st: Add cubeMapFace parameter to st_finalize_texture.
st_finalize_texture always accesses image at face 0, but it may not be set if we are working with cubemap that had other face set. This fixes crash in piglit same-attachment-glFramebufferTexture2D-GL_DEPTH_STENCIL_ATTACHMENT. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
parent
d6fccb4c09
commit
52f9ccefcb
|
@ -1808,7 +1808,7 @@ dri2_interop_export_object(__DRIcontext *_ctx,
|
||||||
return MESA_GLINTEROP_INVALID_MIP_LEVEL;
|
return MESA_GLINTEROP_INVALID_MIP_LEVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!st_finalize_texture(ctx, st->pipe, obj)) {
|
if (!st_finalize_texture(ctx, st->pipe, obj, 0)) {
|
||||||
mtx_unlock(&ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
return MESA_GLINTEROP_OUT_OF_RESOURCES;
|
return MESA_GLINTEROP_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ st_bind_images(struct st_context *st, struct gl_program *prog,
|
||||||
struct pipe_image_view *img = &images[i];
|
struct pipe_image_view *img = &images[i];
|
||||||
|
|
||||||
if (!_mesa_is_image_unit_valid(st->ctx, u) ||
|
if (!_mesa_is_image_unit_valid(st->ctx, u) ||
|
||||||
!st_finalize_texture(st->ctx, st->pipe, u->TexObj) ||
|
!st_finalize_texture(st->ctx, st->pipe, u->TexObj, 0) ||
|
||||||
!stObj->pt) {
|
!stObj->pt) {
|
||||||
memset(img, 0, sizeof(*img));
|
memset(img, 0, sizeof(*img));
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -73,7 +73,7 @@ update_single_texture(struct st_context *st,
|
||||||
}
|
}
|
||||||
stObj = st_texture_object(texObj);
|
stObj = st_texture_object(texObj);
|
||||||
|
|
||||||
retval = st_finalize_texture(ctx, st->pipe, texObj);
|
retval = st_finalize_texture(ctx, st->pipe, texObj, 0);
|
||||||
if (!retval) {
|
if (!retval) {
|
||||||
/* out of mem */
|
/* out of mem */
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
|
@ -488,7 +488,7 @@ st_render_texture(struct gl_context *ctx,
|
||||||
struct st_renderbuffer *strb = st_renderbuffer(rb);
|
struct st_renderbuffer *strb = st_renderbuffer(rb);
|
||||||
struct pipe_resource *pt;
|
struct pipe_resource *pt;
|
||||||
|
|
||||||
if (!st_finalize_texture(ctx, pipe, att->Texture))
|
if (!st_finalize_texture(ctx, pipe, att->Texture, att->CubeMapFace))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pt = st_get_texobj_resource(att->Texture);
|
pt = st_get_texobj_resource(att->Texture);
|
||||||
|
|
|
@ -2434,7 +2434,8 @@ copy_image_data_to_texture(struct st_context *st,
|
||||||
GLboolean
|
GLboolean
|
||||||
st_finalize_texture(struct gl_context *ctx,
|
st_finalize_texture(struct gl_context *ctx,
|
||||||
struct pipe_context *pipe,
|
struct pipe_context *pipe,
|
||||||
struct gl_texture_object *tObj)
|
struct gl_texture_object *tObj,
|
||||||
|
GLuint cubeMapFace)
|
||||||
{
|
{
|
||||||
struct st_context *st = st_context(ctx);
|
struct st_context *st = st_context(ctx);
|
||||||
struct st_texture_object *stObj = st_texture_object(tObj);
|
struct st_texture_object *stObj = st_texture_object(tObj);
|
||||||
|
@ -2478,7 +2479,7 @@ st_finalize_texture(struct gl_context *ctx,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
firstImage = st_texture_image_const(_mesa_base_tex_image(&stObj->base));
|
firstImage = st_texture_image_const(stObj->base.Image[cubeMapFace][stObj->base.BaseLevel]);
|
||||||
assert(firstImage);
|
assert(firstImage);
|
||||||
|
|
||||||
/* If both firstImage and stObj point to a texture which can contain
|
/* If both firstImage and stObj point to a texture which can contain
|
||||||
|
|
|
@ -47,7 +47,8 @@ st_get_blit_mask(GLenum srcFormat, GLenum dstFormat);
|
||||||
extern GLboolean
|
extern GLboolean
|
||||||
st_finalize_texture(struct gl_context *ctx,
|
st_finalize_texture(struct gl_context *ctx,
|
||||||
struct pipe_context *pipe,
|
struct pipe_context *pipe,
|
||||||
struct gl_texture_object *tObj);
|
struct gl_texture_object *tObj,
|
||||||
|
GLuint cubeMapFace);
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
|
|
|
@ -125,7 +125,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
|
||||||
*
|
*
|
||||||
* After this, we'll have all mipmap levels in one resource.
|
* After this, we'll have all mipmap levels in one resource.
|
||||||
*/
|
*/
|
||||||
st_finalize_texture(ctx, st->pipe, texObj);
|
st_finalize_texture(ctx, st->pipe, texObj, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
pt = stObj->pt;
|
pt = stObj->pt;
|
||||||
|
|
Loading…
Reference in New Issue