Commit 033df637 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Use correct data type for immediate constants.

In order to generate correct GLSL for image stores. Signed-off-by: 's avatarJózef Kucia <jkucia@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 7f9c2dab
...@@ -2723,7 +2723,8 @@ static void shader_glsl_fixup_scalar_register_variable(char *register_name, ...@@ -2723,7 +2723,8 @@ static void shader_glsl_fixup_scalar_register_variable(char *register_name,
/** Writes the GLSL variable name that corresponds to the register that the /** Writes the GLSL variable name that corresponds to the register that the
* DX opcode parameter is trying to access */ * DX opcode parameter is trying to access */
static void shader_glsl_get_register_name(const struct wined3d_shader_register *reg, static void shader_glsl_get_register_name(const struct wined3d_shader_register *reg,
char *register_name, BOOL *is_color, const struct wined3d_shader_instruction *ins) enum wined3d_data_type data_type, char *register_name, BOOL *is_color,
const struct wined3d_shader_instruction *ins)
{ {
/* oPos, oFog and oPts in D3D */ /* oPos, oFog and oPts in D3D */
static const char * const hwrastout_reg_names[] = {"vs_out[10]", "vs_out[11].x", "vs_out[11].y"}; static const char * const hwrastout_reg_names[] = {"vs_out[10]", "vs_out[11].x", "vs_out[11].y"};
...@@ -2948,7 +2949,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * ...@@ -2948,7 +2949,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
switch (reg->immconst_type) switch (reg->immconst_type)
{ {
case WINED3D_IMMCONST_SCALAR: case WINED3D_IMMCONST_SCALAR:
switch (reg->data_type) switch (data_type)
{ {
case WINED3D_DATA_FLOAT: case WINED3D_DATA_FLOAT:
if (gl_info->supported[ARB_SHADER_BIT_ENCODING]) if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
...@@ -2965,13 +2966,13 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * ...@@ -2965,13 +2966,13 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
sprintf(register_name, "%#xu", reg->u.immconst_data[0]); sprintf(register_name, "%#xu", reg->u.immconst_data[0]);
break; break;
default: default:
sprintf(register_name, "<unhandled data type %#x>", reg->data_type); sprintf(register_name, "<unhandled data type %#x>", data_type);
break; break;
} }
break; break;
case WINED3D_IMMCONST_VEC4: case WINED3D_IMMCONST_VEC4:
switch (reg->data_type) switch (data_type)
{ {
case WINED3D_DATA_FLOAT: case WINED3D_DATA_FLOAT:
if (gl_info->supported[ARB_SHADER_BIT_ENCODING]) if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
...@@ -3003,7 +3004,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * ...@@ -3003,7 +3004,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
reg->u.immconst_data[2], reg->u.immconst_data[3]); reg->u.immconst_data[2], reg->u.immconst_data[3]);
break; break;
default: default:
sprintf(register_name, "<unhandled data type %#x>", reg->data_type); sprintf(register_name, "<unhandled data type %#x>", data_type);
break; break;
} }
break; break;
...@@ -3247,7 +3248,7 @@ static void shader_glsl_add_src_param_ext(const struct wined3d_shader_instructio ...@@ -3247,7 +3248,7 @@ static void shader_glsl_add_src_param_ext(const struct wined3d_shader_instructio
glsl_src->param_str[0] = '\0'; glsl_src->param_str[0] = '\0';
swizzle_str[0] = '\0'; swizzle_str[0] = '\0';
shader_glsl_get_register_name(&wined3d_src->reg, glsl_src->reg_name, &is_color, ins); shader_glsl_get_register_name(&wined3d_src->reg, data_type, glsl_src->reg_name, &is_color, ins);
shader_glsl_get_swizzle(wined3d_src, is_color, mask, swizzle_str); shader_glsl_get_swizzle(wined3d_src, is_color, mask, swizzle_str);
switch (wined3d_src->reg.type) switch (wined3d_src->reg.type)
...@@ -3294,7 +3295,8 @@ static DWORD shader_glsl_add_dst_param(const struct wined3d_shader_instruction * ...@@ -3294,7 +3295,8 @@ static DWORD shader_glsl_add_dst_param(const struct wined3d_shader_instruction *
glsl_dst->mask_str[0] = '\0'; glsl_dst->mask_str[0] = '\0';
glsl_dst->reg_name[0] = '\0'; glsl_dst->reg_name[0] = '\0';
shader_glsl_get_register_name(&wined3d_dst->reg, glsl_dst->reg_name, &is_color, ins); shader_glsl_get_register_name(&wined3d_dst->reg, wined3d_dst->reg.data_type,
glsl_dst->reg_name, &is_color, ins);
return shader_glsl_get_write_mask(wined3d_dst, glsl_dst->mask_str); return shader_glsl_get_write_mask(wined3d_dst, glsl_dst->mask_str);
} }
...@@ -3586,7 +3588,7 @@ static void shader_glsl_color_correction(const struct wined3d_shader_instruction ...@@ -3586,7 +3588,7 @@ static void shader_glsl_color_correction(const struct wined3d_shader_instruction
char reg_name[256]; char reg_name[256];
BOOL is_color; BOOL is_color;
shader_glsl_get_register_name(&ins->dst[0].reg, reg_name, &is_color, ins); shader_glsl_get_register_name(&ins->dst[0].reg, ins->dst[0].reg.data_type, reg_name, &is_color, ins);
shader_glsl_color_correction_ext(ins->ctx->buffer, reg_name, ins->dst[0].write_mask, fixup); shader_glsl_color_correction_ext(ins->ctx->buffer, reg_name, ins->dst[0].write_mask, fixup);
} }
......
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