if (shader == NULL)
return;
- unsigned num_vertices = vertices_per_prim(shader->info.Geom.InputType);
+ unsigned num_vertices =
+ vertices_per_prim(shader->Program->info.gs.input_primitive);
prog->Geom.VerticesIn = num_vertices;
analyze_clip_cull_usage(prog, shader, ctx,
* EmitStreamVertex() or EmitEndPrimitive() are called with a non-zero
* stream.
*/
- if (prog->Geom.UsesStreams && sh->info.Geom.OutputType != GL_POINTS) {
+ if (prog->Geom.UsesStreams &&
+ sh->Program->info.gs.output_primitive != GL_POINTS) {
linker_error(prog, "EmitStreamVertex(n) and EndStreamPrimitive(n) "
"with n>0 requires point output\n");
}
*/
static void
link_gs_inout_layout_qualifiers(struct gl_shader_program *prog,
- struct gl_linked_shader *linked_shader,
+ struct gl_program *gl_prog,
struct gl_shader **shader_list,
unsigned num_shaders)
{
- linked_shader->info.Geom.VerticesOut = -1;
- linked_shader->info.Geom.Invocations = 0;
- linked_shader->info.Geom.InputType = PRIM_UNKNOWN;
- linked_shader->info.Geom.OutputType = PRIM_UNKNOWN;
-
/* No in/out qualifiers defined for anything but GLSL 1.50+
* geometry shaders so far.
*/
- if (linked_shader->Stage != MESA_SHADER_GEOMETRY ||
+ if (gl_prog->info.stage != MESA_SHADER_GEOMETRY ||
prog->data->Version < 150)
return;
+ int vertices_out = -1;
+
+ gl_prog->info.gs.invocations = 0;
+ gl_prog->info.gs.input_primitive = PRIM_UNKNOWN;
+ gl_prog->info.gs.output_primitive = PRIM_UNKNOWN;
+
/* From the GLSL 1.50 spec, page 46:
*
* "All geometry shader output layout declarations in a program
struct gl_shader *shader = shader_list[i];
if (shader->info.Geom.InputType != PRIM_UNKNOWN) {
- if (linked_shader->info.Geom.InputType != PRIM_UNKNOWN &&
- linked_shader->info.Geom.InputType !=
+ if (gl_prog->info.gs.input_primitive != PRIM_UNKNOWN &&
+ gl_prog->info.gs.input_primitive !=
shader->info.Geom.InputType) {
linker_error(prog, "geometry shader defined with conflicting "
"input types\n");
return;
}
- linked_shader->info.Geom.InputType = shader->info.Geom.InputType;
+ gl_prog->info.gs.input_primitive = shader->info.Geom.InputType;
}
if (shader->info.Geom.OutputType != PRIM_UNKNOWN) {
- if (linked_shader->info.Geom.OutputType != PRIM_UNKNOWN &&
- linked_shader->info.Geom.OutputType !=
+ if (gl_prog->info.gs.output_primitive != PRIM_UNKNOWN &&
+ gl_prog->info.gs.output_primitive !=
shader->info.Geom.OutputType) {
linker_error(prog, "geometry shader defined with conflicting "
"output types\n");
return;
}
- linked_shader->info.Geom.OutputType = shader->info.Geom.OutputType;
+ gl_prog->info.gs.output_primitive = shader->info.Geom.OutputType;
}
if (shader->info.Geom.VerticesOut != -1) {
- if (linked_shader->info.Geom.VerticesOut != -1 &&
- linked_shader->info.Geom.VerticesOut !=
- shader->info.Geom.VerticesOut) {
+ if (vertices_out != -1 &&
+ vertices_out != shader->info.Geom.VerticesOut) {
linker_error(prog, "geometry shader defined with conflicting "
"output vertex count (%d and %d)\n",
- linked_shader->info.Geom.VerticesOut,
- shader->info.Geom.VerticesOut);
+ vertices_out, shader->info.Geom.VerticesOut);
return;
}
- linked_shader->info.Geom.VerticesOut = shader->info.Geom.VerticesOut;
+ vertices_out = shader->info.Geom.VerticesOut;
}
if (shader->info.Geom.Invocations != 0) {
- if (linked_shader->info.Geom.Invocations != 0 &&
- linked_shader->info.Geom.Invocations !=
- shader->info.Geom.Invocations) {
+ if (gl_prog->info.gs.invocations != 0 &&
+ gl_prog->info.gs.invocations !=
+ (unsigned) shader->info.Geom.Invocations) {
linker_error(prog, "geometry shader defined with conflicting "
"invocation count (%d and %d)\n",
- linked_shader->info.Geom.Invocations,
+ gl_prog->info.gs.invocations,
shader->info.Geom.Invocations);
return;
}
- linked_shader->info.Geom.Invocations = shader->info.Geom.Invocations;
+ gl_prog->info.gs.invocations = shader->info.Geom.Invocations;
}
}
* since we already know we're in the right type of shader program
* for doing it.
*/
- if (linked_shader->info.Geom.InputType == PRIM_UNKNOWN) {
+ if (gl_prog->info.gs.input_primitive == PRIM_UNKNOWN) {
linker_error(prog,
"geometry shader didn't declare primitive input type\n");
return;
}
- if (linked_shader->info.Geom.OutputType == PRIM_UNKNOWN) {
+ if (gl_prog->info.gs.output_primitive == PRIM_UNKNOWN) {
linker_error(prog,
"geometry shader didn't declare primitive output type\n");
return;
}
- if (linked_shader->info.Geom.VerticesOut == -1) {
+ if (vertices_out == -1) {
linker_error(prog,
"geometry shader didn't declare max_vertices\n");
return;
+ } else {
+ gl_prog->info.gs.vertices_out = vertices_out;
}
- if (linked_shader->info.Geom.Invocations == 0)
- linked_shader->info.Geom.Invocations = 1;
+ if (gl_prog->info.gs.invocations == 0)
+ gl_prog->info.gs.invocations = 1;
}
link_fs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders);
link_tcs_out_layout_qualifiers(prog, gl_prog, shader_list, num_shaders);
link_tes_in_layout_qualifiers(prog, gl_prog, shader_list, num_shaders);
- link_gs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders);
+ link_gs_inout_layout_qualifiers(prog, gl_prog, shader_list, num_shaders);
link_cs_input_layout_qualifiers(prog, linked, shader_list, num_shaders);
link_xfb_stride_layout_qualifiers(ctx, prog, linked, shader_list,
num_shaders);
/* Set the size of geometry shader input arrays */
if (linked->Stage == MESA_SHADER_GEOMETRY) {
- unsigned num_vertices = vertices_per_prim(linked->info.Geom.InputType);
+ unsigned num_vertices =
+ vertices_per_prim(gl_prog->info.gs.input_primitive);
array_resize_visitor input_resize_visitor(num_vertices, prog,
MESA_SHADER_GEOMETRY);
foreach_in_list(ir_instruction, ir, linked->ir) {
break;
if (check_gs_query(ctx, shProg)) {
*params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->
- info.Geom.VerticesOut;
+ Program->info.gs.vertices_out;
}
return;
case GL_GEOMETRY_SHADER_INVOCATIONS:
break;
if (check_gs_query(ctx, shProg)) {
*params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->
- info.Geom.Invocations;
+ Program->info.gs.invocations;
}
return;
case GL_GEOMETRY_INPUT_TYPE:
break;
if (check_gs_query(ctx, shProg)) {
*params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->
- info.Geom.InputType;
+ Program->info.gs.input_primitive;
}
return;
case GL_GEOMETRY_OUTPUT_TYPE:
break;
if (check_gs_query(ctx, shProg)) {
*params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->
- info.Geom.OutputType;
+ Program->info.gs.output_primitive;
}
return;
case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: {
switch (dst_sh->Stage) {
case MESA_SHADER_GEOMETRY: {
dst->info.gs.vertices_in = src->Geom.VerticesIn;
- dst->info.gs.vertices_out = dst_sh->info.Geom.VerticesOut;
- dst->info.gs.invocations = dst_sh->info.Geom.Invocations;
- dst->info.gs.input_primitive = dst_sh->info.Geom.InputType;
- dst->info.gs.output_primitive = dst_sh->info.Geom.OutputType;
dst->info.gs.uses_end_primitive = src->Geom.UsesEndPrimitive;
dst->info.gs.uses_streams = src->Geom.UsesStreams;
break;