wined3d: Emulate R16G16F and R32G32F if GL_ARB_texture_rg is not supported.
Nvidia doesn't offer it on geforce 7 and earlier cards, but some games need it. This is surprising because the extension was made specifically for compatibility purposes for older cards.
This commit is contained in:
parent
1fbc6e560d
commit
8513f64a01
|
@ -2391,6 +2391,7 @@ static BOOL CheckTextureCapability(struct WineD3DAdapter *adapter,
|
||||||
|
|
||||||
/* Floating point formats */
|
/* Floating point formats */
|
||||||
case WINED3DFMT_R16_FLOAT:
|
case WINED3DFMT_R16_FLOAT:
|
||||||
|
case WINED3DFMT_R16G16_FLOAT:
|
||||||
case WINED3DFMT_R16G16B16A16_FLOAT:
|
case WINED3DFMT_R16G16B16A16_FLOAT:
|
||||||
if(GL_SUPPORT(ARB_TEXTURE_FLOAT) && GL_SUPPORT(ARB_HALF_FLOAT_PIXEL)) {
|
if(GL_SUPPORT(ARB_TEXTURE_FLOAT) && GL_SUPPORT(ARB_HALF_FLOAT_PIXEL)) {
|
||||||
TRACE_(d3d_caps)("[OK]\n");
|
TRACE_(d3d_caps)("[OK]\n");
|
||||||
|
@ -2400,6 +2401,7 @@ static BOOL CheckTextureCapability(struct WineD3DAdapter *adapter,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
case WINED3DFMT_R32_FLOAT:
|
case WINED3DFMT_R32_FLOAT:
|
||||||
|
case WINED3DFMT_R32G32_FLOAT:
|
||||||
case WINED3DFMT_R32G32B32A32_FLOAT:
|
case WINED3DFMT_R32G32B32A32_FLOAT:
|
||||||
if (GL_SUPPORT(ARB_TEXTURE_FLOAT)) {
|
if (GL_SUPPORT(ARB_TEXTURE_FLOAT)) {
|
||||||
TRACE_(d3d_caps)("[OK]\n");
|
TRACE_(d3d_caps)("[OK]\n");
|
||||||
|
@ -2408,15 +2410,6 @@ static BOOL CheckTextureCapability(struct WineD3DAdapter *adapter,
|
||||||
TRACE_(d3d_caps)("[FAILED]\n");
|
TRACE_(d3d_caps)("[FAILED]\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
case WINED3DFMT_R16G16_FLOAT:
|
|
||||||
case WINED3DFMT_R32G32_FLOAT:
|
|
||||||
if(GL_SUPPORT(ARB_TEXTURE_RG)) {
|
|
||||||
TRACE_(d3d_caps)("[OK]\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
TRACE_(d3d_caps)("[FAILED]\n");
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* ATI instancing hack: Although ATI cards do not support Shader Model 3.0, they support
|
/* ATI instancing hack: Although ATI cards do not support Shader Model 3.0, they support
|
||||||
* instancing. To query if the card supports instancing CheckDeviceFormat with the special format
|
* instancing. To query if the card supports instancing CheckDeviceFormat with the special format
|
||||||
* MAKEFOURCC('I','N','S','T') is used. Should a (broken) app check for this provide a proper return value.
|
* MAKEFOURCC('I','N','S','T') is used. Should a (broken) app check for this provide a proper return value.
|
||||||
|
|
|
@ -1795,6 +1795,22 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
|
||||||
*target_bpp = 6;
|
*target_bpp = 6;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WINED3DFMT_R16G16_FLOAT:
|
||||||
|
*convert = CONVERT_R16G16F;
|
||||||
|
*format = GL_RGB;
|
||||||
|
*internal = GL_RGB16F_ARB;
|
||||||
|
*type = GL_HALF_FLOAT_ARB;
|
||||||
|
*target_bpp = 6;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3DFMT_R32G32_FLOAT:
|
||||||
|
*convert = CONVERT_R32G32F;
|
||||||
|
*format = GL_RGB;
|
||||||
|
*internal = GL_RGB32F_ARB;
|
||||||
|
*type = GL_FLOAT;
|
||||||
|
*target_bpp = 12;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2123,6 +2139,7 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
|
||||||
}
|
}
|
||||||
|
|
||||||
case CONVERT_G16R16:
|
case CONVERT_G16R16:
|
||||||
|
case CONVERT_R16G16F:
|
||||||
{
|
{
|
||||||
unsigned int x, y;
|
unsigned int x, y;
|
||||||
const WORD *Source;
|
const WORD *Source;
|
||||||
|
@ -2136,6 +2153,9 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
|
||||||
WORD red = (*Source++);
|
WORD red = (*Source++);
|
||||||
Dest[0] = green;
|
Dest[0] = green;
|
||||||
Dest[1] = red;
|
Dest[1] = red;
|
||||||
|
/* Strictly speaking not correct for R16G16F, but it doesn't matter because the
|
||||||
|
* shader overwrites it anyway
|
||||||
|
*/
|
||||||
Dest[2] = 0xffff;
|
Dest[2] = 0xffff;
|
||||||
Dest += 3;
|
Dest += 3;
|
||||||
}
|
}
|
||||||
|
@ -2143,6 +2163,26 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case CONVERT_R32G32F:
|
||||||
|
{
|
||||||
|
unsigned int x, y;
|
||||||
|
const float *Source;
|
||||||
|
float *Dest;
|
||||||
|
for(y = 0; y < height; y++) {
|
||||||
|
Source = (const float *)(src + y * pitch);
|
||||||
|
Dest = (float *) (dst + y * outpitch);
|
||||||
|
for (x = 0; x < width; x++ ) {
|
||||||
|
float green = (*Source++);
|
||||||
|
float red = (*Source++);
|
||||||
|
Dest[0] = green;
|
||||||
|
Dest[1] = red;
|
||||||
|
Dest[2] = 1.0;
|
||||||
|
Dest += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERR("Unsupported conversation type %d\n", convert);
|
ERR("Unsupported conversation type %d\n", convert);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1824,6 +1824,8 @@ typedef enum {
|
||||||
CONVERT_V16U16,
|
CONVERT_V16U16,
|
||||||
CONVERT_A4L4,
|
CONVERT_A4L4,
|
||||||
CONVERT_G16R16,
|
CONVERT_G16R16,
|
||||||
|
CONVERT_R16G16F,
|
||||||
|
CONVERT_R32G32F,
|
||||||
} CONVERT_TYPES;
|
} CONVERT_TYPES;
|
||||||
|
|
||||||
HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_texturing, GLenum *format, GLenum *internal, GLenum *type, CONVERT_TYPES *convert, int *target_bpp, BOOL srgb_mode);
|
HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_texturing, GLenum *format, GLenum *internal, GLenum *type, CONVERT_TYPES *convert, int *target_bpp, BOOL srgb_mode);
|
||||||
|
|
Loading…
Reference in New Issue