aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_atom_texture.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-04-10 12:44:46 -0600
committerBrian Paul <[email protected]>2011-04-10 13:12:49 -0600
commitecfaab88b2577bd0395bc05d75a036126806a9c4 (patch)
tree5abb78f767f546778d551a57f7f2cfe20c479f50 /src/mesa/state_tracker/st_atom_texture.c
parent1cbd3a1cc734df16610a59dc49cdb42c70dc3270 (diff)
mesa: move sampler state into new gl_sampler_object type
gl_texture_object contains an instance of this type for the regular texture object sampling state. glGenSamplers() generates new instances of gl_sampler_object which can override that state with glBindSampler().
Diffstat (limited to 'src/mesa/state_tracker/st_atom_texture.c')
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 6b9f969ac00..e5fb8f86878 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -138,12 +138,13 @@ check_sampler_swizzle(struct pipe_sampler_view *sv,
static INLINE struct pipe_sampler_view *
st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe,
struct st_texture_object *stObj,
+ const struct gl_sampler_object *samp,
enum pipe_format format)
{
struct pipe_sampler_view templ;
GLuint swizzle = apply_depthmode(stObj->pt->format,
stObj->base._Swizzle,
- stObj->base.DepthMode);
+ samp->DepthMode);
u_sampler_view_default_template(&templ,
stObj->pt,
@@ -164,6 +165,7 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe,
static INLINE struct pipe_sampler_view *
st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj,
struct pipe_context *pipe,
+ const struct gl_sampler_object *samp,
enum pipe_format format)
{
if (!stObj || !stObj->pt) {
@@ -172,7 +174,7 @@ st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj,
if (!stObj->sampler_view) {
stObj->sampler_view =
- st_create_texture_sampler_view_from_stobj(pipe, stObj, format);
+ st_create_texture_sampler_view_from_stobj(pipe, stObj, samp, format);
}
return stObj->sampler_view;
@@ -200,16 +202,20 @@ update_textures(struct st_context *st)
struct st_texture_object *stObj;
GLboolean retval;
GLuint texUnit;
+ const struct gl_sampler_object *samp;
if (fprog->Base.SamplersUsed & (1 << su))
texUnit = fprog->Base.SamplerUnits[su];
else
texUnit = vprog->Base.SamplerUnits[su];
+ samp = st_get_mesa_sampler(st->ctx, texUnit);
+
texObj = st->ctx->Texture.Unit[texUnit]._Current;
if (!texObj) {
texObj = st_get_default_texture(st);
+ samp = &texObj->Sampler;
}
stObj = st_texture_object(texObj);
@@ -228,7 +234,7 @@ update_textures(struct st_context *st)
enum pipe_format firstImageFormat =
st_mesa_format_to_pipe_format(texFormat);
- if ((stObj->base.sRGBDecode == GL_SKIP_DECODE_EXT) &&
+ if ((samp->sRGBDecode == GL_SKIP_DECODE_EXT) &&
(_mesa_get_format_color_encoding(texFormat) == GL_SRGB)) {
/* don't do sRGB->RGB conversion. Interpret the texture
* texture data as linear values.
@@ -248,12 +254,14 @@ update_textures(struct st_context *st)
if (stObj->sampler_view)
if (check_sampler_swizzle(stObj->sampler_view,
stObj->base._Swizzle,
- stObj->base.DepthMode) ||
+ samp->DepthMode) ||
(st_view_format != stObj->sampler_view->format) ||
stObj->base.BaseLevel != stObj->sampler_view->u.tex.first_level)
pipe_sampler_view_reference(&stObj->sampler_view, NULL);
- sampler_view = st_get_texture_sampler_view_from_stobj(stObj, pipe, st_view_format);
+ sampler_view = st_get_texture_sampler_view_from_stobj(stObj, pipe,
+ samp,
+ st_view_format);
}
pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view);
}