[try 4] wined3d: Implented signed texture formats via
NV_TEXTURE_SHADER
Fabian Bieler
der.fabe at gmx.net
Mon Mar 12 07:13:50 CDT 2007
hopefully the last version :)
-------------- next part --------------
From 8070d5728de5730605593a602343fc9486c20aa9 Mon Sep 17 00:00:00 2001
From: Fabian Bieler <der.fabe at gmx.net>
Date: Mon, 12 Mar 2007 13:11:04 +0100
Subject: [PATCH] wined3d: Implented signed texture formats via NV_TEXTURE_SHADER
---
dlls/wined3d/arb_program_shader.c | 8 +++++---
dlls/wined3d/surface.c | 32 ++++++++++++++++++++++++++++++--
dlls/wined3d/utils.c | 8 ++++----
3 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 79148e5..2e636ad 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -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);
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index c8d39f6..8d6494b 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -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;
}
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 9c82ef0..510855c 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -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_DSD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