<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Nov 29, 2018 at 7:50 PM Kristian Høgsberg <<a href="mailto:hoegsberg@gmail.com" target="_blank">hoegsberg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Nov 6, 2018 at 3:03 PM Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</a>> wrote:<br>
><br>
> On Tue, Nov 6, 2018 at 5:18 PM Kristian H. Kristensen<br>
> <<a href="mailto:hoegsberg@gmail.com" target="_blank">hoegsberg@gmail.com</a>> wrote:<br>
> ><br>
> > This also turns on EXT_multisampled_render_to_texture which is a<br>
> > subset of EXT_multisampled_render_to_texture2, allowing only<br>
> > COLOR_ATTACHMENT0.<br>
><br>
> You also enable the texture2 variant as well, no?<br>
<br>
Yes, I'll update the subject.<br>
<br>
><br>
> ><br>
> > Signed-off-by: Kristian H. Kristensen <<a href="mailto:hoegsberg@chromium.org" target="_blank">hoegsberg@chromium.org</a>><br>
> > ---<br>
> > .../EXT_multisampled_render_to_texture.xml | 34 ++++++++++++++<br>
> > src/mapi/glapi/gen/Makefile.am | 1 +<br>
> > src/mapi/glapi/gen/gl_API.xml | 2 +<br>
> > src/mapi/glapi/gen/meson.build | 1 +<br>
> > src/mesa/drivers/common/meta.c | 2 +-<br>
> > src/mesa/main/extensions_table.h | 2 +<br>
> > src/mesa/main/fbobject.c | 45 +++++++++++++------<br>
> > src/mesa/main/fbobject.h | 8 +++-<br>
> > src/mesa/main/mtypes.h | 2 +<br>
> > 9 files changed, 81 insertions(+), 16 deletions(-)<br>
> > create mode 100644 src/mapi/glapi/gen/EXT_multisampled_render_to_texture.xml<br>
> ><br>
> > diff --git a/src/mapi/glapi/gen/EXT_multisampled_render_to_texture.xml b/src/mapi/glapi/gen/EXT_multisampled_render_to_texture.xml<br>
> > new file mode 100644<br>
> > index 00000000000..cf44e6976f0<br>
> > --- /dev/null<br>
> > +++ b/src/mapi/glapi/gen/EXT_multisampled_render_to_texture.xml<br>
> > @@ -0,0 +1,34 @@<br>
> > +<?xml version="1.0"?><br>
> > +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"><br>
> > +<br>
> > +<OpenGLAPI><br>
> > +<br>
> > +<category name="GL_EXT_multisampled_render_to_texture" number="106"><br>
> > +<br>
> > + <enum name="RENDERBUFFER_SAMPLES_EXT" value="0x8CAB"/><br>
> > + <enum name="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT" value="0x8D56"/><br>
> > + <enum name="MAX_SAMPLES_EXT" value="0x8D57"/><br>
> > + <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT" value="0x8D6C"/><br>
><br>
> I don't see any logic to enable retrieving these (*_SAMPLES_EXT), so I<br>
> think this implementation is slightly incomplete.<br>
<br>
Will add.<br>
<br>
> > +<br>
> > +<!-- Already defined in FramebufferTexture2DMultisampleEXT<br>
><br>
> I think you meant to say something else here...<br>
<br>
Oh yea, this is a bit of a circular reference, isn't it... updated to<br>
EXT_framebuffer_object.xml<br>
<br>
> > + <function name="RenderbufferStorageMultisampleEXT" es2="2.0"><br>
> > + <param name="target" type="GLenum"/><br>
> > + <param name="samples" type="GLsizei"/><br>
> > + <param name="internalformat" type="GLenum"/><br>
> > + <param name="width" type="GLsizei"/><br>
> > + <param name="height" type="GLsizei"/><br>
> > + </function><br>
> > +--><br>
> > +<br>
> > + <function name="FramebufferTexture2DMultisampleEXT" es2="2.0"><br>
> > + <param name="target" type="GLenum"/><br>
> > + <param name="attachment" type="GLenum"/><br>
> > + <param name="textarget" type="GLenum"/><br>
> > + <param name="texture" type="GLuint"/><br>
> > + <param name="level" type="GLint"/><br>
> > + <param name="samples" type="GLsizei"/><br>
> > + </function><br>
> > +<br>
> > +</category><br>
> > +<br>
> > +</OpenGLAPI><br>
> > diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am<br>
> > index 6e0ee1e1687..40538b0ff2e 100644<br>
> > --- a/src/mapi/glapi/gen/Makefile.am<br>
> > +++ b/src/mapi/glapi/gen/Makefile.am<br>
> > @@ -200,6 +200,7 @@ API_XML = \<br>
> > EXT_external_objects_fd.xml \<br>
> > EXT_framebuffer_object.xml \<br>
> > EXT_gpu_shader4.xml \<br>
> > + EXT_multisampled_render_to_texture.xml \<br>
> > EXT_packed_depth_stencil.xml \<br>
> > EXT_provoking_vertex.xml \<br>
> > EXT_separate_shader_objects.xml \<br>
> > diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml<br>
> > index aae9a5835db..ee4d13f1f06 100644<br>
> > --- a/src/mapi/glapi/gen/gl_API.xml<br>
> > +++ b/src/mapi/glapi/gen/gl_API.xml<br>
> > @@ -8166,6 +8166,8 @@<br>
> ><br>
> > <xi:include href="ARB_robustness.xml" xmlns:xi="<a href="http://www.w3.org/2001/XInclude" rel="noreferrer" target="_blank">http://www.w3.org/2001/XInclude</a>"/><br>
> ><br>
> > +<xi:include href="EXT_multisampled_render_to_texture.xml" xmlns:xi="<a href="http://www.w3.org/2001/XInclude" rel="noreferrer" target="_blank">http://www.w3.org/2001/XInclude</a>"/><br>
> > +<br>
> > <xi:include href="ARB_base_instance.xml" xmlns:xi="<a href="http://www.w3.org/2001/XInclude" rel="noreferrer" target="_blank">http://www.w3.org/2001/XInclude</a>"/><br>
> ><br>
> > <category name="GL_ARB_transform_feedback_instanced" number="109"><br>
> > diff --git a/src/mapi/glapi/gen/meson.build b/src/mapi/glapi/gen/meson.build<br>
> > index f494e9707b6..8cc163b2989 100644<br>
> > --- a/src/mapi/glapi/gen/meson.build<br>
> > +++ b/src/mapi/glapi/gen/meson.build<br>
> > @@ -107,6 +107,7 @@ api_xml_files = files(<br>
> > 'EXT_external_objects_fd.xml',<br>
> > 'EXT_framebuffer_object.xml',<br>
> > 'EXT_gpu_shader4.xml',<br>
> > + 'EXT_multisampled_render_to_texture.xml',<br>
> > 'EXT_packed_depth_stencil.xml',<br>
> > 'EXT_provoking_vertex.xml',<br>
> > 'EXT_separate_shader_objects.xml',<br>
> > diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c<br>
> > index 4392c4bbd88..3515e312023 100644<br>
> > --- a/src/mesa/drivers/common/meta.c<br>
> > +++ b/src/mesa/drivers/common/meta.c<br>
> > @@ -127,7 +127,7 @@ _mesa_meta_framebuffer_texture_image(struct gl_context *ctx,<br>
> > assert(att);<br>
> ><br>
> > _mesa_framebuffer_texture(ctx, fb, attachment, att, texObj, texTarget,<br>
> > - level, layer, false);<br>
> > + level, att->NumSamples, layer, false);<br>
> > }<br>
> ><br>
> > static struct gl_shader *<br>
> > diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h<br>
> > index a516a1b17f8..f13b8b6a21a 100644<br>
> > --- a/src/mesa/main/extensions_table.h<br>
> > +++ b/src/mesa/main/extensions_table.h<br>
> > @@ -241,6 +241,8 @@ EXT(EXT_map_buffer_range , ARB_map_buffer_range<br>
> > EXT(EXT_memory_object , EXT_memory_object , GLL, GLC, x , ES2, 2017)<br>
> > EXT(EXT_memory_object_fd , EXT_memory_object_fd , GLL, GLC, x , ES2, 2017)<br>
> > EXT(EXT_multi_draw_arrays , dummy_true , GLL, x , ES1, ES2, 1999)<br>
> > +EXT(EXT_multisampled_render_to_texture , EXT_multisampled_render_to_texture , x , x , x , ES2, 2016)<br>
> > +EXT(EXT_multisampled_render_to_texture2 , EXT_multisampled_render_to_texture , x , x , x , ES2, 2016)<br>
> > EXT(EXT_occlusion_query_boolean , ARB_occlusion_query , x , x , x , ES2, 2001)<br>
> > EXT(EXT_packed_depth_stencil , dummy_true , GLL, GLC, x , x , 2005)<br>
> > EXT(EXT_packed_float , EXT_packed_float , GLL, GLC, x , x , 2004)<br>
> > diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c<br>
> > index c3dded6b928..d270dbb1648 100644<br>
> > --- a/src/mesa/main/fbobject.c<br>
> > +++ b/src/mesa/main/fbobject.c<br>
> > @@ -497,8 +497,8 @@ set_texture_attachment(struct gl_context *ctx,<br>
> > struct gl_framebuffer *fb,<br>
> > struct gl_renderbuffer_attachment *att,<br>
> > struct gl_texture_object *texObj,<br>
> > - GLenum texTarget, GLuint level, GLuint layer,<br>
> > - GLboolean layered)<br>
> > + GLenum texTarget, GLuint level, GLsizei samples,<br>
> > + GLuint layer, GLboolean layered)<br>
> > {<br>
> > struct gl_renderbuffer *rb = att->Renderbuffer;<br>
> ><br>
> > @@ -520,6 +520,7 @@ set_texture_attachment(struct gl_context *ctx,<br>
> ><br>
> > /* always update these fields */<br>
> > att->TextureLevel = level;<br>
> > + att->NumSamples = samples;<br>
> > att->CubeMapFace = _mesa_tex_target_to_face(texTarget);<br>
> > att->Zoffset = layer;<br>
> > att->Layered = layered;<br>
> > @@ -1084,8 +1085,11 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,<br>
> > return;<br>
> > }<br>
> ><br>
> > - attNumSamples = texImg->NumSamples;<br>
> > - attNumStorageSamples = texImg->NumSamples;<br>
> > + if (att->NumSamples > 0)<br>
> > + attNumSamples = att->NumSamples;<br>
> > + else<br>
> > + attNumSamples = texImg->NumSamples;<br>
> > + attNumStorageSamples = attNumSamples;<br>
><br>
> Do you want attNumStorageSamples to be attNumSamples here, or<br>
> texImg->NumSamples? Not sure what this affects...<br>
<br>
I don't know how or if at all this extension is supposed to interact<br>
with AMD_framebuffer_multisample_advanced. The checks further down<br>
require sample counts for all color attachments to match and storage<br>
sample counts for all color attachments to match. The<br>
EXT_multisampled_render_to_texture extension allows for texture color<br>
attachments to be either fully multisampled or non-multisampled as<br>
long as their attachment sample count are all the same. For that to<br>
work right, we must consider the attachment sample count both the<br>
sample count and the storage sample count.<br></blockquote><div><br></div>AMD_framebuffer_multisample_advanced is true MSAA that is extended. EXT_multisampled_render_to_texture is just 1xAA with oversampling during rasterization and shading, and the flush to memory averages the samples. It's a little more advanced than the overrasterization supported by AMD GCN, which is not exposed in GL.<br></div><div class="gmail_quote"><br></div><div class="gmail_quote"></div><div class="gmail_quote">Marek<br></div></div>