From 66447040396dfecbcd8f2b1510d65c900424f46a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 5 Sep 2007 17:05:58 +0200 Subject: [PATCH] wined3d: Add texreg2rgb support to arb shaders. --- dlls/wined3d/arb_program_shader.c | 16 ++++++++++++++++ dlls/wined3d/pixelshader.c | 2 +- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index b4d14268151..1fc3338da37 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -1118,6 +1118,22 @@ void pshader_hw_texreg2gb(SHADER_OPCODE_ARG* arg) { shader_hw_sample(arg, reg1, dst_str, "TMP", FALSE, FALSE); } +void pshader_hw_texreg2rgb(SHADER_OPCODE_ARG* arg) { + + SHADER_BUFFER* buffer = arg->buffer; + IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader; + IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device; + DWORD flags; + DWORD reg1 = arg->dst & WINED3DSP_REGNUM_MASK; + char dst_str[8]; + char src_str[50]; + + sprintf(dst_str, "T%u", reg1); + pshader_gen_input_modifier_line(buffer, arg->src[0], 0, src_str); + flags = reg1 < MAX_TEXTURES ? deviceImpl->stateBlock->textureState[reg1][WINED3DTSS_TEXTURETRANSFORMFLAGS] : 0; + shader_hw_sample(arg, reg1, dst_str, src_str, FALSE, FALSE); +} + void pshader_hw_texbem(SHADER_OPCODE_ARG* arg) { IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader; diff --git a/dlls/wined3d/pixelshader.c b/dlls/wined3d/pixelshader.c index ad9b11d3020..512badc2eeb 100644 --- a/dlls/wined3d/pixelshader.c +++ b/dlls/wined3d/pixelshader.c @@ -220,7 +220,7 @@ CONST SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] = { {WINED3DSIO_TEXBEML, "texbeml", GLNAME_REQUIRE_GLSL, 1, 2, pshader_hw_texbem, pshader_glsl_texbem, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)}, {WINED3DSIO_TEXREG2AR,"texreg2ar","undefined", 1, 2, pshader_hw_texreg2ar, pshader_glsl_texreg2ar, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)}, {WINED3DSIO_TEXREG2GB,"texreg2gb","undefined", 1, 2, pshader_hw_texreg2gb, pshader_glsl_texreg2gb, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)}, - {WINED3DSIO_TEXREG2RGB, "texreg2rgb", GLNAME_REQUIRE_GLSL, 1, 2, NULL, pshader_glsl_texreg2rgb, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)}, + {WINED3DSIO_TEXREG2RGB, "texreg2rgb", "undefined", 1, 2, pshader_hw_texreg2rgb, pshader_glsl_texreg2rgb, WINED3DPS_VERSION(1,2), WINED3DPS_VERSION(1,3)}, {WINED3DSIO_TEXM3x2PAD, "texm3x2pad", "undefined", 1, 2, pshader_hw_texm3x2pad, pshader_glsl_texm3x2pad, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)}, {WINED3DSIO_TEXM3x2TEX, "texm3x2tex", "undefined", 1, 2, pshader_hw_texm3x2tex, pshader_glsl_texm3x2tex, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)}, {WINED3DSIO_TEXM3x3PAD, "texm3x3pad", "undefined", 1, 2, pshader_hw_texm3x3pad, pshader_glsl_texm3x3pad, WINED3DPS_VERSION(1,0), WINED3DPS_VERSION(1,3)}, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 86fd2dc8c6a..ddea219fdee 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1788,6 +1788,7 @@ extern void pshader_hw_texdp3(SHADER_OPCODE_ARG* arg); extern void pshader_hw_texm3x3(SHADER_OPCODE_ARG* arg); extern void pshader_hw_texm3x2depth(SHADER_OPCODE_ARG* arg); extern void pshader_hw_dp2add(SHADER_OPCODE_ARG* arg); +extern void pshader_hw_texreg2rgb(SHADER_OPCODE_ARG* arg); /* ARB vertex / pixel shader common prototypes */ extern void shader_hw_nrm(SHADER_OPCODE_ARG* arg);