/**
- * Set UsesClipDistance and ClipDistanceArraySize based on the given shader.
+ * Set clip_distance_array_size based on the given shader.
*
* Also check for errors based on incorrect usage of gl_ClipVertex and
* gl_ClipDistance.
*/
static void
analyze_clip_usage(struct gl_shader_program *prog,
- struct gl_shader *shader, GLboolean *UsesClipDistance,
- GLuint *ClipDistanceArraySize)
+ struct gl_shader *shader,
+ GLuint *clip_distance_array_size)
{
- *ClipDistanceArraySize = 0;
+ *clip_distance_array_size = 0;
if (!prog->IsES && prog->Version >= 130) {
/* From section 7.1 (Vertex Shader Special Variables) of the
_mesa_shader_stage_to_string(shader->Stage));
return;
}
- *UsesClipDistance = clip_distance.variable_found();
- ir_variable *clip_distance_var =
- shader->symbols->get_variable("gl_ClipDistance");
- if (clip_distance_var)
- *ClipDistanceArraySize = clip_distance_var->type->length;
- } else {
- *UsesClipDistance = false;
+
+ if (clip_distance.variable_found()) {
+ ir_variable *clip_distance_var =
+ shader->symbols->get_variable("gl_ClipDistance");
+
+ assert(clip_distance_var);
+ *clip_distance_array_size = clip_distance_var->type->length;
+ }
}
}
/**
* Verify that a vertex shader executable meets all semantic requirements.
*
- * Also sets prog->Vert.UsesClipDistance and prog->Vert.ClipDistanceArraySize
- * as a side effect.
+ * Also sets prog->Vert.ClipDistanceArraySize as a side effect.
*
* \param shader Vertex shader executable to be verified
*/
}
}
- analyze_clip_usage(prog, shader, &prog->Vert.UsesClipDistance,
- &prog->Vert.ClipDistanceArraySize);
+ analyze_clip_usage(prog, shader, &prog->Vert.ClipDistanceArraySize);
}
void
if (shader == NULL)
return;
- analyze_clip_usage(prog, shader, &prog->TessEval.UsesClipDistance,
- &prog->TessEval.ClipDistanceArraySize);
+ analyze_clip_usage(prog, shader, &prog->TessEval.ClipDistanceArraySize);
}
/**
* Verify that a geometry shader executable meets all semantic requirements
*
- * Also sets prog->Geom.VerticesIn, prog->Geom.UsesClipDistance, and
- * prog->Geom.ClipDistanceArraySize as a side effect.
+ * Also sets prog->Geom.VerticesIn, and prog->Geom.ClipDistanceArraySize as
+ * a side effect.
*
* \param shader Geometry shader executable to be verified
*/
unsigned num_vertices = vertices_per_prim(prog->Geom.InputType);
prog->Geom.VerticesIn = num_vertices;
- analyze_clip_usage(prog, shader, &prog->Geom.UsesClipDistance,
- &prog->Geom.ClipDistanceArraySize);
+ analyze_clip_usage(prog, shader, &prog->Geom.ClipDistanceArraySize);
}
/**
* For vertex and geometry shaders, true if the program uses the
* gl_ClipDistance output. Ignored for fragment shaders.
*/
- GLboolean UsesClipDistanceOut;
+ unsigned ClipDistanceArraySize;
/** Named parameters, constants, etc. from program text */
* True if gl_ClipDistance is written to. Copied into
* gl_tess_eval_program by _mesa_copy_linked_program_data().
*/
- GLboolean UsesClipDistance;
GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
0 if not present. */
} TessEval;
* True if gl_ClipDistance is written to. Copied into
* gl_geometry_program by _mesa_copy_linked_program_data().
*/
- GLboolean UsesClipDistance;
GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
0 if not present. */
bool UsesEndPrimitive;
* True if gl_ClipDistance is written to. Copied into gl_vertex_program
* by _mesa_copy_linked_program_data().
*/
- GLboolean UsesClipDistance;
GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
0 if not present. */
} Vert;
{
switch (type) {
case MESA_SHADER_VERTEX:
- dst->UsesClipDistanceOut = src->Vert.UsesClipDistance;
+ dst->ClipDistanceArraySize = src->Vert.ClipDistanceArraySize;
break;
case MESA_SHADER_TESS_CTRL: {
struct gl_tess_ctrl_program *dst_tcp =
dst_tep->Spacing = src->TessEval.Spacing;
dst_tep->VertexOrder = src->TessEval.VertexOrder;
dst_tep->PointMode = src->TessEval.PointMode;
- dst->UsesClipDistanceOut = src->TessEval.UsesClipDistance;
+ dst->ClipDistanceArraySize = src->TessEval.ClipDistanceArraySize;
break;
}
case MESA_SHADER_GEOMETRY: {
dst_gp->Invocations = src->Geom.Invocations;
dst_gp->InputType = src->Geom.InputType;
dst_gp->OutputType = src->Geom.OutputType;
- dst->UsesClipDistanceOut = src->Geom.UsesClipDistance;
+ dst->ClipDistanceArraySize = src->Geom.ClipDistanceArraySize;
dst_gp->UsesEndPrimitive = src->Geom.UsesEndPrimitive;
dst_gp->UsesStreams = src->Geom.UsesStreams;
break;