#include "util/u_string.h"
#include "util/u_math.h"
-#include "main/imports.h"
+
#include "main/shaderobj.h"
#include "main/enums.h"
#include "main/mtypes.h"
}
}
+/**
+ * Check for conflicting viewport_relative settings across shaders, and sets
+ * the value for the linked shader.
+ */
+static void
+link_layer_viewport_relative_qualifier(struct gl_shader_program *prog,
+ struct gl_program *gl_prog,
+ struct gl_shader **shader_list,
+ unsigned num_shaders)
+{
+ unsigned i;
+
+ /* Find first shader with explicit layer declaration */
+ for (i = 0; i < num_shaders; i++) {
+ if (shader_list[i]->redeclares_gl_layer) {
+ gl_prog->info.layer_viewport_relative =
+ shader_list[i]->layer_viewport_relative;
+ break;
+ }
+ }
+
+ /* Now make sure that each subsequent shader's explicit layer declaration
+ * matches the first one's.
+ */
+ for (; i < num_shaders; i++) {
+ if (shader_list[i]->redeclares_gl_layer &&
+ shader_list[i]->layer_viewport_relative !=
+ gl_prog->info.layer_viewport_relative) {
+ linker_error(prog, "all gl_Layer redeclarations must have identical "
+ "viewport_relative settings");
+ }
+ }
+}
+
/**
* Performs the cross-validation of tessellation control shader vertices and
* layout qualifiers for the attached tessellation control shaders,
link_bindless_layout_qualifiers(prog, shader_list, num_shaders);
+ link_layer_viewport_relative_qualifier(prog, gl_prog, shader_list, num_shaders);
+
populate_symbol_table(linked, shader_list[0]->symbols);
/* The pointer to the main function in the final linked shader (i.e., the
return;
}
- if (add_packed_varyings_only)
+ if (add_packed_varyings_only) {
+ _mesa_set_destroy(resource_set, NULL);
return;
+ }
if (!add_fragdata_arrays(ctx, shProg, resource_set))
return;
struct gl_shader_program *prog)
{
update_array_sizes(prog);
- link_assign_uniform_locations(prog, ctx);
-
- if (prog->data->LinkStatus == LINKING_FAILURE)
- return;
if (!ctx->Const.UseNIRGLSLLinker) {
+ link_assign_uniform_locations(prog, ctx);
+
+ if (prog->data->LinkStatus == LINKING_FAILURE)
+ return;
+
link_util_calculate_subroutine_compat(prog);
link_util_check_uniform_resources(ctx, prog);
link_util_check_subroutine_resources(prog);