Commit c2b6cc9d authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wined3d: Fix GLSL regression / draw buffers support.

parent 7216363e
......@@ -512,6 +512,7 @@ BOOL IWineD3DImpl_FillGLCaps(IWineD3D *iface, Display* display) {
* 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 @@ BOOL IWineD3DImpl_FillGLCaps(IWineD3D *iface, Display* display) {
/**
* 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 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
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 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
} 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;
......
......@@ -849,8 +849,13 @@ inline static VOID IWineD3DPixelShaderImpl_GenerateShader(
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);
......
......@@ -51,6 +51,28 @@
* #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 @@ typedef enum _GL_PSVersion {
/* 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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment