wined3d: Make the "is_color" parameter to shader_glsl_get_register_name() optional.

Not all callers care.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-08-15 14:26:22 +04:30 committed by Alexandre Julliard
parent dc57d0c607
commit dd282d3e8c
1 changed files with 7 additions and 9 deletions

View File

@ -2859,7 +2859,7 @@ 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,
enum wined3d_data_type data_type, char *register_name, BOOL *is_color, enum wined3d_data_type data_type, char *register_name, BOOL *is_swizzled,
const struct wined3d_shader_context *ctx) const struct wined3d_shader_context *ctx)
{ {
/* oPos, oFog and oPts in D3D */ /* oPos, oFog and oPts in D3D */
@ -2879,7 +2879,8 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
if (reg->idx[1].offset != ~0u && reg->idx[1].rel_addr) if (reg->idx[1].offset != ~0u && reg->idx[1].rel_addr)
shader_glsl_add_src_param_ext(ctx, reg->idx[1].rel_addr, WINED3DSP_WRITEMASK_0, shader_glsl_add_src_param_ext(ctx, reg->idx[1].rel_addr, WINED3DSP_WRITEMASK_0,
&rel_param1, reg->idx[1].rel_addr->reg.data_type); &rel_param1, reg->idx[1].rel_addr->reg.data_type);
*is_color = FALSE; if (is_swizzled)
*is_swizzled = FALSE;
switch (reg->type) switch (reg->type)
{ {
@ -2895,8 +2896,8 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
if (reg->idx[0].rel_addr) if (reg->idx[0].rel_addr)
FIXME("VS3 input registers relative addressing.\n"); FIXME("VS3 input registers relative addressing.\n");
if (priv->cur_vs_args->swizzle_map & (1u << reg->idx[0].offset)) if (is_swizzled && priv->cur_vs_args->swizzle_map & (1u << reg->idx[0].offset))
*is_color = TRUE; *is_swizzled = TRUE;
if (reg->idx[0].rel_addr) if (reg->idx[0].rel_addr)
{ {
sprintf(register_name, "%s_in[%s + %u]", sprintf(register_name, "%s_in[%s + %u]",
@ -3444,13 +3445,11 @@ static void shader_glsl_add_src_param(const struct wined3d_shader_instruction *i
static DWORD shader_glsl_add_dst_param(const struct wined3d_shader_instruction *ins, static DWORD shader_glsl_add_dst_param(const struct wined3d_shader_instruction *ins,
const struct wined3d_shader_dst_param *wined3d_dst, struct glsl_dst_param *glsl_dst) const struct wined3d_shader_dst_param *wined3d_dst, struct glsl_dst_param *glsl_dst)
{ {
BOOL is_color = FALSE;
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, wined3d_dst->reg.data_type, shader_glsl_get_register_name(&wined3d_dst->reg, wined3d_dst->reg.data_type,
glsl_dst->reg_name, &is_color, ins->ctx); glsl_dst->reg_name, NULL, ins->ctx);
return shader_glsl_get_write_mask(wined3d_dst, glsl_dst->mask_str); return shader_glsl_get_write_mask(wined3d_dst, glsl_dst->mask_str);
} }
@ -3740,9 +3739,8 @@ static void shader_glsl_color_correction_ext(struct wined3d_string_buffer *buffe
static void shader_glsl_color_correction(const struct wined3d_shader_instruction *ins, struct color_fixup_desc fixup) static void shader_glsl_color_correction(const struct wined3d_shader_instruction *ins, struct color_fixup_desc fixup)
{ {
char reg_name[256]; char reg_name[256];
BOOL is_color;
shader_glsl_get_register_name(&ins->dst[0].reg, ins->dst[0].reg.data_type, reg_name, &is_color, ins->ctx); shader_glsl_get_register_name(&ins->dst[0].reg, ins->dst[0].reg.data_type, reg_name, NULL, ins->ctx);
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);
} }