diff mbox

image: make getDrawBufferImage() work for ES or !ARB_draw_buffers

Message ID 1359420607-2748-1-git-send-email-robdclark@gmail.com
State New
Headers show

Commit Message

Rob Clark Jan. 29, 2013, 12:50 a.m. UTC
Without this 'apitrace dump-images' was failing for me (GLES, freedreno
gallium driver) because attachment would be GL_NONE.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 retrace/glstate_images.cpp | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Carl Worth Jan. 29, 2013, 1:02 a.m. UTC | #1
Rob Clark <robdclark@gmail.com> writes:
> Without this 'apitrace dump-images' was failing for me (GLES, freedreno
> gallium driver) because attachment would be GL_NONE.
>
> Signed-off-by: Rob Clark <robdclark@gmail.com>

Reviewed-by: Carl Worth <cworth@cworth.org>

Thanks, Rob!

-Carl
José Fonseca Feb. 1, 2013, 4:59 p.m. UTC | #2
On Tue, Jan 29, 2013 at 12:50 AM, Rob Clark <robdclark@gmail.com> wrote:
> Without this 'apitrace dump-images' was failing for me (GLES, freedreno
> gallium driver) because attachment would be GL_NONE.

Thanks Rob.

>
> Signed-off-by: Rob Clark <robdclark@gmail.com>
> ---
>  retrace/glstate_images.cpp | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/retrace/glstate_images.cpp b/retrace/glstate_images.cpp
> index 7b0a424..f3949b5 100644
> --- a/retrace/glstate_images.cpp
> +++ b/retrace/glstate_images.cpp
> @@ -745,6 +745,8 @@ getDrawBufferImage() {
>              if (draw_buffer == GL_NONE) {
>                  return NULL;
>              }
> +        } else {
> +            draw_buffer = GL_COLOR_ATTACHMENT0;
>          }
>
>          if (!getFramebufferAttachmentDesc(context, framebuffer_target, draw_buffer, desc)) {
> @@ -756,6 +758,8 @@ getDrawBufferImage() {
>              if (draw_buffer == GL_NONE) {
>                  return NULL;
>              }
> +        } else {
> +            draw_buffer = GL_COLOR_ATTACHMENT0;

I believe here it should be GL_BACK/GL_FRONT, as there is no bound
framebuffer in this path.

I looked at the code for dumping FBOs and there are many other places
were we use non GLES calls/state (glReadBuffer, READ_BUFFER,
DRAW_BUFFER, etc).

Jose
diff mbox

Patch

diff --git a/retrace/glstate_images.cpp b/retrace/glstate_images.cpp
index 7b0a424..f3949b5 100644
--- a/retrace/glstate_images.cpp
+++ b/retrace/glstate_images.cpp
@@ -745,6 +745,8 @@  getDrawBufferImage() {
             if (draw_buffer == GL_NONE) {
                 return NULL;
             }
+        } else {
+            draw_buffer = GL_COLOR_ATTACHMENT0;
         }
 
         if (!getFramebufferAttachmentDesc(context, framebuffer_target, draw_buffer, desc)) {
@@ -756,6 +758,8 @@  getDrawBufferImage() {
             if (draw_buffer == GL_NONE) {
                 return NULL;
             }
+        } else {
+            draw_buffer = GL_COLOR_ATTACHMENT0;
         }
 
         if (!getDrawableBounds(&desc.width, &desc.height)) {