mesa/st: translate SO info in glsl_to_nir() case

This was handled for VS, but not for GS.

Fixes for gallium drivers using nir:
spec@arb_gpu_shader5@arb_gpu_shader5-xfb-streams-without-invocations
spec@arb_gpu_shader5@arb_gpu_shader5-xfb-streams*
spec@arb_transform_feedback3@arb_transform_feedback3-ext_interleaved_two_bufs_gs*
spec@ext_transform_feedback@geometry-shaders-basic
spec@ext_transform_feedback@* use_gs
spec@glsl-1.50@execution@geometry@primitive-id*
spec@glsl-1.50@execution@geometry@tri-strip-ordering-with-prim-restart gl_triangle_strip *
spec@glsl-1.50@transform-feedback-builtins
spec@glsl-1.50@transform-feedback-type-and-size

v2: don't call st_translate_program_stream_output) for TCS

v3: drop scanning patch outputs as TCS can't output xfb

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Karol Herbst <kherbst@redhat.com>
This commit is contained in:
Rob Clark 2018-01-10 03:54:14 +01:00 committed by Timothy Arceri
parent 44a27cdcec
commit 4c69961daf

View File

@ -1425,6 +1425,40 @@ st_translate_program_common(struct st_context *st,
}
}
/**
* Update stream-output info for GS/TCS/TES. Normally this is done in
* st_translate_program_common() but that is not called for glsl_to_nir
* case.
*/
static void
st_translate_program_stream_output(struct gl_program *prog,
struct pipe_stream_output_info *stream_output)
{
if (!prog->sh.LinkedTransformFeedback)
return;
ubyte outputMapping[VARYING_SLOT_TESS_MAX];
GLuint attr;
uint num_outputs = 0;
memset(outputMapping, 0, sizeof(outputMapping));
/*
* Determine number of outputs, the (default) output register
* mapping and the semantic information for each output.
*/
for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
if (prog->info.outputs_written & BITFIELD64_BIT(attr)) {
GLuint slot = num_outputs++;
outputMapping[attr] = slot;
}
}
st_translate_stream_output_info2(prog->sh.LinkedTransformFeedback,
outputMapping,
stream_output);
}
/**
* Translate a geometry program to create a new variant.
@ -1436,8 +1470,10 @@ st_translate_geometry_program(struct st_context *st,
struct ureg_program *ureg;
/* We have already compiled to NIR so just return */
if (stgp->shader_program)
if (stgp->shader_program) {
st_translate_program_stream_output(&stgp->Base, &stgp->tgsi.stream_output);
return true;
}
ureg = ureg_create_with_screen(PIPE_SHADER_GEOMETRY, st->pipe->screen);
if (ureg == NULL)
@ -1493,6 +1529,7 @@ st_get_basic_variant(struct st_context *st,
tgsi.ir.nir = nir_shader_clone(NULL, prog->tgsi.ir.nir);
st_finalize_nir(st, &prog->Base, prog->shader_program,
tgsi.ir.nir);
tgsi.stream_output = prog->tgsi.stream_output;
} else
tgsi = prog->tgsi;
/* fill in new variant */
@ -1533,7 +1570,7 @@ st_translate_tessctrl_program(struct st_context *st,
{
struct ureg_program *ureg;
/* We have already compiler to NIR so just return */
/* We have already compiled to NIR so just return */
if (sttcp->shader_program)
return true;
@ -1562,9 +1599,11 @@ st_translate_tesseval_program(struct st_context *st,
{
struct ureg_program *ureg;
/* We have already compiler to NIR so just return */
if (sttep->shader_program)
/* We have already compiled to NIR so just return */
if (sttep->shader_program) {
st_translate_program_stream_output(&sttep->Base, &sttep->tgsi.stream_output);
return true;
}
ureg = ureg_create_with_screen(PIPE_SHADER_TESS_EVAL, st->pipe->screen);
if (ureg == NULL)