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

Roland Scheidegger sroland at vmware.com
Fri Mar 11 07:44:16 PST 2011


I believe the reason it wasn't implemented in gallium was that it's an
extension which isn't widely used (some of the IHVs don't support it).
So if the hw needs to implement it in the shader anyway, it's probably
not worth it because any app wanting to use it will just be able to use
a shader itself instead.
It is a simple extension though, so I'm not really against it in principle.

Roland


Am 11.03.2011 05:35, schrieb Marek Olšák:
> 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;
>     }



More information about the mesa-dev mailing list