[Mesa-dev] [PATCH 02/14] compiler: Store the clip/cull distance array sizes in shader_info.

Kenneth Graunke kenneth at whitecape.org
Tue Nov 15 01:41:26 UTC 2016


We switched from a boolean to array lengths in gl_program a while back.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/compiler/glsl/glsl_to_nir.cpp | 4 ++--
 src/compiler/shader_info.h        | 7 +++++--
 src/mesa/program/prog_to_nir.c    | 3 ++-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 096ab4c..6ca760b 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -152,8 +152,8 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
    shader->info->num_abos = shader_prog->NumAtomicBuffers;
    shader->info->num_ssbos = sh->NumShaderStorageBlocks;
    shader->info->num_images = sh->NumImages;
-   shader->info->uses_clip_distance_out =
-      sh->Program->ClipDistanceArraySize != 0;
+   shader->info->clip_distance_array_size = sh->Program->ClipDistanceArraySize;
+   shader->info->cull_distance_array_size = sh->Program->CullDistanceArraySize;
    shader->info->separate_shader = shader_prog->SeparateShader;
    shader->info->has_transform_feedback_varyings =
       shader_prog->TransformFeedback.NumVarying > 0;
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index b449900..fbc3834 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -65,8 +65,11 @@ typedef struct shader_info {
    /* Whether or not this shader ever uses textureGather() */
    bool uses_texture_gather;
 
-   /* Whether or not this shader uses the gl_ClipDistance output */
-   bool uses_clip_distance_out;
+   /* The size of the gl_ClipDistance[] array, if declared. */
+   unsigned clip_distance_array_size;
+
+   /* The size of the gl_CullDistance[] array, if declared. */
+   unsigned cull_distance_array_size;
 
    /* Whether or not separate shader objects were used */
    bool separate_shader;
diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c
index 08df05d..3239dd5 100644
--- a/src/mesa/program/prog_to_nir.c
+++ b/src/mesa/program/prog_to_nir.c
@@ -1052,7 +1052,8 @@ prog_to_nir(const struct gl_program *prog,
    s->info->num_ssbos = 0;
    s->info->num_images = 0;
    s->info->uses_texture_gather = false;
-   s->info->uses_clip_distance_out = false;
+   s->info->clip_distance_array_size = 0;
+   s->info->cull_distance_array_size = 0;
    s->info->separate_shader = false;
 
 fail:
-- 
2.10.2



More information about the mesa-dev mailing list