Module: wine Branch: refs/heads/master Commit: c2b6cc9dc4dbe30c058cc59c521c6e5989e6a8e0 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=c2b6cc9dc4dbe30c058cc59c...
Author: Roderick Colenbrander thunderbird2k@gmx.net Date: Wed Aug 9 18:24:08 2006 +0200
wined3d: Fix GLSL regression / draw buffers support.
---
dlls/wined3d/directx.c | 25 +++++++++++++------------ dlls/wined3d/pixelshader.c | 9 +++++++-- include/wine/wined3d_gl.h | 26 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 14 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 7720723..26751b3 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -512,6 +512,7 @@ BOOL IWineD3DImpl_FillGLCaps(IWineD3D *i * with Default values */ memset(&gl_info->supported, 0, sizeof(gl_info->supported)); + gl_info->max_buffers = 1; gl_info->max_textures = 1; gl_info->max_texture_stages = 1; gl_info->max_samplers = 1; @@ -573,7 +574,12 @@ #undef USE_GL_FUNC /** * ARB */ - if (strcmp(ThisExtn, "GL_ARB_fragment_program") == 0) { + if (strcmp(ThisExtn, "GL_ARB_draw_buffers") == 0) { + glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &gl_max); + TRACE_(d3d_caps)(" FOUND: ARB_draw_buffers support - max buffers=%u\n", gl_max); + gl_info->supported[ARB_DRAW_BUFFERS] = TRUE; + gl_info->max_buffers = gl_max; + } else if (strcmp(ThisExtn, "GL_ARB_fragment_program") == 0) { gl_info->ps_arb_version = PS_VERSION_11; TRACE_(d3d_caps)(" FOUND: ARB Pixel Shader support - version=%02x\n", gl_info->ps_arb_version); gl_info->supported[ARB_FRAGMENT_PROGRAM] = TRUE; @@ -2106,7 +2112,6 @@ #endif The following fields apply to d3d9 only ------------------------------------------------ */ if (This->dxVersion > 8) { - GLint max_buffers = 1; FIXME("Caps support for directx9 is nonexistent at the moment!\n"); *pCaps->DevCaps2 = 0; /* TODO: D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES and VS3.0 needs atleast D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET */ @@ -2130,17 +2135,13 @@ #endif } else *pCaps->DeclTypes = 0;
-#if 0 /*FIXME: Simultaneous render targets*/ - GL_MAX_DRAW_BUFFERS_ATI 0x00008824 - if (GL_SUPPORT(GL_MAX_DRAW_BUFFERS_ATI)) { - ENTER_GL(); - glEnable(GL_MAX_DRAW_BUFFERS_ATI); - glGetIntegerv(GL_MAX_DRAW_BUFFERS_ATI, &max_buffers); - glDisable(GL_MAX_DRAW_BUFFERS_ATI); - LEAVE_GL(); - } +#if 0 /* We don't properly support multiple render targets yet, so disable this for now */ + if (GL_SUPPORT(ARB_DRAWBUFFERS)) { + *pCaps->NumSimultaneousRTs = GL_LIMITS(buffers); + } else #endif - *pCaps->NumSimultaneousRTs = max_buffers; + *pCaps->NumSimultaneousRTs = 1; + *pCaps->StretchRectFilterCaps = 0; *pCaps->VertexTextureFilterCaps = 0;
diff --git a/dlls/wined3d/pixelshader.c b/dlls/wined3d/pixelshader.c index 9a8227f..f5d6462 100644 --- a/dlls/wined3d/pixelshader.c +++ b/dlls/wined3d/pixelshader.c @@ -849,8 +849,13 @@ #endif shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction);
/* Pixel shaders < 2.0 place the resulting color in R0 implicitly */ - if (This->baseShader.hex_version < D3DPS_VERSION(2,0)) - shader_addline(&buffer, "gl_FragData[0] = R0;\n"); + if (This->baseShader.hex_version < D3DPS_VERSION(2,0)) { + /* Some older cards like GeforceFX ones don't support multiple buffers, so also not gl_FragData */ + if(GL_SUPPORT(ARB_DRAW_BUFFERS)) + shader_addline(&buffer, "gl_FragData[0] = R0;\n"); + else + shader_addline(&buffer, "gl_FragColor = R0;\n"); + } shader_addline(&buffer, "}\n\0");
TRACE("Compiling shader object %u\n", shader_obj); diff --git a/include/wine/wined3d_gl.h b/include/wine/wined3d_gl.h index 71e3b01..6cbdea2 100644 --- a/include/wine/wined3d_gl.h +++ b/include/wine/wined3d_gl.h @@ -51,6 +51,28 @@ #define APIENTRY * #defines and functions pointer ****************************************************/
+/* GL_ARB_draw_buffers */ +#ifndef GL_ARB_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER15_ARB 0x8834 +#endif +typedef void (APIENTRY *PGLFNDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); + /* GL_ARB_imaging */ #ifndef GL_ARB_imaging #define GL_CONSTANT_COLOR 0x8001 @@ -1358,6 +1380,7 @@ #define MAKEDWORD_VERSION(maj, min) ((m /* OpenGL Supported Extensions (ARB and EXT) */ typedef enum _GL_SupportedExt { /* ARB */ + ARB_DRAW_BUFFERS, ARB_FRAGMENT_PROGRAM, ARB_FRAGMENT_SHADER, ARB_IMAGING, @@ -1423,6 +1446,8 @@ typedef enum _GL_SupportedExt { ****************************************************/ #define GL_EXT_FUNCS_GEN \ /** ARB Extensions **/ \ + /* GL_ARB_draw_buffers */ \ + USE_GL_FUNC(PGLFNDRAWBUFFERSARBPROC, glDrawBuffersARB); \ /* GL_ARB_imaging */ \ USE_GL_FUNC(PGLFNBLENDCOLORPROC, glBlendColor); \ USE_GL_FUNC(PGLFNBLENDEQUATIONPROC, glBlendEquation); \ @@ -1697,6 +1722,7 @@ typedef struct _WineD3D_GL_Info { /** * CAPS Constants */ + UINT max_buffers; UINT max_lights; UINT max_textures; UINT max_texture_stages;