[Mesa-dev] [PATCH 1/6] intel: Add support for ARB_sampler_objects.
Brian Paul
brian.e.paul at gmail.com
Wed Apr 20 20:17:16 PDT 2011
On Wed, Apr 20, 2011 at 7:01 PM, Eric Anholt <eric at anholt.net> wrote:
> This extension support consists of replacing
> "gl_texture_obj->Sampler." with "_mesa_get_samplerobj(ctx, unit)->".
> One instance of referencing the texture's base sampler remains in the
> initial miptree allocation, where I'm not sure we have a clear
> association with any texture unit.
>
> Tested with piglit ARB_sampler_objects/sampler-objects.
> ---
> src/mesa/drivers/common/driverfuncs.c | 3 ++
> src/mesa/drivers/dri/i915/i830_texstate.c | 26 ++++++++------
> src/mesa/drivers/dri/i915/i915_texstate.c | 40 +++++++++++----------
> src/mesa/drivers/dri/i965/brw_draw.c | 16 +++++---
> src/mesa/drivers/dri/i965/brw_wm.c | 10 +++--
> src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 35 ++++++++++---------
> src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 6 ++-
> src/mesa/drivers/dri/intel/intel_extensions.c | 1 +
> src/mesa/drivers/dri/intel/intel_tex_validate.c | 11 ++++--
> src/mesa/main/samplerobj.c | 8 ++++
> src/mesa/main/samplerobj.h | 2 +
> 11 files changed, 95 insertions(+), 63 deletions(-)
>
> diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
> index 4a28c91..b6fd46d 100644
> --- a/src/mesa/main/samplerobj.c
> +++ b/src/mesa/main/samplerobj.c
> @@ -39,6 +39,14 @@
> #include "main/mtypes.h"
> #include "main/samplerobj.h"
>
> +struct gl_sampler_object *
> +_mesa_get_samplerobj(struct gl_context *ctx, GLuint unit)
> +{
> + if (ctx->Texture.Unit[unit].Sampler)
> + return ctx->Texture.Unit[unit].Sampler;
> + else
> + return &ctx->Texture.Unit[unit]._Current->Sampler;
> +}
This probably compiles down to about a dozen x86 instructions so I'd
probably make it an inline function in samplerobj.h. Then,
st_get_mesa_sampler() in st_texture.h could be removed too.
I'll let someone else review the i965 changes.
-Brian
More information about the mesa-dev
mailing list