if (state->out_qualifier->out_xfb_stride[i]->
process_qualifier_constant(state, "xfb_stride", &xfb_stride,
true)) {
- shader->TransformFeedback.BufferStride[i] = xfb_stride;
+ shader->info.TransformFeedback.BufferStride[i] = xfb_stride;
}
}
}
switch (shader->Stage) {
case MESA_SHADER_TESS_CTRL:
- shader->TessCtrl.VerticesOut = 0;
+ shader->info.TessCtrl.VerticesOut = 0;
if (state->tcs_output_vertices_specified) {
unsigned vertices;
if (state->out_qualifier->vertices->
_mesa_glsl_error(&loc, state, "vertices (%d) exceeds "
"GL_MAX_PATCH_VERTICES", vertices);
}
- shader->TessCtrl.VerticesOut = vertices;
+ shader->info.TessCtrl.VerticesOut = vertices;
}
}
break;
case MESA_SHADER_TESS_EVAL:
- shader->TessEval.PrimitiveMode = PRIM_UNKNOWN;
+ shader->info.TessEval.PrimitiveMode = PRIM_UNKNOWN;
if (state->in_qualifier->flags.q.prim_type)
- shader->TessEval.PrimitiveMode = state->in_qualifier->prim_type;
+ shader->info.TessEval.PrimitiveMode = state->in_qualifier->prim_type;
- shader->TessEval.Spacing = 0;
+ shader->info.TessEval.Spacing = 0;
if (state->in_qualifier->flags.q.vertex_spacing)
- shader->TessEval.Spacing = state->in_qualifier->vertex_spacing;
+ shader->info.TessEval.Spacing = state->in_qualifier->vertex_spacing;
- shader->TessEval.VertexOrder = 0;
+ shader->info.TessEval.VertexOrder = 0;
if (state->in_qualifier->flags.q.ordering)
- shader->TessEval.VertexOrder = state->in_qualifier->ordering;
+ shader->info.TessEval.VertexOrder = state->in_qualifier->ordering;
- shader->TessEval.PointMode = -1;
+ shader->info.TessEval.PointMode = -1;
if (state->in_qualifier->flags.q.point_mode)
- shader->TessEval.PointMode = state->in_qualifier->point_mode;
+ shader->info.TessEval.PointMode = state->in_qualifier->point_mode;
break;
case MESA_SHADER_GEOMETRY:
- shader->Geom.VerticesOut = -1;
+ shader->info.Geom.VerticesOut = -1;
if (state->out_qualifier->flags.q.max_vertices) {
unsigned qual_max_vertices;
if (state->out_qualifier->max_vertices->
"GL_MAX_GEOMETRY_OUTPUT_VERTICES",
qual_max_vertices);
}
- shader->Geom.VerticesOut = qual_max_vertices;
+ shader->info.Geom.VerticesOut = qual_max_vertices;
}
}
if (state->gs_input_prim_type_specified) {
- shader->Geom.InputType = state->in_qualifier->prim_type;
+ shader->info.Geom.InputType = state->in_qualifier->prim_type;
} else {
- shader->Geom.InputType = PRIM_UNKNOWN;
+ shader->info.Geom.InputType = PRIM_UNKNOWN;
}
if (state->out_qualifier->flags.q.prim_type) {
- shader->Geom.OutputType = state->out_qualifier->prim_type;
+ shader->info.Geom.OutputType = state->out_qualifier->prim_type;
} else {
- shader->Geom.OutputType = PRIM_UNKNOWN;
+ shader->info.Geom.OutputType = PRIM_UNKNOWN;
}
- shader->Geom.Invocations = 0;
+ shader->info.Geom.Invocations = 0;
if (state->in_qualifier->flags.q.invocations) {
unsigned invocations;
if (state->in_qualifier->invocations->
"GL_MAX_GEOMETRY_SHADER_INVOCATIONS",
invocations);
}
- shader->Geom.Invocations = invocations;
+ shader->info.Geom.Invocations = invocations;
}
}
break;
case MESA_SHADER_COMPUTE:
if (state->cs_input_local_size_specified) {
for (int i = 0; i < 3; i++)
- shader->Comp.LocalSize[i] = state->cs_input_local_size[i];
+ shader->info.Comp.LocalSize[i] = state->cs_input_local_size[i];
} else {
for (int i = 0; i < 3; i++)
- shader->Comp.LocalSize[i] = 0;
+ shader->info.Comp.LocalSize[i] = 0;
}
break;
case MESA_SHADER_FRAGMENT:
- shader->redeclares_gl_fragcoord = state->fs_redeclares_gl_fragcoord;
- shader->uses_gl_fragcoord = state->fs_uses_gl_fragcoord;
- shader->pixel_center_integer = state->fs_pixel_center_integer;
- shader->origin_upper_left = state->fs_origin_upper_left;
- shader->ARB_fragment_coord_conventions_enable =
+ shader->info.redeclares_gl_fragcoord =
+ state->fs_redeclares_gl_fragcoord;
+ shader->info.uses_gl_fragcoord = state->fs_uses_gl_fragcoord;
+ shader->info.pixel_center_integer = state->fs_pixel_center_integer;
+ shader->info.origin_upper_left = state->fs_origin_upper_left;
+ shader->info.ARB_fragment_coord_conventions_enable =
state->ARB_fragment_coord_conventions_enable;
- shader->EarlyFragmentTests = state->fs_early_fragment_tests;
+ shader->info.EarlyFragmentTests = state->fs_early_fragment_tests;
break;
default:
shader->InfoLog = state->info_log;
shader->Version = state->language_version;
shader->IsES = state->es_shader;
- shader->uses_builtin_functions = state->uses_builtin_functions;
+ shader->info.uses_builtin_functions = state->uses_builtin_functions;
/* Retain any live IR, but trash the rest. */
reparent_ir(shader->ir, shader->ir);
if (shader == NULL)
return;
- unsigned num_vertices = vertices_per_prim(shader->Geom.InputType);
+ unsigned num_vertices = vertices_per_prim(shader->info.Geom.InputType);
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->Geom.OutputType != GL_POINTS) {
+ if (prog->Geom.UsesStreams && sh->info.Geom.OutputType != GL_POINTS) {
linker_error(prog, "EmitStreamVertex(n) and EndStreamPrimitive(n) "
"with n>0 requires point output\n");
}
unsigned num_shaders)
{
for (unsigned i = 0; i < MAX_FEEDBACK_BUFFERS; i++) {
- linked_shader->TransformFeedback.BufferStride[i] = 0;
+ linked_shader->info.TransformFeedback.BufferStride[i] = 0;
}
for (unsigned i = 0; i < num_shaders; i++) {
struct gl_shader *shader = shader_list[i];
for (unsigned j = 0; j < MAX_FEEDBACK_BUFFERS; j++) {
- if (shader->TransformFeedback.BufferStride[j]) {
- if (linked_shader->TransformFeedback.BufferStride[j] != 0 &&
- shader->TransformFeedback.BufferStride[j] != 0 &&
- linked_shader->TransformFeedback.BufferStride[j] !=
- shader->TransformFeedback.BufferStride[j]) {
+ if (shader->info.TransformFeedback.BufferStride[j]) {
+ if (linked_shader->info.TransformFeedback.BufferStride[j] != 0 &&
+ shader->info.TransformFeedback.BufferStride[j] != 0 &&
+ linked_shader->info.TransformFeedback.BufferStride[j] !=
+ shader->info.TransformFeedback.BufferStride[j]) {
linker_error(prog,
"intrastage shaders defined with conflicting "
"xfb_stride for buffer %d (%d and %d)\n", j,
- linked_shader->TransformFeedback.BufferStride[j],
- shader->TransformFeedback.BufferStride[j]);
+ linked_shader->
+ info.TransformFeedback.BufferStride[j],
+ shader->info.TransformFeedback.BufferStride[j]);
return;
}
- if (shader->TransformFeedback.BufferStride[j])
- linked_shader->TransformFeedback.BufferStride[j] =
- shader->TransformFeedback.BufferStride[j];
+ if (shader->info.TransformFeedback.BufferStride[j])
+ linked_shader->info.TransformFeedback.BufferStride[j] =
+ shader->info.TransformFeedback.BufferStride[j];
}
}
}
for (unsigned j = 0; j < MAX_FEEDBACK_BUFFERS; j++) {
- if (linked_shader->TransformFeedback.BufferStride[j]) {
+ if (linked_shader->info.TransformFeedback.BufferStride[j]) {
prog->TransformFeedback.BufferStride[j] =
- linked_shader->TransformFeedback.BufferStride[j];
+ linked_shader->info.TransformFeedback.BufferStride[j];
/* We will validate doubles at a later stage */
if (prog->TransformFeedback.BufferStride[j] % 4) {
struct gl_shader **shader_list,
unsigned num_shaders)
{
- linked_shader->TessCtrl.VerticesOut = 0;
+ linked_shader->info.TessCtrl.VerticesOut = 0;
if (linked_shader->Stage != MESA_SHADER_TESS_CTRL)
return;
for (unsigned i = 0; i < num_shaders; i++) {
struct gl_shader *shader = shader_list[i];
- if (shader->TessCtrl.VerticesOut != 0) {
- if (linked_shader->TessCtrl.VerticesOut != 0 &&
- linked_shader->TessCtrl.VerticesOut != shader->TessCtrl.VerticesOut) {
+ if (shader->info.TessCtrl.VerticesOut != 0) {
+ if (linked_shader->info.TessCtrl.VerticesOut != 0 &&
+ linked_shader->info.TessCtrl.VerticesOut !=
+ shader->info.TessCtrl.VerticesOut) {
linker_error(prog, "tessellation control shader defined with "
"conflicting output vertex count (%d and %d)\n",
- linked_shader->TessCtrl.VerticesOut,
- shader->TessCtrl.VerticesOut);
+ linked_shader->info.TessCtrl.VerticesOut,
+ shader->info.TessCtrl.VerticesOut);
return;
}
- linked_shader->TessCtrl.VerticesOut = shader->TessCtrl.VerticesOut;
+ linked_shader->info.TessCtrl.VerticesOut =
+ shader->info.TessCtrl.VerticesOut;
}
}
* since we already know we're in the right type of shader program
* for doing it.
*/
- if (linked_shader->TessCtrl.VerticesOut == 0) {
+ if (linked_shader->info.TessCtrl.VerticesOut == 0) {
linker_error(prog, "tessellation control shader didn't declare "
"vertices out layout qualifier\n");
return;
struct gl_shader **shader_list,
unsigned num_shaders)
{
- linked_shader->TessEval.PrimitiveMode = PRIM_UNKNOWN;
- linked_shader->TessEval.Spacing = 0;
- linked_shader->TessEval.VertexOrder = 0;
- linked_shader->TessEval.PointMode = -1;
+ linked_shader->info.TessEval.PrimitiveMode = PRIM_UNKNOWN;
+ linked_shader->info.TessEval.Spacing = 0;
+ linked_shader->info.TessEval.VertexOrder = 0;
+ linked_shader->info.TessEval.PointMode = -1;
if (linked_shader->Stage != MESA_SHADER_TESS_EVAL)
return;
for (unsigned i = 0; i < num_shaders; i++) {
struct gl_shader *shader = shader_list[i];
- if (shader->TessEval.PrimitiveMode != PRIM_UNKNOWN) {
- if (linked_shader->TessEval.PrimitiveMode != PRIM_UNKNOWN &&
- linked_shader->TessEval.PrimitiveMode != shader->TessEval.PrimitiveMode) {
+ if (shader->info.TessEval.PrimitiveMode != PRIM_UNKNOWN) {
+ if (linked_shader->info.TessEval.PrimitiveMode != PRIM_UNKNOWN &&
+ linked_shader->info.TessEval.PrimitiveMode !=
+ shader->info.TessEval.PrimitiveMode) {
linker_error(prog, "tessellation evaluation shader defined with "
"conflicting input primitive modes.\n");
return;
}
- linked_shader->TessEval.PrimitiveMode = shader->TessEval.PrimitiveMode;
+ linked_shader->info.TessEval.PrimitiveMode = shader->info.TessEval.PrimitiveMode;
}
- if (shader->TessEval.Spacing != 0) {
- if (linked_shader->TessEval.Spacing != 0 &&
- linked_shader->TessEval.Spacing != shader->TessEval.Spacing) {
+ if (shader->info.TessEval.Spacing != 0) {
+ if (linked_shader->info.TessEval.Spacing != 0 &&
+ linked_shader->info.TessEval.Spacing !=
+ shader->info.TessEval.Spacing) {
linker_error(prog, "tessellation evaluation shader defined with "
"conflicting vertex spacing.\n");
return;
}
- linked_shader->TessEval.Spacing = shader->TessEval.Spacing;
+ linked_shader->info.TessEval.Spacing = shader->info.TessEval.Spacing;
}
- if (shader->TessEval.VertexOrder != 0) {
- if (linked_shader->TessEval.VertexOrder != 0 &&
- linked_shader->TessEval.VertexOrder != shader->TessEval.VertexOrder) {
+ if (shader->info.TessEval.VertexOrder != 0) {
+ if (linked_shader->info.TessEval.VertexOrder != 0 &&
+ linked_shader->info.TessEval.VertexOrder !=
+ shader->info.TessEval.VertexOrder) {
linker_error(prog, "tessellation evaluation shader defined with "
"conflicting ordering.\n");
return;
}
- linked_shader->TessEval.VertexOrder = shader->TessEval.VertexOrder;
+ linked_shader->info.TessEval.VertexOrder =
+ shader->info.TessEval.VertexOrder;
}
- if (shader->TessEval.PointMode != -1) {
- if (linked_shader->TessEval.PointMode != -1 &&
- linked_shader->TessEval.PointMode != shader->TessEval.PointMode) {
+ if (shader->info.TessEval.PointMode != -1) {
+ if (linked_shader->info.TessEval.PointMode != -1 &&
+ linked_shader->info.TessEval.PointMode !=
+ shader->info.TessEval.PointMode) {
linker_error(prog, "tessellation evaluation shader defined with "
"conflicting point modes.\n");
return;
}
- linked_shader->TessEval.PointMode = shader->TessEval.PointMode;
+ linked_shader->info.TessEval.PointMode =
+ shader->info.TessEval.PointMode;
}
}
* since we already know we're in the right type of shader program
* for doing it.
*/
- if (linked_shader->TessEval.PrimitiveMode == PRIM_UNKNOWN) {
+ if (linked_shader->info.TessEval.PrimitiveMode == PRIM_UNKNOWN) {
linker_error(prog,
"tessellation evaluation shader didn't declare input "
"primitive modes.\n");
return;
}
- if (linked_shader->TessEval.Spacing == 0)
- linked_shader->TessEval.Spacing = GL_EQUAL;
+ if (linked_shader->info.TessEval.Spacing == 0)
+ linked_shader->info.TessEval.Spacing = GL_EQUAL;
- if (linked_shader->TessEval.VertexOrder == 0)
- linked_shader->TessEval.VertexOrder = GL_CCW;
+ if (linked_shader->info.TessEval.VertexOrder == 0)
+ linked_shader->info.TessEval.VertexOrder = GL_CCW;
- if (linked_shader->TessEval.PointMode == -1)
- linked_shader->TessEval.PointMode = GL_FALSE;
+ if (linked_shader->info.TessEval.PointMode == -1)
+ linked_shader->info.TessEval.PointMode = GL_FALSE;
}
struct gl_shader **shader_list,
unsigned num_shaders)
{
- linked_shader->redeclares_gl_fragcoord = false;
- linked_shader->uses_gl_fragcoord = false;
- linked_shader->origin_upper_left = false;
- linked_shader->pixel_center_integer = false;
+ linked_shader->info.redeclares_gl_fragcoord = false;
+ linked_shader->info.uses_gl_fragcoord = false;
+ linked_shader->info.origin_upper_left = false;
+ linked_shader->info.pixel_center_integer = false;
if (linked_shader->Stage != MESA_SHADER_FRAGMENT ||
(prog->Version < 150 && !prog->ARB_fragment_coord_conventions_enable))
* it must be redeclared in all the fragment shaders in that program
* that have a static use gl_FragCoord."
*/
- if ((linked_shader->redeclares_gl_fragcoord
- && !shader->redeclares_gl_fragcoord
- && shader->uses_gl_fragcoord)
- || (shader->redeclares_gl_fragcoord
- && !linked_shader->redeclares_gl_fragcoord
- && linked_shader->uses_gl_fragcoord)) {
+ if ((linked_shader->info.redeclares_gl_fragcoord
+ && !shader->info.redeclares_gl_fragcoord
+ && shader->info.uses_gl_fragcoord)
+ || (shader->info.redeclares_gl_fragcoord
+ && !linked_shader->info.redeclares_gl_fragcoord
+ && linked_shader->info.uses_gl_fragcoord)) {
linker_error(prog, "fragment shader defined with conflicting "
"layout qualifiers for gl_FragCoord\n");
}
* "All redeclarations of gl_FragCoord in all fragment shaders in a
* single program must have the same set of qualifiers."
*/
- if (linked_shader->redeclares_gl_fragcoord && shader->redeclares_gl_fragcoord
- && (shader->origin_upper_left != linked_shader->origin_upper_left
- || shader->pixel_center_integer != linked_shader->pixel_center_integer)) {
+ if (linked_shader->info.redeclares_gl_fragcoord &&
+ shader->info.redeclares_gl_fragcoord &&
+ (shader->info.origin_upper_left !=
+ linked_shader->info.origin_upper_left ||
+ shader->info.pixel_center_integer !=
+ linked_shader->info.pixel_center_integer)) {
linker_error(prog, "fragment shader defined with conflicting "
"layout qualifiers for gl_FragCoord\n");
}
* are multiple redeclarations, all the fields except uses_gl_fragcoord
* are already known to be the same.
*/
- if (shader->redeclares_gl_fragcoord || shader->uses_gl_fragcoord) {
- linked_shader->redeclares_gl_fragcoord =
- shader->redeclares_gl_fragcoord;
- linked_shader->uses_gl_fragcoord = linked_shader->uses_gl_fragcoord
- || shader->uses_gl_fragcoord;
- linked_shader->origin_upper_left = shader->origin_upper_left;
- linked_shader->pixel_center_integer = shader->pixel_center_integer;
+ if (shader->info.redeclares_gl_fragcoord ||
+ shader->info.uses_gl_fragcoord) {
+ linked_shader->info.redeclares_gl_fragcoord =
+ shader->info.redeclares_gl_fragcoord;
+ linked_shader->info.uses_gl_fragcoord =
+ linked_shader->info.uses_gl_fragcoord ||
+ shader->info.uses_gl_fragcoord;
+ linked_shader->info.origin_upper_left =
+ shader->info.origin_upper_left;
+ linked_shader->info.pixel_center_integer =
+ shader->info.pixel_center_integer;
}
- linked_shader->EarlyFragmentTests |= shader->EarlyFragmentTests;
+ linked_shader->info.EarlyFragmentTests |=
+ shader->info.EarlyFragmentTests;
}
}
struct gl_shader **shader_list,
unsigned num_shaders)
{
- linked_shader->Geom.VerticesOut = -1;
- linked_shader->Geom.Invocations = 0;
- linked_shader->Geom.InputType = PRIM_UNKNOWN;
- linked_shader->Geom.OutputType = PRIM_UNKNOWN;
+ 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.
for (unsigned i = 0; i < num_shaders; i++) {
struct gl_shader *shader = shader_list[i];
- if (shader->Geom.InputType != PRIM_UNKNOWN) {
- if (linked_shader->Geom.InputType != PRIM_UNKNOWN &&
- linked_shader->Geom.InputType != shader->Geom.InputType) {
+ if (shader->info.Geom.InputType != PRIM_UNKNOWN) {
+ if (linked_shader->info.Geom.InputType != PRIM_UNKNOWN &&
+ linked_shader->info.Geom.InputType !=
+ shader->info.Geom.InputType) {
linker_error(prog, "geometry shader defined with conflicting "
"input types\n");
return;
}
- linked_shader->Geom.InputType = shader->Geom.InputType;
+ linked_shader->info.Geom.InputType = shader->info.Geom.InputType;
}
- if (shader->Geom.OutputType != PRIM_UNKNOWN) {
- if (linked_shader->Geom.OutputType != PRIM_UNKNOWN &&
- linked_shader->Geom.OutputType != shader->Geom.OutputType) {
+ if (shader->info.Geom.OutputType != PRIM_UNKNOWN) {
+ if (linked_shader->info.Geom.OutputType != PRIM_UNKNOWN &&
+ linked_shader->info.Geom.OutputType !=
+ shader->info.Geom.OutputType) {
linker_error(prog, "geometry shader defined with conflicting "
"output types\n");
return;
}
- linked_shader->Geom.OutputType = shader->Geom.OutputType;
+ linked_shader->info.Geom.OutputType = shader->info.Geom.OutputType;
}
- if (shader->Geom.VerticesOut != -1) {
- if (linked_shader->Geom.VerticesOut != -1 &&
- linked_shader->Geom.VerticesOut != shader->Geom.VerticesOut) {
+ if (shader->info.Geom.VerticesOut != -1) {
+ if (linked_shader->info.Geom.VerticesOut != -1 &&
+ linked_shader->info.Geom.VerticesOut !=
+ shader->info.Geom.VerticesOut) {
linker_error(prog, "geometry shader defined with conflicting "
"output vertex count (%d and %d)\n",
- linked_shader->Geom.VerticesOut,
- shader->Geom.VerticesOut);
+ linked_shader->info.Geom.VerticesOut,
+ shader->info.Geom.VerticesOut);
return;
}
- linked_shader->Geom.VerticesOut = shader->Geom.VerticesOut;
+ linked_shader->info.Geom.VerticesOut = shader->info.Geom.VerticesOut;
}
- if (shader->Geom.Invocations != 0) {
- if (linked_shader->Geom.Invocations != 0 &&
- linked_shader->Geom.Invocations != shader->Geom.Invocations) {
+ if (shader->info.Geom.Invocations != 0) {
+ if (linked_shader->info.Geom.Invocations != 0 &&
+ linked_shader->info.Geom.Invocations !=
+ shader->info.Geom.Invocations) {
linker_error(prog, "geometry shader defined with conflicting "
"invocation count (%d and %d)\n",
- linked_shader->Geom.Invocations,
- shader->Geom.Invocations);
+ linked_shader->info.Geom.Invocations,
+ shader->info.Geom.Invocations);
return;
}
- linked_shader->Geom.Invocations = shader->Geom.Invocations;
+ linked_shader->info.Geom.Invocations = shader->info.Geom.Invocations;
}
}
* since we already know we're in the right type of shader program
* for doing it.
*/
- if (linked_shader->Geom.InputType == PRIM_UNKNOWN) {
+ if (linked_shader->info.Geom.InputType == PRIM_UNKNOWN) {
linker_error(prog,
"geometry shader didn't declare primitive input type\n");
return;
}
- if (linked_shader->Geom.OutputType == PRIM_UNKNOWN) {
+ if (linked_shader->info.Geom.OutputType == PRIM_UNKNOWN) {
linker_error(prog,
"geometry shader didn't declare primitive output type\n");
return;
}
- if (linked_shader->Geom.VerticesOut == -1) {
+ if (linked_shader->info.Geom.VerticesOut == -1) {
linker_error(prog,
"geometry shader didn't declare max_vertices\n");
return;
}
- if (linked_shader->Geom.Invocations == 0)
- linked_shader->Geom.Invocations = 1;
+ if (linked_shader->info.Geom.Invocations == 0)
+ linked_shader->info.Geom.Invocations = 1;
}
unsigned num_shaders)
{
for (int i = 0; i < 3; i++)
- linked_shader->Comp.LocalSize[i] = 0;
+ linked_shader->info.Comp.LocalSize[i] = 0;
/* This function is called for all shader stages, but it only has an effect
* for compute shaders.
for (unsigned sh = 0; sh < num_shaders; sh++) {
struct gl_shader *shader = shader_list[sh];
- if (shader->Comp.LocalSize[0] != 0) {
- if (linked_shader->Comp.LocalSize[0] != 0) {
+ if (shader->info.Comp.LocalSize[0] != 0) {
+ if (linked_shader->info.Comp.LocalSize[0] != 0) {
for (int i = 0; i < 3; i++) {
- if (linked_shader->Comp.LocalSize[i] !=
- shader->Comp.LocalSize[i]) {
+ if (linked_shader->info.Comp.LocalSize[i] !=
+ shader->info.Comp.LocalSize[i]) {
linker_error(prog, "compute shader defined with conflicting "
"local sizes\n");
return;
}
}
}
- for (int i = 0; i < 3; i++)
- linked_shader->Comp.LocalSize[i] = shader->Comp.LocalSize[i];
+ for (int i = 0; i < 3; i++) {
+ linked_shader->info.Comp.LocalSize[i] =
+ shader->info.Comp.LocalSize[i];
+ }
}
}
* since we already know we're in the right type of shader program
* for doing it.
*/
- if (linked_shader->Comp.LocalSize[0] == 0) {
+ if (linked_shader->info.Comp.LocalSize[0] == 0) {
linker_error(prog, "compute shader didn't declare local size\n");
return;
}
for (int i = 0; i < 3; i++)
- prog->Comp.LocalSize[i] = linked_shader->Comp.LocalSize[i];
+ prog->Comp.LocalSize[i] = linked_shader->info.Comp.LocalSize[i];
}
/* Check if any shader needs built-in functions. */
bool need_builtins = false;
for (unsigned i = 0; i < num_shaders; i++) {
- if (shader_list[i]->uses_builtin_functions) {
+ if (shader_list[i]->info.uses_builtin_functions) {
need_builtins = true;
break;
}
/* Set the size of geometry shader input arrays */
if (linked->Stage == MESA_SHADER_GEOMETRY) {
- unsigned num_vertices = vertices_per_prim(linked->Geom.InputType);
+ unsigned num_vertices = vertices_per_prim(linked->info.Geom.InputType);
geom_array_resize_visitor input_resize_visitor(num_vertices, prog);
foreach_in_list(ir_instruction, ir, linked->ir) {
ir->accept(&input_resize_visitor);
* known until draw time.
*/
const int num_vertices = tcs
- ? tcs->TessCtrl.VerticesOut
+ ? tcs->info.TessCtrl.VerticesOut
: ctx->Const.MaxPatchVertices;
tess_eval_array_resize_visitor input_resize_visitor(num_vertices, prog);
goto done;
}
- if (prog->Shaders[i]->ARB_fragment_coord_conventions_enable) {
+ if (prog->Shaders[i]->info.ARB_fragment_coord_conventions_enable) {
prog->ARB_fragment_coord_conventions_enable = true;
}
};
/**
- * A linked GLSL shader object.
+ * Shader information needed by both gl_shader and gl_linked shader.
*/
-struct gl_linked_shader
+struct gl_shader_info
{
- gl_shader_stage Stage;
-
- struct gl_program *Program; /**< Post-compile assembly code */
-
- /**
- * \name Sampler tracking
- *
- * \note Each of these fields is only set post-linking.
- */
- /*@{*/
- unsigned num_samplers; /**< Number of samplers used by this shader. */
- GLbitfield active_samplers; /**< Bitfield of which samplers are used */
- GLbitfield shadow_samplers; /**< Samplers used for shadow sampling. */
- /*@}*/
-
- /**
- * Map from sampler unit to texture unit (set by glUniform1i())
- *
- * A sampler unit is associated with each sampler uniform by the linker.
- * The sampler unit associated with each uniform is stored in the
- * \c gl_uniform_storage::sampler field.
- */
- GLubyte SamplerUnits[MAX_SAMPLERS];
- /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */
- gl_texture_index SamplerTargets[MAX_SAMPLERS];
-
- /**
- * Number of default uniform block components used by this shader.
- *
- * This field is only set post-linking.
- */
- unsigned num_uniform_components;
-
- /**
- * Number of combined uniform components used by this shader.
- *
- * This field is only set post-linking. It is the sum of the uniform block
- * sizes divided by sizeof(float), and num_uniform_compoennts.
- */
- unsigned num_combined_uniform_components;
-
- unsigned NumUniformBlocks;
- struct gl_uniform_block **UniformBlocks;
-
- unsigned NumShaderStorageBlocks;
- struct gl_uniform_block **ShaderStorageBlocks;
-
- struct exec_list *ir;
- struct exec_list *packed_varyings;
- struct exec_list *fragdata_arrays;
- struct glsl_symbol_table *symbols;
-
bool uses_builtin_functions;
bool uses_gl_fragcoord;
bool redeclares_gl_fragcoord;
GLenum OutputType;
} Geom;
+ /**
+ * Whether early fragment tests are enabled as defined by
+ * ARB_shader_image_load_store.
+ */
+ bool EarlyFragmentTests;
+
+ /**
+ * Compute shader state from ARB_compute_shader layout qualifiers.
+ */
+ struct {
+ /**
+ * Size specified using local_size_{x,y,z}, or all 0's to indicate that
+ * it's not set in this shader.
+ */
+ unsigned LocalSize[3];
+ } Comp;
+};
+
+/**
+ * A linked GLSL shader object.
+ */
+struct gl_linked_shader
+{
+ gl_shader_stage Stage;
+
+ struct gl_program *Program; /**< Post-compile assembly code */
+
+ /**
+ * \name Sampler tracking
+ *
+ * \note Each of these fields is only set post-linking.
+ */
+ /*@{*/
+ unsigned num_samplers; /**< Number of samplers used by this shader. */
+ GLbitfield active_samplers; /**< Bitfield of which samplers are used */
+ GLbitfield shadow_samplers; /**< Samplers used for shadow sampling. */
+ /*@}*/
+
+ /**
+ * Map from sampler unit to texture unit (set by glUniform1i())
+ *
+ * A sampler unit is associated with each sampler uniform by the linker.
+ * The sampler unit associated with each uniform is stored in the
+ * \c gl_uniform_storage::sampler field.
+ */
+ GLubyte SamplerUnits[MAX_SAMPLERS];
+ /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */
+ gl_texture_index SamplerTargets[MAX_SAMPLERS];
+
+ /**
+ * Number of default uniform block components used by this shader.
+ *
+ * This field is only set post-linking.
+ */
+ unsigned num_uniform_components;
+
+ /**
+ * Number of combined uniform components used by this shader.
+ *
+ * This field is only set post-linking. It is the sum of the uniform block
+ * sizes divided by sizeof(float), and num_uniform_compoennts.
+ */
+ unsigned num_combined_uniform_components;
+
+ unsigned NumUniformBlocks;
+ struct gl_uniform_block **UniformBlocks;
+
+ unsigned NumShaderStorageBlocks;
+ struct gl_uniform_block **ShaderStorageBlocks;
+
+ struct exec_list *ir;
+ struct exec_list *packed_varyings;
+ struct exec_list *fragdata_arrays;
+ struct glsl_symbol_table *symbols;
+
/**
* Map from image uniform index to image unit (set by glUniform1i())
*
struct gl_active_atomic_buffer **AtomicBuffers;
unsigned NumAtomicBuffers;
- /**
- * Whether early fragment tests are enabled as defined by
- * ARB_shader_image_load_store.
- */
- bool EarlyFragmentTests;
-
- /**
- * Compute shader state from ARB_compute_shader layout qualifiers.
- */
- struct {
- /**
- * Size specified using local_size_{x,y,z}, or all 0's to indicate that
- * it's not set in this shader.
- */
- unsigned LocalSize[3];
- } Comp;
-
/**
* Number of types for subroutine uniforms.
*/
GLuint NumSubroutineFunctions;
GLuint MaxSubroutineFunctionIndex;
struct gl_subroutine_function *SubroutineFunctions;
+
+ struct gl_shader_info info;
};
/**
struct exec_list *ir;
struct glsl_symbol_table *symbols;
- bool uses_builtin_functions;
- bool uses_gl_fragcoord;
- bool redeclares_gl_fragcoord;
- bool ARB_fragment_coord_conventions_enable;
-
- /**
- * Fragment shader state from GLSL 1.50 layout qualifiers.
- */
- bool origin_upper_left;
- bool pixel_center_integer;
-
- struct {
- /** Global xfb_stride out qualifier if any */
- GLuint BufferStride[MAX_FEEDBACK_BUFFERS];
- } TransformFeedback;
-
- /**
- * Tessellation Control shader state from layout qualifiers.
- */
- struct {
- /**
- * 0 - vertices not declared in shader, or
- * 1 .. GL_MAX_PATCH_VERTICES
- */
- GLint VerticesOut;
- } TessCtrl;
-
- /**
- * Tessellation Evaluation shader state from layout qualifiers.
- */
- struct {
- /**
- * GL_TRIANGLES, GL_QUADS, GL_ISOLINES or PRIM_UNKNOWN if it's not set
- * in this shader.
- */
- GLenum PrimitiveMode;
- /**
- * GL_EQUAL, GL_FRACTIONAL_ODD, GL_FRACTIONAL_EVEN, or 0 if it's not set
- * in this shader.
- */
- GLenum Spacing;
- /**
- * GL_CW, GL_CCW, or 0 if it's not set in this shader.
- */
- GLenum VertexOrder;
- /**
- * 1, 0, or -1 if it's not set in this shader.
- */
- int PointMode;
- } TessEval;
-
- /**
- * Geometry shader state from GLSL 1.50 layout qualifiers.
- */
- struct {
- GLint VerticesOut;
- /**
- * 0 - Invocations count not declared in shader, or
- * 1 .. MAX_GEOMETRY_SHADER_INVOCATIONS
- */
- GLint Invocations;
- /**
- * GL_POINTS, GL_LINES, GL_LINES_ADJACENCY, GL_TRIANGLES, or
- * GL_TRIANGLES_ADJACENCY, or PRIM_UNKNOWN if it's not set in this
- * shader.
- */
- GLenum InputType;
- /**
- * GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP, or PRIM_UNKNOWN if
- * it's not set in this shader.
- */
- GLenum OutputType;
- } Geom;
-
- /**
- * Whether early fragment tests are enabled as defined by
- * ARB_shader_image_load_store.
- */
- bool EarlyFragmentTests;
-
- /**
- * Compute shader state from ARB_compute_shader layout qualifiers.
- */
- struct {
- /**
- * Size specified using local_size_{x,y,z}, or all 0's to indicate that
- * it's not set in this shader.
- */
- unsigned LocalSize[3];
- } Comp;
+ struct gl_shader_info info;
};