Re: [Mesa-dev] [PATCH 05/17] mesa: Fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE for default framebuffer.

2015-07-29 Thread Ian Romanick
This patch is

Reviewed-by: Ian Romanick ian.d.roman...@intel.com

I think this patch could also be tagged for the 10.6.x series.

On 07/29/2015 07:01 AM, Samuel Iglesias Gonsalvez wrote:
 From: Iago Toral Quiroga ito...@igalia.com
 
 From section 9.2. Binding and Managing Framebuffer Objects:
 
 Upon successful return from Get*FramebufferAttachmentParameteriv, if
 pname is FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, then params will contain
 one of NONE, FRAMEBUFFER_DEFAULT, TEXTURE, or RENDERBUFFER, identifying
 the type of object which contains the attached image.
 
 And then it clarifies further:
 
 If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, then
 either no framebuffer is bound to target; or the default framebuffer is
 bound, attachment is DEPTH or STENCIL, and the number of depth or stencil
 bits, respectively, is zero
 
 Currently, if the default framebuffer is bound, we always return
 GL_FRAMEBUFFER_DEFAULT for FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, but
 according to the spec, when GL_DEPTH or GL_STENCIL attachments are
 the ones being queried, we should return GL_NONE if they don't exist.
 
 Fixes the following dEQP test:
 dEQP-GLES3.functional.state_query.fbo.framebuffer_attachment_x_size_initial
 ---
  src/mesa/main/fbobject.c | 11 ++-
  1 file changed, 10 insertions(+), 1 deletion(-)
 
 diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
 index cc342c2..84321e4 100644
 --- a/src/mesa/main/fbobject.c
 +++ b/src/mesa/main/fbobject.c
 @@ -3584,7 +3584,16 @@ _mesa_get_framebuffer_attachment_parameter(struct 
 gl_context *ctx,
  
 switch (pname) {
 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:
 -  *params = _mesa_is_winsys_fbo(buffer)
 +  /* From the OpenGL spec, 9.2. Binding and Managing Framebuffer Objects:
 +   *
 +   * If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, then
 +   *  either no framebuffer is bound to target; or the default 
 framebuffer
 +   *  is bound, attachment is DEPTH or STENCIL, and the number of depth 
 or
 +   *  stencil bits, respectively, is zero.
 +   */
 +  *params = (_mesa_is_winsys_fbo(buffer) 
 + ((attachment != GL_DEPTH  attachment != GL_STENCIL) ||
 +  (att-Type != GL_NONE)))
   ? GL_FRAMEBUFFER_DEFAULT : att-Type;
return;
 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT:
 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 05/17] mesa: Fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE for default framebuffer.

2015-07-29 Thread Samuel Iglesias Gonsalvez
From: Iago Toral Quiroga ito...@igalia.com

From section 9.2. Binding and Managing Framebuffer Objects:

Upon successful return from Get*FramebufferAttachmentParameteriv, if
pname is FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, then params will contain
one of NONE, FRAMEBUFFER_DEFAULT, TEXTURE, or RENDERBUFFER, identifying
the type of object which contains the attached image.

And then it clarifies further:

If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, then
either no framebuffer is bound to target; or the default framebuffer is
bound, attachment is DEPTH or STENCIL, and the number of depth or stencil
bits, respectively, is zero

Currently, if the default framebuffer is bound, we always return
GL_FRAMEBUFFER_DEFAULT for FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, but
according to the spec, when GL_DEPTH or GL_STENCIL attachments are
the ones being queried, we should return GL_NONE if they don't exist.

Fixes the following dEQP test:
dEQP-GLES3.functional.state_query.fbo.framebuffer_attachment_x_size_initial
---
 src/mesa/main/fbobject.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index cc342c2..84321e4 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -3584,7 +3584,16 @@ _mesa_get_framebuffer_attachment_parameter(struct 
gl_context *ctx,
 
switch (pname) {
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:
-  *params = _mesa_is_winsys_fbo(buffer)
+  /* From the OpenGL spec, 9.2. Binding and Managing Framebuffer Objects:
+   *
+   * If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, then
+   *  either no framebuffer is bound to target; or the default framebuffer
+   *  is bound, attachment is DEPTH or STENCIL, and the number of depth or
+   *  stencil bits, respectively, is zero.
+   */
+  *params = (_mesa_is_winsys_fbo(buffer) 
+ ((attachment != GL_DEPTH  attachment != GL_STENCIL) ||
+  (att-Type != GL_NONE)))
  ? GL_FRAMEBUFFER_DEFAULT : att-Type;
   return;
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT:
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev