Re: [Mesa-dev] [PATCH v3] mesa: Fix GLES2 OES float texture framebuffer rendering.

2018-12-12 Thread Erik Faye-Lund
On Wed, 2018-12-12 at 09:27 +0200, Tapani Pälli wrote:
> 
> On 12/12/18 8:42 AM, Tapani Pälli wrote:
> > 
> > On 12/12/18 5:05 AM, Nick Kreeger wrote:
> > > This change enables GLES2 to render float/half-float textures to
> > > a
> > > framebuffer when the appropriate OES extensions are available.
> > > 
> > > This commit regressed OES GLES2 float texture rendering:
> > > https://gitlab.freedesktop.org/mesa/mesa/commit/e333035c47a6a4cc88f0f9ca2bced500538bebae
> > >  
> > > 
> > 
> > Which test/app got regressed? I'm curious because this commit also
> > fixed 
> > a failing conformance test that explicitly tests that the fbo with
> > float 
> > attachment should be marked incomplete.
> > 
> 
> I'm against this change because these same tests will start to fail
> if 
> we allow this:
> 
> https://mesa-ci.01.org/tpalli/builds/652/group/63a9f0ea7bb98050796b649e85481845
> 
> I believe the rule is that you should be able to render to sized
> formats 
> such as RGBA32F (with modern GLES) but not to unsized formats such
> as 
> GL_FLOAT.
> 

So...

The extension spec for OES_texture_half_float / OES_texture_float says:

---8<---
Accepted by the  parameter of TexImage2D,  TexSubImage2D, 
TexImage3D, and TexSubImage3D

HALF_FLOAT_OES0x8D61
FLOAT 0x1406
---8<---

This allows these formats for texturing. But for using them for color
attachments, they also need to be color-renderable. The color-
renderable property is based on internal-format in the OpenGL ES 2.0
spec, and only the following internal formats are color-renderable
there: RGB565, RGBA4, RGB5_A1. 

OES_rgb8_rgba8 adds RGB8 and RGBA8 as color-renderable (it doesn't
explicitly say that it does, but it lists them under "Accepted by the
 parameter of RenderbufferStorageOES", and the ES2 spec
says "internalformatmust be color-renderable, depth-renderable, or
stencil-renderable" for RenderbufferStorage)

EXT_color_buffer_half_float (if OES_texture_half_float is supported)
adds R16F, RG16F (if EXT_texture_rg is supported), RGB16F and RGBA16F
as color-renderable.

EXT_color_buffer_float is written against ES3, so it doesn't apply to
ES2.

These are all the seemingly relevant extensions. None of them seems to
add unsized float-support.

So I tend to agree with Tapani here; I don't think this change is
correct.

I *do* think that this is implemented in a rather... uh, creative way,
though. The color-renderable tests are kinda littered a bit all over
the place, not in a very systematic and easy to follow way. I tried
untangling this some years back, and my patches for that are here[1],
but someone else did some conflicting changes that lead to me dropping
this effort. Looking at what was done, the situation doesn't currently
look much better IMO.

[1]: https://github.com/kusma/mesa/commits/color_renderable_fix

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


Re: [Mesa-dev] [PATCH v3] mesa: Fix GLES2 OES float texture framebuffer rendering.

2018-12-11 Thread Tapani Pälli



On 12/12/18 8:42 AM, Tapani Pälli wrote:



On 12/12/18 5:05 AM, Nick Kreeger wrote:

This change enables GLES2 to render float/half-float textures to a
framebuffer when the appropriate OES extensions are available.

This commit regressed OES GLES2 float texture rendering:
https://gitlab.freedesktop.org/mesa/mesa/commit/e333035c47a6a4cc88f0f9ca2bced500538bebae 



Which test/app got regressed? I'm curious because this commit also fixed 
a failing conformance test that explicitly tests that the fbo with float 
attachment should be marked incomplete.




I'm against this change because these same tests will start to fail if 
we allow this:


https://mesa-ci.01.org/tpalli/builds/652/group/63a9f0ea7bb98050796b649e85481845

I believe the rule is that you should be able to render to sized formats 
such as RGBA32F (with modern GLES) but not to unsized formats such as 
GL_FLOAT.




---
  src/mesa/main/fbobject.c | 20 +++-
  1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 23e4939619..cedfc3d81b 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -869,15 +869,17 @@ test_attachment_completeness(const struct 
gl_context *ctx, GLenum format,

  return;
   }
- /* OES_texture_float allows creation and use of floating point
-  * textures with GL_FLOAT, GL_HALF_FLOAT but it does not allow
-  * these textures to be used as a render target, this is 
done via
-  * GL_EXT_color_buffer(_half)_float with set of new sized 
types.

-  */
- if (_mesa_is_gles(ctx) && (texObj->_IsFloat || 
texObj->_IsHalfFloat)) {

-    att_incomplete("bad internal format");
-    att->Complete = GL_FALSE;
-    return;
+ if (_mesa_is_gles(ctx)) {
+   /**
+    * GL ES 2 will allow GL_FLOAT and GL_HALF_FLOAT to render 
as a
+    * target when the appropriate OES_* extensions are 
available.

+    */
+   if ((texObj->_IsHalfFloat && 
!_mesa_has_OES_texture_half_float(ctx)) ||
+   (texObj->_IsFloat && 
!_mesa_has_OES_texture_float(ctx))) {

+ att_incomplete("bad internal format");
+ att->Complete = GL_FALSE;
+ return;
+   }
   }
    }
    else if (format == GL_DEPTH) {


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

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


Re: [Mesa-dev] [PATCH v3] mesa: Fix GLES2 OES float texture framebuffer rendering.

2018-12-11 Thread Tapani Pälli



On 12/12/18 5:05 AM, Nick Kreeger wrote:

This change enables GLES2 to render float/half-float textures to a
framebuffer when the appropriate OES extensions are available.

This commit regressed OES GLES2 float texture rendering:
https://gitlab.freedesktop.org/mesa/mesa/commit/e333035c47a6a4cc88f0f9ca2bced500538bebae


Which test/app got regressed? I'm curious because this commit also fixed 
a failing conformance test that explicitly tests that the fbo with float 
attachment should be marked incomplete.




---
  src/mesa/main/fbobject.c | 20 +++-
  1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 23e4939619..cedfc3d81b 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -869,15 +869,17 @@ test_attachment_completeness(const struct gl_context 
*ctx, GLenum format,
  return;
   }
  
- /* OES_texture_float allows creation and use of floating point

-  * textures with GL_FLOAT, GL_HALF_FLOAT but it does not allow
-  * these textures to be used as a render target, this is done via
-  * GL_EXT_color_buffer(_half)_float with set of new sized types.
-  */
- if (_mesa_is_gles(ctx) && (texObj->_IsFloat || texObj->_IsHalfFloat)) 
{
-att_incomplete("bad internal format");
-att->Complete = GL_FALSE;
-return;
+ if (_mesa_is_gles(ctx)) {
+   /**
+* GL ES 2 will allow GL_FLOAT and GL_HALF_FLOAT to render as a
+* target when the appropriate OES_* extensions are available.
+*/
+   if ((texObj->_IsHalfFloat && 
!_mesa_has_OES_texture_half_float(ctx)) ||
+   (texObj->_IsFloat && !_mesa_has_OES_texture_float(ctx))) {
+ att_incomplete("bad internal format");
+ att->Complete = GL_FALSE;
+ return;
+   }
   }
}
else if (format == GL_DEPTH) {


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


[Mesa-dev] [PATCH v3] mesa: Fix GLES2 OES float texture framebuffer rendering.

2018-12-11 Thread Nick Kreeger
This change enables GLES2 to render float/half-float textures to a
framebuffer when the appropriate OES extensions are available.

This commit regressed OES GLES2 float texture rendering:
https://gitlab.freedesktop.org/mesa/mesa/commit/e333035c47a6a4cc88f0f9ca2bced500538bebae
---
 src/mesa/main/fbobject.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 23e4939619..cedfc3d81b 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -869,15 +869,17 @@ test_attachment_completeness(const struct gl_context 
*ctx, GLenum format,
 return;
  }
 
- /* OES_texture_float allows creation and use of floating point
-  * textures with GL_FLOAT, GL_HALF_FLOAT but it does not allow
-  * these textures to be used as a render target, this is done via
-  * GL_EXT_color_buffer(_half)_float with set of new sized types.
-  */
- if (_mesa_is_gles(ctx) && (texObj->_IsFloat || texObj->_IsHalfFloat)) 
{
-att_incomplete("bad internal format");
-att->Complete = GL_FALSE;
-return;
+ if (_mesa_is_gles(ctx)) {
+   /**
+* GL ES 2 will allow GL_FLOAT and GL_HALF_FLOAT to render as a
+* target when the appropriate OES_* extensions are available.
+*/
+   if ((texObj->_IsHalfFloat && 
!_mesa_has_OES_texture_half_float(ctx)) ||
+   (texObj->_IsFloat && !_mesa_has_OES_texture_float(ctx))) {
+ att_incomplete("bad internal format");
+ att->Complete = GL_FALSE;
+ return;
+   }
  }
   }
   else if (format == GL_DEPTH) {
-- 
2.17.1

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