Commit ac651a70 authored by H. Verbeet's avatar H. Verbeet Committed by Alexandre Julliard

wined3d: Fix the texm3x3tex instruction to sample properly.

parent e7122e9a
......@@ -781,13 +781,15 @@ void pshader_hw_texm3x3tex(SHADER_OPCODE_ARG* arg) {
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
SHADER_BUFFER* buffer = arg->buffer;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
char dst_str[8];
char src0_name[50];
pshader_gen_input_modifier_line(buffer, arg->src[0], 0, src0_name);
shader_addline(buffer, "DP3 TMP.z, T%u, %s;\n", reg, src0_name);
/* Cubemap textures will be more used than 3D ones. */
shader_addline(buffer, "TEX T%u, TMP, texture[%u], CUBE;\n", reg, reg);
/* Sample the texture using the calculated coordinates */
sprintf(dst_str, "T%u", reg);
shader_hw_sample(arg, reg, dst_str, "TMP");
current_state->current_row = 0;
}
......
......@@ -1560,33 +1560,22 @@ void pshader_glsl_texm3x2tex(SHADER_OPCODE_ARG* arg) {
}
/** Process the WINED3DSIO_TEXM3X3TEX instruction in GLSL
* Perform the 3rd row of a 3x3 matrix multiply, then sample the texture using the calculate coordinates */
* Perform the 3rd row of a 3x3 matrix multiply, then sample the texture using the calculated coordinates */
void pshader_glsl_texm3x3tex(SHADER_OPCODE_ARG* arg) {
char dst_str[8];
char src0_str[100];
char src0_name[50];
char src0_mask[6];
char dimensions[5];
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
DWORD src0_regnum = arg->src[0] & WINED3DSP_REGNUM_MASK;
DWORD stype = arg->reg_maps->samplers[src0_regnum] & WINED3DSP_TEXTURETYPE_MASK;
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
SHADER_PARSE_STATE* current_state = &This->baseShader.parse_state;
switch (stype) {
case WINED3DSTT_2D: strcpy(dimensions, "2D"); break;
case WINED3DSTT_CUBE: strcpy(dimensions, "Cube"); break;
case WINED3DSTT_VOLUME: strcpy(dimensions, "3D"); break;
default:
strcpy(dimensions, "");
FIXME("Unrecognized sampler type: %#x\n", stype);
break;
}
shader_glsl_add_param(arg, arg->src[0], arg->src_addr[0], TRUE, src0_name, src0_mask, src0_str);
shader_addline(arg->buffer, "tmp0.z = dot(vec3(T%u), vec3(%s));\n", reg, src0_str);
shader_addline(arg->buffer, "T%u = texture%s(Psampler%u, tmp0.%s);\n",
reg, dimensions, reg, (stype == WINED3DSTT_2D) ? "xy" : "xyz");
/* Sample the texture using the calculated coordinates */
sprintf(dst_str, "T%u", reg);
shader_glsl_sample(arg, reg, dst_str, "tmp0");
current_state->current_row = 0;
}
......
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