wined3d: Avoid using gl_ViewportIndex unnecessarily.
Fixes geometry shaders when ARB_viewport_array is not available. Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ca8e05154e
commit
3702e2bc42
|
@ -5152,11 +5152,11 @@ static void shader_glsl_else(const struct wined3d_shader_instruction *ins)
|
|||
static void shader_glsl_emit(const struct wined3d_shader_instruction *ins)
|
||||
{
|
||||
unsigned int stream = ins->handler_idx == WINED3DSIH_EMIT ? 0 : ins->src[0].reg.idx[0].offset;
|
||||
const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps;
|
||||
|
||||
shader_addline(ins->ctx->buffer, "gl_ViewportIndex = 0;\n");
|
||||
shader_addline(ins->ctx->buffer, "setup_gs_output(gs_out);\n");
|
||||
if (!ins->ctx->gl_info->supported[ARB_CLIP_CONTROL])
|
||||
shader_glsl_fixup_position(ins->ctx->buffer, TRUE);
|
||||
shader_glsl_fixup_position(ins->ctx->buffer, reg_maps->viewport_array);
|
||||
|
||||
if (!stream)
|
||||
shader_addline(ins->ctx->buffer, "EmitVertex();\n");
|
||||
|
@ -8244,7 +8244,12 @@ static GLuint shader_glsl_generate_geometry_shader(const struct wined3d_context
|
|||
shader_addline(buffer, "in shader_in_out { vec4 reg[%u]; } shader_in[];\n", shader->limits->packed_input);
|
||||
|
||||
if (!gl_info->supported[ARB_CLIP_CONTROL])
|
||||
shader_addline(buffer, "uniform vec4 pos_fixup[%u];\n", WINED3D_MAX_VIEWPORTS);
|
||||
{
|
||||
shader_addline(buffer, "uniform vec4 pos_fixup");
|
||||
if (reg_maps->viewport_array)
|
||||
shader_addline(buffer, "[%u]", WINED3D_MAX_VIEWPORTS);
|
||||
shader_addline(buffer, ";\n");
|
||||
}
|
||||
|
||||
if (is_rasterization_disabled(shader))
|
||||
{
|
||||
|
@ -8274,10 +8279,7 @@ static GLuint shader_glsl_generate_geometry_shader(const struct wined3d_context
|
|||
}
|
||||
shader_addline(buffer, "setup_gs_output(gs_out);\n");
|
||||
if (!gl_info->supported[ARB_CLIP_CONTROL])
|
||||
{
|
||||
shader_addline(buffer, "gl_ViewportIndex = 0;\n");
|
||||
shader_glsl_fixup_position(buffer, TRUE);
|
||||
}
|
||||
shader_glsl_fixup_position(buffer, FALSE);
|
||||
shader_addline(buffer, "EmitVertex();\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1807,6 +1807,10 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
|
|||
return hr;
|
||||
reg_maps->cull_distance_mask |= mask;
|
||||
}
|
||||
else if (e->sysval_semantic == WINED3D_SV_VIEWPORT_ARRAY_INDEX)
|
||||
{
|
||||
reg_maps->viewport_array = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (reg_maps->output_registers)
|
||||
|
|
|
@ -1030,7 +1030,8 @@ struct wined3d_shader_reg_maps
|
|||
DWORD point_size : 1;
|
||||
DWORD vocp : 1;
|
||||
DWORD input_rel_addressing : 1;
|
||||
DWORD padding : 16;
|
||||
DWORD viewport_array : 1;
|
||||
DWORD padding : 15;
|
||||
|
||||
DWORD rt_mask; /* Used render targets, 32 max. */
|
||||
|
||||
|
|
Loading…
Reference in New Issue