nir/glsl: Take a gl_shader_program and a stage rather than a gl_shader
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 5 Aug 2015 23:39:32 +0000 (16:39 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 2 Oct 2015 21:22:53 +0000 (14:22 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/nir/glsl_to_nir.cpp
src/glsl/nir/glsl_to_nir.h
src/mesa/drivers/dri/i965/brw_nir.c

index f8745828a77c82d2c224591672a22427a0a998c8..ba08e1726375946702f3889bae0d327fca2102ca 100644 (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);
index 3801e8c55c631c18949495dc20918aa6db74b0b2..29badcda08d6e5bd82f6c3cec3f030a08f9689d6 100644 (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
index 2812fd72fd9035f2de5c82b7a7cb94c7afbb47d2..cc9430c83e61fb7dcee6dab22983fb1fc5d5e0e7 100644 (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 */