summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glsl/nir/glsl_to_nir.cpp10
-rw-r--r--src/glsl/nir/nir.h13
-rw-r--r--src/mesa/program/prog_to_nir.c6
3 files changed, 29 insertions, 0 deletions
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index d230ad4416d..76e1382c362 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -173,6 +173,16 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
shader->info.gs.invocations = sh->Geom.Invocations;
break;
+ case MESA_SHADER_FRAGMENT: {
+ struct gl_fragment_program *fp =
+ (struct gl_fragment_program *)sh->Program;
+
+ shader->info.fs.uses_discard = fp->UsesKill;
+ shader->info.fs.early_fragment_tests = sh->EarlyFragmentTests;
+ shader->info.fs.depth_layout = fp->FragDepthLayout;
+ break;
+ }
+
case MESA_SHADER_COMPUTE: {
struct gl_compute_program *cp = (struct gl_compute_program *)sh->Program;
shader->info.cs.local_size[0] = cp->LocalSize[0];
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 32259e720d9..2ab48fb9d9c 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1503,6 +1503,19 @@ typedef struct nir_shader_info {
} gs;
struct {
+ bool uses_discard;
+
+ /**
+ * Whether early fragment tests are enabled as defined by
+ * ARB_shader_image_load_store.
+ */
+ bool early_fragment_tests;
+
+ /** gl_FragDepth layout for ARB_conservative_depth. */
+ enum gl_frag_depth_layout depth_layout;
+ } fs;
+
+ struct {
unsigned local_size[3];
} cs;
};
diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c
index da61a2b9bd3..539e3c05312 100644
--- a/src/mesa/program/prog_to_nir.c
+++ b/src/mesa/program/prog_to_nir.c
@@ -1129,6 +1129,12 @@ prog_to_nir(const struct gl_program *prog,
s->info.uses_clip_distance_out = false;
s->info.separate_shader = false;
+ if (stage == MESA_SHADER_FRAGMENT) {
+ struct gl_fragment_program *fp = (struct gl_fragment_program *)prog;
+
+ s->info.fs.uses_discard = fp->UsesKill;
+ }
+
fail:
if (c->error) {
ralloc_free(s);