mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
Added _swrast_validate_texture_images() to make sure all textures have
data resident for software rasterization. Relies on new swrast driver function: ValidateTextureImage()
This commit is contained in:
parent
f67bb30314
commit
398cb30c72
2 changed files with 49 additions and 0 deletions
|
|
@ -368,6 +368,45 @@ _swrast_validate_blend_func( GLcontext *ctx, GLuint n,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make sure we have texture image data for all the textures we may need
|
||||
* for subsequent rendering.
|
||||
*/
|
||||
static void
|
||||
_swrast_validate_texture_images(GLcontext *ctx)
|
||||
{
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
GLuint u;
|
||||
|
||||
if (!swrast->ValidateTextureImage || !ctx->Texture._EnabledUnits) {
|
||||
/* no textures enabled, or no way to validate images! */
|
||||
return;
|
||||
}
|
||||
|
||||
for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
|
||||
if (ctx->Texture.Unit[u]._ReallyEnabled) {
|
||||
struct gl_texture_object *texObj = ctx->Texture.Unit[u]._Current;
|
||||
ASSERT(texObj);
|
||||
if (texObj) {
|
||||
GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
|
||||
GLuint face;
|
||||
for (face = 0; face < numFaces; face++) {
|
||||
GLuint lvl;
|
||||
for (lvl = texObj->BaseLevel; lvl <= texObj->_MaxLevel; lvl++) {
|
||||
struct gl_texture_image *texImg = texObj->Image[face][lvl];
|
||||
if (texImg && !texImg->Data) {
|
||||
swrast->ValidateTextureImage(ctx, texObj, face, lvl);
|
||||
ASSERT(texObj->Image[face][lvl]->Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
_swrast_sleep( GLcontext *ctx, GLbitfield new_state )
|
||||
{
|
||||
|
|
@ -452,6 +491,9 @@ _swrast_validate_derived( GLcontext *ctx )
|
|||
if (swrast->NewState & _NEW_TEXTURE)
|
||||
_swrast_update_texture_samplers( ctx );
|
||||
|
||||
if (swrast->NewState & (_NEW_TEXTURE | _NEW_PROGRAM))
|
||||
_swrast_validate_texture_images( ctx );
|
||||
|
||||
swrast->NewState = 0;
|
||||
swrast->StateChanges = 0;
|
||||
swrast->InvalidateState = _swrast_invalidate_state;
|
||||
|
|
|
|||
|
|
@ -226,6 +226,11 @@ typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *,
|
|||
const SWvertex *, const SWvertex *);
|
||||
|
||||
|
||||
typedef void (*validate_texture_image_func)(GLcontext *ctx,
|
||||
struct gl_texture_object *texObj,
|
||||
GLuint face, GLuint level);
|
||||
|
||||
|
||||
/** \defgroup Bitmasks
|
||||
* Bitmasks to indicate which rasterization options are enabled
|
||||
* (RasterMask)
|
||||
|
|
@ -354,6 +359,8 @@ typedef struct
|
|||
*/
|
||||
GLchan *TexelBuffer;
|
||||
|
||||
validate_texture_image_func ValidateTextureImage;
|
||||
|
||||
} SWcontext;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue