Commit d4a88724 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Load projected textures in fragment shaders.

parent 0b7a96e9
......@@ -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) {
......
......@@ -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) {
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;
if(This->wineD3DDevice->stateBlock->textureState[sampler_code][D3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED) {
switch(sampler_type) {
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;
}
}
}
......
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