dri/nouveau: Rectangle texture fixes.
This commit is contained in:
@@ -232,6 +232,7 @@ nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state)
|
||||
case GL_TEXTURE_1D:
|
||||
case GL_TEXTURE_2D:
|
||||
case GL_TEXTURE_3D:
|
||||
case GL_TEXTURE_RECTANGLE:
|
||||
context_dirty_i(ctx, TEX_ENV, ctx->Texture.CurrentUnit);
|
||||
context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
|
||||
break;
|
||||
|
||||
@@ -283,7 +283,8 @@ nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t)
|
||||
struct nouveau_texture *nt = to_nouveau_texture(t);
|
||||
int i, last = get_last_level(t);
|
||||
|
||||
if (!nt->surfaces[last].bo)
|
||||
if (!teximage_fits(t, t->BaseLevel) ||
|
||||
!teximage_fits(t, last))
|
||||
return GL_FALSE;
|
||||
|
||||
if (nt->dirty) {
|
||||
@@ -420,6 +421,40 @@ nouveau_teximage_3d(GLcontext *ctx, GLenum target, GLint level,
|
||||
packing, t, ti);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_texsubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLint width, GLint height, GLint depth,
|
||||
GLenum format, GLenum type, const void *pixels,
|
||||
const struct gl_pixelstore_attrib *packing,
|
||||
struct gl_texture_object *t,
|
||||
struct gl_texture_image *ti)
|
||||
{
|
||||
struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
|
||||
int ret;
|
||||
|
||||
pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, depth,
|
||||
format, type, pixels, packing,
|
||||
"glTexSubImage");
|
||||
if (pixels) {
|
||||
nouveau_teximage_map(ctx, ti);
|
||||
|
||||
ret = _mesa_texstore(ctx, 3, ti->_BaseFormat, ti->TexFormat,
|
||||
ti->Data, xoffset, yoffset, zoffset,
|
||||
s->pitch, ti->ImageOffsets,
|
||||
width, height, depth, format, type,
|
||||
pixels, packing);
|
||||
assert(ret);
|
||||
|
||||
nouveau_teximage_unmap(ctx, ti);
|
||||
_mesa_unmap_teximage_pbo(ctx, packing);
|
||||
}
|
||||
|
||||
if (!to_nouveau_texture(t)->dirty)
|
||||
validate_teximage(ctx, t, level, xoffset, yoffset, zoffset,
|
||||
width, height, depth);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
@@ -429,15 +464,9 @@ nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, GLint level,
|
||||
struct gl_texture_object *t,
|
||||
struct gl_texture_image *ti)
|
||||
{
|
||||
nouveau_teximage_map(ctx, ti);
|
||||
_mesa_store_texsubimage3d(ctx, target, level, xoffset, yoffset, zoffset,
|
||||
width, height, depth, format, type, pixels,
|
||||
packing, t, ti);
|
||||
nouveau_teximage_unmap(ctx, ti);
|
||||
|
||||
if (!to_nouveau_texture(t)->dirty)
|
||||
validate_teximage(ctx, t, level, xoffset, yoffset, zoffset,
|
||||
width, height, depth);
|
||||
nouveau_texsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset,
|
||||
width, height, depth, format, type, pixels,
|
||||
packing, t, ti);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -449,15 +478,9 @@ nouveau_texsubimage_2d(GLcontext *ctx, GLenum target, GLint level,
|
||||
struct gl_texture_object *t,
|
||||
struct gl_texture_image *ti)
|
||||
{
|
||||
nouveau_teximage_map(ctx, ti);
|
||||
_mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset,
|
||||
width, height, format, type, pixels,
|
||||
packing, t, ti);
|
||||
nouveau_teximage_unmap(ctx, ti);
|
||||
|
||||
if (!to_nouveau_texture(t)->dirty)
|
||||
validate_teximage(ctx, t, level, xoffset, yoffset, 0,
|
||||
width, height, 1);
|
||||
nouveau_texsubimage(ctx, 2, target, level, xoffset, yoffset, 0,
|
||||
width, height, 1, format, type, pixels,
|
||||
packing, t, ti);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -468,15 +491,9 @@ nouveau_texsubimage_1d(GLcontext *ctx, GLenum target, GLint level,
|
||||
struct gl_texture_object *t,
|
||||
struct gl_texture_image *ti)
|
||||
{
|
||||
nouveau_teximage_map(ctx, ti);
|
||||
_mesa_store_texsubimage1d(ctx, target, level, xoffset,
|
||||
width, format, type, pixels,
|
||||
packing, t, ti);
|
||||
nouveau_teximage_unmap(ctx, ti);
|
||||
|
||||
if (!to_nouveau_texture(t)->dirty)
|
||||
validate_teximage(ctx, t, level, xoffset, 0, 0,
|
||||
width, 1, 1);
|
||||
nouveau_texsubimage(ctx, 1, target, level, xoffset, 0, 0,
|
||||
width, 1, 1, format, type, pixels,
|
||||
packing, t, ti);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user