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

wined3d: Match position output register by sysval semantic value.

parent 9eef3c90
...@@ -5053,7 +5053,7 @@ static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct w ...@@ -5053,7 +5053,7 @@ static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct w
if (args->vp_mode == vertexshader) if (args->vp_mode == vertexshader)
{ {
if (input->sysval_semantic == WINED3D_SV_POSITION) if (input->sysval_semantic == WINED3D_SV_POSITION && !semantic_idx)
shader_addline(buffer, "ps_in[%u]%s = vpos%s;\n", shader_addline(buffer, "ps_in[%u]%s = vpos%s;\n",
shader->u.ps.input_reg_map[input->register_idx], reg_mask, reg_mask); shader->u.ps.input_reg_map[input->register_idx], reg_mask, reg_mask);
else if (args->pointsprite && shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_TEXCOORD)) else if (args->pointsprite && shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_TEXCOORD))
...@@ -5392,7 +5392,7 @@ static GLuint generate_param_reorder_function(struct shader_glsl_priv *priv, ...@@ -5392,7 +5392,7 @@ static GLuint generate_param_reorder_function(struct shader_glsl_priv *priv,
semantic_idx = output->semantic_idx; semantic_idx = output->semantic_idx;
shader_glsl_write_mask_to_str(output->mask, reg_mask); shader_glsl_write_mask_to_str(output->mask, reg_mask);
if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_POSITION) && !semantic_idx) if (output->sysval_semantic == WINED3D_SV_POSITION && !semantic_idx)
{ {
shader_addline(buffer, "gl_Position%s = vs_out[%u]%s;\n", shader_addline(buffer, "gl_Position%s = vs_out[%u]%s;\n",
reg_mask, output->register_idx, reg_mask); reg_mask, output->register_idx, reg_mask);
......
...@@ -256,7 +256,7 @@ static void shader_dump_src_param(struct wined3d_string_buffer *buffer, ...@@ -256,7 +256,7 @@ static void shader_dump_src_param(struct wined3d_string_buffer *buffer,
const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx) const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx)
{ {
if (handler_idx >= sizeof(shader_opcode_names) / sizeof(*shader_opcode_names)) if (handler_idx >= ARRAY_SIZE(shader_opcode_names))
return wine_dbg_sprintf("UNRECOGNIZED(%#x)", handler_idx); return wine_dbg_sprintf("UNRECOGNIZED(%#x)", handler_idx);
return shader_opcode_names[handler_idx]; return shader_opcode_names[handler_idx];
...@@ -264,7 +264,7 @@ const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HA ...@@ -264,7 +264,7 @@ const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HA
static const char *shader_semantic_name_from_usage(enum wined3d_decl_usage usage) static const char *shader_semantic_name_from_usage(enum wined3d_decl_usage usage)
{ {
if (usage >= sizeof(semantic_names) / sizeof(*semantic_names)) if (usage >= ARRAY_SIZE(semantic_names))
{ {
FIXME("Unrecognized usage %#x.\n", usage); FIXME("Unrecognized usage %#x.\n", usage);
return "UNRECOGNIZED"; return "UNRECOGNIZED";
...@@ -277,14 +277,26 @@ static enum wined3d_decl_usage shader_usage_from_semantic_name(const char *name) ...@@ -277,14 +277,26 @@ static enum wined3d_decl_usage shader_usage_from_semantic_name(const char *name)
{ {
unsigned int i; unsigned int i;
for (i = 0; i < sizeof(semantic_names) / sizeof(*semantic_names); ++i) for (i = 0; i < ARRAY_SIZE(semantic_names); ++i)
{ {
if (!strcmp(name, semantic_names[i])) return i; if (!strcmp(name, semantic_names[i]))
return i;
} }
return ~0U; return ~0U;
} }
static enum wined3d_sysval_semantic shader_sysval_semantic_from_usage(enum wined3d_decl_usage usage)
{
switch (usage)
{
case WINED3D_DECL_USAGE_POSITION:
return WINED3D_SV_POSITION;
default:
return 0;
}
}
BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage)
{ {
return !strcmp(semantic_name, shader_semantic_name_from_usage(usage)); return !strcmp(semantic_name, shader_semantic_name_from_usage(usage));
...@@ -295,7 +307,7 @@ static void shader_signature_from_semantic(struct wined3d_shader_signature_eleme ...@@ -295,7 +307,7 @@ static void shader_signature_from_semantic(struct wined3d_shader_signature_eleme
{ {
e->semantic_name = shader_semantic_name_from_usage(s->usage); e->semantic_name = shader_semantic_name_from_usage(s->usage);
e->semantic_idx = s->usage_idx; e->semantic_idx = s->usage_idx;
e->sysval_semantic = 0; e->sysval_semantic = shader_sysval_semantic_from_usage(s->usage);
e->component_type = 0; e->component_type = 0;
e->register_idx = s->reg.reg.idx[0].offset; e->register_idx = s->reg.reg.idx[0].offset;
e->mask = s->reg.write_mask; e->mask = s->reg.write_mask;
...@@ -306,7 +318,7 @@ static void shader_signature_from_usage(struct wined3d_shader_signature_element ...@@ -306,7 +318,7 @@ static void shader_signature_from_usage(struct wined3d_shader_signature_element
{ {
e->semantic_name = shader_semantic_name_from_usage(usage); e->semantic_name = shader_semantic_name_from_usage(usage);
e->semantic_idx = usage_idx; e->semantic_idx = usage_idx;
e->sysval_semantic = 0; e->sysval_semantic = shader_sysval_semantic_from_usage(usage);
e->component_type = 0; e->component_type = 0;
e->register_idx = reg_idx; e->register_idx = reg_idx;
e->mask = write_mask; e->mask = write_mask;
......
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