mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 04:20:08 +01:00
glsl: rename link_shaders() -> link_shaders_init()
And move it to the linker util file. Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31500>
This commit is contained in:
parent
37ac8f5e79
commit
e4c3e7e0d8
6 changed files with 35 additions and 27 deletions
|
|
@ -91,28 +91,4 @@
|
|||
#include "main/context.h"
|
||||
|
||||
|
||||
void
|
||||
link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
|
||||
{
|
||||
prog->data->LinkStatus = LINKING_SUCCESS; /* All error paths will set this to false */
|
||||
prog->data->Validated = false;
|
||||
|
||||
/* Section 7.3 (Program Objects) of the OpenGL 4.5 Core Profile spec says:
|
||||
*
|
||||
* "Linking can fail for a variety of reasons as specified in the
|
||||
* OpenGL Shading Language Specification, as well as any of the
|
||||
* following reasons:
|
||||
*
|
||||
* - No shader objects are attached to program."
|
||||
*
|
||||
* The Compatibility Profile specification does not list the error. In
|
||||
* Compatibility Profile missing shader stages are replaced by
|
||||
* fixed-function. This applies to the case where all stages are
|
||||
* missing.
|
||||
*/
|
||||
if (prog->NumShaders == 0) {
|
||||
if (ctx->API != API_OPENGL_COMPAT)
|
||||
linker_error(prog, "no shaders attached to the program\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,32 @@ linker_warning(gl_shader_program *prog, const char *fmt, ...)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
link_shaders_init(struct gl_context *ctx, struct gl_shader_program *prog)
|
||||
{
|
||||
prog->data->LinkStatus = LINKING_SUCCESS; /* All error paths will set this to false */
|
||||
prog->data->Validated = false;
|
||||
|
||||
/* Section 7.3 (Program Objects) of the OpenGL 4.5 Core Profile spec says:
|
||||
*
|
||||
* "Linking can fail for a variety of reasons as specified in the
|
||||
* OpenGL Shading Language Specification, as well as any of the
|
||||
* following reasons:
|
||||
*
|
||||
* - No shader objects are attached to program."
|
||||
*
|
||||
* The Compatibility Profile specification does not list the error. In
|
||||
* Compatibility Profile missing shader stages are replaced by
|
||||
* fixed-function. This applies to the case where all stages are
|
||||
* missing.
|
||||
*/
|
||||
if (prog->NumShaders == 0) {
|
||||
if (ctx->API != API_OPENGL_COMPAT)
|
||||
linker_error(prog, "no shaders attached to the program\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a string identifying a program resource, break it into a base name
|
||||
* and an optional array index in square brackets.
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "util/glheader.h"
|
||||
#include "compiler/glsl/list.h"
|
||||
#include "compiler/glsl_types.h"
|
||||
#include "main/mtypes.h"
|
||||
#include "main/shader_types.h"
|
||||
|
||||
struct gl_constants;
|
||||
|
|
@ -84,6 +85,9 @@ struct array_deref_range {
|
|||
unsigned size;
|
||||
};
|
||||
|
||||
void
|
||||
link_shaders_init(struct gl_context *ctx, struct gl_shader_program *prog);
|
||||
|
||||
void
|
||||
linker_error(struct gl_shader_program *prog, const char *fmt, ...);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "gl_nir_linker.h"
|
||||
#include "glsl_parser_extras.h"
|
||||
#include "builtin_functions.h"
|
||||
#include "linker_util.h"
|
||||
#include "main/mtypes.h"
|
||||
#include "program/program.h"
|
||||
|
||||
|
|
@ -427,7 +428,7 @@ standalone_compile_shader(const struct standalone_options *_options,
|
|||
_mesa_clear_shader_program_data(ctx, whole_program);
|
||||
|
||||
whole_program->data->LinkStatus = LINKING_SUCCESS;
|
||||
link_shaders(ctx, whole_program);
|
||||
link_shaders_init(ctx, whole_program);
|
||||
gl_nir_link_glsl(ctx, whole_program);
|
||||
|
||||
status = (whole_program->data->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "gl_nir.h"
|
||||
#include "gl_nir_linker.h"
|
||||
#include "glsl_to_nir.h"
|
||||
#include "linker_util.h"
|
||||
#include "nir_builder.h"
|
||||
#include "program.h"
|
||||
|
||||
|
|
@ -204,7 +205,7 @@ namespace
|
|||
ASSERT_EQ(shader->CompileStatus, COMPILE_SUCCESS);
|
||||
}
|
||||
|
||||
link_shaders(ctx, whole_program);
|
||||
link_shaders_init(ctx, whole_program);
|
||||
gl_nir_link_glsl(ctx, whole_program);
|
||||
if (whole_program->data->LinkStatus != LINKING_SUCCESS)
|
||||
fprintf(stderr, "Linker error: %s", whole_program->data->InfoLog);
|
||||
|
|
|
|||
|
|
@ -986,7 +986,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
|
|||
|
||||
if (prog->data->LinkStatus) {
|
||||
if (!spirv) {
|
||||
link_shaders(ctx, prog);
|
||||
link_shaders_init(ctx, prog);
|
||||
|
||||
#ifdef ENABLE_SHADER_CACHE
|
||||
shader_cache_read_program_metadata(ctx, prog);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue