Module: wine Branch: master Commit: ede01abee2966b2bafa7a121b5fb8eb92797a6be URL: http://source.winehq.org/git/wine.git/?a=commit;h=ede01abee2966b2bafa7a121b5...
Author: Stefan Dösinger stefan@codeweavers.com Date: Tue Mar 20 23:42:37 2007 +0100
wined3d: Support GL_ATI_envmap_bumpmap for D3DFMT_V8U8.
---
dlls/wined3d/arb_program_shader.c | 9 +++++---- dlls/wined3d/surface.c | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index f5fcbd7..56ef5fb 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -715,11 +715,12 @@ void pshader_hw_texbem(SHADER_OPCODE_ARG* arg) { * So the surface loading code converts the -128 ... 127 signed integers to * 0 ... 255 unsigned ones. The following line undoes that. * - * TODO: GL_ATI_envmap_bumpmap provides pixel formats - * suitable for loading the Direct3D perturbation data. If it is used, do - * not correct the signedness + * TODO: GL_ATI_envmap_bumpmap supports D3DFMT_DU8DV8 only. If conversion for other formats + * is implemented check the texture format. + * + * TODO: Move that to the common sampling function */ - if(!GL_SUPPORT(NV_TEXTURE_SHADER3)) + if(!GL_SUPPORT(NV_TEXTURE_SHADER3) && !GL_SUPPORT(ATI_ENVMAP_BUMPMAP)) shader_addline(buffer, "MAD T%u, T%u, coefmul.x, -one;\n", src, src);
shader_addline(buffer, "SWZ TMP2, bumpenvmat, x, z, 0, 0;\n"); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index c1b1465..e1c754e 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1464,11 +1464,14 @@ static HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BO break;
case WINED3DFMT_V8U8: - /* TODO: GL_ATI_envmap_bumpmap provides suitable formats. - * use it instead of converting - * Remember to adjust the texbem instruction in the shader - */ if(GL_SUPPORT(NV_TEXTURE_SHADER3)) break; + else if(GL_SUPPORT(ATI_ENVMAP_BUMPMAP)) { + *format = GL_DUDV_ATI; + *internal = GL_DU8DV8_ATI; + *type = GL_BYTE; + /* No conversion - Just change the gl type */ + break; + } *convert = CONVERT_V8U8; *format = GL_BGR; *internal = GL_RGB8; @@ -1483,6 +1486,7 @@ static HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BO *internal = GL_RGBA8; *type = GL_BYTE; *target_bpp = 4; + /* Not supported by GL_ATI_envmap_bumpmap */ break;
case WINED3DFMT_Q8W8V8U8: @@ -1492,6 +1496,7 @@ static HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BO *internal = GL_RGBA8; *type = GL_BYTE; *target_bpp = 4; + /* Not supported by GL_ATI_envmap_bumpmap */ break;
case WINED3DFMT_V16U16: @@ -1501,6 +1506,9 @@ static HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BO *internal = GL_COLOR_INDEX; *type = GL_SHORT; *target_bpp = 4; + /* What should I do here about GL_ATI_envmap_bumpmap? + * Convert it or allow data loss by loading it into a 8 bit / channel texture? + */ break;
default: