st/mesa: use new _mesa_base_tex_image() helper
This involved adding a new st_texture_image_const() helper also. Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
@@ -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);
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user