Commit 620a423b authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Kill the GL_ATI_envmap_bumpmap code.

GL_ATI_envmap_bumpmap provides two things: Signed V8U8 pixel formats, and bump mapping. The extension is only supported on fglrx, and this driver also supports GL_ARB_fragment_program. Thus the bump mapping code is never used on any driver out there. Furthermore, if it is used, it tends to crash the driver The signed pixel format is used, as it can be used by pixel shaders or the ARBfp replacement. However, the format is broken in fglrx, and negative values are clamped to 0.0. This results in test failures. WineD3D has an alternative codepath using scale+bias to enable V8U8 using a standard signed RGB which works correctly on fglrx.
parent a8497a55
......@@ -659,8 +659,7 @@ static void gen_color_correction(SHADER_BUFFER *buffer, const char *reg, const c
switch(fmt) {
case WINED3DFMT_V8U8:
case WINED3DFMT_V16U16:
if(GL_SUPPORT(NV_TEXTURE_SHADER) ||
(GL_SUPPORT(ATI_ENVMAP_BUMPMAP) && fmt == WINED3DFMT_V8U8)) {
if(GL_SUPPORT(NV_TEXTURE_SHADER) && fmt == WINED3DFMT_V8U8) {
if(0) {
/* The 3rd channel returns 1.0 in d3d, but 0.0 in gl. Fix this while we're at it :-)
* disabled until an application that needs it is found because it causes unneeded
......
......@@ -56,7 +56,6 @@ static const struct {
{"GL_ATI_separate_stencil", ATI_SEPARATE_STENCIL, 0 },
{"GL_ATI_texture_env_combine3", ATI_TEXTURE_ENV_COMBINE3, 0 },
{"GL_ATI_texture_mirror_once", ATI_TEXTURE_MIRROR_ONCE, 0 },
{"GL_ATI_envmap_bumpmap", ATI_ENVMAP_BUMPMAP, 0 },
{"GL_ATI_fragment_shader", ATI_FRAGMENT_SHADER, 0 },
{"GL_ATI_texture_compression_3dc", ATI_TEXTURE_COMPRESSION_3DC, 0 },
......@@ -837,10 +836,6 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
gl_info->supported[NV_TEXGEN_REFLECTION] = TRUE;
}
if (gl_info->supported[NV_TEXTURE_SHADER2]) {
/* GL_ATI_envmap_bumpmap won't play nice with texture shaders, so disable it
* Won't occur in any real world situation though
*/
gl_info->supported[ATI_ENVMAP_BUMPMAP] = FALSE;
if(gl_info->supported[NV_REGISTER_COMBINERS]) {
/* Also disable ATI_FRAGMENT_SHADER if register combiners and texture_shader2
* are supported. The nv extensions provide the same functionality as the
......@@ -2915,7 +2910,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
break;
case WINED3DFMT_V8U8:
if(!GL_SUPPORT(NV_TEXTURE_SHADER) || !GL_SUPPORT(ATI_ENVMAP_BUMPMAP)) {
if(!GL_SUPPORT(NV_TEXTURE_SHADER)) {
TRACE_(d3d_caps)("[FAILED] - No converted formats on volumes\n");
return WINED3DERR_NOTAVAILABLE;
}
......
......@@ -1296,8 +1296,7 @@ static void shader_glsl_color_correction(SHADER_OPCODE_ARG* arg) {
switch(fmt) {
case WINED3DFMT_V8U8:
case WINED3DFMT_V16U16:
if(GL_SUPPORT(NV_TEXTURE_SHADER) ||
(GL_SUPPORT(ATI_ENVMAP_BUMPMAP) && fmt == WINED3DFMT_V8U8)) {
if(GL_SUPPORT(NV_TEXTURE_SHADER) && fmt == WINED3DFMT_V8U8) {
/* The 3rd channel returns 1.0 in d3d, but 0.0 in gl. Fix this while we're at it :-) */
mask = shader_glsl_add_dst_param(arg, arg->dst, WINED3DSP_WRITEMASK_2, &dst_param);
mask_size = shader_glsl_get_write_mask_size(mask);
......
......@@ -1639,13 +1639,6 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
case WINED3DFMT_V8U8:
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;
......@@ -1678,7 +1671,6 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
* 4th component, which is returned as alpha
*/
} else {
/* Not supported by GL_ATI_envmap_bumpmap */
*format = GL_BGRA;
*internal = GL_RGB8;
*type = GL_UNSIGNED_INT_8_8_8_8_REV;
......@@ -1692,7 +1684,6 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
*internal = GL_RGBA8;
*type = GL_UNSIGNED_BYTE;
*target_bpp = 4;
/* Not supported by GL_ATI_envmap_bumpmap */
break;
case WINED3DFMT_V16U16:
......@@ -1702,9 +1693,6 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
*internal = GL_RGB16_EXT;
*type = GL_UNSIGNED_SHORT;
*target_bpp = 6;
/* 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;
case WINED3DFMT_A4L4:
......
......@@ -372,16 +372,12 @@ BOOL initPixelFormats(WineD3D_GL_Info *gl_info)
* an application that needs this because it causes performance problems due to
* shader recompiling in some games.
*/
if(!GL_SUPPORT(ATI_ENVMAP_BUMPMAP) && !GL_SUPPORT(NV_TEXTURE_SHADER2)) {
if(!GL_SUPPORT(NV_TEXTURE_SHADER2)) {
/* signed -> unsigned fixup */
dst = getFmtIdx(WINED3DFMT_V8U8);
gl_info->gl_formats[dst].conversion_group = WINED3DFMT_V8U8;
dst = getFmtIdx(WINED3DFMT_V16U16);
gl_info->gl_formats[dst].conversion_group = WINED3DFMT_V8U8;
} else if(GL_SUPPORT(ATI_ENVMAP_BUMPMAP)) {
/* signed -> unsigned fixup */
dst = getFmtIdx(WINED3DFMT_V16U16);
gl_info->gl_formats[dst].conversion_group = WINED3DFMT_V16U16;
} else {
/* Blue = 1.0 fixup, disabled for now */
if(0) {
......
......@@ -2843,23 +2843,6 @@ typedef void (WINE_GLAPI * PGLFNFINISHOBJECTAPPLEPROC) (GLenum, GLuint);
#define GL_APPLE_client_storage 1
#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2
#endif
/* GL_ATI_envmap_bumpmap */
#ifndef GL_ATI_envmap_bumpmap
#define GL_ATI_envmap_bumpmap 1
#define GL_BUMP_ROT_MATRIX_ATI 0x8775
#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776
#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777
#define GL_BUMP_TEX_UNITS_ATI 0x8778
#define GL_DUDV_ATI 0x8779
#define GL_DU8DV8_ATI 0x877A
#define GL_BUMP_ENVMAP_ATI 0x877B
#define GL_BUMP_TARGET_ATI 0x877C
#endif
typedef void (WINE_GLAPI * PGLFNTEXBUMPPARAMETERIVATIPROC) (GLenum, GLint *);
typedef void (WINE_GLAPI * PGLFNTEXBUMPPARAMETERFVATIPROC) (GLenum, GLfloat *);
typedef void (WINE_GLAPI * PGLFNGETTEXBUMPPARAMETERIVATIPROC) (GLenum, GLint *);
typedef void (WINE_GLAPI * PGLFNGETTEXBUMPPARAMETERFVATIPROC) (GLenum, GLfloat *);
/* GLX_SGI_video_sync */
typedef int (WINE_GLAPI * PGLXFNGETVIDEOSYNCSGIPROC) (unsigned int *);
typedef int (WINE_GLAPI * PGLXFNWAITVIDEOSYNCSGIPROC) (int, int, unsigned int *);
......@@ -3389,7 +3372,6 @@ typedef enum _GL_SupportedExt {
ATI_TEXTURE_ENV_COMBINE3,
ATI_TEXTURE_MIRROR_ONCE,
EXT_VERTEX_SHADER,
ATI_ENVMAP_BUMPMAP,
ATI_FRAGMENT_SHADER,
ATI_TEXTURE_COMPRESSION_3DC,
/* APPLE */
......@@ -3691,11 +3673,6 @@ typedef enum _GL_SupportedExt {
USE_GL_FUNC(PGLFNISFENCEAPPLEPROC, glIsFenceAPPLE, APPLE_FENCE, NULL )\
USE_GL_FUNC(PGLFNTESTOBJECTAPPLEPROC, glTestObjectAPPLE, APPLE_FENCE, NULL )\
USE_GL_FUNC(PGLFNFINISHOBJECTAPPLEPROC, glFinishObjectAPPLE, APPLE_FENCE, NULL )\
/* GL_ATI_envmap_bumpmap */ \
USE_GL_FUNC(PGLFNTEXBUMPPARAMETERIVATIPROC, glTexBumpParameterivATI, ATI_ENVMAP_BUMPMAP, NULL )\
USE_GL_FUNC(PGLFNTEXBUMPPARAMETERFVATIPROC, glTexBumpParameterfvATI, ATI_ENVMAP_BUMPMAP, NULL )\
USE_GL_FUNC(PGLFNGETTEXBUMPPARAMETERIVATIPROC, glGetTexBumpParameterivATI, ATI_ENVMAP_BUMPMAP, NULL )\
USE_GL_FUNC(PGLFNGETTEXBUMPPARAMETERFVATIPROC, glGetTexBumpParameterfvATI, ATI_ENVMAP_BUMPMAP, NULL )\
/* GLX_SGI_video_sync */ \
USE_GL_FUNC(PGLXFNGETVIDEOSYNCSGIPROC, glXGetVideoSyncSGI, SGI_VIDEO_SYNC, NULL )\
USE_GL_FUNC(PGLXFNWAITVIDEOSYNCSGIPROC, glXWaitVideoSyncSGI, SGI_VIDEO_SYNC, NULL )\
......
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