summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c3
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c3
-rw-r--r--src/mesa/state_tracker/st_cb_drawtex.c3
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c4
-rw-r--r--src/mesa/state_tracker/st_texture.h6
5 files changed, 14 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 17b536bf504..f8d7cd7f9b3 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -36,6 +36,7 @@
#include "main/mtypes.h"
#include "main/glformats.h"
#include "main/samplerobj.h"
+#include "main/teximage.h"
#include "main/texobj.h"
#include "st_context.h"
@@ -141,7 +142,7 @@ convert_sampler(struct st_context *st,
texobj = _mesa_get_fallback_texture(ctx, TEXTURE_2D_INDEX);
}
- teximg = texobj->Image[0][texobj->BaseLevel];
+ teximg = _mesa_base_tex_image_const(texobj);
texBaseFormat = teximg ? teximg->_BaseFormat : GL_RGBA;
msamp = _mesa_get_samplerobj(ctx, texUnit);
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 19072ae2fe8..c95e36abc0f 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -35,6 +35,7 @@
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/samplerobj.h"
+#include "main/teximage.h"
#include "main/texobj.h"
#include "program/prog_instruction.h"
@@ -176,7 +177,7 @@ static unsigned
get_texture_format_swizzle(const struct st_texture_object *stObj)
{
const struct gl_texture_image *texImage =
- stObj->base.Image[0][stObj->base.BaseLevel];
+ _mesa_base_tex_image_const(&stObj->base);
unsigned tex_swizzle;
if (texImage) {
diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c
index d057ff62aee..1420b96e55a 100644
--- a/src/mesa/state_tracker/st_cb_drawtex.c
+++ b/src/mesa/state_tracker/st_cb_drawtex.c
@@ -15,6 +15,7 @@
#include "main/imports.h"
#include "main/image.h"
#include "main/macros.h"
+#include "main/teximage.h"
#include "program/program.h"
#include "program/prog_print.h"
@@ -196,7 +197,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
if (ctx->Texture.Unit[i]._Current &&
ctx->Texture.Unit[i]._Current->Target == GL_TEXTURE_2D) {
struct gl_texture_object *obj = ctx->Texture.Unit[i]._Current;
- struct gl_texture_image *img = obj->Image[0][obj->BaseLevel];
+ const struct gl_texture_image *img = _mesa_base_tex_image(obj);
const GLfloat wt = (GLfloat) img->Width;
const GLfloat ht = (GLfloat) img->Height;
const GLfloat s0 = obj->CropRect[0] / wt;
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index a8dbb788848..c2bf1ef0289 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1546,7 +1546,7 @@ st_finalize_texture(struct gl_context *ctx,
struct st_texture_object *stObj = st_texture_object(tObj);
const GLuint nr_faces = (stObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
GLuint face;
- struct st_texture_image *firstImage;
+ const struct st_texture_image *firstImage;
enum pipe_format firstImageFormat;
GLuint ptWidth, ptHeight, ptDepth, ptLayers, ptNumSamples;
@@ -1587,7 +1587,7 @@ st_finalize_texture(struct gl_context *ctx,
}
- firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]);
+ firstImage = st_texture_image_const(_mesa_base_tex_image(&stObj->base));
assert(firstImage);
/* If both firstImage and stObj point to a texture which can contain
diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h
index d66afcb560b..2f540295f46 100644
--- a/src/mesa/state_tracker/st_texture.h
+++ b/src/mesa/state_tracker/st_texture.h
@@ -123,6 +123,12 @@ st_texture_image(struct gl_texture_image *img)
return (struct st_texture_image *) img;
}
+static INLINE const struct st_texture_image *
+st_texture_image_const(const struct gl_texture_image *img)
+{
+ return (const struct st_texture_image *) img;
+}
+
static INLINE struct st_texture_object *
st_texture_object(struct gl_texture_object *obj)
{