Re: [Mesa-dev] [PATCH] intel: FBOs with texture border are unsupported

2012-02-03 Thread Eric Anholt
On Wed,  1 Feb 2012 10:31:23 -0700, Ian Romanick i...@freedesktop.org wrote:
 ---
  src/mesa/drivers/dri/intel/intel_fbo.c |   13 +
  1 files changed, 13 insertions(+), 0 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
 b/src/mesa/drivers/dri/intel/intel_fbo.c
 index 2ba43ac..62ed754 100644
 --- a/src/mesa/drivers/dri/intel/intel_fbo.c
 +++ b/src/mesa/drivers/dri/intel/intel_fbo.c
 @@ -746,6 +746,7 @@ intel_validate_framebuffer(struct gl_context *ctx, struct 
 gl_framebuffer *fb)
  
 for (i = 0; i  Elements(fb-Attachment); i++) {
struct gl_renderbuffer *rb;
 +  struct gl_texture_object *tex;
struct intel_renderbuffer *irb;
  
if (fb-Attachment[i].Type == GL_NONE)
 @@ -762,6 +763,18 @@ intel_validate_framebuffer(struct gl_context *ctx, 
 struct gl_framebuffer *fb)
continue;
}
  
 +  tex = fb-Attachment[i].Texture;
 +  if (tex != NULL) {
 +  const unsigned face = fb-Attachment[i].CubeMapFace;
 +  const unsigned level = fb-Attachment[i].TextureLevel;
 +
 +  if (tex-Image[face][level]-Border) {
 + DBG(texture with border\n);
 + fb-_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
 + continue;
 +  }
 +  }

_mesa_get_attachment_teximage(struct gl_renderbuffer_attachment *att)
can make this shorter.  Other than that,

Reviewed-by: Eric Anholt e...@anholt.net


pgpYFkLKBH3pY.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] intel: FBOs with texture border are unsupported

2012-02-01 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

FBOs differ from textures in a significant way.  With textures, we can
strip the border and get correct rendering except when the application
fetches texels outside [0,1].

With an FBO, the pixel at (0,0) is in the border.  The
ARB_framebuffer_object spec says:

If the attached image is a texture image, then the window
coordinates (x[w], y[w]) correspond to the texel (i, j, k), from
figure 3.10 as follows:

   i = (x[w] - b)

   j = (y[w] - b)

   k = (layer - b)

where b is the texture image's border width...

Since the border doesn't exist, we can never render any pixels in the
correct location.  Just mark these FBOs FRAMEBUFFER_UNSUPPORTED.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42336
---
 src/mesa/drivers/dri/intel/intel_fbo.c |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index 2ba43ac..62ed754 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -746,6 +746,7 @@ intel_validate_framebuffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)
 
for (i = 0; i  Elements(fb-Attachment); i++) {
   struct gl_renderbuffer *rb;
+  struct gl_texture_object *tex;
   struct intel_renderbuffer *irb;
 
   if (fb-Attachment[i].Type == GL_NONE)
@@ -762,6 +763,18 @@ intel_validate_framebuffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)
 continue;
   }
 
+  tex = fb-Attachment[i].Texture;
+  if (tex != NULL) {
+const unsigned face = fb-Attachment[i].CubeMapFace;
+const unsigned level = fb-Attachment[i].TextureLevel;
+
+if (tex-Image[face][level]-Border) {
+   DBG(texture with border\n);
+   fb-_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+   continue;
+}
+  }
+
   irb = intel_renderbuffer(rb);
   if (irb == NULL) {
 DBG(software rendering renderbuffer\n);
-- 
1.7.6.4

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


Re: [Mesa-dev] [PATCH] intel: FBOs with texture border are unsupported

2012-02-01 Thread Kenneth Graunke

On 02/01/2012 09:31 AM, Ian Romanick wrote:

From: Ian Romanickian.d.roman...@intel.com

FBOs differ from textures in a significant way.  With textures, we can
strip the border and get correct rendering except when the application
fetches texels outside [0,1].

With an FBO, the pixel at (0,0) is in the border.  The
ARB_framebuffer_object spec says:

 If the attached image is a texture image, then the window
 coordinates (x[w], y[w]) correspond to the texel (i, j, k), from
 figure 3.10 as follows:

i = (x[w] - b)

j = (y[w] - b)

k = (layer - b)

 whereb  is the texture image's border width...

Since the border doesn't exist, we can never render any pixels in the
correct location.  Just mark these FBOs FRAMEBUFFER_UNSUPPORTED.

Signed-off-by: Ian Romanickian.d.roman...@intel.com
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42336
---
  src/mesa/drivers/dri/intel/intel_fbo.c |   13 +
  1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index 2ba43ac..62ed754 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -746,6 +746,7 @@ intel_validate_framebuffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)

 for (i = 0; i  Elements(fb-Attachment); i++) {
struct gl_renderbuffer *rb;
+  struct gl_texture_object *tex;
struct intel_renderbuffer *irb;

if (fb-Attachment[i].Type == GL_NONE)
@@ -762,6 +763,18 @@ intel_validate_framebuffer(struct gl_context *ctx, struct 
gl_framebuffer *fb)
 continue;
}

+  tex = fb-Attachment[i].Texture;
+  if (tex != NULL) {
+const unsigned face = fb-Attachment[i].CubeMapFace;
+const unsigned level = fb-Attachment[i].TextureLevel;
+
+if (tex-Image[face][level]-Border) {
+   DBG(texture with border\n);
+   fb-_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+   continue;
+}
+  }
+
irb = intel_renderbuffer(rb);
if (irb == NULL) {
 DBG(software rendering renderbuffer\n);


Yeah, I think flagging these as unsupported is best.  They aren't, and 
the application already has to check for FBO completeness, so they 
should be prepared to handle this.  Plus, seriously, who uses this crap?


Reviewed-by: Kenneth Graunke kenn...@whitecape.org
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev