Commit 8dae597f authored by Fabian Bieler's avatar Fabian Bieler Committed by Alexandre Julliard

wined3d: Implemented signed texture formats via NV_TEXTURE_SHADER.

parent 89843f2c
......@@ -694,6 +694,7 @@ void pshader_hw_texreg2gb(SHADER_OPCODE_ARG* arg) {
void pshader_hw_texbem(SHADER_OPCODE_ARG* arg) {
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
WineD3D_GL_Info *gl_info = &((IWineD3DImpl *)(((IWineD3DDeviceImpl *)(This->baseShader.device))->wineD3D))->gl_info;
DWORD dst = arg->dst;
DWORD src = arg->src[0] & WINED3DSP_REGNUM_MASK;
......@@ -714,11 +715,12 @@ void pshader_hw_texbem(SHADER_OPCODE_ARG* arg) {
* So the surface loading code converts the -128 ... 127 signed integers to
* 0 ... 255 unsigned ones. The following line undoes that.
*
* TODO: Both GL_NV_texture_shader and GL_ATI_envmap_bumpmap provide pixel formats
* suitable for loading the Direct3D perturbation data. If one of them is used, do
* TODO: GL_ATI_envmap_bumpmap provides pixel formats
* suitable for loading the Direct3D perturbation data. If it is used, do
* not correct the signedness
*/
shader_addline(buffer, "MAD T%u, T%u, coefmul.x, -one;\n", src, src);
if(!GL_SUPPORT(NV_TEXTURE_SHADER3))
shader_addline(buffer, "MAD T%u, T%u, coefmul.x, -one;\n", src, src);
shader_addline(buffer, "SWZ TMP2, bumpenvmat, x, z, 0, 0;\n");
shader_addline(buffer, "DP3 TMP.r, TMP2, T%u;\n", src);
......
......@@ -1455,10 +1455,11 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
break;
case WINED3DFMT_V8U8:
/* TODO: GL_NV_texture_shader and GL_ATI_envmap_bumpmap provide suitable formats.
* use one of them instead of converting
/* TODO: GL_ATI_envmap_bumpmap provides suitable formats.
* use it instead of converting
* Remember to adjust the texbem instruction in the shader
*/
if(GL_SUPPORT(NV_TEXTURE_SHADER3)) break;
*convert = CONVERT_V8U8;
*format = GL_BGR;
*internal = GL_RGB8;
......@@ -1466,6 +1467,33 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
*target_bpp = 3;
break;
case WINED3DFMT_X8L8V8U8:
if(GL_SUPPORT(NV_TEXTURE_SHADER3)) break;
FIXME("Conversion for D3D_X8L8V8U8 not implemented\n");
*format = GL_BGRA;
*internal = GL_RGBA8;
*type = GL_BYTE;
*target_bpp = 4;
break;
case WINED3DFMT_Q8W8V8U8:
if(GL_SUPPORT(NV_TEXTURE_SHADER3)) break;
FIXME("Conversion for D3D_Q8W8V8U8 not implemented\n");
*format = GL_BGRA;
*internal = GL_RGBA8;
*type = GL_BYTE;
*target_bpp = 4;
break;
case WINED3DFMT_V16U16:
if(GL_SUPPORT(NV_TEXTURE_SHADER3)) break;
FIXME("Conversion for D3D_V16U16 not implemented\n");
*format = GL_COLOR_INDEX;
*internal = GL_COLOR_INDEX;
*type = GL_SHORT;
*target_bpp = 4;
break;
default:
break;
}
......
......@@ -82,11 +82,11 @@ static const PixelFormatDesc formats[] = {
{WINED3DFMT_A8L8 ,0x0000ff00 ,0x0 ,0x0 ,0x0 ,2 ,FALSE ,GL_LUMINANCE8_ALPHA8 ,GL_LUMINANCE_ALPHA ,GL_UNSIGNED_BYTE },
{WINED3DFMT_A4L4 ,0x000000f0 ,0x0 ,0x0 ,0x0 ,1 ,FALSE ,GL_LUMINANCE4_ALPHA4 ,GL_LUMINANCE_ALPHA ,GL_UNSIGNED_BYTE },
/* Bump mapping stuff */
{WINED3DFMT_V8U8 ,0x0 ,0x0 ,0x0 ,0x0 ,2 ,FALSE ,GL_RGB8 ,GL_BGR ,GL_BYTE /* needs conversion! */},
{WINED3DFMT_V8U8 ,0x0 ,0x0 ,0x0 ,0x0 ,2 ,FALSE ,GL_DSDT8_NV ,GL_DSDT_NV ,GL_BYTE },
{WINED3DFMT_L6V5U5 ,0x0 ,0x0 ,0x0 ,0x0 ,2 ,FALSE ,GL_COLOR_INDEX8_EXT ,GL_COLOR_INDEX ,GL_UNSIGNED_SHORT_5_5_5_1 },
{WINED3DFMT_X8L8V8U8 ,0x0 ,0x0 ,0x0 ,0x0 ,4 ,FALSE ,GL_RGBA8 ,GL_BGRA ,GL_UNSIGNED_BYTE },
{WINED3DFMT_Q8W8V8U8 ,0x0 ,0x0 ,0x0 ,0x0 ,4 ,FALSE ,GL_RGBA8 ,GL_RGBA ,GL_UNSIGNED_INT_8_8_8_8_REV/*?*/},
{WINED3DFMT_V16U16 ,0x0 ,0x0 ,0x0 ,0x0 ,4 ,FALSE ,GL_COLOR_INDEX ,GL_COLOR_INDEX ,GL_UNSIGNED_SHORT },
{WINED3DFMT_X8L8V8U8 ,0x0 ,0x0 ,0x0 ,0x0 ,4 ,FALSE ,GL_DSDT8_MAG8_INTENSITY8_NV,GL_DSDT_MAG_INTENSITY_NV,GL_BYTE },
{WINED3DFMT_Q8W8V8U8 ,0x0 ,0x0 ,0x0 ,0x0 ,4 ,FALSE ,GL_SIGNED_RGBA8_NV ,GL_RGBA ,GL_BYTE },
{WINED3DFMT_V16U16 ,0x0 ,0x0 ,0x0 ,0x0 ,4 ,FALSE ,GL_SIGNED_HILO16_NV ,GL_HILO_NV ,GL_SHORT },
{WINED3DFMT_W11V11U10 ,0x0 ,0x0 ,0x0 ,0x0 ,4 ,FALSE ,0 ,0 ,0 },
{WINED3DFMT_A2W10V10U10 ,0xb0000000 ,0x0 ,0x0 ,0x0 ,4 ,FALSE ,0 ,0 ,0 },
/* Depth stencil formats */
......
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