progress = true;
if (mode == nir_var_shader_in) {
- if (!prog->IsES && prog->data->Version <= 120) {
+ if (!prog->IsES && prog->GLSL_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
"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->data->Version);
+ linker_error(prog, msg, prog->IsES ? "ES" : "", prog->GLSL_Version);
return false;
} else {
linker_warning(prog, msg, prog->IsES ? "ES" : "",
- prog->data->Version);
+ prog->GLSL_Version);
}
}
}
* with loop induction variable. This check emits a warning or error
* depending if backend can handle dynamic indexing.
*/
- if ((!prog->IsES && prog->data->Version < 130) ||
- (prog->IsES && prog->data->Version < 300)) {
+ if ((!prog->IsES && prog->GLSL_Version < 130) ||
+ (prog->IsES && prog->GLSL_Version < 300)) {
if (!validate_sampler_array_indexing(consts, prog))
return false;
}
* interpolation qualifiers of variables of the same name do not
* match."
*/
- if (prog->IsES || prog->data->Version < 440)
+ if (prog->IsES || prog->GLSL_Version < 440)
if (c->fields.structure[i].interpolation !=
p->fields.structure[i].interpolation)
return true;
* 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->data->Version < 310)
+ if (!prog->IsES || prog->GLSL_Version < 310)
if (c->fields.structure[i].centroid !=
p->fields.structure[i].centroid)
return true;
continue;
/* Built-in interface redeclaration check. */
- if (prog->SeparateShader && !prog->IsES && prog->data->Version >= 150 &&
+ if (prog->SeparateShader && !prog->IsES && prog->GLSL_Version >= 150 &&
var->data.how_declared == ir_var_declared_implicitly &&
var->data.used && !producer_iface) {
linker_error(prog, "missing output builtin block %s redeclaration "
ir_variable *producer_def = definitions.lookup(var);
/* Built-in interface redeclaration check. */
- if (prog->SeparateShader && !prog->IsES && prog->data->Version >= 150 &&
+ if (prog->SeparateShader && !prog->IsES && prog->GLSL_Version >= 150 &&
var->data.how_declared == ir_var_declared_implicitly &&
var->data.used && !producer_iface) {
linker_error(prog, "missing input builtin block %s redeclaration "
* OpenGLES 3.0 drivers, so we relax the checking in all cases.
*/
if (false /* always skip the centroid check */ &&
- prog->data->Version < (prog->IsES ? 310 : 430) &&
+ prog->GLSL_Version < (prog->IsES ? 310 : 430) &&
input->data.centroid != output->data.centroid) {
linker_error(prog,
"%s shader output `%s' %s centroid qualifier, "
* and fragment shaders must match."
*/
if (input->data.explicit_invariant != output->data.explicit_invariant &&
- prog->data->Version < (prog->IsES ? 300 : 420)) {
+ prog->GLSL_Version < (prog->IsES ? 300 : 420)) {
linker_error(prog,
"%s shader output `%s' %s invariant qualifier, "
"but %s shader input %s invariant qualifier\n",
output_interpolation = INTERP_MODE_SMOOTH;
}
if (input_interpolation != output_interpolation &&
- prog->data->Version < 440) {
+ prog->GLSL_Version < 440) {
if (!consts->AllowGLSLCrossStageInterpolationMismatch) {
linker_error(prog,
"%s shader output `%s' specifies %s "
static bool
static_input_output_matching(struct gl_shader_program *prog)
{
- return prog->data->Version >= (prog->IsES ? 0 : 420);
+ return prog->GLSL_Version >= (prog->IsES ? 0 : 420);
}
/**
info->clip_distance_array_size = 0;
info->cull_distance_array_size = 0;
- if (prog->data->Version >= (prog->IsES ? 300 : 130)) {
+ if (prog->GLSL_Version >= (prog->IsES ? 300 : 130)) {
/* From section 7.1 (Vertex Shader Special Variables) of the
* GLSL 1.30 spec:
*
* All GLSL ES Versions are similar to GLSL 1.40--failing to write to
* gl_Position is not an error.
*/
- if (prog->data->Version < (prog->IsES ? 300 : 140)) {
+ if (prog->GLSL_Version < (prog->IsES ? 300 : 140)) {
find_variable gl_Position("gl_Position");
find_assignments(shader->ir, &gl_Position);
if (!gl_Position.found) {
if (!consts->AllowGLSLRelaxedES &&
prog->IsES && !var->get_interface_type() &&
existing->data.precision != var->data.precision) {
- if ((existing->data.used && var->data.used) || prog->data->Version >= 300) {
+ if ((existing->data.used && var->data.used) ||
+ prog->GLSL_Version >= 300) {
linker_error(prog, "declarations for %s `%s` have "
"mismatching precision qualifiers\n",
mode_string(var), var->name);
bool pixel_center_integer = false;
if (linked_shader->Stage != MESA_SHADER_FRAGMENT ||
- (prog->data->Version < 150 &&
+ (prog->GLSL_Version < 150 &&
!prog->ARB_fragment_coord_conventions_enable))
return;
/* No in/out qualifiers defined for anything but GLSL 1.50+
* geometry shaders so far.
*/
- if (gl_prog->info.stage != MESA_SHADER_GEOMETRY ||
- prog->data->Version < 150)
+ if (gl_prog->info.stage != MESA_SHADER_GEOMETRY || prog->GLSL_Version < 150)
return;
int vertices_out = -1;
}
}
} else if (target_index == MESA_SHADER_FRAGMENT ||
- (prog->IsES && prog->data->Version >= 300)) {
+ (prog->IsES && prog->GLSL_Version >= 300)) {
linker_error(prog, "overlapping location is assigned "
"to %s `%s' %d %d %d\n", string, var->name,
used_locations, use_mask, attr);
goto done;
}
- prog->data->Version = max_version;
+ prog->GLSL_Version = max_version;
prog->IsES = prog->Shaders[0]->IsES;
/* Some shaders have to be linked with some other shaders present.
lower_named_interface_blocks(mem_ctx, prog->_LinkedShaders[i]);
}
- if (prog->IsES && prog->data->Version == 100)
+ if (prog->IsES && prog->GLSL_Version == 100)
if (!validate_invariant_builtins(prog,
prog->_LinkedShaders[MESA_SHADER_VERTEX],
prog->_LinkedShaders[MESA_SHADER_FRAGMENT]))
write_hash_tables(blob, prog);
- blob_write_uint32(blob, prog->data->Version);
+ blob_write_uint32(blob, prog->GLSL_Version);
blob_write_uint32(blob, prog->IsES);
blob_write_uint32(blob, prog->data->linked_stages);
read_hash_tables(blob, prog);
- prog->data->Version = blob_read_uint32(blob);
+ prog->GLSL_Version = blob_read_uint32(blob);
prog->IsES = blob_read_uint32(blob);
prog->data->linked_stages = blob_read_uint32(blob);
enum gl_link_status LinkStatus; /**< GL_LINK_STATUS */
GLchar *InfoLog;
- unsigned Version; /**< GLSL version used for linking */
-
/* Mask of stages this program was linked against */
unsigned linked_stages;
* #extension ARB_fragment_coord_conventions: enable
*/
GLboolean ARB_fragment_coord_conventions_enable;
+
+ unsigned GLSL_Version; /**< GLSL version used for linking */
};
/**
}
if (file) {
fprintf(file, "[require]\nGLSL%s >= %u.%02u\n",
- shProg->IsES ? " ES" : "",
- shProg->data->Version / 100, shProg->data->Version % 100);
+ shProg->IsES ? " ES" : "", shProg->GLSL_Version / 100,
+ shProg->GLSL_Version % 100);
if (shProg->SeparateShader)
fprintf(file, "GL_ARB_separate_shader_objects\nSSO ENABLED\n");
fprintf(file, "\n");
if (samplers_used & 1 &&
(ctx->Texture.Unit[tex_unit]._Current->Target != GL_TEXTURE_BUFFER ||
st->texture_buffer_sampler)) {
- st_convert_sampler_from_unit(st, sampler, tex_unit,
- prog->sh.data && prog->sh.data->Version >= 130);
+ st_convert_sampler_from_unit(
+ st, sampler, tex_unit,
+ prog->shader_program && prog->shader_program->GLSL_Version >= 130);
states[unit] = sampler;
} else {
states[unit] = NULL;
return 0;
unsigned num_textures = util_last_bit(samplers_used);
-
- /* prog->sh.data is NULL if it's ARB_fragment_program */
- bool glsl130 = (prog->sh.data ? prog->sh.data->Version : 0) >= 130;
+ const bool glsl130 =
+ (prog->shader_program ? prog->shader_program->GLSL_Version : 0) >= 130;
/* loop over sampler units (aka tex image units) */
for (unit = 0; unit < num_textures; unit++) {
struct pipe_context *pipe = st->pipe;
struct pipe_sampler_view *view;
struct pipe_sampler_state sampler = {0};
+ const bool glsl130 =
+ (prog->shader_program ? prog->shader_program->GLSL_Version : 0) >= 130;
/* TODO: Clarify the interaction of ARB_bindless_texture and EXT_texture_sRGB_decode */
- view = st_update_single_texture(st, texUnit, prog->sh.data->Version >= 130,
- true, false);
+ view = st_update_single_texture(st, texUnit, glsl130, true, false);
if (!view)
return 0;
if (view->target != PIPE_BUFFER)
- st_convert_sampler_from_unit(st, &sampler, texUnit,
- prog->sh.data && prog->sh.data->Version >= 130);
+ st_convert_sampler_from_unit(st, &sampler, texUnit, glsl130);
assert(st->ctx->Texture.Unit[texUnit]._Current);