mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 13:38:06 +02:00
nir/glsl: Take a gl_shader_program and a stage rather than a gl_shader
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
30c6357113
commit
cd1ae6ebfa
3 changed files with 9 additions and 5 deletions
|
|
@ -129,9 +129,13 @@ private:
|
||||||
}; /* end of anonymous namespace */
|
}; /* end of anonymous namespace */
|
||||||
|
|
||||||
nir_shader *
|
nir_shader *
|
||||||
glsl_to_nir(struct gl_shader *sh, const nir_shader_compiler_options *options)
|
glsl_to_nir(const struct gl_shader_program *shader_prog,
|
||||||
|
gl_shader_stage stage,
|
||||||
|
const nir_shader_compiler_options *options)
|
||||||
{
|
{
|
||||||
nir_shader *shader = nir_shader_create(NULL, sh->Stage, options);
|
struct gl_shader *sh = shader_prog->_LinkedShaders[stage];
|
||||||
|
|
||||||
|
nir_shader *shader = nir_shader_create(NULL, stage, options);
|
||||||
|
|
||||||
nir_visitor v1(shader);
|
nir_visitor v1(shader);
|
||||||
nir_function_visitor v2(&v1);
|
nir_function_visitor v2(&v1);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nir_shader *glsl_to_nir(struct gl_shader *sh,
|
nir_shader *glsl_to_nir(const struct gl_shader_program *shader_prog,
|
||||||
|
gl_shader_stage stage,
|
||||||
const nir_shader_compiler_options *options);
|
const nir_shader_compiler_options *options);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -103,13 +103,12 @@ brw_create_nir(struct brw_context *brw,
|
||||||
static const nir_lower_tex_options tex_options = {
|
static const nir_lower_tex_options tex_options = {
|
||||||
.lower_txp = ~0,
|
.lower_txp = ~0,
|
||||||
};
|
};
|
||||||
struct gl_shader *shader = shader_prog ? shader_prog->_LinkedShaders[stage] : NULL;
|
|
||||||
bool debug_enabled = INTEL_DEBUG & intel_debug_flag_for_shader_stage(stage);
|
bool debug_enabled = INTEL_DEBUG & intel_debug_flag_for_shader_stage(stage);
|
||||||
nir_shader *nir;
|
nir_shader *nir;
|
||||||
|
|
||||||
/* First, lower the GLSL IR or Mesa IR to NIR */
|
/* First, lower the GLSL IR or Mesa IR to NIR */
|
||||||
if (shader_prog) {
|
if (shader_prog) {
|
||||||
nir = glsl_to_nir(shader, options);
|
nir = glsl_to_nir(shader_prog, stage, options);
|
||||||
} else {
|
} else {
|
||||||
nir = prog_to_nir(prog, options);
|
nir = prog_to_nir(prog, options);
|
||||||
nir_convert_to_ssa(nir); /* turn registers into SSA */
|
nir_convert_to_ssa(nir); /* turn registers into SSA */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue