wined3d: Add GL_EXT_texture_sRGB constants and corresponding CheckDeviceFormat query.

This commit is contained in:
Phil Costin 2007-06-06 23:03:47 +00:00 committed by Alexandre Julliard
parent 56c6dbee9b
commit 3650e31e85
2 changed files with 45 additions and 0 deletions

View File

@ -718,6 +718,9 @@ BOOL IWineD3DImpl_FillGLCaps(IWineD3D *iface, Display* display) {
} else if (strcmp(ThisExtn, "GL_EXT_texture_env_dot3") == 0) { } else if (strcmp(ThisExtn, "GL_EXT_texture_env_dot3") == 0) {
TRACE_(d3d_caps)(" FOUND: EXT Dot3 support\n"); TRACE_(d3d_caps)(" FOUND: EXT Dot3 support\n");
gl_info->supported[EXT_TEXTURE_ENV_DOT3] = TRUE; gl_info->supported[EXT_TEXTURE_ENV_DOT3] = TRUE;
} else if (strcmp(ThisExtn, "GL_EXT_texture_sRGB") == 0) {
TRACE_(d3d_caps)(" FOUND: EXT sRGB support\n");
gl_info->supported[EXT_TEXTURE_SRGB] = TRUE;
} else if (strcmp(ThisExtn, "GL_EXT_texture_filter_anisotropic") == 0) { } else if (strcmp(ThisExtn, "GL_EXT_texture_filter_anisotropic") == 0) {
gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC] = TRUE; gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC] = TRUE;
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max); glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max);
@ -1726,6 +1729,27 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
} }
} }
/* Check for supported sRGB formats (Texture loading and framebuffer) */
if (GL_SUPPORT(EXT_TEXTURE_SRGB) && (Usage & WINED3DUSAGE_QUERY_SRGBREAD)) {
switch (CheckFormat) {
case WINED3DFMT_A8R8G8B8:
case WINED3DFMT_X8R8G8B8:
case WINED3DFMT_L8:
case WINED3DFMT_A8L8:
case WINED3DFMT_DXT1:
case WINED3DFMT_DXT2:
case WINED3DFMT_DXT3:
case WINED3DFMT_DXT4:
case WINED3DFMT_DXT5:
TRACE_(d3d_caps)("[OK]\n");
return WINED3D_OK;
default:
TRACE_(d3d_caps)("[FAILED] Gamma texture format %s not supported.\n", debug_d3dformat(CheckFormat));
return WINED3DERR_NOTAVAILABLE;
}
}
if (GL_SUPPORT(ARB_TEXTURE_FLOAT)) { if (GL_SUPPORT(ARB_TEXTURE_FLOAT)) {
BOOL half_pixel_support = GL_SUPPORT(ARB_HALF_FLOAT_PIXEL); BOOL half_pixel_support = GL_SUPPORT(ARB_HALF_FLOAT_PIXEL);

View File

@ -520,6 +520,26 @@ typedef void (APIENTRY * PGLFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint leve
#define GL_DOT3_RGB_EXT 0x8740 #define GL_DOT3_RGB_EXT 0x8740
#define GL_DOT3_RGBA_EXT 0x8741 #define GL_DOT3_RGBA_EXT 0x8741
#endif #endif
/* GL_EXT_texture_sRGB */
#ifndef GL_EXT_texture_sRGB
#define GL_EXT_texture_sRGB 1
#define GL_SRGB_EXT 0x8C40
#define GL_SRGB8_EXT 0x8C41
#define GL_SRGB_ALPHA_EXT 0x8C42
#define GL_SRGB8_ALPHA8_EXT 0x8C43
#define GL_SLUMINANCE_ALPHA_EXT 0x8C44
#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45
#define GL_SLUMINANCE_EXT 0x8C46
#define GL_SLUMINANCE8_EXT 0x8C47
#define GL_COMPRESSED_SRGB_EXT 0x8C48
#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49
#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A
#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
#endif
/* GL_ARB_texture_float */ /* GL_ARB_texture_float */
#ifndef GL_ARB_texture_float #ifndef GL_ARB_texture_float
#define GL_ARB_texture_float 1 #define GL_ARB_texture_float 1
@ -1541,6 +1561,7 @@ typedef enum _GL_SupportedExt {
EXT_TEXTURE_ENV_ADD, EXT_TEXTURE_ENV_ADD,
EXT_TEXTURE_ENV_COMBINE, EXT_TEXTURE_ENV_COMBINE,
EXT_TEXTURE_ENV_DOT3, EXT_TEXTURE_ENV_DOT3,
EXT_TEXTURE_SRGB,
EXT_VERTEX_WEIGHTING, EXT_VERTEX_WEIGHTING,
/* NVIDIA */ /* NVIDIA */
NV_FOG_DISTANCE, NV_FOG_DISTANCE,