st/mesa/glsl: move Version to gl_shader_program_data
This is mostly just used during linking however the st uses it when updating textures. In order to store gl_program in the CurrentProgram array rather than gl_shader_program we need to move this field to the shared gl_shader_program_data struct. Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
@@ -64,7 +64,7 @@ interstage_member_mismatch(struct gl_shader_program *prog,
|
||||
* interpolation qualifiers of variables of the same name do not
|
||||
* match."
|
||||
*/
|
||||
if (prog->IsES || prog->Version < 440)
|
||||
if (prog->IsES || prog->data->Version < 440)
|
||||
if (c->fields.structure[i].interpolation !=
|
||||
p->fields.structure[i].interpolation)
|
||||
return true;
|
||||
@@ -83,7 +83,7 @@ interstage_member_mismatch(struct gl_shader_program *prog,
|
||||
* The table in Section 9.2.1 Linked Shaders of the GLSL ES 3.2 spec
|
||||
* says that sample need not match for varyings.
|
||||
*/
|
||||
if (!prog->IsES || prog->Version < 310)
|
||||
if (!prog->IsES || prog->data->Version < 310)
|
||||
if (c->fields.structure[i].centroid !=
|
||||
p->fields.structure[i].centroid)
|
||||
return true;
|
||||
@@ -114,7 +114,7 @@ intrastage_match(ir_variable *a,
|
||||
*/
|
||||
if ((a->data.how_declared != ir_var_declared_implicitly ||
|
||||
b->data.how_declared != ir_var_declared_implicitly) &&
|
||||
(!prog->IsES || prog->Version != 310 ||
|
||||
(!prog->IsES || prog->data->Version != 310 ||
|
||||
interstage_member_mismatch(prog, a->get_interface_type(),
|
||||
b->get_interface_type())))
|
||||
return false;
|
||||
|
@@ -271,7 +271,7 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
|
||||
* OpenGLES 3.0 drivers, so we relax the checking in all cases.
|
||||
*/
|
||||
if (false /* always skip the centroid check */ &&
|
||||
prog->Version < (prog->IsES ? 310 : 430) &&
|
||||
prog->data->Version < (prog->IsES ? 310 : 430) &&
|
||||
input->data.centroid != output->data.centroid) {
|
||||
linker_error(prog,
|
||||
"%s shader output `%s' %s centroid qualifier, "
|
||||
@@ -326,7 +326,7 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
|
||||
* and fragment shaders must match."
|
||||
*/
|
||||
if (input->data.invariant != output->data.invariant &&
|
||||
prog->Version < (prog->IsES ? 300 : 430)) {
|
||||
prog->data->Version < (prog->IsES ? 300 : 430)) {
|
||||
linker_error(prog,
|
||||
"%s shader output `%s' %s invariant qualifier, "
|
||||
"but %s shader input %s invariant qualifier\n",
|
||||
@@ -348,7 +348,7 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
|
||||
*
|
||||
*/
|
||||
if (input->data.interpolation != output->data.interpolation &&
|
||||
prog->Version < 440) {
|
||||
prog->data->Version < 440) {
|
||||
linker_error(prog,
|
||||
"%s shader output `%s' specifies %s "
|
||||
"interpolation qualifier, "
|
||||
@@ -2234,7 +2234,7 @@ assign_varying_locations(struct gl_context *ctx,
|
||||
|
||||
if (var && var->data.mode == ir_var_shader_in &&
|
||||
var->data.is_unmatched_generic_inout) {
|
||||
if (!prog->IsES && prog->Version <= 120) {
|
||||
if (!prog->IsES && prog->data->Version <= 120) {
|
||||
/* On page 25 (page 31 of the PDF) of the GLSL 1.20 spec:
|
||||
*
|
||||
* Only those varying variables used (i.e. read) in
|
||||
|
@@ -553,7 +553,7 @@ analyze_clip_cull_usage(struct gl_shader_program *prog,
|
||||
*clip_distance_array_size = 0;
|
||||
*cull_distance_array_size = 0;
|
||||
|
||||
if (prog->Version >= (prog->IsES ? 300 : 130)) {
|
||||
if (prog->data->Version >= (prog->IsES ? 300 : 130)) {
|
||||
/* From section 7.1 (Vertex Shader Special Variables) of the
|
||||
* GLSL 1.30 spec:
|
||||
*
|
||||
@@ -672,7 +672,7 @@ validate_vertex_shader_executable(struct gl_shader_program *prog,
|
||||
* All GLSL ES Versions are similar to GLSL 1.40--failing to write to
|
||||
* gl_Position is not an error.
|
||||
*/
|
||||
if (prog->Version < (prog->IsES ? 300 : 140)) {
|
||||
if (prog->data->Version < (prog->IsES ? 300 : 140)) {
|
||||
find_assignment_visitor find("gl_Position");
|
||||
find.run(shader->ir);
|
||||
if (!find.variable_found()) {
|
||||
@@ -1089,7 +1089,8 @@ cross_validate_globals(struct gl_shader_program *prog,
|
||||
* In GLSL ES 3.00 and ES 3.20, precision qualifier for each block
|
||||
* member should match.
|
||||
*/
|
||||
if (prog->IsES && (prog->Version != 310 || !var->get_interface_type()) &&
|
||||
if (prog->IsES && (prog->data->Version != 310 ||
|
||||
!var->get_interface_type()) &&
|
||||
existing->data.precision != var->data.precision) {
|
||||
linker_error(prog, "declarations for %s `%s` have "
|
||||
"mismatching precision qualifiers\n",
|
||||
@@ -1831,7 +1832,8 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog,
|
||||
linked_shader->info.BlendSupport = 0;
|
||||
|
||||
if (linked_shader->Stage != MESA_SHADER_FRAGMENT ||
|
||||
(prog->Version < 150 && !prog->ARB_fragment_coord_conventions_enable))
|
||||
(prog->data->Version < 150 &&
|
||||
!prog->ARB_fragment_coord_conventions_enable))
|
||||
return;
|
||||
|
||||
for (unsigned i = 0; i < num_shaders; i++) {
|
||||
@@ -1910,7 +1912,8 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog,
|
||||
/* No in/out qualifiers defined for anything but GLSL 1.50+
|
||||
* geometry shaders so far.
|
||||
*/
|
||||
if (linked_shader->Stage != MESA_SHADER_GEOMETRY || prog->Version < 150)
|
||||
if (linked_shader->Stage != MESA_SHADER_GEOMETRY ||
|
||||
prog->data->Version < 150)
|
||||
return;
|
||||
|
||||
/* From the GLSL 1.50 spec, page 46:
|
||||
@@ -2806,7 +2809,7 @@ assign_attribute_or_color_locations(void *mem_ctx,
|
||||
}
|
||||
}
|
||||
} else if (target_index == MESA_SHADER_FRAGMENT ||
|
||||
(prog->IsES && prog->Version >= 300)) {
|
||||
(prog->IsES && prog->data->Version >= 300)) {
|
||||
linker_error(prog, "overlapping location is assigned "
|
||||
"to %s `%s' %d %d %d\n", string, var->name,
|
||||
used_locations, use_mask, attr);
|
||||
@@ -4355,10 +4358,12 @@ validate_sampler_array_indexing(struct gl_context *ctx,
|
||||
"expressions is forbidden in GLSL %s %u";
|
||||
/* Backend has indicated that it has no dynamic indexing support. */
|
||||
if (no_dynamic_indexing) {
|
||||
linker_error(prog, msg, prog->IsES ? "ES" : "", prog->Version);
|
||||
linker_error(prog, msg, prog->IsES ? "ES" : "",
|
||||
prog->data->Version);
|
||||
return false;
|
||||
} else {
|
||||
linker_warning(prog, msg, prog->IsES ? "ES" : "", prog->Version);
|
||||
linker_warning(prog, msg, prog->IsES ? "ES" : "",
|
||||
prog->data->Version);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4790,7 +4795,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
|
||||
goto done;
|
||||
}
|
||||
|
||||
prog->Version = max_version;
|
||||
prog->data->Version = max_version;
|
||||
prog->IsES = prog->Shaders[0]->IsES;
|
||||
|
||||
/* Some shaders have to be linked with some other shaders present.
|
||||
@@ -5021,8 +5026,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
|
||||
* with loop induction variable. This check emits a warning or error
|
||||
* depending if backend can handle dynamic indexing.
|
||||
*/
|
||||
if ((!prog->IsES && prog->Version < 130) ||
|
||||
(prog->IsES && prog->Version < 300)) {
|
||||
if ((!prog->IsES && prog->data->Version < 130) ||
|
||||
(prog->IsES && prog->data->Version < 300)) {
|
||||
if (!validate_sampler_array_indexing(ctx, prog))
|
||||
goto done;
|
||||
}
|
||||
|
Reference in New Issue
Block a user