aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_cb_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index c3e990e0775..b182106fd56 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -51,6 +51,7 @@
#include "state_tracker/st_texture.h"
#include "state_tracker/st_gen_mipmap.h"
#include "state_tracker/st_inlines.h"
+#include "state_tracker/st_atom.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
@@ -418,7 +419,6 @@ compress_with_blit(GLcontext * ctx,
const GLuint dstImageOffsets[1] = {0};
struct st_texture_image *stImage = st_texture_image(texImage);
struct pipe_screen *screen = ctx->st->pipe->screen;
- const GLuint face = _mesa_tex_target_to_face(target);
const struct gl_texture_format *mesa_format;
struct pipe_texture templ;
struct pipe_texture *src_tex;
@@ -467,7 +467,7 @@ compress_with_blit(GLcontext * ctx,
/* Put user's tex data into the temporary texture
*/
tex_xfer = st_cond_flush_get_tex_transfer(st_context(ctx), src_tex,
- face, level, 0,
+ 0, 0, 0, /* face, level are zero */
PIPE_TRANSFER_WRITE,
0, 0, width, height); /* x, y, w, h */
map = screen->transfer_map(screen, tex_xfer);
@@ -1315,8 +1315,9 @@ st_copy_texsubimage(GLcontext *ctx,
GLboolean use_fallback = GL_TRUE;
GLboolean matching_base_formats;
- /* any rendering in progress must complete before we grab the fb image */
- st_finish(ctx->st);
+ /* make sure finalize_textures has been called?
+ */
+ if (0) st_validate_state(ctx->st);
/* determine if copying depth or color data */
if (texBaseFormat == GL_DEPTH_COMPONENT ||
@@ -1331,6 +1332,39 @@ st_copy_texsubimage(GLcontext *ctx,
strb = st_renderbuffer(fb->_ColorReadBuffer);
}
+ if (!strb || !strb->surface || !stImage->pt) {
+ debug_printf("%s: null strb or stImage\n", __FUNCTION__);
+ return;
+ }
+
+ if (srcX < 0) {
+ width -= -srcX;
+ destX += -srcX;
+ srcX = 0;
+ }
+
+ if (srcY < 0) {
+ height -= -srcY;
+ destY += -srcY;
+ srcY = 0;
+ }
+
+ if (destX < 0) {
+ width -= -destX;
+ srcX += -destX;
+ destX = 0;
+ }
+
+ if (destY < 0) {
+ height -= -destY;
+ srcY += -destY;
+ destY = 0;
+ }
+
+ if (width < 0 || height < 0)
+ return;
+
+
assert(strb);
assert(strb->surface);
assert(stImage->pt);