wined3d: Load projected textures in fragment shaders.

This commit is contained in:
Stefan Dösinger 2006-08-24 23:57:46 +02:00 committed by Alexandre Julliard
parent 0b7a96e92b
commit d4a88724dd
2 changed files with 40 additions and 16 deletions

View File

@ -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) {

View File

@ -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;
}
}
}