aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.c21
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.h3
4 files changed, 22 insertions, 17 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index d43f67ac9..05139ec5a 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -47,6 +47,7 @@
#include "st_context.h"
#include "st_cb_fbo.h"
#include "st_cb_flush.h"
+#include "st_cb_texture.h"
#include "st_format.h"
#include "st_texture.h"
#include "st_manager.h"
@@ -340,15 +341,17 @@ st_render_texture(struct gl_context *ctx,
struct pipe_context *pipe = st->pipe;
struct st_renderbuffer *strb;
struct gl_renderbuffer *rb;
- struct pipe_resource *pt = st_get_texobj_resource(att->Texture);
+ struct pipe_resource *pt;
struct st_texture_object *stObj;
const struct gl_texture_image *texImage;
struct pipe_surface surf_tmpl;
- /* When would this fail? Perhaps assert? */
- if (!pt)
+ if (!st_finalize_texture(ctx, pipe, att->Texture))
return;
+ pt = st_get_texobj_resource(att->Texture);
+ assert(pt);
+
/* get pointer to texture image we're rendeing to */
texImage = _mesa_get_attachment_teximage(att);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 97c1fabd5..e744a9f0d 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -577,8 +577,7 @@ st_TexImage(struct gl_context * ctx,
*/
if (stObj->pt) {
if (level > (GLint) stObj->pt->last_level ||
- !st_texture_match_image(stObj->pt, &stImage->base,
- stImage->base.Face, stImage->base.Level)) {
+ !st_texture_match_image(stObj->pt, &stImage->base)) {
DBG("release it\n");
pipe_resource_reference(&stObj->pt, NULL);
assert(!stObj->pt);
@@ -611,8 +610,7 @@ st_TexImage(struct gl_context * ctx,
* in its own buffer.
*/
if (stObj->pt &&
- st_texture_match_image(stObj->pt, &stImage->base,
- stImage->base.Face, stImage->base.Level)) {
+ st_texture_match_image(stObj->pt, &stImage->base)) {
pipe_resource_reference(&stImage->pt, stObj->pt);
assert(stImage->pt);
diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c
index c5dc7dcc4..c18268829 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_texture.c
@@ -170,8 +170,7 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture,
*/
GLboolean
st_texture_match_image(const struct pipe_resource *pt,
- const struct gl_texture_image *image,
- GLuint face, GLuint level)
+ const struct gl_texture_image *image)
{
GLuint ptWidth, ptHeight, ptDepth, ptLayers;
@@ -192,9 +191,9 @@ st_texture_match_image(const struct pipe_resource *pt,
/* Test if this image's size matches what's expected in the
* established texture.
*/
- if (ptWidth != u_minify(pt->width0, level) ||
- ptHeight != u_minify(pt->height0, level) ||
- ptDepth != u_minify(pt->depth0, level) ||
+ if (ptWidth != u_minify(pt->width0, image->Level) ||
+ ptHeight != u_minify(pt->height0, image->Level) ||
+ ptDepth != u_minify(pt->depth0, image->Level) ||
ptLayers != pt->array_size)
return GL_FALSE;
@@ -366,9 +365,15 @@ st_texture_image_copy(struct pipe_context *pipe,
struct pipe_box src_box;
GLuint i;
- assert(u_minify(src->width0, srcLevel) == width);
- assert(u_minify(src->height0, srcLevel) == height);
- assert(u_minify(src->depth0, srcLevel) == depth);
+ if (u_minify(src->width0, srcLevel) != width ||
+ u_minify(src->height0, srcLevel) != height ||
+ u_minify(src->depth0, srcLevel) != depth) {
+ /* The source image size doesn't match the destination image size.
+ * This can happen in some degenerate situations such as rendering to a
+ * cube map face which was set up with mismatched texture sizes.
+ */
+ return;
+ }
src_box.x = 0;
src_box.y = 0;
diff --git a/mesalib/src/mesa/state_tracker/st_texture.h b/mesalib/src/mesa/state_tracker/st_texture.h
index 50b7284e7..dd3bc7310 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.h
+++ b/mesalib/src/mesa/state_tracker/st_texture.h
@@ -184,8 +184,7 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture,
*/
extern GLboolean
st_texture_match_image(const struct pipe_resource *pt,
- const struct gl_texture_image *image,
- GLuint face, GLuint level);
+ const struct gl_texture_image *image);
/* Return a pointer to an image within a texture. Return image stride as
* well.