From 9c018fd877a0bc28810c598d47b010dc0a728fe2 Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Sun, 21 May 2006 15:05:41 +0200 Subject: [PATCH] wined3d: Fix ARB_imaging abuse. --- dlls/wined3d/device.c | 27 +++++++++---- dlls/wined3d/directx.c | 3 ++ include/wine/wined3d_gl.h | 84 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+), 7 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index cfc9435a0e6..4d5b6b604d0 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -294,8 +294,12 @@ void WINAPI IWineD3DDeviceImpl_SetupTextureStates(IWineD3DDevice *iface, DWORD S */ D3DCOLORTOGLFLOAT4(This->stateBlock->renderState[WINED3DRS_TEXTUREFACTOR], col); /* Set the default alpha blend color */ - glBlendColor(col[0], col[1], col[2], col[3]); - checkGLcall("glBlendColor"); + if (GL_SUPPORT(ARB_IMAGING)) { + GL_EXTCALL(glBlendColor(col[0], col[1], col[2], col[3])); + checkGLcall("glBlendColor"); + } else { + WARN("Unsupported in local OpenGL implementation: glBlendColor\n"); + } D3DCOLORTOGLFLOAT4(This->stateBlock->renderState[WINED3DRS_TEXTUREFACTOR], col); glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]); @@ -3347,9 +3351,14 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE default: FIXME("Unrecognized/Unhandled D3DBLENDOP value %ld\n", Value); } - TRACE("glBlendEquation(%x)\n", glParm); - glBlendEquation(glParm); - checkGLcall("glBlendEquation"); + + if(GL_SUPPORT(ARB_IMAGING)) { + TRACE("glBlendEquation(%x)\n", glParm); + GL_EXTCALL(glBlendEquation(glParm)); + checkGLcall("glBlendEquation"); + } else { + WARN("Unsupported in local OpenGL implementation: glBlendEquation\n"); + } } break; @@ -3362,8 +3371,12 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE float col[4]; D3DCOLORTOGLFLOAT4(Value, col); /* Set the default alpha blend color */ - glBlendColor(col[0], col[1], col[2], col[3]); - checkGLcall("glBlendColor"); + if (GL_SUPPORT(ARB_IMAGING)) { + GL_EXTCALL(glBlendColor(col[0], col[1], col[2], col[3])); + checkGLcall("glBlendColor"); + } else { + WARN("Unsupported in local OpenGL implementation: glBlendColor\n"); + } /* And now the default texture color as well */ for (i = 0; i < GL_LIMITS(textures); i++) { diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 62af4a6b088..c27e75c001e 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -489,6 +489,9 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display) { glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &gl_max); TRACE_(d3d_caps)(" FOUND: ARB Pixel Shader support - GL_MAX_TEXTURE_IMAGE_UNITS_ARB=%u\n", gl_max); gl_info->max_samplers = min(MAX_SAMPLERS, gl_max); + } else if (strcmp(ThisExtn, "GL_ARB_imaging") == 0) { + TRACE_(d3d_caps)(" FOUND: ARB imaging support\n"); + gl_info->supported[ARB_IMAGING] = TRUE; } else if (strcmp(ThisExtn, "GL_ARB_shading_language_100") == 0) { TRACE_(d3d_caps)(" FOUND: GL Shading Language v100 support\n"); gl_info->supported[ARB_SHADING_LANGUAGE_100] = TRUE; diff --git a/include/wine/wined3d_gl.h b/include/wine/wined3d_gl.h index 48e540ce102..c054f1a11e9 100644 --- a/include/wine/wined3d_gl.h +++ b/include/wine/wined3d_gl.h @@ -51,6 +51,86 @@ * #defines and functions pointer ****************************************************/ +/* GL_ARB_imaging */ +#ifndef GL_ARB_imaging +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#endif +typedef void (APIENTRY *PGLFNBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRY *PGLFNBLENDEQUATIONPROC) (GLenum mode); /* GL_ARB_point_parameters */ #ifndef GL_ARB_point_parameters #define GL_ARB_point_parameters 1 @@ -1186,6 +1266,7 @@ typedef enum _GL_PSVersion { typedef enum _GL_SupportedExt { /* ARB */ ARB_FRAGMENT_PROGRAM, + ARB_IMAGING, ARB_MULTISAMPLE, ARB_MULTITEXTURE, ARB_OCCLUSION_QUERY, @@ -1247,6 +1328,9 @@ typedef enum _GL_SupportedExt { ****************************************************/ #define GL_EXT_FUNCS_GEN \ /** ARB Extensions **/ \ + /* GL_ARB_imaging */ \ + USE_GL_FUNC(PGLFNBLENDCOLORPROC, glBlendColor); \ + USE_GL_FUNC(PGLFNBLENDEQUATIONPROC, glBlendEquation); \ /* GL_ARB_point_parameters */ \ USE_GL_FUNC(PGLFNGLPOINTPARAMETERFARBPROC, glPointParameterfARB); \ USE_GL_FUNC(PGLFNGLPOINTPARAMETERFVARBPROC, glPointParameterfvARB); \