diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 7a3fb7056ee..e3c21e33fdb 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -642,8 +642,13 @@ void pshader_hw_tex(SHADER_OPCODE_ARG* arg) { else reg_sampler_code = src[1] & D3DSP_REGNUM_MASK; - shader_addline(buffer, "TEX %s, %s, texture[%lu], 2D;\n", - reg_dest, reg_coord, reg_sampler_code); + if(This->wineD3DDevice->stateBlock->textureState[reg_sampler_code][D3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED) { + shader_addline(buffer, "TXP %s, %s, texture[%lu], 2D;\n", + reg_dest, reg_coord, reg_sampler_code); + } else { + shader_addline(buffer, "TEX %s, %s, texture[%lu], 2D;\n", + reg_dest, reg_coord, reg_sampler_code); + } } void pshader_hw_texcoord(SHADER_OPCODE_ARG* arg) { diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 2ff147cd7c3..257b9e557c2 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1377,21 +1377,40 @@ void pshader_glsl_tex(SHADER_OPCODE_ARG* arg) { } sampler_type = arg->reg_maps->samplers[sampler_code] & WINED3DSP_TEXTURETYPE_MASK; - switch(sampler_type) { + if(This->wineD3DDevice->stateBlock->textureState[sampler_code][D3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED) { + switch(sampler_type) { - case WINED3DSTT_2D: - shader_addline(buffer, "%s = texture2D(%s, %s.st);\n", dst_str, sampler_str, coord_reg); - break; - case WINED3DSTT_CUBE: - shader_addline(buffer, "%s = textureCube(%s, %s.stp);\n", dst_str, sampler_str, coord_reg); - break; - case WINED3DSTT_VOLUME: - shader_addline(buffer, "%s = texture3D(%s, %s.stp);\n", dst_str, sampler_str, coord_reg); - break; - default: - shader_addline(buffer, "%s = unrecognized_stype(%s, %s.stp);\n", dst_str, sampler_str, coord_reg); - FIXME("Unrecognized sampler type: %#lx;\n", sampler_type); - break; + case WINED3DSTT_2D: + shader_addline(buffer, "%s = texture2DProj(%s, %s);\n", dst_str, sampler_str, coord_reg); + break; + case WINED3DSTT_CUBE: + shader_addline(buffer, "%s = textureCubeProj(%s, %s);\n", dst_str, sampler_str, coord_reg); + break; + case WINED3DSTT_VOLUME: + shader_addline(buffer, "%s = texture3DProj(%s, %s);\n", dst_str, sampler_str, coord_reg); + break; + default: + shader_addline(buffer, "%s = unrecognized_stype(%s, %s.stp);\n", dst_str, sampler_str, coord_reg); + FIXME("Unrecognized sampler type: %#lx;\n", sampler_type); + break; + } + } else { + switch(sampler_type) { + + case WINED3DSTT_2D: + shader_addline(buffer, "%s = texture2D(%s, %s.st);\n", dst_str, sampler_str, coord_reg); + break; + case WINED3DSTT_CUBE: + shader_addline(buffer, "%s = textureCube(%s, %s.stp);\n", dst_str, sampler_str, coord_reg); + break; + case WINED3DSTT_VOLUME: + shader_addline(buffer, "%s = texture3D(%s, %s.stp);\n", dst_str, sampler_str, coord_reg); + break; + default: + shader_addline(buffer, "%s = unrecognized_stype(%s, %s.stp);\n", dst_str, sampler_str, coord_reg); + FIXME("Unrecognized sampler type: %#lx;\n", sampler_type); + break; + } } }