[Mesa-dev] [PATCH] st/mesa: add ARB_shadow_ambient support

Marek Olšák maraeo at gmail.com
Thu Mar 10 20:35:16 PST 2011


It's not nice to see this implemented for r300 and not enable it.
I guess this is something the other drivers needn't care about.
---
 src/gallium/include/pipe/p_defines.h     |    1 +
 src/gallium/include/pipe/p_state.h       |    1 +
 src/mesa/state_tracker/st_atom_sampler.c |    1 +
 src/mesa/state_tracker/st_extensions.c   |    4 ++++
 4 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index bac3300..67ffd83 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -463,6 +463,7 @@ enum pipe_cap {
    PIPE_CAP_SHADER_STENCIL_EXPORT,
    PIPE_CAP_TGSI_INSTANCEID,
    PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR,
+   PIPE_CAP_SHADOW_COMPARE_FAIL_VALUE,
 };
 
 /* Shader caps not specific to any single stage */
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index cf6c5b5..6e36a18 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -268,6 +268,7 @@ struct pipe_sampler_state
    float lod_bias;               /**< LOD/lambda bias */
    float min_lod, max_lod;       /**< LOD clamp range, after bias */
    float border_color[4];
+   float compare_fail_value;
 };
 
 
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 474cbd5..066f43e 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -192,6 +192,7 @@ update_samplers(struct st_context *st)
             sampler->compare_mode = PIPE_TEX_COMPARE_R_TO_TEXTURE;
             sampler->compare_func
                = st_compare_func_to_pipe(texobj->CompareFunc);
+            sampler->compare_fail_value = texobj->CompareFailValue;
          }
 
          st->state.num_samplers = su + 1;
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index e34f90f..a83e5db 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -519,6 +519,10 @@ void st_init_extensions(struct st_context *st)
       ctx->Extensions.ARB_instanced_arrays = GL_TRUE;
    }
 
+   if (screen->get_param(screen, PIPE_CAP_SHADOW_COMPARE_FAIL_VALUE)) {
+      ctx->Extensions.ARB_shadow_ambient = GL_TRUE;
+   }
+
    if (screen->fence_finish) {
       ctx->Extensions.ARB_sync = GL_TRUE;
    }
-- 
1.7.1



More information about the mesa-dev mailing list