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:
Jason Ekstrand 2015-08-05 16:39:32 -07:00
parent 30c6357113
commit cd1ae6ebfa
3 changed files with 9 additions and 5 deletions

View file

@ -129,9 +129,13 @@ private:
}; /* end of anonymous namespace */
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_function_visitor v2(&v1);

View file

@ -32,7 +32,8 @@
extern "C" {
#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);
#ifdef __cplusplus

View file

@ -103,13 +103,12 @@ brw_create_nir(struct brw_context *brw,
static const nir_lower_tex_options tex_options = {
.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);
nir_shader *nir;
/* First, lower the GLSL IR or Mesa IR to NIR */
if (shader_prog) {
nir = glsl_to_nir(shader, options);
nir = glsl_to_nir(shader_prog, stage, options);
} else {
nir = prog_to_nir(prog, options);
nir_convert_to_ssa(nir); /* turn registers into SSA */