summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2015-02-26 12:12:15 +0000
committerEmil Velikov <emil.l.velikov@gmail.com>2015-03-11 18:11:10 +0000
commit7f32fa0dcb7dcdc9cb28521c26ec93e48c198bfa (patch)
tree505b2d65a04abaee57129fb4d7d1984b48b6e4d0
parenta15de1ae1aa0a74f3caeb9f651430facefee8937 (diff)
Revert "common: Fix PBOs for 1D_ARRAY."
This reverts commit 546aba143d13ba3f993ead4cc30b2404abfc0202. I think the changes to the calls to glBlitFramebuffer from this patch are no different to what it was doing previously because it used to set height to 1 before doing the blits. However it was introducing some problems with the blit for layer 0 because this was no longer special cased. It didn't fix problems with the yoffset which needs to be interpreted as a slice offset. I think a better solution would be to modify the original if statement to cope with the yoffset. Conflicts: src/mesa/drivers/common/meta_tex_subimage.c Cc: "10.5" <mesa-stable@lists.freedesktop.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> (cherry picked from commit 7d10d2feee381739eef97f4720cbadbd65bb4fc6)
-rw-r--r--src/mesa/drivers/common/meta_tex_subimage.c62
1 files changed, 26 insertions, 36 deletions
diff --git a/src/mesa/drivers/common/meta_tex_subimage.c b/src/mesa/drivers/common/meta_tex_subimage.c
index 42cbf0c3c24..f57db3c3c00 100644
--- a/src/mesa/drivers/common/meta_tex_subimage.c
+++ b/src/mesa/drivers/common/meta_tex_subimage.c
@@ -137,7 +137,7 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
struct gl_texture_image *pbo_tex_image;
GLenum status;
bool success = false;
- int z, iters;
+ int z;
/* XXX: This should probably be passed in from somewhere */
const char *where = "_mesa_meta_pbo_TexSubImage";
@@ -190,6 +190,12 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
_mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbos[0]);
_mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbos[1]);
+ if (tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
+ assert(depth == 1);
+ depth = height;
+ height = 1;
+ }
+
_mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
pbo_tex_image, 0);
/* If this passes on the first layer it should pass on the others */
@@ -213,27 +219,17 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
GL_COLOR_BUFFER_BIT, GL_NEAREST))
goto fail;
- iters = tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY ?
- height : depth;
-
- for (z = 1; z < iters; z++) {
+ for (z = 1; z < depth; z++) {
_mesa_meta_bind_fbo_image(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
tex_image, zoffset + z);
_mesa_update_state(ctx);
- if (tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY)
- _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
- 0, z, width, z + 1,
- xoffset, yoffset,
- xoffset + width, yoffset + 1,
- GL_COLOR_BUFFER_BIT, GL_NEAREST);
- else
- _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
- 0, z * height, width, (z + 1) * height,
- xoffset, yoffset,
- xoffset + width, yoffset + height,
- GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
+ 0, z * height, width, (z + 1) * height,
+ xoffset, yoffset,
+ xoffset + width, yoffset + height,
+ GL_COLOR_BUFFER_BIT, GL_NEAREST);
}
success = true;
@@ -260,7 +256,7 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
struct gl_texture_image *pbo_tex_image;
GLenum status;
bool success = false;
- int z, iters;
+ int z;
/* XXX: This should probably be passed in from somewhere */
const char *where = "_mesa_meta_pbo_GetTexSubImage";
@@ -307,6 +303,12 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
_mesa_GenFramebuffers(2, fbos);
+ if (tex_image && tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
+ assert(depth == 1);
+ depth = height;
+ height = 1;
+ }
+
/* If we were given a texture, bind it to the read framebuffer. If not,
* we're doing a ReadPixels and we should just use whatever framebuffer
* the client has bound.
@@ -340,29 +342,17 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
GL_COLOR_BUFFER_BIT, GL_NEAREST))
goto fail;
- if (tex_image && tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY)
- iters = height;
- else
- iters = depth;
-
- for (z = 1; z < iters; z++) {
+ for (z = 1; z < depth; z++) {
_mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
tex_image, zoffset + z);
_mesa_update_state(ctx);
- if (tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY)
- _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
- xoffset, yoffset,
- xoffset + width, yoffset + 1,
- 0, z, width, z + 1,
- GL_COLOR_BUFFER_BIT, GL_NEAREST);
- else
- _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
- xoffset, yoffset,
- xoffset + width, yoffset + height,
- 0, z * height, width, (z + 1) * height,
- GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ _mesa_meta_BlitFramebuffer(ctx, ctx->ReadBuffer, ctx->DrawBuffer,
+ xoffset, yoffset,
+ xoffset + width, yoffset + height,
+ 0, z * height, width, (z + 1) * height,
+ GL_COLOR_BUFFER_BIT, GL_NEAREST);
}
success = true;