Re: [Mesa-dev] [PATCH] glsl/glcpp: allow undefining __VERSION__ and GL_
On 26 August 2015 at 16:48, Ilia Mirkin wrote: > On Wed, Aug 26, 2015 at 2:38 AM, Dave Airlie wrote: >> From: Dave Airlie >> >> GL33-CTS.shaders.preprocessor.definitions.* >> has 4 tests the undefine these, >> >> I can't find anything in the spec saying that isn't correct. >> >> Signed-off-by: Dave Airlie >> --- >> src/glsl/glcpp/glcpp-parse.y | 4 +--- >> 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y >> index 18e50af..77010b4 100644 >> --- a/src/glsl/glcpp/glcpp-parse.y >> +++ b/src/glsl/glcpp/glcpp-parse.y >> @@ -289,9 +289,7 @@ control_line_success: >> } IDENTIFIER NEWLINE { >> macro_t *macro; >> if (strcmp("__LINE__", $4) == 0 >> - || strcmp("__FILE__", $4) == 0 >> - || strcmp("__VERSION__", $4) == 0 >> - || strncmp("GL_", $4, 3) == 0) > > From GLSL 4.50 page 12, section 3.3: > > All macro > names prefixed with “GL_” (“GL” followed by a single underscore) are > also reserved, and defining such a > name results in a compile-time error. That said I don't see anything > about redefining __FILE__. Okay that must be new language brought it at some point, at least 4.2 has older language which means it should be conditional on #version on whether GL_ can be done. uggh, maybe I can try again :-) Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl/glcpp: allow undefining __VERSION__ and GL_
On Wed, Aug 26, 2015 at 2:38 AM, Dave Airlie wrote: > From: Dave Airlie > > GL33-CTS.shaders.preprocessor.definitions.* > has 4 tests the undefine these, > > I can't find anything in the spec saying that isn't correct. > > Signed-off-by: Dave Airlie > --- > src/glsl/glcpp/glcpp-parse.y | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y > index 18e50af..77010b4 100644 > --- a/src/glsl/glcpp/glcpp-parse.y > +++ b/src/glsl/glcpp/glcpp-parse.y > @@ -289,9 +289,7 @@ control_line_success: > } IDENTIFIER NEWLINE { > macro_t *macro; > if (strcmp("__LINE__", $4) == 0 > - || strcmp("__FILE__", $4) == 0 > - || strcmp("__VERSION__", $4) == 0 > - || strncmp("GL_", $4, 3) == 0) From GLSL 4.50 page 12, section 3.3: All macro names prefixed with “GL_” (“GL” followed by a single underscore) are also reserved, and defining such a name results in a compile-time error. That said I don't see anything about redefining __FILE__. > + || strcmp("__FILE__", $4) == 0) > glcpp_error(& @1, parser, "Built-in (pre-defined)" > " macro names cannot be undefined."); > > -- > 2.4.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glsl/glcpp: allow undefining __VERSION__ and GL_ (v2)
From: Dave Airlie GL33-CTS.shaders.preprocessor.definitions.* has 4 tests the undefine these, It appears GLES doesn't allow this, but desktop GL does, yay specs. Signed-off-by: Dave Airlie --- src/glsl/glcpp/glcpp-parse.y | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 18e50af..0579dc0 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -288,10 +288,11 @@ control_line_success: glcpp_parser_resolve_implicit_version(parser); } IDENTIFIER NEWLINE { macro_t *macro; - if (strcmp("__LINE__", $4) == 0 - || strcmp("__FILE__", $4) == 0 - || strcmp("__VERSION__", $4) == 0 - || strncmp("GL_", $4, 3) == 0) + if (parser->is_gles && + (strcmp("__LINE__", $4) == 0 +|| strcmp("__FILE__", $4) == 0 +|| strcmp("__VERSION__", $4) == 0 +|| strncmp("GL_", $4, 3) == 0)) glcpp_error(& @1, parser, "Built-in (pre-defined)" " macro names cannot be undefined."); -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glsl/glcpp: allow undefining __VERSION__ and GL_
From: Dave Airlie GL33-CTS.shaders.preprocessor.definitions.* has 4 tests the undefine these, I can't find anything in the spec saying that isn't correct. Signed-off-by: Dave Airlie --- src/glsl/glcpp/glcpp-parse.y | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 18e50af..77010b4 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -289,9 +289,7 @@ control_line_success: } IDENTIFIER NEWLINE { macro_t *macro; if (strcmp("__LINE__", $4) == 0 - || strcmp("__FILE__", $4) == 0 - || strcmp("__VERSION__", $4) == 0 - || strncmp("GL_", $4, 3) == 0) + || strcmp("__FILE__", $4) == 0) glcpp_error(& @1, parser, "Built-in (pre-defined)" " macro names cannot be undefined."); -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 1/2] mesa/es3.1: Expose GL_ARB_framebuffer_no_attachments to GLES 3.1
On Wed, Aug 26, 2015 at 1:34 AM, Tapani Pälli wrote: > On 08/24/2015 05:04 PM, Ilia Mirkin wrote: >> >> On Mon, Aug 24, 2015 at 9:59 AM, Lofstedt, Marta >> wrote: > +static const int extra_ARB_framebuffer_no_attachments_es31[] = { > + EXT(ARB_framebuffer_no_attachments), > + EXTRA_API_ES31, > + EXTRA_END > +}; What does this add? When would you have ES31 but not ARB_framebuffer_no_attachments? >>> >>> As far as I understand, I am following what appear to be the established >>> template on how to add GLES 3.1 stuff that previously has only been exposed >>> under OpenGL. >> >> OK, but ... let's look at what this is actually doing. This is >> creating a helper which will roughly translate in the code to mean >> >> if (ARB_framebuffer_no_attachments || es31) >> >> (see get.c:check_extra). Now, this would make a ton of sense if es31 >> could be enabled independently of ARB_framebuffer_no_attachments. >> However, I don't think that's the case -- it's one of the prereqs for >> es31 (look at compute_version_es2 -- it's commented out now, but IIRC >> you uncomment it later in the series). >> >> I think that many of the existing things you're using as a template >> are wrong too, but that's no reason to continue the wrongness. > > > Technically there's nothing wrong here though, the check is absolutely > correct. Either you have ES3.1 driver or you possibly have desktop only > driver supporting this particular extension (but no ES 3.1 support). If we > now start to use multiple ways I'm not sure it will be as generic? Sure, there's nothing *wrong* with adding || 1, but... why do it? You can't have an ES3.1 driver that doesn't set Extensions.ARB_framebuffer_no_attachments... it's (going to be) required by compute_version_es2. You could have a driver that doesn't support that ext, nor ES3.1, and a user force-enables ES3.1 on the cmdline, but I don't think that's worth worrying about here -- i965 supports the ext, and any driver that doesn't isn't going to gain much from exposing these enums in a forced es31 context. -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 1/2] mesa/es3.1: Expose GL_ARB_framebuffer_no_attachments to GLES 3.1
On 08/24/2015 05:04 PM, Ilia Mirkin wrote: On Mon, Aug 24, 2015 at 9:59 AM, Lofstedt, Marta wrote: -Original Message- From: mesa-dev [mailto:mesa-dev-boun...@lists.freedesktop.org] On Behalf Of Ilia Mirkin Sent: Monday, August 24, 2015 3:02 PM To: Marta Lofstedt Cc: mesa-dev@lists.freedesktop.org Subject: Re: [Mesa-dev] [PATCH v2 1/2] mesa/es3.1: Expose GL_ARB_framebuffer_no_attachments to GLES 3.1 On Mon, Aug 24, 2015 at 7:01 AM, Marta Lofstedt wrote: From: Marta Lofstedt Signed-off-by: Marta Lofstedt --- src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml | 4 ++-- src/mapi/glapi/gen/apiexec.py | 4 ++-- src/mesa/main/get.c | 6 ++ src/mesa/main/get_hash_params.py | 8 +--- src/mesa/main/tests/dispatch_sanity.cpp | 6 ++ src/mesa/main/version.c | 2 +- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml b/src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml index 59839a0..55ad764 100644 --- a/src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml +++ b/src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml @@ -15,13 +15,13 @@ /> value="0x9318" /> - + - + diff --git a/src/mapi/glapi/gen/apiexec.py b/src/mapi/glapi/gen/apiexec.py index 3a0eb18..58ec08b 100644 --- a/src/mapi/glapi/gen/apiexec.py +++ b/src/mapi/glapi/gen/apiexec.py @@ -151,8 +151,8 @@ functions = { # OpenGL 4.3 / GL_ARB_framebuffer_no_attachments. Mesa can expose the # extension with OpenGL 3.0. -"FramebufferParameteri": exec_info(compatibility=30, core=31), -"GetFramebufferParameteri": exec_info(compatibility=30, core=31), +"FramebufferParameteri": exec_info(compatibility=30, core=31, es2=31), +"GetFramebufferParameteri": exec_info(compatibility=30, core=31, + es2=31), # OpenGL 4.5 / GL_ARB_direct_state_access. Mesa can expose the extension # with core profile. diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 307a5ff..8542ddb 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -403,6 +403,12 @@ static const int extra_ARB_explicit_uniform_location_es31[] = { EXTRA_END }; +static const int extra_ARB_framebuffer_no_attachments_es31[] = { + EXT(ARB_framebuffer_no_attachments), + EXTRA_API_ES31, + EXTRA_END +}; What does this add? When would you have ES31 but not ARB_framebuffer_no_attachments? As far as I understand, I am following what appear to be the established template on how to add GLES 3.1 stuff that previously has only been exposed under OpenGL. OK, but ... let's look at what this is actually doing. This is creating a helper which will roughly translate in the code to mean if (ARB_framebuffer_no_attachments || es31) (see get.c:check_extra). Now, this would make a ton of sense if es31 could be enabled independently of ARB_framebuffer_no_attachments. However, I don't think that's the case -- it's one of the prereqs for es31 (look at compute_version_es2 -- it's commented out now, but IIRC you uncomment it later in the series). I think that many of the existing things you're using as a template are wrong too, but that's no reason to continue the wrongness. Technically there's nothing wrong here though, the check is absolutely correct. Either you have ES3.1 driver or you possibly have desktop only driver supporting this particular extension (but no ES 3.1 support). If we now start to use multiple ways I'm not sure it will be as generic? // Tapani ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 5/6] mesa: enable enums for OES_texture_storage_multisample_2d_array
On Wed, Aug 26, 2015 at 1:19 AM, Tapani Pälli wrote: > On 08/24/2015 04:18 PM, Ilia Mirkin wrote: >> >> On Fri, Aug 21, 2015 at 3:22 AM, Tapani Pälli >> wrote: >>> >>> Signed-off-by: Tapani Pälli >>> --- >>> src/mesa/main/get_hash_params.py | 6 +++--- >>> src/mesa/main/texobj.c | 6 -- >>> src/mesa/main/texparam.c | 2 +- >>> 3 files changed, 8 insertions(+), 6 deletions(-) >>> >>> diff --git a/src/mesa/main/get_hash_params.py >>> b/src/mesa/main/get_hash_params.py >>> index 517c391..c06e9b1 100644 >>> --- a/src/mesa/main/get_hash_params.py >>> +++ b/src/mesa/main/get_hash_params.py >>> @@ -434,6 +434,9 @@ descriptor=[ >>> [ "SAMPLE_MASK", "CONTEXT_BOOL(Multisample.SampleMask), >>> extra_ARB_texture_multisample_es31" ], >>> [ "MAX_SAMPLE_MASK_WORDS", "CONST(1), >>> extra_ARB_texture_multisample_es31" ], >>> >>> +# GL_ARB_texture_multisample / ES 3.1 with >>> GL_OES_texture_storage_multisample_2d_array >>> + [ "TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY", "LOC_CUSTOM, TYPE_INT, >>> TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, extra_ARB_texture_multisample_es31" ], >> >> What does the _es31 add? Should be removed, I think. Should be done in >> a cleanup patch later though. Looks like I wasn't looking carefully >> enough at what was going on the list and this managed to sneak >> through... same goes for most (but probably not all) of the _es31 >> things. > > > I think using the _es31 is technically the best solution leaving no gaps or > 'hidden features' where we enable some GLES functionality through desktop > extension. I think we already went through this discussion. Yeah, and I pointed this same thing out then too, and was ignored I believe. > For extensions > string enable, I think it's feasible to use desktop feature enables but > anywhere else in the code it hides things from the reader. I must be missing something. Can you describe to me a scenario under which the _es31 thing makes *any* change to the code paths executed? The only one I can imagine is with a driver that doesn't set Extensions.ARB_texture_multisample, but a user has force-enabled ES3.1 via override flags. I don't think that this is a case worth worrying about. In fact I've sent a patch to remove all the _es31 things (except for ARB_cs, where it's an actual scenario). > >>> + >>> # GL_ARB_texture_gather / GLES 3.1 >>> [ "MIN_PROGRAM_TEXTURE_GATHER_OFFSET", >>> "CONTEXT_INT(Const.MinProgramTextureGatherOffset), >>> extra_ARB_texture_gather_es31"], >>> [ "MAX_PROGRAM_TEXTURE_GATHER_OFFSET", >>> "CONTEXT_INT(Const.MaxProgramTextureGatherOffset), >>> extra_ARB_texture_gather_es31"], >>> @@ -740,9 +743,6 @@ descriptor=[ >>> [ "TEXTURE_BUFFER_FORMAT_ARB", "LOC_CUSTOM, TYPE_INT, 0, >>> extra_texture_buffer_object" ], >>> [ "TEXTURE_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, >>> extra_texture_buffer_object" ], >>> >>> -# GL_ARB_texture_multisample / GL 3.2 >>> - [ "TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY", "LOC_CUSTOM, TYPE_INT, >>> TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, extra_ARB_texture_multisample" ], >>> - >>> # GL 3.0 >>> [ "CONTEXT_FLAGS", "CONTEXT_INT(Const.ContextFlags), >>> extra_version_30" ], >>> >>> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c >>> index 395e4d3..a3f44c9 100644 >>> --- a/src/mesa/main/texobj.c >>> +++ b/src/mesa/main/texobj.c >>> @@ -217,7 +217,8 @@ _mesa_get_current_tex_object(struct gl_context *ctx, >>> GLenum target) >>>return ctx->Extensions.ARB_texture_multisample >>> ? ctx->Texture.ProxyTex[TEXTURE_2D_MULTISAMPLE_INDEX] : >>> NULL; >>> case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: >>> - return ctx->Extensions.ARB_texture_multisample >>> + return (ctx->Extensions.ARB_texture_multisample || >>> + >>> ctx->Extensions.OES_texture_storage_multisample_2d_array) >> >> And then you don't have to touch this (if you don't add the extra enable) > > > This is used in such a lot of places that I'll need to then add is_gles31() > though. One should not be able to get this using bare gles 2.0. errr... how does the context affect what's in Extensions.*? [hint, it doesn't... if you need those checks now, you also needed them before] > >>> ? texUnit->CurrentTex[TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX] : >>> NULL; >>> case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: >>>return ctx->Extensions.ARB_texture_multisample >>> @@ -1612,7 +1613,8 @@ _mesa_tex_target_to_index(const struct gl_context >>> *ctx, GLenum target) >>> return ((_mesa_is_desktop_gl(ctx) && >>> ctx->Extensions.ARB_texture_multisample) || >>> _mesa_is_gles31(ctx)) ? TEXTURE_2D_MULTISAMPLE_INDEX: -1; >>> case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: >>> - return _mesa_is_desktop_gl(ctx) && >>> ctx->Extensions.ARB_texture_multisample >>> + return ((_mesa_is_desktop_gl(ctx) && >>> ctx->Extensions.ARB_texture_multisample) || >>> + ctx->Extensions.OES_texture_storage_multisample_2d_array) >> >> or this
Re: [Mesa-dev] [PATCH 5/6] mesa: enable enums for OES_texture_storage_multisample_2d_array
On 08/24/2015 04:18 PM, Ilia Mirkin wrote: On Fri, Aug 21, 2015 at 3:22 AM, Tapani Pälli wrote: Signed-off-by: Tapani Pälli --- src/mesa/main/get_hash_params.py | 6 +++--- src/mesa/main/texobj.c | 6 -- src/mesa/main/texparam.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index 517c391..c06e9b1 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -434,6 +434,9 @@ descriptor=[ [ "SAMPLE_MASK", "CONTEXT_BOOL(Multisample.SampleMask), extra_ARB_texture_multisample_es31" ], [ "MAX_SAMPLE_MASK_WORDS", "CONST(1), extra_ARB_texture_multisample_es31" ], +# GL_ARB_texture_multisample / ES 3.1 with GL_OES_texture_storage_multisample_2d_array + [ "TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY", "LOC_CUSTOM, TYPE_INT, TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, extra_ARB_texture_multisample_es31" ], What does the _es31 add? Should be removed, I think. Should be done in a cleanup patch later though. Looks like I wasn't looking carefully enough at what was going on the list and this managed to sneak through... same goes for most (but probably not all) of the _es31 things. I think using the _es31 is technically the best solution leaving no gaps or 'hidden features' where we enable some GLES functionality through desktop extension. I think we already went through this discussion. For extensions string enable, I think it's feasible to use desktop feature enables but anywhere else in the code it hides things from the reader. + # GL_ARB_texture_gather / GLES 3.1 [ "MIN_PROGRAM_TEXTURE_GATHER_OFFSET", "CONTEXT_INT(Const.MinProgramTextureGatherOffset), extra_ARB_texture_gather_es31"], [ "MAX_PROGRAM_TEXTURE_GATHER_OFFSET", "CONTEXT_INT(Const.MaxProgramTextureGatherOffset), extra_ARB_texture_gather_es31"], @@ -740,9 +743,6 @@ descriptor=[ [ "TEXTURE_BUFFER_FORMAT_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], [ "TEXTURE_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], -# GL_ARB_texture_multisample / GL 3.2 - [ "TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY", "LOC_CUSTOM, TYPE_INT, TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, extra_ARB_texture_multisample" ], - # GL 3.0 [ "CONTEXT_FLAGS", "CONTEXT_INT(Const.ContextFlags), extra_version_30" ], diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 395e4d3..a3f44c9 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -217,7 +217,8 @@ _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target) return ctx->Extensions.ARB_texture_multisample ? ctx->Texture.ProxyTex[TEXTURE_2D_MULTISAMPLE_INDEX] : NULL; case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: - return ctx->Extensions.ARB_texture_multisample + return (ctx->Extensions.ARB_texture_multisample || + ctx->Extensions.OES_texture_storage_multisample_2d_array) And then you don't have to touch this (if you don't add the extra enable) This is used in such a lot of places that I'll need to then add is_gles31() though. One should not be able to get this using bare gles 2.0. ? texUnit->CurrentTex[TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX] : NULL; case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: return ctx->Extensions.ARB_texture_multisample @@ -1612,7 +1613,8 @@ _mesa_tex_target_to_index(const struct gl_context *ctx, GLenum target) return ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_multisample) || _mesa_is_gles31(ctx)) ? TEXTURE_2D_MULTISAMPLE_INDEX: -1; case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: - return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_multisample + return ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_multisample) || + ctx->Extensions.OES_texture_storage_multisample_2d_array) or this Same here, is_gles31() check needed without separate extension enable. ? TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX: -1; default: return -1; diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 947a2a1..3b72417 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -1223,6 +1223,7 @@ legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target, case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: return (_mesa_is_gles31(ctx) || ctx->Extensions.ARB_texture_cube_map); case GL_TEXTURE_2D_MULTISAMPLE: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: return (_mesa_is_gles31(ctx) || ctx->Extensions.ARB_texture_multisample); And note another case of the same issue I was mentioning earlier, with needless gles31 checks being placed all over. [But it was like that before you got there... your change is fine.] } @@ -1267,7 +1268,6 @@ legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target, * "target may also be TEXTURE_BUFFE
Re: [Mesa-dev] [PATCH 3/6] mesa: Add extension enable for OES_texture_storage_multisample_2d_array
On 08/24/2015 04:12 PM, Ilia Mirkin wrote: On Fri, Aug 21, 2015 at 3:22 AM, Tapani Pälli wrote: Signed-off-by: Tapani Pälli --- src/mesa/main/extensions.c | 1 + src/mesa/main/mtypes.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 4a3c231..d3f43cc 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -336,6 +336,7 @@ static const struct extension extension_table[] = { { "GL_OES_texture_half_float", o(OES_texture_half_float), ES2, 2005 }, { "GL_OES_texture_half_float_linear", o(OES_texture_half_float_linear), ES2, 2005 }, { "GL_OES_texture_mirrored_repeat", o(dummy_true), ES1, 2005 }, + { "GL_OES_texture_storage_multisample_2d_array",o(OES_texture_storage_multisample_2d_array), ES31, 2014 }, Isn't this just ARB_texture_multisample? True, I will make this enable on ARB_texture_multisample. { "GL_OES_texture_npot", o(ARB_texture_non_power_of_two), ES1 | ES2, 2005 }, { "GL_OES_vertex_array_object", o(dummy_true), ES1 | ES2, 2010 }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 5031b08..e49f57b 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3874,6 +3874,7 @@ struct gl_extensions GLboolean OES_texture_half_float; GLboolean OES_texture_half_float_linear; GLboolean OES_compressed_ETC1_RGB8_texture; + GLboolean OES_texture_storage_multisample_2d_array; GLboolean extension_sentinel; /** The extension string */ const GLubyte *String; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa/formats: pass correct parameter to _mesa_is_format_compressed
On Tue, Aug 25, 2015 at 8:38 PM, Nanley Chery wrote: > > > On Tue, Aug 25, 2015 at 5:38 PM, Dave Airlie wrote: > >> From: Dave Airlie >> >> commit 26c549e69d12e44e2e36c09764ce2cceab262a1b >> Author: Nanley Chery >> Date: Fri Jul 31 10:26:36 2015 -0700 >> >> mesa/formats: remove compressed formats from matching function >> >> caused a regression in my CTS testing, this looks like a clear >> thinko. >> >> sSigned-off-by: Dave Airlie >> > You have an extra 's' at the beginning of this line. > >> --- >> src/mesa/main/formats.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c >> index 0d88c0b..f217adc 100644 >> --- a/src/mesa/main/formats.c >> +++ b/src/mesa/main/formats.c >> @@ -2046,7 +2046,7 @@ _mesa_format_matches_format_and_type(mesa_format >> mesa_format, >> case MESA_FORMAT_X8R8G8B8_SRGB: >>return GL_FALSE; >> default: >> - assert(_mesa_is_format_compressed(format)); >> + assert(_mesa_is_format_compressed(mesa_format)); >>if (error) >> *error = GL_INVALID_ENUM; >> } >> -- >> 2.4.3 >> >> > Thanks for finding this error! FWIW, > > Reviewed-by: Nanley Chery > > Please ignore the extra '.' after the '@' ;-). ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa/formats: pass correct parameter to _mesa_is_format_compressed
On Tue, Aug 25, 2015 at 5:38 PM, Dave Airlie wrote: > From: Dave Airlie > > commit 26c549e69d12e44e2e36c09764ce2cceab262a1b > Author: Nanley Chery > Date: Fri Jul 31 10:26:36 2015 -0700 > > mesa/formats: remove compressed formats from matching function > > caused a regression in my CTS testing, this looks like a clear > thinko. > > sSigned-off-by: Dave Airlie > You have an extra 's' at the beginning of this line. > --- > src/mesa/main/formats.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c > index 0d88c0b..f217adc 100644 > --- a/src/mesa/main/formats.c > +++ b/src/mesa/main/formats.c > @@ -2046,7 +2046,7 @@ _mesa_format_matches_format_and_type(mesa_format > mesa_format, > case MESA_FORMAT_X8R8G8B8_SRGB: >return GL_FALSE; > default: > - assert(_mesa_is_format_compressed(format)); > + assert(_mesa_is_format_compressed(mesa_format)); >if (error) > *error = GL_INVALID_ENUM; > } > -- > 2.4.3 > > Thanks for finding this error! FWIW, Reviewed-by: Nanley Chery ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/5] nir: Convert the NIR instruction insertion API to use cursors.
On Aug 25, 2015 12:24 PM, "Kenneth Graunke" wrote: > > This patch implements a general nir_instr_insert() function that takes a > nir_cursor for the insertion point. It then reworks the existing API to > simply be a wrapper around that for compatibility. > > This largely involves moving the existing code into a new function. > > Suggested by Connor Abbott. > > Signed-off-by: Kenneth Graunke > --- > src/glsl/nir/nir.c | 115 ++--- > src/glsl/nir/nir.h | 7 > 2 files changed, 63 insertions(+), 59 deletions(-) > > diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c > index ff758f4..a3e7966 100644 > --- a/src/glsl/nir/nir.c > +++ b/src/glsl/nir/nir.c > @@ -664,102 +664,99 @@ add_defs_uses(nir_instr *instr) > } > > void > +nir_instr_insert(nir_cursor cursor, nir_instr *instr) > +{ > + switch (cursor.option) { > + case nir_cursor_before_block: > + /* Only allow inserting jumps into empty blocks. */ > + if (instr->type == nir_instr_type_jump) > + assert(exec_list_is_empty(&cursor.block->instr_list)); > + > + instr->block = cursor.block; > + add_defs_uses(instr); > + exec_list_push_head(&cursor.block->instr_list, &instr->node); > + break; > + case nir_cursor_after_block: { > + /* Inserting instructions after a jump is illegal. */ > + nir_instr *last = nir_block_last_instr(cursor.block); > + assert(last == NULL || last->type != nir_instr_type_jump); > + (void) last; > + > + instr->block = cursor.block; > + add_defs_uses(instr); > + exec_list_push_tail(&cursor.block->instr_list, &instr->node); > + break; > + } > + case nir_cursor_before_instr: > + assert(instr->type != nir_instr_type_jump); > + instr->block = cursor.instr->block; > + add_defs_uses(instr); > + exec_node_insert_node_before(&cursor.instr->node, &instr->node); > + break; > + case nir_cursor_after_instr: > + /* Inserting instructions after a jump is illegal. */ > + assert(cursor.instr->type != nir_instr_type_jump); > + > + /* Only allow inserting jumps at the end of the block. */ > + if (instr->type == nir_instr_type_jump) > + assert(cursor.instr == nir_block_last_instr(cursor.instr->block)); > + > + instr->block = cursor.instr->block; > + add_defs_uses(instr); > + exec_node_insert_after(&cursor.instr->node, &instr->node); > + break; > + } > + > + if (instr->type == nir_instr_type_jump) > + nir_handle_add_jump(instr->block); > +} > + > +void > nir_instr_insert_before(nir_instr *instr, nir_instr *before) > { > - assert(before->type != nir_instr_type_jump); > - before->block = instr->block; > - add_defs_uses(before); > - exec_node_insert_node_before(&instr->node, &before->node); > + nir_instr_insert(nir_before_instr(instr), before); > } > > void > nir_instr_insert_after(nir_instr *instr, nir_instr *after) > { > - assert(instr->type != nir_instr_type_jump); > - > - if (after->type == nir_instr_type_jump) { > - assert(instr == nir_block_last_instr(instr->block)); > - } > - > - after->block = instr->block; > - add_defs_uses(after); > - exec_node_insert_after(&instr->node, &after->node); > - > - if (after->type == nir_instr_type_jump) > - nir_handle_add_jump(after->block); > + nir_instr_insert(nir_after_instr(instr), after); > } > > void > nir_instr_insert_before_block(nir_block *block, nir_instr *before) > { > - if (before->type == nir_instr_type_jump) > - assert(exec_list_is_empty(&block->instr_list)); > - > - before->block = block; > - add_defs_uses(before); > - exec_list_push_head(&block->instr_list, &before->node); > - > - if (before->type == nir_instr_type_jump) > - nir_handle_add_jump(block); > + nir_instr_insert(nir_before_block(block), before); > } > > void > nir_instr_insert_after_block(nir_block *block, nir_instr *after) > { > - nir_instr *last = nir_block_last_instr(block); > - assert(last == NULL || last->type != nir_instr_type_jump); > - (void) last; > - > - after->block = block; > - add_defs_uses(after); > - exec_list_push_tail(&block->instr_list, &after->node); > - > - if (after->type == nir_instr_type_jump) > - nir_handle_add_jump(block); > + nir_instr_insert(nir_after_block(block), after); > } > > void > nir_instr_insert_before_cf(nir_cf_node *node, nir_instr *before) > { > - if (node->type == nir_cf_node_block) { > - nir_instr_insert_before_block(nir_cf_node_as_block(node), before); > - } else { > - nir_cf_node *prev = nir_cf_node_prev(node); > - assert(prev->type == nir_cf_node_block); > - nir_block *prev_block = nir_cf_node_as_block(prev); > - > - nir_instr_insert_before_block(prev_block, before); > - } > + nir_instr_insert(nir_before_cf_node(node), before); > } > > void > nir_instr_insert_after_cf(nir_cf_node *node, nir_instr *after) > { > - if (node->type == nir_cf_node_bloc
Re: [Mesa-dev] big endian: r600g
FYI, I've just acquired a PowerMac7,3 (AGP, PCI... sadly no PCIe, but hard to argue at $30), and am planning on looking into any issues with the NV34 that's in there. Hopefully any fixes I make in mesa will be transferable to ATI hardware as well. This is all still a ways away (step 1: build a chroot that it will use as nfsroot), but figured I'd mention it. [BTW, these things are *way* heavier than ARM boards with Adreno GPUs... which I use in an identical fashion.] On Thu, Aug 20, 2015 at 1:28 AM, Christian Zigotzky wrote: > Hi Michel, > > Many thanks for your answer. We need to think about the topic. > > Cheers, > > Christian > > On 20 August 2015 at 04:53 AM, Michel Dänzer wrote: >> >> On 19.08.2015 16:34, Christian Zigotzky wrote: >>> >>> Thank you for your answer. I don't have an idea anymore. Could you >>> tell me which files we have to modify? >> >> If I knew exactly what needs to be done where, I probably would have >> done it myself. :) That said, I suspect changes to the driver >> (src/gallium/drivers/{radeon,r600}/ as well as to the Gallium DRI state >> tracker (src/gallium/state_trackers/dri/ code might be necessary at least. >> >> >>> Is it possible to port the AMD Catalyst driver to the PowerPC >>> platform? >> >> The avenues suggested by Dragomir and Martin make more sense to me. >> >> > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/6] mesa/formats: 8-bit channel integer formats addition
From: Dave Airlie Add enough 8-bit channel formats to handle all the different things CTS throws at us. Signed-off-by: Dave Airlie --- src/mesa/main/formats.c | 43 +++ src/mesa/main/formats.csv| 4 src/mesa/main/formats.h | 5 + src/mesa/main/glformats.c| 8 src/mesa/swrast/s_texfetch.c | 4 5 files changed, 64 insertions(+) diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index e73a549..e151f30 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -883,6 +883,10 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format, case MESA_FORMAT_R8G8B8X8_UNORM: case MESA_FORMAT_B8G8R8X8_UNORM: case MESA_FORMAT_X8R8G8B8_UNORM: + case MESA_FORMAT_A8B8G8R8_UINT: + case MESA_FORMAT_R8G8B8A8_UINT: + case MESA_FORMAT_B8G8R8A8_UINT: + case MESA_FORMAT_A8R8G8B8_UINT: *datatype = GL_UNSIGNED_BYTE; *comps = 4; return; @@ -1992,6 +1996,45 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, case MESA_FORMAT_R5G5B5A1_UINT: return format == GL_RGBA_INTEGER && type == GL_UNSIGNED_SHORT_1_5_5_5_REV; + case MESA_FORMAT_A8B8G8R8_UINT: + if (format == GL_RGBA_INTEGER && type == GL_UNSIGNED_INT_8_8_8_8 && !swapBytes) + return GL_TRUE; + + if (format == GL_RGBA_INTEGER && type == GL_UNSIGNED_INT_8_8_8_8_REV && swapBytes) + return GL_TRUE; + return GL_FALSE; + + case MESA_FORMAT_A8R8G8B8_UINT: + if (format == GL_BGRA_INTEGER && type == GL_UNSIGNED_INT_8_8_8_8 && + !swapBytes) + return GL_TRUE; + + if (format == GL_BGRA_INTEGER && type == GL_UNSIGNED_INT_8_8_8_8_REV && + swapBytes) + return GL_TRUE; + + return GL_FALSE; + + case MESA_FORMAT_R8G8B8A8_UINT: + if (format == GL_RGBA_INTEGER && type == GL_UNSIGNED_INT_8_8_8_8_REV && + !swapBytes) + return GL_TRUE; + + if (format == GL_RGBA_INTEGER && type == GL_UNSIGNED_INT_8_8_8_8 && swapBytes) + return GL_TRUE; + + return GL_FALSE; + + case MESA_FORMAT_B8G8R8A8_UINT: + if (format == GL_BGRA_INTEGER && type == GL_UNSIGNED_INT_8_8_8_8_REV && + !swapBytes) + return GL_TRUE; + + if (format == GL_BGRA_INTEGER && type == GL_UNSIGNED_INT_8_8_8_8 && swapBytes) + return GL_TRUE; + + return GL_FALSE; + case MESA_FORMAT_R9G9B9E5_FLOAT: return format == GL_RGB && type == GL_UNSIGNED_INT_5_9_9_9_REV && !swapBytes; diff --git a/src/mesa/main/formats.csv b/src/mesa/main/formats.csv index d30b0a9..3e70655 100644 --- a/src/mesa/main/formats.csv +++ b/src/mesa/main/formats.csv @@ -186,6 +186,10 @@ MESA_FORMAT_RGBX_FLOAT32 , array , 1, 1, f32 , f32 , f32 , x32 MESA_FORMAT_Z_FLOAT32 , array , 1, 1, f32 , , , , x___, zs # Packed signed/unsigned non-normalized integer formats +MESA_FORMAT_A8B8G8R8_UINT , packed, 1, 1, u8 , u8 , u8 , u8 , wzyx, rgb +MESA_FORMAT_A8R8G8B8_UINT , packed, 1, 1, u8 , u8 , u8 , u8 , yzwx, rgb +MESA_FORMAT_R8G8B8A8_UINT , packed, 1, 1, u8 , u8 , u8 , u8 , xyzw, rgb +MESA_FORMAT_B8G8R8A8_UINT , packed, 1, 1, u8 , u8 , u8 , u8 , zyxw, rgb MESA_FORMAT_B10G10R10A2_UINT , packed, 1, 1, u10 , u10 , u10 , u2 , zyxw, rgb MESA_FORMAT_R10G10B10A2_UINT , packed, 1, 1, u10 , u10 , u10 , u2 , xyzw, rgb MESA_FORMAT_A2B10G10R10_UINT , packed, 1, 1, u2 , u10 , u10 , u10 , wzyx, rgb diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index dff5980..17cb091 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -470,6 +470,11 @@ typedef enum MESA_FORMAT_Z_FLOAT32, /* Packed signed/unsigned non-normalized integer formats */ + + MESA_FORMAT_A8B8G8R8_UINT,/* */ + MESA_FORMAT_A8R8G8B8_UINT,/* */ + MESA_FORMAT_R8G8B8A8_UINT,/* */ + MESA_FORMAT_B8G8R8A8_UINT,/* */ MESA_FORMAT_B10G10R10A2_UINT, /* AARR GGBB */ MESA_FORMAT_R10G10B10A2_UINT, /* AABB GGRR */ MESA_FORMAT_A2B10G10R10_UINT, /* RRGG BBAA */ diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c index 672532f..cef831c 100644 --- a/src/mesa/main/glformats.c +++ b/src/mesa/main/glformats.c @@ -2818,6 +2818,10 @@ _mesa_format_from_format_and_type(GLenum format, GLenum type) return MESA_FORMAT_A8R8G8B8_UNORM; else if (format == GL_ABGR_EXT) return MESA_FORMAT_R8G8B8A8_UNORM; + else if (format == GL_RGBA_INTEGER) + return MESA_FORMAT_A8B8G8R8_UINT; + else if (format == GL_BGRA_INTEGER) + return MESA_FORMAT_
[Mesa-dev] [PATCH 4/6] mesa: handle SwapBytes in compressed texture get code.
This case just wasn't handled, so add support for row by row swapping when we've decompressed the texture. Signed-off-by: Dave Airlie --- src/mesa/main/texgetimage.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 872274e..25fa84c 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -361,6 +361,25 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions, tempSlice, RGBA32_FLOAT, srcStride, width, height, needsRebase ? rebaseSwizzle : NULL); + /* Handle byte swapping if required */ + if (ctx->Pack.SwapBytes) { + GLint swapSize = _mesa_sizeof_packed_type(type); + if (swapSize == 2 || swapSize == 4) { +int swapsPerPixel = _mesa_bytes_per_pixel(format, type) / swapSize; +int stride = _mesa_image_row_stride(&ctx->Pack, width, format, type); +int row; +const uint8_t *dstrow; +assert(_mesa_bytes_per_pixel(format, type) % swapSize == 0); +dstrow = dest; +for (row = 0; row < height; row++) { + if (swapSize == 2) + _mesa_swap2((GLushort *) dstrow, width * swapsPerPixel); + else if (swapSize == 4) + _mesa_swap4((GLuint *) dstrow, width * swapsPerPixel); + dstrow += stride; +} + } + } tempSlice += 4 * width * height; } -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/6] mesa/formats: add some formats from GL3.3
From: Dave Airlie GL3.3 added GL_ARB_texture_rgb10_a2ui, which specifies a lot more things than just rgb10/a2ui. While playing with ogl conform one of the tests must attempted all valid formats for GL3.3 and hits the unreachable here. This adds the first chunk of formats that hit the assert. Signed-off-by: Dave Airlie --- src/mesa/main/formats.c | 63 src/mesa/main/formats.csv| 12 + src/mesa/main/formats.h | 12 + src/mesa/main/glformats.c| 24 + src/mesa/swrast/s_texfetch.c | 12 + 5 files changed, 123 insertions(+) diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 34a4434..e73a549 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -893,6 +893,8 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format, return; case MESA_FORMAT_B5G6R5_UNORM: case MESA_FORMAT_R5G6B5_UNORM: + case MESA_FORMAT_B5G6R5_UINT: + case MESA_FORMAT_R5G6B5_UINT: *datatype = GL_UNSIGNED_SHORT_5_6_5; *comps = 3; return; @@ -900,6 +902,8 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format, case MESA_FORMAT_B4G4R4A4_UNORM: case MESA_FORMAT_A4R4G4B4_UNORM: case MESA_FORMAT_B4G4R4X4_UNORM: + case MESA_FORMAT_B4G4R4A4_UINT: + case MESA_FORMAT_A4R4G4B4_UINT: *datatype = GL_UNSIGNED_SHORT_4_4_4_4; *comps = 4; return; @@ -907,6 +911,8 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format, case MESA_FORMAT_B5G5R5A1_UNORM: case MESA_FORMAT_A1R5G5B5_UNORM: case MESA_FORMAT_B5G5R5X1_UNORM: + case MESA_FORMAT_B5G5R5A1_UINT: + case MESA_FORMAT_A1R5G5B5_UINT: *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; *comps = 4; return; @@ -917,6 +923,7 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format, return; case MESA_FORMAT_A1B5G5R5_UNORM: + case MESA_FORMAT_A1B5G5R5_UINT: *datatype = GL_UNSIGNED_SHORT_5_5_5_1; *comps = 4; return; @@ -951,19 +958,23 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format, return; case MESA_FORMAT_R3G3B2_UNORM: + case MESA_FORMAT_R3G3B2_UINT: *datatype = GL_UNSIGNED_BYTE_2_3_3_REV; *comps = 3; return; case MESA_FORMAT_A4B4G4R4_UNORM: + case MESA_FORMAT_A4B4G4R4_UINT: *datatype = GL_UNSIGNED_SHORT_4_4_4_4; *comps = 4; return; case MESA_FORMAT_R4G4B4A4_UNORM: + case MESA_FORMAT_R4G4B4A4_UINT: *datatype = GL_UNSIGNED_SHORT_4_4_4_4; *comps = 4; return; case MESA_FORMAT_R5G5B5A1_UNORM: + case MESA_FORMAT_R5G5B5A1_UINT: *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; *comps = 4; return; @@ -979,6 +990,7 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format, return; case MESA_FORMAT_B2G3R3_UNORM: + case MESA_FORMAT_B2G3R3_UINT: *datatype = GL_UNSIGNED_BYTE_3_3_2; *comps = 3; return; @@ -1929,6 +1941,57 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, type == GL_UNSIGNED_INT_2_10_10_10_REV && !swapBytes); + case MESA_FORMAT_B5G6R5_UINT: + return format == GL_RGB_INTEGER && type == GL_UNSIGNED_SHORT_5_6_5; + + case MESA_FORMAT_R5G6B5_UINT: + return format == GL_RGB_INTEGER && type == GL_UNSIGNED_SHORT_5_6_5_REV; + + case MESA_FORMAT_B2G3R3_UINT: + return format == GL_RGB_INTEGER && type == GL_UNSIGNED_BYTE_3_3_2; + + case MESA_FORMAT_R3G3B2_UINT: + return format == GL_RGB_INTEGER && type == GL_UNSIGNED_BYTE_2_3_3_REV; + + case MESA_FORMAT_A4B4G4R4_UINT: + if (format == GL_RGBA_INTEGER && type == GL_UNSIGNED_SHORT_4_4_4_4 && !swapBytes) + return GL_TRUE; + + if (format == GL_RGBA_INTEGER && type == GL_UNSIGNED_SHORT_4_4_4_4_REV && swapBytes) + return GL_TRUE; + return GL_FALSE; + + case MESA_FORMAT_R4G4B4A4_UINT: + if (format == GL_RGBA_INTEGER && type == GL_UNSIGNED_SHORT_4_4_4_4_REV && !swapBytes) + return GL_TRUE; + + if (format == GL_RGBA_INTEGER && type == GL_UNSIGNED_SHORT_4_4_4_4 && swapBytes) + return GL_TRUE; + + return GL_FALSE; + + case MESA_FORMAT_B4G4R4A4_UINT: + return format == GL_BGRA_INTEGER && type == GL_UNSIGNED_SHORT_4_4_4_4_REV && + !swapBytes; + + case MESA_FORMAT_A4R4G4B4_UINT: + return GL_FALSE; + + case MESA_FORMAT_A1B5G5R5_UINT: + return format == GL_RGBA_INTEGER && type == GL_UNSIGNED_SHORT_5_5_5_1 && + !swapBytes; + + case MESA_FORMAT_B5G5R5A1_UINT: + return format == GL_BGRA_INTEGER && type == GL_UNSIGNED_SHORT_1_5_5_5_REV && + !swapBytes; + + case MESA_FORMAT_A1R5G5B5_UINT: + return format == GL_BGRA_INTEGER && type == GL_UNSIGNED_SHORT_5_5_5_1 && + !swapBytes; + + case MESA_FORMAT_R5G5B5A1_UINT: + return format == GL_RGBA_INTEGER && type == GL_UNSIGNED_SHORT_1_5_5_5_REV;
[Mesa-dev] [PATCH 1/6] mesa: fix SwapBytes handling in texstore.
From: Dave Airlie This code doesn't handle the the user setting GL_UNPACK_ALIGNMENT at all well since we have the cases where 7 byte wide (GL_RED/GL_UNSIGNED_BYTE) still has it's rows aligned to 8, and the old code failed in that case. Just iterate the swaps over rows and images to handle this instead. Signed-off-by: Dave Airlie --- src/mesa/main/texstore.c | 34 ++ 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index fc83310..d07acca 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -729,17 +729,35 @@ texstore_rgba(TEXSTORE_PARAMS) if (swapSize == 2 || swapSize == 4) { int bytesPerPixel = _mesa_bytes_per_pixel(srcFormat, srcType); int swapsPerPixel = bytesPerPixel / swapSize; - int elementCount = srcWidth * srcHeight * srcDepth; + int srcStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); + int imageStride = _mesa_image_image_stride(srcPacking, srcWidth, srcHeight, srcFormat, srcType); + int bufferSize = imageStride * srcDepth; + int row, layer; + const uint8_t *src, *srcrow; + uint8_t *dst, *dstrow; + assert(bytesPerPixel % swapSize == 0); - tempImage = malloc(elementCount * bytesPerPixel); + tempImage = malloc(bufferSize); if (!tempImage) return GL_FALSE; - if (swapSize == 2) -_mesa_swap2_copy(tempImage, (GLushort *) srcAddr, - elementCount * swapsPerPixel); - else -_mesa_swap4_copy(tempImage, (GLuint *) srcAddr, - elementCount * swapsPerPixel); + src = srcAddr; + dst = tempImage; + for (layer = 0; layer < srcDepth; layer++) { +srcrow = src; +dstrow = dst; +for (row = 0; row < srcHeight; row++) { + if (swapSize == 2) + _mesa_swap2_copy((GLushort *)dstrow, (GLushort *)srcrow, + srcWidth * swapsPerPixel); + else + _mesa_swap4_copy((GLuint *)dstrow, (GLuint *)srcrow, + srcWidth * swapsPerPixel); + srcrow += srcStride; + dstrow += srcStride; +} +src += imageStride; +dst += imageStride; + } srcAddr = tempImage; } } -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] formats fixes for glcts pixel store tests
The glcts has two tests GL33-CTS.gtf32.GL3Tests.packed_pixels.packed_pixels and GL33-CTS.gtf32.GL3Tests.packed_pixels.packed_pixels_pixelstore that try all the valid combinations of things at TexImage, GetTexImage and ReadPixels. This series of patches is a first round of fixes: a) SwapBytes handling was broken in the presence of (UN)PACK_ROW_LENGTH with a 1-byte format/type combo, b) GetTexImage on a compressed format has no swap bytes handling c) format/type combinations for integer were missing internal formats to handle conversion to/from them. two patches add the internal formats for all cases these tests throw at us. This series alone doesn't completely fix the test on my cayman gpu, the other patches I've got to fix the remaining cases all involve disabling the mesa/st fast paths or fastpaths in readpix or texcompress_s3tc. I'll try and narrow those down to real fixes as well. Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/6] mesa: fix swapbytes in readpixels paths.
From: Dave Airlie Same as for other paths, need to take into a/c rowlength vs width differences for 7/RED/UNSIGNED_BYTE cases. Signed-off-by: Dave Airlie --- src/mesa/main/readpix.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index 1277944..41b4ab4 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -616,11 +616,19 @@ done_swap: GLint swapSize = _mesa_sizeof_packed_type(type); if (swapSize == 2 || swapSize == 4) { int swapsPerPixel = _mesa_bytes_per_pixel(format, type) / swapSize; + int stride = _mesa_image_row_stride(packing, width, format, type); + int row; + const uint8_t *dstrow; + assert(_mesa_bytes_per_pixel(format, type) % swapSize == 0); - if (swapSize == 2) -_mesa_swap2((GLushort *) dst, width * height * swapsPerPixel); - else if (swapSize == 4) -_mesa_swap4((GLuint *) dst, width * height * swapsPerPixel); + dstrow = dst; + for (row = 0; row < height; row++) { +if (swapSize == 2) + _mesa_swap2((GLushort *) dstrow, width * swapsPerPixel); +else if (swapSize == 4) + _mesa_swap4((GLuint *) dstrow, width * swapsPerPixel); +dstrow += stride; + } } } -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/6] mesa: handle SwapBytes in uncompressed get texture paths properly
This code wasn't handling the 7-width/GL_RED/GL_BYTE case where GL_PACK_ALIGNMENT was set to 4. This fixes it to iterate on a row by row basis over the image instead, and avoids accessing uninitialised memory. Signed-off-by: Dave Airlie --- src/mesa/main/texgetimage.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index f62553d..872274e 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -561,11 +561,18 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions, GLint swapSize = _mesa_sizeof_packed_type(type); if (swapSize == 2 || swapSize == 4) { int swapsPerPixel = _mesa_bytes_per_pixel(format, type) / swapSize; +int stride = _mesa_image_row_stride(&ctx->Pack, width, format, type); +int row; +const uint8_t *dstrow; assert(_mesa_bytes_per_pixel(format, type) % swapSize == 0); -if (swapSize == 2) - _mesa_swap2((GLushort *) dest, width * height * swapsPerPixel); -else if (swapSize == 4) - _mesa_swap4((GLuint *) dest, width * height * swapsPerPixel); +dstrow = dest; +for (row = 0; row < height; row++) { + if (swapSize == 2) + _mesa_swap2((GLushort *) dstrow, width * swapsPerPixel); + else if (swapSize == 4) + _mesa_swap4((GLuint *) dstrow, width * swapsPerPixel); + dstrow += stride; +} } } -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa/formats: pass correct parameter to _mesa_is_format_compressed
From: Dave Airlie commit 26c549e69d12e44e2e36c09764ce2cceab262a1b Author: Nanley Chery Date: Fri Jul 31 10:26:36 2015 -0700 mesa/formats: remove compressed formats from matching function caused a regression in my CTS testing, this looks like a clear thinko. sSigned-off-by: Dave Airlie --- src/mesa/main/formats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 0d88c0b..f217adc 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -2046,7 +2046,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, case MESA_FORMAT_X8R8G8B8_SRGB: return GL_FALSE; default: - assert(_mesa_is_format_compressed(format)); + assert(_mesa_is_format_compressed(mesa_format)); if (error) *error = GL_INVALID_ENUM; } -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v4] mesa/formats: remove compressed formats from matching function
> case MESA_FORMAT_B8G8R8X8_SRGB: > case MESA_FORMAT_X8R8G8B8_SRGB: >return GL_FALSE; > + default: > + assert(_mesa_is_format_compressed(format)); This assert is clearly wrong, _mesa_is_format_compressed should take a mesa_format not a format. Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa/texformat: Use format conversion function in _mesa_choose_tex_format
On Sun 16 Aug 2015, Nanley Chery wrote: > The last line of the commit message should say: > >GL_RGBA4_S3TC (0x83A3) -> COMPRESSED_RGBA_S3TC_DXT5_EXT (0x83F3) There's another weird line too, see below. > On Wed, Aug 12, 2015 at 4:19 PM, Nanley Chery wrote: > > > From: Nanley Chery > > > > This function's cases for non-generic compressed formats duplicate > > the GL to MESA translation in _mesa_glenum_to_compressed_format(). > > This patch replaces the switch cases with a call to the translation > > function. There are no behavioral changes except for the RGB[A]4 formats: > > > >case GL_RGB4_S3TC: > > return MESA_FORMAT_RGB_DXT1 (old) -> MESA_FORMAT_RGBA_DXT1 (new) ^ I have trouble believing this line is correct. It adds an alpha channel. Can you provide the documentation for that translation? > >case GL_RGBA4_S3TC: > > return MESA_FORMAT_RGBA_DXT3 (old) -> MESA_FORMAT_RGBA_DXT5 (new) > > > > Although unclear, the old behavior was likely a bug, given that online > > documentation (few and far between) imply a format mapping of the > > following: > > > >GL_RGB_S3TC(0x83A0) -> COMPRESSED_RGB_S3TC_DXT1_EXT (0x83F0) > >GL_RGB4_S3TC (0x83A1) -> COMPRESSED_RGBA_S3TC_DXT1_EXT (0x83F1) > >GL_RGBA_S3TC (0x83A2) -> COMPRESSED_RGBA_S3TC_DXT3_EXT (0x83F2) > >GL_RGBA4_S3TC (0x83A2) -> COMPRESSED_RGBA_S3TC_DXT5_EXT (0x83F2) > > > > Cc: Brian Paul > > Cc: Ian Romanick > > Signed-off-by: Nanley Chery > > --- > > src/mesa/main/texformat.c | 94 > > +++ > > 1 file changed, 13 insertions(+), 81 deletions(-) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v6 2/2] mesa/teximage: accept ASTC formats for 3D texture specification
On Tue 25 Aug 2015, Nanley Chery wrote: > From: Nanley Chery > > The ASTC spec was revised as follows: > >Revision 2, April 28, 2015 - added CompressedTex{Sub,}Image3D to >commands accepting ASTC format tokens in the New Tokens section [...]. > > Support only exists in the HDR submode: > >Add a second new column "3D Tex." which is empty for all non-ASTC >formats. If only the LDR profile is supported by the implementation, >this column is also empty for all ASTC formats. If both the LDR and HDR >profiles are supported only, this column is checked for all ASTC >formats. > > LDR-only systems should generate an INVALID_OPERATION error when > attempting to call CompressedTexImage3D with the TEXTURE_3D target. > > v2. return the proper error for LDR-only systems. > v3. update is_astc_format(). > v4. use _mesa_is_astc_format(). > v5. place logic in _mesa_target_can_be_compressed. > v6. fix issues handling ASTC formats. > > Signed-off-by: Nanley Chery > --- > src/mesa/main/teximage.c | 63 > ++-- > 1 file changed, 56 insertions(+), 7 deletions(-) Reviewed-by: Chad Versace ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] mesa/teximage: Add GL error parameter to _mesa_target_can_be_compressed
On Tue 25 Aug 2015, Nanley Chery wrote: > From: Nanley Chery > > Enables _mesa_target_can_be_compressed to return the appropriate GL error > depending on it's inputs. Use the parameter to return the appropriate GL error > for ETC2 formats on GLES3. > > Suggested-by: Chad Versace > Signed-off-by: Nanley Chery > --- > src/mesa/main/teximage.c | 90 > +++--- > src/mesa/main/teximage.h | 2 +- > src/mesa/main/texstorage.c | 20 --- > 3 files changed, 68 insertions(+), 44 deletions(-) LGTM. This patch is Reviewed-by: Chad Versace ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v4] mesa/formats: remove compressed formats from matching function
On Mon 24 Aug 2015, Nanley Chery wrote: > From: Nanley Chery > > All compressed formats return GL_FALSE and there isn't any evidence to > support that this behaviour would change. Remove all switch cases for > compressed formats. > > v2. Since the exhaustive switch is removed, add a gtest to ensure > all formats are handled. > v3. Ensure that GL_NO_ERROR is set before returning. > v4. Fix an arg to _mesa_uncompressed_format_to_type_and_comps(); > fix formatting and misc improvements (Chad). > > Cc: Brian Paul > Cc: Chad Versace > Signed-off-by: Nanley Chery > --- > src/mesa/drivers/dri/i915/intel_pixel_read.c | 2 +- > src/mesa/drivers/dri/i915/intel_tex_image.c | 2 +- > src/mesa/main/formats.c | 58 > ++-- > src/mesa/main/formats.h | 2 +- > src/mesa/main/readpix.c | 2 +- > src/mesa/main/tests/mesa_formats.cpp | 9 - > src/mesa/main/texgetimage.c | 2 +- > src/mesa/main/texstore.c | 2 +- > src/mesa/state_tracker/st_cb_readpixels.c| 2 +- > src/mesa/state_tracker/st_cb_texture.c | 6 +-- > src/mesa/state_tracker/st_format.c | 2 +- > src/mesa/swrast/s_drawpix.c | 2 +- > 12 files changed, 31 insertions(+), 60 deletions(-) v4 is Reviewed-by: Chad Versace ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] meta: Save/restore compute shaders
On Sat, Aug 22, 2015 at 9:31 PM, Jordan Justen wrote: > Signed-off-by: Jordan Justen > --- > src/mesa/drivers/common/meta.c | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c > index bde544e..e27489d 100644 > --- a/src/mesa/drivers/common/meta.c > +++ b/src/mesa/drivers/common/meta.c > @@ -599,7 +599,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) >/* Save the shader state from ctx->Shader (instead of ctx->_Shader) so > * that we don't have to worry about the current pipeline state. > */ > - for (i = 0; i <= MESA_SHADER_FRAGMENT; i++) { > + for (i = 0; i < MESA_SHADER_STAGES; i++) { > _mesa_reference_shader_program(ctx, &save->Shader[i], > ctx->Shader.CurrentProgram[i]); >} > @@ -949,7 +949,9 @@ _mesa_meta_end(struct gl_context *ctx) > GL_TESS_EVALUATION_SHADER, > GL_GEOMETRY_SHADER, > GL_FRAGMENT_SHADER, > + GL_COMPUTE_SHADER, >}; > + STATIC_ASSERT(MESA_SHADER_STAGES == ARRAY_SIZE(targets)); > >bool any_shader; > > @@ -975,7 +977,7 @@ _mesa_meta_end(struct gl_context *ctx) >} > >any_shader = false; > - for (i = 0; i <= MESA_SHADER_FRAGMENT; i++) { > + for (i = 0; i < MESA_SHADER_STAGES; i++) { > /* It is safe to call _mesa_use_shader_program even if the extension >* necessary for that program state is not supported. In that case, >* the saved program object must be NULL and the currently bound > -- > 2.1.4 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev Reviewed-by: Anuj Phogat ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] mesa/formats: make format testing a gtest
On Mon 24 Aug 2015, Nanley Chery wrote: > On Fri, Aug 21, 2015 at 2:12 PM, Chad Versace > wrote: > > > On Wed 19 Aug 2015, Nanley Chery wrote: > > > From: Nanley Chery > > > > > > We currently check that our format info table is sane during context > > > initialization in debug builds. Perform this check during > > > `make check` instead. This enables format testing in release builds > > > and removes the requirement of an exhuastive switch for > > > _mesa_uncompressed_format_to_type_and_comps(). > > > > > > Signed-off-by: Nanley Chery > > > --- > > > src/mesa/main/context.c | 4 - > > > src/mesa/main/formats.c | 157 > > ++- > > > src/mesa/main/tests/Makefile.am | 1 + > > > src/mesa/main/tests/mesa_formats.cpp | 130 + > > > 4 files changed, 137 insertions(+), 155 deletions(-) > > > create mode 100644 src/mesa/main/tests/mesa_formats.cpp > > > > > +/** > > > + * Debug/test: check that all uncompressed formats are handled in the > > > + * _mesa_uncompressed_format_to_type_and_comps() function. When new > > pixel > > > + * formats are added to Mesa, that function needs to be updated. > > > + */ > > > +TEST(MesaFormatsTest, FormatTypeAndComps) > > > +{ > > > + for (int fi = MESA_FORMAT_NONE + 1; fi < MESA_FORMAT_COUNT; ++fi) { > > > + mesa_format f = (mesa_format) fi; > > > + > > > + /* This function will emit a problem/warning if the format is > > > + * not handled. > > > + */ > > > + if (!_mesa_is_format_compressed(f)) { > > > + GLenum datatype = 0; > > > + GLuint comps = 0; > > > + _mesa_uncompressed_format_to_type_and_comps(f, &datatype, > > &comps); > > > + > > > + /* If the datatype is zero, the format was not handled */ > > > + ASSERT_NE(datatype, (GLenum)0); > > > > I think the test should also assert that comps >= 1. > > > > In the failure scenario for this function, comps will be set equal to 1. > It can also be set equal to 1 for certain valid formats as well. Right. I retract my comment. Since GLenum is unsigned, it doesn't matter whether we check for != 0 or >= 1. But my other comments in the previous email still hold. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v4 (part2) 11/59] glsl: add support for unsized arrays in shader storage blocks
Reviewed-by: Jordan Justen On 2015-08-05 01:30:08, Iago Toral Quiroga wrote: > From: Samuel Iglesias Gonsalvez > > They only can be defined in the last position of the shader > storage blocks. > > When an unsized array is used in different shaders, it might be > converted in different sized arrays, avoid get a linker error > in that case. > > v2: > - Rework error condition and error messages (Timothy Arceri) > > Signed-off-by: Samuel Iglesias Gonsalvez > --- > src/glsl/ast_array_index.cpp | 3 +- > src/glsl/ast_to_hir.cpp | 66 ++ > src/glsl/ir.cpp | 1 + > src/glsl/ir.h| 14 ++ > src/glsl/linker.cpp | 107 > --- > 5 files changed, 154 insertions(+), 37 deletions(-) > > diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp > index 27e84d1..115b5f2 100644 > --- a/src/glsl/ast_array_index.cpp > +++ b/src/glsl/ast_array_index.cpp > @@ -226,7 +226,8 @@ _mesa_ast_array_index_to_hir(void *mem_ctx, > * by the linker. > */ > } > - else { > + else if (array->variable_referenced()->data.mode != > + ir_var_shader_storage) { > _mesa_glsl_error(&loc, state, "unsized array index must be > constant"); > } >} else if (array->type->fields.array->is_interface() > diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp > index 68f71c6..6e63d86 100644 > --- a/src/glsl/ast_to_hir.cpp > +++ b/src/glsl/ast_to_hir.cpp > @@ -5844,6 +5844,19 @@ private: > bool found; > }; > > +static bool > +is_unsized_array_last_element(ir_variable *v) > +{ > + const glsl_type *interface_type = v->get_interface_type(); > + int length = interface_type->length; > + > + assert(v->type->is_unsized_array()); > + > + /* Check if it is the last element of the interface */ > + if (strcmp(interface_type->fields.structure[length-1].name, v->name) == 0) > + return true; > + return false; > +} > > ir_rvalue * > ast_interface_block::hir(exec_list *instructions, > @@ -6210,6 +6223,33 @@ ast_interface_block::hir(exec_list *instructions, >else if (state->stage == MESA_SHADER_TESS_CTRL && var_mode == > ir_var_shader_out) > handle_tess_ctrl_shader_output_decl(state, loc, var); > > + for (unsigned i = 0; i < num_variables; i++) { > + if (fields[i].type->is_unsized_array()) { > +if (var_mode == ir_var_shader_storage) { > + if (i != (num_variables - 1)) { > + _mesa_glsl_error(&loc, state, "unsized array `%s' > definition: " > + "only last member of a shader storage > block " > + "can be defined as unsized array", > + fields[i].name); > + } > +} else { > + /* From GLSL ES 3.10 spec, section 4.1.9 "Arrays": > + * > + * "If an array is declared as the last member of a shader > storage > + * block and the size is not specified at compile-time, it is > + * sized at run-time. In all other cases, arrays are sized only > + * at compile-time." > + */ > + if (state->es_shader) { > + _mesa_glsl_error(&loc, state, "unsized array `%s' > definition: " > + "only last member of a shader storage block > " > + "can be defined as unsized array", > + fields[i].name); > + } > +} > + } > + } > + >if (ir_variable *earlier = >state->symbols->get_variable(this->instance_name)) { > if (!redeclaring_per_vertex) { > @@ -6301,6 +6341,32 @@ ast_interface_block::hir(exec_list *instructions, > var->data.explicit_binding = this->layout.flags.q.explicit_binding; > var->data.binding = this->layout.binding; > > + if (var->type->is_unsized_array()) { > +if (var->is_in_shader_storage_block()) { > + if (!is_unsized_array_last_element(var)) { > + _mesa_glsl_error(&loc, state, "unsized array `%s' > definition: " > + "only last member of a shader storage > block " > + "can be defined as unsized array", > + var->name); > + } > + var->data.from_ssbo_unsized_array = true; > +} else { > + /* From GLSL ES 3.10 spec, section 4.1.9 "Arrays": > + * > + * "If an array is declared as the last member of a shader > storage > + * block and the size is not specified at compile-time, it is > + * sized at run-time. In all other cases, arrays are sized only > +
[Mesa-dev] [Bug 91747] Ubuntu 15.04/Oibaf PPA - Unity bar not transparent
https://bugs.freedesktop.org/show_bug.cgi?id=91747 Sinclair Yeh changed: What|Removed |Added CC||s...@vmware.com -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v6 2/2] mesa/teximage: accept ASTC formats for 3D texture specification
From: Nanley Chery The ASTC spec was revised as follows: Revision 2, April 28, 2015 - added CompressedTex{Sub,}Image3D to commands accepting ASTC format tokens in the New Tokens section [...]. Support only exists in the HDR submode: Add a second new column "3D Tex." which is empty for all non-ASTC formats. If only the LDR profile is supported by the implementation, this column is also empty for all ASTC formats. If both the LDR and HDR profiles are supported only, this column is checked for all ASTC formats. LDR-only systems should generate an INVALID_OPERATION error when attempting to call CompressedTexImage3D with the TEXTURE_3D target. v2. return the proper error for LDR-only systems. v3. update is_astc_format(). v4. use _mesa_is_astc_format(). v5. place logic in _mesa_target_can_be_compressed. v6. fix issues handling ASTC formats. Signed-off-by: Nanley Chery --- src/mesa/main/teximage.c | 63 ++-- 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index c28cd03..1a5923a 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1854,19 +1854,68 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target, return write_error(error, GL_INVALID_OPERATION); target_can_be_compresed = ctx->Extensions.ARB_texture_cube_map_array; - break; - case GL_TEXTURE_3D: - /* See ETC2/EAC comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY. */ - if (layout == MESA_FORMAT_LAYOUT_ETC2 && _mesa_is_gles3(ctx)) + /* From the KHR_texture_compression_astc_hdr spec: + * + * Add a second new column "3D Tex." which is empty for all non-ASTC + * formats. If only the LDR profile is supported by the + * implementation, this column is also empty for all ASTC formats. If + * both the LDR and HDR profiles are supported only, this column is + * checked for all ASTC formats. + * + * Add a third new column "Cube Map Array Tex." which is empty for all + * non-ASTC formats, and checked for all ASTC formats. + * + * and, + * + * 'An INVALID_OPERATION error is generated by CompressedTexImage3D + * if is TEXTURE_CUBE_MAP_ARRAY and the + * "Cube Map Array" column of table 8.19 is *not* checked, or if + * is TEXTURE_3D and the "3D Tex." column of table + * 8.19 is *not* checked' + * + * The instances of above should say . + */ + + /* Throw an INVALID_OPERATION error if the target is + * TEXTURE_CUBE_MAP_ARRAY and the format is not ASTC. + */ + if (target_can_be_compresed && + ctx->Extensions.KHR_texture_compression_astc_ldr && + layout != MESA_FORMAT_LAYOUT_ASTC) return write_error(error, GL_INVALID_OPERATION); - if (layout == MESA_FORMAT_LAYOUT_BPTC) { + break; + case GL_TEXTURE_3D: + switch (layout) { + case MESA_FORMAT_LAYOUT_ETC2: + /* See ETC2/EAC comment in case GL_TEXTURE_CUBE_MAP_ARRAY. */ + if (_mesa_is_gles3(ctx)) +return write_error(error, GL_INVALID_OPERATION); + break; + case MESA_FORMAT_LAYOUT_BPTC: target_can_be_compresed = ctx->Extensions.ARB_texture_compression_bptc; break; - } + case MESA_FORMAT_LAYOUT_ASTC: + target_can_be_compresed = + ctx->Extensions.KHR_texture_compression_astc_hdr; - break; + /* Throw an INVALID_OPERATION error if the target is TEXTURE_3D and + * and the hdr extension is not supported. + * See comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY for more info. + */ + if (!target_can_be_compresed) +return write_error(error, GL_INVALID_OPERATION); + break; + default: + /* Throw an INVALID_OPERATION error if the target is TEXTURE_3D and + * the format is not ASTC. + * See comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY for more info. + */ + if (ctx->Extensions.KHR_texture_compression_astc_ldr) +return write_error(error, GL_INVALID_OPERATION); + break; + } default: break; } -- 2.5.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v5 2/2] mesa/teximage: accept ASTC formats for 3D texture specification
I'm planning to send out a v6 to fix an issue w/ a not-yet-upstreamed piglit test I've developed for ASTC. On Tue, Aug 25, 2015 at 1:00 PM, Nanley Chery wrote: > From: Nanley Chery > > The ASTC spec was revised as follows: > >Revision 2, April 28, 2015 - added CompressedTex{Sub,}Image3D to >commands accepting ASTC format tokens in the New Tokens section [...]. > > Support only exists in the HDR submode: > >Add a second new column "3D Tex." which is empty for all non-ASTC >formats. If only the LDR profile is supported by the implementation, >this column is also empty for all ASTC formats. If both the LDR and HDR >profiles are supported only, this column is checked for all ASTC >formats. > > LDR-only systems should generate an INVALID_OPERATION error when > attempting to call CompressedTexImage3D with the TEXTURE_3D target. > > v2. return the proper error for LDR-only systems. > v3. update is_astc_format(). > v4. use _mesa_is_astc_format(). > v5. place logic in _mesa_target_can_be_compressed. > > Signed-off-by: Nanley Chery > --- > src/mesa/main/teximage.c | 54 > +--- > 1 file changed, 47 insertions(+), 7 deletions(-) > > diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c > index c28cd03..5602123 100644 > --- a/src/mesa/main/teximage.c > +++ b/src/mesa/main/teximage.c > @@ -1854,19 +1854,59 @@ _mesa_target_can_be_compressed(const struct > gl_context *ctx, GLenum target, > return write_error(error, GL_INVALID_OPERATION); > >target_can_be_compresed = > ctx->Extensions.ARB_texture_cube_map_array; > - break; > - case GL_TEXTURE_3D: > > - /* See ETC2/EAC comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY. */ > - if (layout == MESA_FORMAT_LAYOUT_ETC2 && _mesa_is_gles3(ctx)) > + /* From the KHR_texture_compression_astc_hdr spec: > + * > + * Add a second new column "3D Tex." which is empty for all > non-ASTC > + * formats. If only the LDR profile is supported by the > implementation, > + * this column is also empty for all ASTC formats. If both the > LDR and HDR > + * profiles are supported only, this column is checked for all > ASTC > + * formats. > + * > + * Add a third new column "Cube Map Array Tex." which is empty > for all > + * non-ASTC formats, and checked for all ASTC formats. > + * > + * and, > + * > + * 'An INVALID_OPERATION error is generated by > CompressedTexImage3D > + * if is TEXTURE_CUBE_MAP_ARRAY and the > + * "Cube Map Array" column of table 8.19 is *not* checked, or > if > + * is TEXTURE_3D and the "3D Tex." column of > table > + * 8.19 is *not* checked' > + * > + * The instances of above should say . > + */ > + > + /* Throw an INVALID_OPERATION error if the target is > + * TEXTURE_CUBE_MAP_ARRAY and the format is not ASTC. > + */ > + if (target_can_be_compresed && > + ctx->Extensions.KHR_texture_compression_astc_ldr && > + layout != MESA_FORMAT_LAYOUT_ASTC) > return write_error(error, GL_INVALID_OPERATION); > > - if (layout == MESA_FORMAT_LAYOUT_BPTC) { > + break; > + case GL_TEXTURE_3D: > + switch (layout) { > + case MESA_FORMAT_LAYOUT_ETC2: > + /* See ETC2/EAC comment in case GL_TEXTURE_CUBE_MAP_ARRAY. */ > + if (_mesa_is_gles3(ctx)) > +return write_error(error, GL_INVALID_OPERATION); > + break; > + case MESA_FORMAT_LAYOUT_BPTC: > target_can_be_compresed = > ctx->Extensions.ARB_texture_compression_bptc; > break; > + default: > + /* Throw an INVALID_OPERATION error if the target is TEXTURE_3D > and > + * (the format is not ASTC or the hdr extension is not > supported). > + * See comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY for more > info. > + */ > + if (ctx->Extensions.KHR_texture_compression_astc_ldr && > + (layout != MESA_FORMAT_LAYOUT_ASTC || > + !ctx->Extensions.KHR_texture_compression_astc_hdr)) > +return write_error(error, GL_INVALID_OPERATION); > + break; >} > - > - break; > default: >break; > } > -- > 2.5.0 > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 7/9] softpipe: don't use 3-component formats
On Tue, Aug 25, 2015 at 9:23 PM, Brian Paul wrote: > On 08/24/2015 06:59 PM, Marek Olšák wrote: >> >> On Tue, Aug 25, 2015 at 1:04 AM, Brian Paul wrote: >>> >>> Mesa and gallium don't have a complete set of matching 3-component >>> texture formats. For example, 8-bit sRGB unorm. To fully support >>> the GL_ARB_copy_image extension we need to have support for all of >>> these formats: RGB8_UNORM, RGB8_SNORM, RGB8_SRGB, RGB8_UINT, and >>> RGB8_SINT using the same component order. Since we don't have that, >>> disable the 3-component formats for now. >>> --- >>> src/gallium/drivers/softpipe/sp_screen.c | 25 + >>> 1 file changed, 25 insertions(+) >>> >>> diff --git a/src/gallium/drivers/softpipe/sp_screen.c >>> b/src/gallium/drivers/softpipe/sp_screen.c >>> index aeef8e6..24d79f1 100644 >>> --- a/src/gallium/drivers/softpipe/sp_screen.c >>> +++ b/src/gallium/drivers/softpipe/sp_screen.c >>> @@ -360,6 +360,31 @@ softpipe_is_format_supported( struct pipe_screen >>> *screen, >>> return FALSE; >>> } >>> >>> + if ((bind & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW)) && >>> + ((bind & PIPE_BIND_DISPLAY_TARGET) == 0)) { >>> + if (format == PIPE_FORMAT_R8G8B8_UINT || >>> + format == PIPE_FORMAT_R8G8B8_SINT || >>> + format == PIPE_FORMAT_R8G8B8_UNORM || >>> + format == PIPE_FORMAT_R16G16B16_UINT || >>> + format == PIPE_FORMAT_R16G16B16_SINT || >>> + format == PIPE_FORMAT_R16G16B16_UNORM || >>> + format == PIPE_FORMAT_R16G16B16_FLOAT || >>> + format == PIPE_FORMAT_R32G32B32_UINT || >>> + format == PIPE_FORMAT_R32G32B32_SINT || >>> + format == PIPE_FORMAT_R32G32B32_UNORM || >>> + format == PIPE_FORMAT_R32G32B32_FLOAT) { >> >> >> For simpler code and keeping TBO support: >> >> desc->is_array && desc->nr_channels == 3 && target != PIPE_BUFFER >> >> where desc = util_format_description(format) > > > Formats such as PIPE_FORMAT_B8G8R8X8_UNORM report nr_channels=4. One also Yes, X is counted as a component, that's the whole point. nr_channels is 3 for RGB but not RGBX, which seems to be exactly what you want, and "is_array" assures you won't remove R5G6B5, Z32_S8X24 and other packed ones. Basically, (nr_channels == 3 && is_array) covers this: *_R8G8B8_* *_R16G16B16_* *_R32G32B32_* *_R64G64B64_* Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/5] nir: Strengthen "no jumps" assertions in instruction insertion API.
Jumps must be the last instruction in a block, so inserting another instruction after a jump is illegal. Previously, we only checked this when the new instruction being inserted was a jump. This is a red herring - inserting *any* kind of instruction after a jump is illegal. Signed-off-by: Kenneth Graunke --- src/glsl/nir/nir.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c index 77cc4f0..ff758f4 100644 --- a/src/glsl/nir/nir.c +++ b/src/glsl/nir/nir.c @@ -675,9 +675,10 @@ nir_instr_insert_before(nir_instr *instr, nir_instr *before) void nir_instr_insert_after(nir_instr *instr, nir_instr *after) { + assert(instr->type != nir_instr_type_jump); + if (after->type == nir_instr_type_jump) { assert(instr == nir_block_last_instr(instr->block)); - assert(instr->type != nir_instr_type_jump); } after->block = instr->block; @@ -705,10 +706,9 @@ nir_instr_insert_before_block(nir_block *block, nir_instr *before) void nir_instr_insert_after_block(nir_block *block, nir_instr *after) { - if (after->type == nir_instr_type_jump) { - assert(exec_list_is_empty(&block->instr_list) || - nir_block_last_instr(block)->type != nir_instr_type_jump); - } + nir_instr *last = nir_block_last_instr(block); + assert(last == NULL || last->type != nir_instr_type_jump); + (void) last; after->block = block; add_defs_uses(after); -- 2.5.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/5] nir: Move nir_cursor to nir.h.
We want to use this for normal instruction insertion too, not just control flow. Generally these functions are going to be extremely useful when working with NIR, so I want them to be widely available without having to include a separate file. Signed-off-by: Kenneth Graunke --- src/glsl/nir/nir.h | 97 + src/glsl/nir/nir_control_flow.h | 89 - 2 files changed, 97 insertions(+), 89 deletions(-) diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 12ddeb2..65e4daf 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1546,6 +1546,101 @@ nir_deref *nir_copy_deref(void *mem_ctx, nir_deref *deref); nir_load_const_instr * nir_deref_get_const_initializer_load(nir_shader *shader, nir_deref_var *deref); +/** + * NIR Cursors and Instruction Insertion API + * @{ + * + * A tiny struct representing a point to insert/extract instructions or + * control flow nodes. Helps reduce the combinatorial explosion of possible + * points to insert/extract. + * + * \sa nir_control_flow.h + */ +typedef enum { + nir_cursor_before_block, + nir_cursor_after_block, + nir_cursor_before_instr, + nir_cursor_after_instr, +} nir_cursor_option; + +typedef struct { + nir_cursor_option option; + union { + nir_block *block; + nir_instr *instr; + }; +} nir_cursor; + +static inline nir_cursor +nir_before_block(nir_block *block) +{ + nir_cursor cursor; + cursor.option = nir_cursor_before_block; + cursor.block = block; + return cursor; +} + +static inline nir_cursor +nir_after_block(nir_block *block) +{ + nir_cursor cursor; + cursor.option = nir_cursor_after_block; + cursor.block = block; + return cursor; +} + +static inline nir_cursor +nir_before_instr(nir_instr *instr) +{ + nir_cursor cursor; + cursor.option = nir_cursor_before_instr; + cursor.instr = instr; + return cursor; +} + +static inline nir_cursor +nir_after_instr(nir_instr *instr) +{ + nir_cursor cursor; + cursor.option = nir_cursor_after_instr; + cursor.instr = instr; + return cursor; +} + +static inline nir_cursor +nir_before_cf_node(nir_cf_node *node) +{ + if (node->type == nir_cf_node_block) + return nir_before_block(nir_cf_node_as_block(node)); + + return nir_after_block(nir_cf_node_as_block(nir_cf_node_prev(node))); +} + +static inline nir_cursor +nir_after_cf_node(nir_cf_node *node) +{ + if (node->type == nir_cf_node_block) + return nir_after_block(nir_cf_node_as_block(node)); + + return nir_before_block(nir_cf_node_as_block(nir_cf_node_next(node))); +} + +static inline nir_cursor +nir_before_cf_list(struct exec_list *cf_list) +{ + nir_cf_node *first_node = exec_node_data(nir_cf_node, +exec_list_get_head(cf_list), node); + return nir_before_cf_node(first_node); +} + +static inline nir_cursor +nir_after_cf_list(struct exec_list *cf_list) +{ + nir_cf_node *last_node = exec_node_data(nir_cf_node, + exec_list_get_tail(cf_list), node); + return nir_after_cf_node(last_node); +} + void nir_instr_insert_before(nir_instr *instr, nir_instr *before); void nir_instr_insert_after(nir_instr *instr, nir_instr *after); @@ -1560,6 +1655,8 @@ void nir_instr_insert_after_cf_list(struct exec_list *list, nir_instr *after); void nir_instr_remove(nir_instr *instr); +/** @} */ + typedef bool (*nir_foreach_ssa_def_cb)(nir_ssa_def *def, void *state); typedef bool (*nir_foreach_dest_cb)(nir_dest *dest, void *state); typedef bool (*nir_foreach_src_cb)(nir_src *src, void *state); diff --git a/src/glsl/nir/nir_control_flow.h b/src/glsl/nir/nir_control_flow.h index 5efd41c..b71382f 100644 --- a/src/glsl/nir/nir_control_flow.h +++ b/src/glsl/nir/nir_control_flow.h @@ -45,95 +45,6 @@ extern "C" { *deleting them. */ -/* Helper struct for representing a point to extract/insert. Helps reduce the - * combinatorial explosion of possible points to extract. - */ - -typedef enum { - nir_cursor_before_block, - nir_cursor_after_block, - nir_cursor_before_instr, - nir_cursor_after_instr, -} nir_cursor_option; - -typedef struct { - nir_cursor_option option; - union { - nir_block *block; - nir_instr *instr; - }; -} nir_cursor; - -static inline nir_cursor -nir_before_block(nir_block *block) -{ - nir_cursor cursor; - cursor.option = nir_cursor_before_block; - cursor.block = block; - return cursor; -} - -static inline nir_cursor -nir_after_block(nir_block *block) -{ - nir_cursor cursor; - cursor.option = nir_cursor_after_block; - cursor.block = block; - return cursor; -} - -static inline nir_cursor -nir_before_instr(nir_instr *instr) -{ - nir_cursor cursor; - cursor.option = nir_cursor_before_instr; - cursor.instr = instr; - return cursor; -} - -static inline nir_cursor -nir_after_instr(nir_instr *instr) -{ - nir_cursor cursor; - cursor.option = nir_cursor_after_instr; - cursor.
[Mesa-dev] [PATCH 1/5] nir: Make nir_block_{first, last}_instr return NULL for empty blocks.
This is a lot more reasonable than returning an offset from NULL. Signed-off-by: Kenneth Graunke --- src/glsl/nir/nir.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 40871f7..12ddeb2 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1219,14 +1219,14 @@ static inline nir_instr * nir_block_first_instr(nir_block *block) { struct exec_node *head = exec_list_get_head(&block->instr_list); - return exec_node_data(nir_instr, head, node); + return head ? exec_node_data(nir_instr, head, node) : NULL; } static inline nir_instr * nir_block_last_instr(nir_block *block) { struct exec_node *tail = exec_list_get_tail(&block->instr_list); - return exec_node_data(nir_instr, tail, node); + return tail ? exec_node_data(nir_instr, tail, node) : NULL; } #define nir_foreach_instr(block, instr) \ -- 2.5.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/5] nir: Convert the NIR instruction insertion API to use cursors.
This patch implements a general nir_instr_insert() function that takes a nir_cursor for the insertion point. It then reworks the existing API to simply be a wrapper around that for compatibility. This largely involves moving the existing code into a new function. Suggested by Connor Abbott. Signed-off-by: Kenneth Graunke --- src/glsl/nir/nir.c | 115 ++--- src/glsl/nir/nir.h | 7 2 files changed, 63 insertions(+), 59 deletions(-) diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c index ff758f4..a3e7966 100644 --- a/src/glsl/nir/nir.c +++ b/src/glsl/nir/nir.c @@ -664,102 +664,99 @@ add_defs_uses(nir_instr *instr) } void +nir_instr_insert(nir_cursor cursor, nir_instr *instr) +{ + switch (cursor.option) { + case nir_cursor_before_block: + /* Only allow inserting jumps into empty blocks. */ + if (instr->type == nir_instr_type_jump) + assert(exec_list_is_empty(&cursor.block->instr_list)); + + instr->block = cursor.block; + add_defs_uses(instr); + exec_list_push_head(&cursor.block->instr_list, &instr->node); + break; + case nir_cursor_after_block: { + /* Inserting instructions after a jump is illegal. */ + nir_instr *last = nir_block_last_instr(cursor.block); + assert(last == NULL || last->type != nir_instr_type_jump); + (void) last; + + instr->block = cursor.block; + add_defs_uses(instr); + exec_list_push_tail(&cursor.block->instr_list, &instr->node); + break; + } + case nir_cursor_before_instr: + assert(instr->type != nir_instr_type_jump); + instr->block = cursor.instr->block; + add_defs_uses(instr); + exec_node_insert_node_before(&cursor.instr->node, &instr->node); + break; + case nir_cursor_after_instr: + /* Inserting instructions after a jump is illegal. */ + assert(cursor.instr->type != nir_instr_type_jump); + + /* Only allow inserting jumps at the end of the block. */ + if (instr->type == nir_instr_type_jump) + assert(cursor.instr == nir_block_last_instr(cursor.instr->block)); + + instr->block = cursor.instr->block; + add_defs_uses(instr); + exec_node_insert_after(&cursor.instr->node, &instr->node); + break; + } + + if (instr->type == nir_instr_type_jump) + nir_handle_add_jump(instr->block); +} + +void nir_instr_insert_before(nir_instr *instr, nir_instr *before) { - assert(before->type != nir_instr_type_jump); - before->block = instr->block; - add_defs_uses(before); - exec_node_insert_node_before(&instr->node, &before->node); + nir_instr_insert(nir_before_instr(instr), before); } void nir_instr_insert_after(nir_instr *instr, nir_instr *after) { - assert(instr->type != nir_instr_type_jump); - - if (after->type == nir_instr_type_jump) { - assert(instr == nir_block_last_instr(instr->block)); - } - - after->block = instr->block; - add_defs_uses(after); - exec_node_insert_after(&instr->node, &after->node); - - if (after->type == nir_instr_type_jump) - nir_handle_add_jump(after->block); + nir_instr_insert(nir_after_instr(instr), after); } void nir_instr_insert_before_block(nir_block *block, nir_instr *before) { - if (before->type == nir_instr_type_jump) - assert(exec_list_is_empty(&block->instr_list)); - - before->block = block; - add_defs_uses(before); - exec_list_push_head(&block->instr_list, &before->node); - - if (before->type == nir_instr_type_jump) - nir_handle_add_jump(block); + nir_instr_insert(nir_before_block(block), before); } void nir_instr_insert_after_block(nir_block *block, nir_instr *after) { - nir_instr *last = nir_block_last_instr(block); - assert(last == NULL || last->type != nir_instr_type_jump); - (void) last; - - after->block = block; - add_defs_uses(after); - exec_list_push_tail(&block->instr_list, &after->node); - - if (after->type == nir_instr_type_jump) - nir_handle_add_jump(block); + nir_instr_insert(nir_after_block(block), after); } void nir_instr_insert_before_cf(nir_cf_node *node, nir_instr *before) { - if (node->type == nir_cf_node_block) { - nir_instr_insert_before_block(nir_cf_node_as_block(node), before); - } else { - nir_cf_node *prev = nir_cf_node_prev(node); - assert(prev->type == nir_cf_node_block); - nir_block *prev_block = nir_cf_node_as_block(prev); - - nir_instr_insert_before_block(prev_block, before); - } + nir_instr_insert(nir_before_cf_node(node), before); } void nir_instr_insert_after_cf(nir_cf_node *node, nir_instr *after) { - if (node->type == nir_cf_node_block) { - nir_instr_insert_after_block(nir_cf_node_as_block(node), after); - } else { - nir_cf_node *next = nir_cf_node_next(node); - assert(next->type == nir_cf_node_block); - nir_block *next_block = nir_cf_node_as_block(next); - - nir_instr_insert_before_block(next_block, after); - } + nir_instr_inser
[Mesa-dev] [PATCH 5/5] nir: Convert the builder to use the new NIR cursor API.
The NIR cursor API is exactly what we want for the builder's insertion point. This simplifies the API, the implementation, and is actually more flexible as well. This required a bit of reworking of TGSI->NIR's if/loop stack handling; we now store cursors instead of cf_node_lists, for better or worse. v2: Actually move the cursor in the after_instr case. v3: Take advantage of nir_instr_insert (suggested by Connor). v4: vc4 build fixes (thanks to Eric). Signed-off-by: Kenneth Graunke Reviewed-by: Eric Anholt [v1] --- src/gallium/auxiliary/nir/tgsi_to_nir.c| 34 - .../drivers/freedreno/ir3/ir3_nir_lower_if_else.c | 2 +- src/gallium/drivers/vc4/vc4_nir_lower_blend.c | 2 +- src/gallium/drivers/vc4/vc4_nir_lower_io.c | 6 +-- src/glsl/nir/nir_builder.h | 43 +- src/glsl/nir/nir_lower_idiv.c | 2 +- src/glsl/nir/nir_lower_io.c| 2 +- src/glsl/nir/nir_lower_load_const_to_scalar.c | 2 +- src/glsl/nir/nir_lower_tex_projector.c | 2 +- src/glsl/nir/nir_normalize_cubemap_coords.c| 2 +- src/mesa/program/prog_to_nir.c | 2 +- 11 files changed, 38 insertions(+), 61 deletions(-) diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index 278d5e9..db50734 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -65,24 +65,24 @@ struct ttn_compile { nir_register *addr_reg; /** -* Stack of cf_node_lists where instructions should be pushed as we pop +* Stack of nir_cursors where instructions should be pushed as we pop * back out of the control flow stack. * * For each IF/ELSE/ENDIF block, if_stack[if_stack_pos] has where the else * instructions should be placed, and if_stack[if_stack_pos - 1] has where * the next instructions outside of the if/then/else block go. */ - struct exec_list **if_stack; + nir_cursor *if_stack; unsigned if_stack_pos; /** -* Stack of cf_node_lists where instructions should be pushed as we pop +* Stack of nir_cursors where instructions should be pushed as we pop * back out of the control flow stack. * * loop_stack[loop_stack_pos - 1] contains the cf_node_list for the outside * of the loop. */ - struct exec_list **loop_stack; + nir_cursor *loop_stack; unsigned loop_stack_pos; /* How many TGSI_FILE_IMMEDIATE vec4s have been parsed so far. */ @@ -922,7 +922,7 @@ ttn_if(struct ttn_compile *c, nir_ssa_def *src, bool is_uint) nir_builder *b = &c->build; /* Save the outside-of-the-if-statement node list. */ - c->if_stack[c->if_stack_pos] = b->cf_node_list; + c->if_stack[c->if_stack_pos] = b->cursor; c->if_stack_pos++; src = ttn_channel(b, src, X); @@ -933,11 +933,11 @@ ttn_if(struct ttn_compile *c, nir_ssa_def *src, bool is_uint) } else { if_stmt->condition = nir_src_for_ssa(nir_fne(b, src, nir_imm_int(b, 0))); } - nir_cf_node_insert_end(b->cf_node_list, &if_stmt->cf_node); + nir_builder_cf_insert(b, &if_stmt->cf_node); - nir_builder_insert_after_cf_list(b, &if_stmt->then_list); + b->cursor = nir_after_cf_list(&if_stmt->then_list); - c->if_stack[c->if_stack_pos] = &if_stmt->else_list; + c->if_stack[c->if_stack_pos] = nir_after_cf_list(&if_stmt->else_list); c->if_stack_pos++; } @@ -946,7 +946,7 @@ ttn_else(struct ttn_compile *c) { nir_builder *b = &c->build; - nir_builder_insert_after_cf_list(b, c->if_stack[c->if_stack_pos - 1]); + b->cursor = c->if_stack[c->if_stack_pos - 1]; } static void @@ -955,7 +955,7 @@ ttn_endif(struct ttn_compile *c) nir_builder *b = &c->build; c->if_stack_pos -= 2; - nir_builder_insert_after_cf_list(b, c->if_stack[c->if_stack_pos]); + b->cursor = c->if_stack[c->if_stack_pos]; } static void @@ -964,13 +964,13 @@ ttn_bgnloop(struct ttn_compile *c) nir_builder *b = &c->build; /* Save the outside-of-the-loop node list. */ - c->loop_stack[c->loop_stack_pos] = b->cf_node_list; + c->loop_stack[c->loop_stack_pos] = b->cursor; c->loop_stack_pos++; nir_loop *loop = nir_loop_create(b->shader); - nir_cf_node_insert_end(b->cf_node_list, &loop->cf_node); + nir_builder_cf_insert(b, &loop->cf_node); - nir_builder_insert_after_cf_list(b, &loop->body); + b->cursor = nir_after_cf_list(&loop->body); } static void @@ -993,7 +993,7 @@ ttn_endloop(struct ttn_compile *c) nir_builder *b = &c->build; c->loop_stack_pos--; - nir_builder_insert_after_cf_list(b, c->loop_stack[c->loop_stack_pos]); + b->cursor = c->loop_stack[c->loop_stack_pos]; } static void @@ -1803,7 +1803,7 @@ tgsi_to_nir(const void *tgsi_tokens, nir_function_impl *impl = nir_function_impl_create(overload); nir_builder_init(&c->build, impl); - nir_builder_insert_after_cf_list(&c->build, &impl->bod
[Mesa-dev] [PATCH v5 2/2] mesa/teximage: accept ASTC formats for 3D texture specification
From: Nanley Chery The ASTC spec was revised as follows: Revision 2, April 28, 2015 - added CompressedTex{Sub,}Image3D to commands accepting ASTC format tokens in the New Tokens section [...]. Support only exists in the HDR submode: Add a second new column "3D Tex." which is empty for all non-ASTC formats. If only the LDR profile is supported by the implementation, this column is also empty for all ASTC formats. If both the LDR and HDR profiles are supported only, this column is checked for all ASTC formats. LDR-only systems should generate an INVALID_OPERATION error when attempting to call CompressedTexImage3D with the TEXTURE_3D target. v2. return the proper error for LDR-only systems. v3. update is_astc_format(). v4. use _mesa_is_astc_format(). v5. place logic in _mesa_target_can_be_compressed. Signed-off-by: Nanley Chery --- src/mesa/main/teximage.c | 54 +--- 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index c28cd03..5602123 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1854,19 +1854,59 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target, return write_error(error, GL_INVALID_OPERATION); target_can_be_compresed = ctx->Extensions.ARB_texture_cube_map_array; - break; - case GL_TEXTURE_3D: - /* See ETC2/EAC comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY. */ - if (layout == MESA_FORMAT_LAYOUT_ETC2 && _mesa_is_gles3(ctx)) + /* From the KHR_texture_compression_astc_hdr spec: + * + * Add a second new column "3D Tex." which is empty for all non-ASTC + * formats. If only the LDR profile is supported by the implementation, + * this column is also empty for all ASTC formats. If both the LDR and HDR + * profiles are supported only, this column is checked for all ASTC + * formats. + * + * Add a third new column "Cube Map Array Tex." which is empty for all + * non-ASTC formats, and checked for all ASTC formats. + * + * and, + * + * 'An INVALID_OPERATION error is generated by CompressedTexImage3D + * if is TEXTURE_CUBE_MAP_ARRAY and the + * "Cube Map Array" column of table 8.19 is *not* checked, or if + * is TEXTURE_3D and the "3D Tex." column of table + * 8.19 is *not* checked' + * + * The instances of above should say . + */ + + /* Throw an INVALID_OPERATION error if the target is + * TEXTURE_CUBE_MAP_ARRAY and the format is not ASTC. + */ + if (target_can_be_compresed && + ctx->Extensions.KHR_texture_compression_astc_ldr && + layout != MESA_FORMAT_LAYOUT_ASTC) return write_error(error, GL_INVALID_OPERATION); - if (layout == MESA_FORMAT_LAYOUT_BPTC) { + break; + case GL_TEXTURE_3D: + switch (layout) { + case MESA_FORMAT_LAYOUT_ETC2: + /* See ETC2/EAC comment in case GL_TEXTURE_CUBE_MAP_ARRAY. */ + if (_mesa_is_gles3(ctx)) +return write_error(error, GL_INVALID_OPERATION); + break; + case MESA_FORMAT_LAYOUT_BPTC: target_can_be_compresed = ctx->Extensions.ARB_texture_compression_bptc; break; + default: + /* Throw an INVALID_OPERATION error if the target is TEXTURE_3D and + * (the format is not ASTC or the hdr extension is not supported). + * See comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY for more info. + */ + if (ctx->Extensions.KHR_texture_compression_astc_ldr && + (layout != MESA_FORMAT_LAYOUT_ASTC || + !ctx->Extensions.KHR_texture_compression_astc_hdr)) +return write_error(error, GL_INVALID_OPERATION); + break; } - - break; default: break; } -- 2.5.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] mesa/teximage: Add GL error parameter to _mesa_target_can_be_compressed
From: Nanley Chery Enables _mesa_target_can_be_compressed to return the appropriate GL error depending on it's inputs. Use the parameter to return the appropriate GL error for ETC2 formats on GLES3. Suggested-by: Chad Versace Signed-off-by: Nanley Chery --- src/mesa/main/teximage.c | 90 +++--- src/mesa/main/teximage.h | 2 +- src/mesa/main/texstorage.c | 20 --- 3 files changed, 68 insertions(+), 44 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index b130d65..c28cd03 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1794,18 +1794,36 @@ _mesa_format_no_online_compression(const struct gl_context *ctx, GLenum format) compressedteximage_only_format(ctx, format); } +/* Writes to an GL error pointer if non-null and returns whether or not the + * error is GL_NO_ERROR */ +static bool +write_error(GLenum *err_ptr, GLenum error) +{ + if (err_ptr) + *err_ptr = error; + + return error == GL_NO_ERROR; +} + /** * Helper function to determine whether a target and specific compression - * format are supported. + * format are supported. The error parameter returns GL_NO_ERROR if the + * target can be compressed. Otherwise it returns either GL_INVALID_OPERATION + * or GL_INVALID_ENUM, whichever is more appropriate. */ GLboolean _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target, - GLenum intFormat) + GLenum intFormat, GLenum *error) { + GLboolean target_can_be_compresed = GL_FALSE; + mesa_format format = _mesa_glenum_to_compressed_format(intFormat); + enum mesa_format_layout layout = _mesa_get_format_layout(format); + switch (target) { case GL_TEXTURE_2D: case GL_PROXY_TEXTURE_2D: - return GL_TRUE; /* true for any compressed format so far */ + target_can_be_compresed = GL_TRUE; /* true for any compressed format so far */ + break; case GL_PROXY_TEXTURE_CUBE_MAP: case GL_TEXTURE_CUBE_MAP: case GL_TEXTURE_CUBE_MAP_POSITIVE_X: @@ -1814,26 +1832,46 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target, case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - return ctx->Extensions.ARB_texture_cube_map; + target_can_be_compresed = ctx->Extensions.ARB_texture_cube_map; + break; case GL_PROXY_TEXTURE_2D_ARRAY_EXT: case GL_TEXTURE_2D_ARRAY_EXT: - return ctx->Extensions.EXT_texture_array; + target_can_be_compresed = ctx->Extensions.EXT_texture_array; + break; case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: case GL_TEXTURE_CUBE_MAP_ARRAY: - return ctx->Extensions.ARB_texture_cube_map_array; + /* From section 3.8.6, page 146 of OpenGL ES 3.0 spec: + * + *"The ETC2/EAC texture compression algorithm supports only + * two-dimensional images. If internalformat is an ETC2/EAC format, + * glCompressedTexImage3D will generate an INVALID_OPERATION error if + * target is not TEXTURE_2D_ARRAY." + * + * This should also be applicable for glTexStorage3D(). Other available + * targets for these functions are: TEXTURE_3D and TEXTURE_CUBE_MAP_ARRAY. + */ + if (layout == MESA_FORMAT_LAYOUT_ETC2 && _mesa_is_gles3(ctx)) +return write_error(error, GL_INVALID_OPERATION); + + target_can_be_compresed = ctx->Extensions.ARB_texture_cube_map_array; + break; case GL_TEXTURE_3D: - switch (intFormat) { - case GL_COMPRESSED_RGBA_BPTC_UNORM: - case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM: - case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT: - case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT: - return ctx->Extensions.ARB_texture_compression_bptc; - default: - return GL_FALSE; + + /* See ETC2/EAC comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY. */ + if (layout == MESA_FORMAT_LAYOUT_ETC2 && _mesa_is_gles3(ctx)) + return write_error(error, GL_INVALID_OPERATION); + + if (layout == MESA_FORMAT_LAYOUT_BPTC) { + target_can_be_compresed = ctx->Extensions.ARB_texture_compression_bptc; + break; } + + break; default: - return GL_FALSE; + break; } + return write_error(error, + target_can_be_compresed ? GL_NO_ERROR : GL_INVALID_ENUM); } @@ -2293,8 +2331,9 @@ texture_error_check( struct gl_context *ctx, /* additional checks for compressed textures */ if (_mesa_is_compressed_format(ctx, internalFormat)) { - if (!_mesa_target_can_be_compressed(ctx, target, internalFormat)) { - _mesa_error(ctx, GL_INVALID_ENUM, + GLenum err; + if (!_mesa_target_can_be_compressed(ctx, target, internalFormat, &err)) { + _mesa_error(ctx, err, "glTexImage%dD(target can't be compressed)", dimensions);
Re: [Mesa-dev] [PATCH 7/9] softpipe: don't use 3-component formats
On 08/24/2015 05:08 PM, Ilia Mirkin wrote: On Mon, Aug 24, 2015 at 7:04 PM, Brian Paul wrote: Mesa and gallium don't have a complete set of matching 3-component texture formats. For example, 8-bit sRGB unorm. To fully support the GL_ARB_copy_image extension we need to have support for all of these formats: RGB8_UNORM, RGB8_SNORM, RGB8_SRGB, RGB8_UINT, and RGB8_SINT using the same component order. Since we don't have that, disable the 3-component formats for now. --- src/gallium/drivers/softpipe/sp_screen.c | 25 + 1 file changed, 25 insertions(+) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index aeef8e6..24d79f1 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -360,6 +360,31 @@ softpipe_is_format_supported( struct pipe_screen *screen, return FALSE; } + if ((bind & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW)) && + ((bind & PIPE_BIND_DISPLAY_TARGET) == 0)) { + if (format == PIPE_FORMAT_R8G8B8_UINT || + format == PIPE_FORMAT_R8G8B8_SINT || + format == PIPE_FORMAT_R8G8B8_UNORM || + format == PIPE_FORMAT_R16G16B16_UINT || + format == PIPE_FORMAT_R16G16B16_SINT || + format == PIPE_FORMAT_R16G16B16_UNORM || + format == PIPE_FORMAT_R16G16B16_FLOAT || + format == PIPE_FORMAT_R32G32B32_UINT || + format == PIPE_FORMAT_R32G32B32_SINT || + format == PIPE_FORMAT_R32G32B32_UNORM || + format == PIPE_FORMAT_R32G32B32_FLOAT) { Won't this lose you ARB_texture_buffer_object_rgb32 support? static const struct st_extension_format_mapping tbo_rgb32[] = { { {o(ARB_texture_buffer_object_rgb32) }, { PIPE_FORMAT_R32G32B32_FLOAT, PIPE_FORMAT_R32G32B32_UINT, PIPE_FORMAT_R32G32B32_SINT, } }, init_format_extensions(screen, extensions, tbo_rgb32, ARRAY_SIZE(tbo_rgb32), PIPE_BUFFER, PIPE_BIND_SAMPLER_VIEW); Yeah, I also need to check that target!=PIPE_BUFFER. I'm fixing that and re-checking with piglit. Thanks. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 7/9] softpipe: don't use 3-component formats
On 08/24/2015 06:59 PM, Marek Olšák wrote: On Tue, Aug 25, 2015 at 1:04 AM, Brian Paul wrote: Mesa and gallium don't have a complete set of matching 3-component texture formats. For example, 8-bit sRGB unorm. To fully support the GL_ARB_copy_image extension we need to have support for all of these formats: RGB8_UNORM, RGB8_SNORM, RGB8_SRGB, RGB8_UINT, and RGB8_SINT using the same component order. Since we don't have that, disable the 3-component formats for now. --- src/gallium/drivers/softpipe/sp_screen.c | 25 + 1 file changed, 25 insertions(+) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index aeef8e6..24d79f1 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -360,6 +360,31 @@ softpipe_is_format_supported( struct pipe_screen *screen, return FALSE; } + if ((bind & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW)) && + ((bind & PIPE_BIND_DISPLAY_TARGET) == 0)) { + if (format == PIPE_FORMAT_R8G8B8_UINT || + format == PIPE_FORMAT_R8G8B8_SINT || + format == PIPE_FORMAT_R8G8B8_UNORM || + format == PIPE_FORMAT_R16G16B16_UINT || + format == PIPE_FORMAT_R16G16B16_SINT || + format == PIPE_FORMAT_R16G16B16_UNORM || + format == PIPE_FORMAT_R16G16B16_FLOAT || + format == PIPE_FORMAT_R32G32B32_UINT || + format == PIPE_FORMAT_R32G32B32_SINT || + format == PIPE_FORMAT_R32G32B32_UNORM || + format == PIPE_FORMAT_R32G32B32_FLOAT) { For simpler code and keeping TBO support: desc->is_array && desc->nr_channels == 3 && target != PIPE_BUFFER where desc = util_format_description(format) Formats such as PIPE_FORMAT_B8G8R8X8_UNORM report nr_channels=4. One also has to count the number of non-UTIL_FORMAT_TYPE_VOID channel types. I had tried that but it didn't work out and I didn't dig deeper into it. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] mesa/formats: refactor by globbing on types in switch statement
On Tue, Aug 25, 2015 at 7:42 AM, Emil Velikov wrote: > Hi Nanley, > > On 24 August 2015 at 23:49, Nanley Chery wrote: > > On Thu, Aug 20, 2015 at 3:52 PM, Nanley Chery > wrote: > >> > >> On Thu, Aug 20, 2015 at 11:34 AM, Emil Velikov < > emil.l.veli...@gmail.com> > >> wrote: > >>> > >>> 2015-08-12 0:07 GMT+01:00 Nanley Chery : > >>> > From: Nanley Chery > >>> > > >>> > Combine the adjacent cases which have the same GL type in the switch > >>> > statemnt. > >>> > > >>> > Signed-off-by: Nanley Chery > >>> > --- > >>> > src/mesa/main/formats.c | 152 > >>> > ++-- > >>> > 1 file changed, 17 insertions(+), 135 deletions(-) > >>> > > >>> > diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c > >>> > index cb5ad21..9b9d79b 100644 > >>> > --- a/src/mesa/main/formats.c > >>> > +++ b/src/mesa/main/formats.c > >>> > @@ -1005,13 +1005,10 @@ > >>> > _mesa_uncompressed_format_to_type_and_comps(mesa_format format, > >>> > case MESA_FORMAT_R8G8B8X8_UNORM: > >>> > case MESA_FORMAT_B8G8R8X8_UNORM: > >>> > case MESA_FORMAT_X8R8G8B8_UNORM: > >>> > - *datatype = GL_UNSIGNED_BYTE; > >>> > - *comps = 4; > >>> > - return; > >>> > case MESA_FORMAT_BGR_UNORM8: > >>> > case MESA_FORMAT_RGB_UNORM8: > >>> >*datatype = GL_UNSIGNED_BYTE; > >>> > - *comps = 3; > >>> > + *comps = _mesa_format_num_components(format); > >>> With the datatype aside what is stopping us from using a single > >>> _mesa_format_num_components(format) ? > >>> > >> I just checked w/ a gtest and we don't get the same output for the > formats > >> listed below. The "Actual" value is the output of > >> _mesa_format_num_components() and the "Expected" value is the output of > >> _mesa_uncompressed_format_to_type_and_comps(). > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_B4G4R4X4_UNORM > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_B5G5R5X1_UNORM > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_B10G10R10X2_UNORM > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_R10G10B10X2_UNORM > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 0 > >> Expected: comps > >> Which is: 2 > >> MESA_FORMAT_YCBCR > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 0 > >> Expected: comps > >> Which is: 2 > >> MESA_FORMAT_YCBCR_REV > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_RGBX_UNORM16 > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_R8G8B8X8_SNORM > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_RGBX_SNORM16 > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_B8G8R8X8_SRGB > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_X8R8G8B8_SRGB > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_R8G8B8X8_SRGB > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_X8B8G8R8_SRGB > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 2 > >> Expected: comps > >> Which is: 1 > >> MESA_FORMAT_Z32_FLOAT_S8X24_UINT > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_RGBX_FLOAT16 > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_RGBX_FLOAT32 > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_RGBX_UINT8 > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: comps > >> Which is: 4 > >> MESA_FORMAT_RGBX_UINT16 > >> > >> mesa_formats.cpp:59: Failure > >> Value of: _mesa_format_num_components(f) > >> Actual: 3 > >> Expected: co
Re: [Mesa-dev] [PATCH 1/2] nir: Store gl_shader_stage in nir_shader.
The non-TGSI bits and the patch that follows are Reviewed-by: Jason Ekstrand On Fri, Aug 21, 2015 at 7:52 PM, Kenneth Graunke wrote: > This makes it easy for NIR passes to inspect what kind of shader they're > operating on. > > Thanks to Michel Dänzer for helping me figure out where TGSI stores the > shader stage information. > > Signed-off-by: Kenneth Graunke > --- > src/gallium/auxiliary/nir/tgsi_to_nir.c | 25 + > src/glsl/nir/glsl_to_nir.cpp| 2 +- > src/glsl/nir/nir.c | 6 +- > src/glsl/nir/nir.h | 4 > src/mesa/program/prog_to_nir.c | 4 +++- > 5 files changed, 34 insertions(+), 7 deletions(-) > > diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c > b/src/gallium/auxiliary/nir/tgsi_to_nir.c > index 93dfb80..199680d 100644 > --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c > +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c > @@ -1764,6 +1764,21 @@ ttn_add_output_stores(struct ttn_compile *c) > } > } > > +static gl_shader_stage > +tgsi_processor_to_shader_stage(unsigned processor) > +{ > + switch (processor) { > + case TGSI_PROCESSOR_FRAGMENT: return MESA_SHADER_FRAGMENT; > + case TGSI_PROCESSOR_VERTEX:return MESA_SHADER_VERTEX; > + case TGSI_PROCESSOR_GEOMETRY: return MESA_SHADER_GEOMETRY; > + case TGSI_PROCESSOR_TESS_CTRL: return MESA_SHADER_TESS_CTRL; > + case TGSI_PROCESSOR_TESS_EVAL: return MESA_SHADER_TESS_EVAL; > + case TGSI_PROCESSOR_COMPUTE: return MESA_SHADER_COMPUTE; > + default: > + unreachable("invalid TGSI processor"); > + }; > +} > + > struct nir_shader * > tgsi_to_nir(const void *tgsi_tokens, > const nir_shader_compiler_options *options) > @@ -1775,7 +1790,12 @@ tgsi_to_nir(const void *tgsi_tokens, > int ret; > > c = rzalloc(NULL, struct ttn_compile); > - s = nir_shader_create(NULL, options); > + > + tgsi_scan_shader(tgsi_tokens, &scan); > + c->scan = &scan; > + > + s = nir_shader_create(NULL, > tgsi_processor_to_shader_stage(scan.processor), > + options); > > nir_function *func = nir_function_create(s, "main"); > nir_function_overload *overload = nir_function_overload_create(func); > @@ -1784,9 +1804,6 @@ tgsi_to_nir(const void *tgsi_tokens, > nir_builder_init(&c->build, impl); > nir_builder_insert_after_cf_list(&c->build, &impl->body); > > - tgsi_scan_shader(tgsi_tokens, &scan); > - c->scan = &scan; > - > s->num_inputs = scan.file_max[TGSI_FILE_INPUT] + 1; > s->num_uniforms = scan.const_file_max[0] + 1; > s->num_outputs = scan.file_max[TGSI_FILE_OUTPUT] + 1; > diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp > index 913f2f4..f3798dd 100644 > --- a/src/glsl/nir/glsl_to_nir.cpp > +++ b/src/glsl/nir/glsl_to_nir.cpp > @@ -131,7 +131,7 @@ private: > nir_shader * > glsl_to_nir(struct gl_shader *sh, const nir_shader_compiler_options *options) > { > - nir_shader *shader = nir_shader_create(NULL, options); > + nir_shader *shader = nir_shader_create(NULL, sh->Stage, options); > > nir_visitor v1(shader, sh->Stage); > nir_function_visitor v2(&v1); > diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c > index 2f7cbae..1dc7cdd 100644 > --- a/src/glsl/nir/nir.c > +++ b/src/glsl/nir/nir.c > @@ -29,7 +29,9 @@ > #include > > nir_shader * > -nir_shader_create(void *mem_ctx, const nir_shader_compiler_options *options) > +nir_shader_create(void *mem_ctx, > + gl_shader_stage stage, > + const nir_shader_compiler_options *options) > { > nir_shader *shader = ralloc(mem_ctx, nir_shader); > > @@ -49,6 +51,8 @@ nir_shader_create(void *mem_ctx, const > nir_shader_compiler_options *options) > shader->num_outputs = 0; > shader->num_uniforms = 0; > > + shader->stage = stage; > + > return shader; > } > > diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h > index 222a219..31a1ab8 100644 > --- a/src/glsl/nir/nir.h > +++ b/src/glsl/nir/nir.h > @@ -1469,6 +1469,9 @@ typedef struct nir_shader { > > /** the number of uniforms that are only accessed directly */ > unsigned num_direct_uniforms; > + > + /** The shader stage, such as MESA_SHADER_VERTEX. */ > + gl_shader_stage stage; > } nir_shader; > > #define nir_foreach_overload(shader, overload)\ > @@ -1477,6 +1480,7 @@ typedef struct nir_shader { > &(func)->overload_list) > > nir_shader *nir_shader_create(void *mem_ctx, > + gl_shader_stage stage, >const nir_shader_compiler_options *options); > > /** creates a register, including assigning it an index and adding it to the > list */ > diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c > index d54f934..e088578 100644 > --- a/src/mesa/program/prog_to_nir.c > +++ b/src/mesa/program/prog_to_nir.c > @@ -33,6 +33,7 @@ > #include "prog_instruction.h" > #inclu
Re: [Mesa-dev] [PATCH] prog_to_nir: Don't allocate nir_variable with type vec4[0] for uniforms.
Reviewed-by: Jason Ekstrand On Mon, Aug 24, 2015 at 4:39 PM, Kenneth Graunke wrote: > If there are no parameters, we don't need to create a nir_variable to > hold them...and allocating an array of length 0 is pretty bogus. > > Should avoid i965 backend assertions in future patches Jason and I are > working on. > > Signed-off-by: Kenneth Graunke > --- > src/mesa/program/prog_to_nir.c | 18 +++--- > 1 file changed, 11 insertions(+), 7 deletions(-) > > Hey Jason, > > It sounds like the right thing to do is make prog_to_nir stop generating > idiotic shader code. Here's a patch that does that. > > The assert you're removing may still be unnecessary, but it also seems > like a totally reasonable thing for the backend to enforce...so I'd prefer > to leave it... > > --Ken > > diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c > index e088578..29ff638 100644 > --- a/src/mesa/program/prog_to_nir.c > +++ b/src/mesa/program/prog_to_nir.c > @@ -167,6 +167,8 @@ ptn_get_src(struct ptn_compile *c, const struct > prog_src_register *prog_src) > } > /* FALLTHROUGH */ >case PROGRAM_STATE_VAR: { > + assert(c->parameters != NULL); > + > nir_intrinsic_instr *load = > nir_intrinsic_instr_create(b->shader, nir_intrinsic_load_var); > nir_ssa_dest_init(&load->instr, &load->dest, 4, NULL); > @@ -1090,13 +1092,15 @@ prog_to_nir(const struct gl_program *prog, >goto fail; > c->prog = prog; > > - c->parameters = rzalloc(s, nir_variable); > - c->parameters->type = glsl_array_type(glsl_vec4_type(), > -prog->Parameters->NumParameters); > - c->parameters->name = "parameters"; > - c->parameters->data.read_only = true; > - c->parameters->data.mode = nir_var_uniform; > - exec_list_push_tail(&s->uniforms, &c->parameters->node); > + if (prog->Parameters->NumParameters > 0) { > + c->parameters = rzalloc(s, nir_variable); > + c->parameters->type = > + glsl_array_type(glsl_vec4_type(), prog->Parameters->NumParameters); > + c->parameters->name = "parameters"; > + c->parameters->data.read_only = true; > + c->parameters->data.mode = nir_var_uniform; > + exec_list_push_tail(&s->uniforms, &c->parameters->node); > + } > > nir_function *func = nir_function_create(s, "main"); > nir_function_overload *overload = nir_function_overload_create(func); > -- > 2.5.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2] glsl: provide the option of using BFE for unpack builting lowering
This greatly improves generated code, especially for the snorm variants, since it is able to get rid of the lshift/rshift for sext, as well as replacing each shift + mask with a single op. Signed-off-by: Ilia Mirkin --- v1 -> v2: Only use BFE for .yz of a -> uvec4 conversion. src/glsl/ir_builder.cpp| 6 ++ src/glsl/ir_builder.h | 1 + src/glsl/ir_optimization.h | 1 + src/glsl/lower_packing_builtins.cpp| 103 + src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 +- 5 files changed, 100 insertions(+), 14 deletions(-) diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp index cd03859..c9cf124 100644 --- a/src/glsl/ir_builder.cpp +++ b/src/glsl/ir_builder.cpp @@ -567,6 +567,12 @@ csel(operand a, operand b, operand c) } ir_expression * +bitfield_extract(operand a, operand b, operand c) +{ + return expr(ir_triop_bitfield_extract, a, b, c); +} + +ir_expression * bitfield_insert(operand a, operand b, operand c, operand d) { void *mem_ctx = ralloc_parent(a.val); diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h index f76453f..b483ebf 100644 --- a/src/glsl/ir_builder.h +++ b/src/glsl/ir_builder.h @@ -200,6 +200,7 @@ ir_expression *interpolate_at_sample(operand a, operand b); ir_expression *fma(operand a, operand b, operand c); ir_expression *lrp(operand x, operand y, operand a); ir_expression *csel(operand a, operand b, operand c); +ir_expression *bitfield_extract(operand a, operand b, operand c); ir_expression *bitfield_insert(operand a, operand b, operand c, operand d); ir_swizzle *swizzle(operand a, int swizzle, int components); diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index b955874..265b223 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -69,6 +69,7 @@ enum lower_packing_builtins_op { LOWER_UNPACK_UNORM_4x8 = 0x0800, LOWER_PACK_USE_BFI = 0x1000, + LOWER_PACK_USE_BFE = 0x2000, }; bool do_common_optimization(exec_list *ir, bool linked, diff --git a/src/glsl/lower_packing_builtins.cpp b/src/glsl/lower_packing_builtins.cpp index be17e1d..1bd635e 100644 --- a/src/glsl/lower_packing_builtins.cpp +++ b/src/glsl/lower_packing_builtins.cpp @@ -118,6 +118,7 @@ public: *rvalue = split_unpack_half_2x16(op0); break; case LOWER_PACK_UNPACK_NONE: + default: assert(!"not reached"); break; } @@ -307,6 +308,39 @@ private: } /** +* \brief Unpack a uint32 into two int16's. +* +* Specifically each 16-bit value is sign-extended to the full width of an +* int32 on return. +*/ + ir_rvalue * + unpack_uint_to_ivec2(ir_rvalue *uint_rval) + { + assert(uint_rval->type == glsl_type::uint_type); + + if (!(op_mask & LOWER_PACK_USE_BFE)) { + return rshift(lshift(u2i(unpack_uint_to_uvec2(uint_rval)), + constant(16u)), + constant(16u)); + } + + ir_variable *i = factory.make_temp(glsl_type::int_type, + "tmp_unpack_uint_to_ivec2_i"); + factory.emit(assign(i, u2i(uint_rval))); + + /* ivec2 i2; */ + ir_variable *i2 = factory.make_temp(glsl_type::ivec2_type, + "tmp_unpack_uint_to_ivec2_i2"); + + factory.emit(assign(i2, bitfield_extract(i, constant(0), constant(16)), + WRITEMASK_X)); + factory.emit(assign(i2, bitfield_extract(i, constant(16), constant(16)), + WRITEMASK_Y)); + + return deref(i2).val; + } + + /** * \brief Unpack a uint32 into four uint8's. * * Interpret the given uint32 as a uint8 4-tuple where the uint32's least @@ -330,13 +364,23 @@ private: /* u4.x = u & 0xffu; */ factory.emit(assign(u4, bit_and(u, constant(0xffu)), WRITEMASK_X)); - /* u4.y = (u >> 8u) & 0xffu; */ - factory.emit(assign(u4, bit_and(rshift(u, constant(8u)), - constant(0xffu)), WRITEMASK_Y)); - - /* u4.z = (u >> 16u) & 0xffu; */ - factory.emit(assign(u4, bit_and(rshift(u, constant(16u)), - constant(0xffu)), WRITEMASK_Z)); + if (op_mask & LOWER_PACK_USE_BFE) { + /* u4.y = bitfield_extract(u, 8, 8); */ + factory.emit(assign(u4, bitfield_extract(u, constant(8), constant(8)), + WRITEMASK_Y)); + + /* u4.z = bitfield_extract(u, 16, 8); */ + factory.emit(assign(u4, bitfield_extract(u, constant(16), constant(8)), + WRITEMASK_Z)); + } else { + /* u4.y = (u >> 8u) & 0xffu; */ + factory.emit(assign(u4, bit_and(rshift(u, constant(8u)), + constant(0xffu)), WRITEMASK_Y)); + + /* u4.z = (u >> 16u) & 0xffu; */
Re: [Mesa-dev] [PATCH 1/4] r600g: make all scissor states use single atom
On Tue, Aug 25, 2015 at 2:33 PM, Grazvydas Ignotas wrote: > But the original code only did 0, so maybe it's better to do it as a > followup patch, so that functional change is separate from > refactoring? Yeah, no problem. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 5/9] gallium: add new PIPE_CAP_COPY_IMAGE
On Mon, Aug 24, 2015 at 6:50 PM, Marek Olšák wrote: > On Tue, Aug 25, 2015 at 1:04 AM, Brian Paul wrote: > > In principle, all gallium drivers that implement pipe_context:: > > clear_render_target() and clear_depth_stencil() and the right surface > > clear? really? anyway: > Ugh. Another intern was working on GL_ARB_clear_texture. I guess I got my wires crossed that day. I'll fix the comment before committing. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] mesa/formats: refactor by globbing on types in switch statement
Hi Nanley, On 24 August 2015 at 23:49, Nanley Chery wrote: > On Thu, Aug 20, 2015 at 3:52 PM, Nanley Chery wrote: >> >> On Thu, Aug 20, 2015 at 11:34 AM, Emil Velikov >> wrote: >>> >>> 2015-08-12 0:07 GMT+01:00 Nanley Chery : >>> > From: Nanley Chery >>> > >>> > Combine the adjacent cases which have the same GL type in the switch >>> > statemnt. >>> > >>> > Signed-off-by: Nanley Chery >>> > --- >>> > src/mesa/main/formats.c | 152 >>> > ++-- >>> > 1 file changed, 17 insertions(+), 135 deletions(-) >>> > >>> > diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c >>> > index cb5ad21..9b9d79b 100644 >>> > --- a/src/mesa/main/formats.c >>> > +++ b/src/mesa/main/formats.c >>> > @@ -1005,13 +1005,10 @@ >>> > _mesa_uncompressed_format_to_type_and_comps(mesa_format format, >>> > case MESA_FORMAT_R8G8B8X8_UNORM: >>> > case MESA_FORMAT_B8G8R8X8_UNORM: >>> > case MESA_FORMAT_X8R8G8B8_UNORM: >>> > - *datatype = GL_UNSIGNED_BYTE; >>> > - *comps = 4; >>> > - return; >>> > case MESA_FORMAT_BGR_UNORM8: >>> > case MESA_FORMAT_RGB_UNORM8: >>> >*datatype = GL_UNSIGNED_BYTE; >>> > - *comps = 3; >>> > + *comps = _mesa_format_num_components(format); >>> With the datatype aside what is stopping us from using a single >>> _mesa_format_num_components(format) ? >>> >> I just checked w/ a gtest and we don't get the same output for the formats >> listed below. The "Actual" value is the output of >> _mesa_format_num_components() and the "Expected" value is the output of >> _mesa_uncompressed_format_to_type_and_comps(). >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_B4G4R4X4_UNORM >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_B5G5R5X1_UNORM >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_B10G10R10X2_UNORM >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_R10G10B10X2_UNORM >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 0 >> Expected: comps >> Which is: 2 >> MESA_FORMAT_YCBCR >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 0 >> Expected: comps >> Which is: 2 >> MESA_FORMAT_YCBCR_REV >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_RGBX_UNORM16 >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_R8G8B8X8_SNORM >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_RGBX_SNORM16 >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_B8G8R8X8_SRGB >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_X8R8G8B8_SRGB >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_R8G8B8X8_SRGB >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_X8B8G8R8_SRGB >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 2 >> Expected: comps >> Which is: 1 >> MESA_FORMAT_Z32_FLOAT_S8X24_UINT >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_RGBX_FLOAT16 >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_RGBX_FLOAT32 >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_RGBX_UINT8 >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_RGBX_UINT16 >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_RGBX_UINT32 >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_RGBX_SINT8 >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >> Actual: 3 >> Expected: comps >> Which is: 4 >> MESA_FORMAT_RGBX_SINT16 >> >> mesa_formats.cpp:59: Failure >> Value of: _mesa_format_num_components(f) >>
Re: [Mesa-dev] [PATCH] mesa: Allow query of GL_VERTEX_BINDING_BUFFER
On Tue, Aug 25, 2015 at 10:18 AM, Fredrik Höglund wrote: > On Monday 24 August 2015, Brian Paul wrote: >> On 08/19/2015 12:17 PM, Marta Lofstedt wrote: >> > From: Marta Lofstedt >> > >> > According to OpenGL ES 3.1 specification table : 20.2 and >> > OpenGL specification 4.4 table 23.4. The glGetIntegeri_v >> > functions should report the name of the buffer bound >> > when called with GL_VERTEX_BINDING_BUFFER. >> > >> > Signed-off-by: Marta Lofstedt >> > --- >> > src/mesa/main/get.c | 8 >> > 1 file changed, 8 insertions(+) >> > >> > diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c >> > index 307a5ff..ae2d0b7 100644 >> > --- a/src/mesa/main/get.c >> > +++ b/src/mesa/main/get.c >> > @@ -1989,6 +1989,14 @@ find_value_indexed(const char *func, GLenum pname, >> > GLuint index, union value *v) >> > v->value_int = >> > ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride; >> > return TYPE_INT; >> > >> > + case GL_VERTEX_BINDING_BUFFER: >> > + if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles31(ctx)) >> > + goto invalid_enum; >> >> Looks like this enum/query was added in GL 4.3 so don't we need to check >> for that version? > > It was also added in ARB_vertex_attrib_binding, which is always enabled > on desktop GL. So I guess this should just be if (ctx->API == GLES2 && ctx->Version < 31) goto invalid_value; > >> > + if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) >> > + goto invalid_value; >> >> Looks like you have 4 spaces of indentation there instead of 3. >> >> -Brian >> >> > + v->value_int = >> > ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].BufferObj->Name; >> > + return TYPE_INT; >> > + >> > /* ARB_shader_image_load_store */ >> > case GL_IMAGE_BINDING_NAME: { >> > struct gl_texture_object *t; >> > >> >> ___ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/mesa-dev >> > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-users] glClearColor is broken in a weird way if compiled with mangling enabled
Now I have osmesa+llvmpipe with mangling enabled on both Linux and Mac. Is there any way to have it on Windows? With cross compiling, I can have a multi-threaded gdi driver. But not osmesa. Yuzhu - Original Message - From: "Yuzhu Lu" To: "Brian Paul" Cc: mesa-dev@lists.freedesktop.org, mesa-us...@lists.freedesktop.org Sent: Monday, August 24, 2015 5:45:03 PM Subject: Re: [Mesa-dev] [Mesa-users] glClearColor is broken in a weird way if compiled with mangling enabled Ahh. You are righ. That fixes it. Yuzhu - Original Message - From: "Brian Paul" To: "Yuzhu Lu" Cc: mesa-dev@lists.freedesktop.org, mesa-us...@lists.freedesktop.org Sent: Monday, August 24, 2015 8:00:52 PM Subject: Re: [Mesa-users] [Mesa-dev] glClearColor is broken in a weird way if compiled with mangling enabled Looks like your code is not finding any mgl*() prototypes. What #includes do you have? I think you need to #include "GL/gl_mangle.h" and then "GL/gl.h", IIRC. -Brian On 08/24/2015 11:42 AM, Yuzhu Lu wrote: > Sorry. > > Here it is: > > osboxes@osboxes:~/Documents/mesa-demos-8.2.0/src/osdemos$ gcc -o > osdemo32 osdemo32.c -I/usr/local/include/ > -I/home/osboxes/Documents/mesa-demos-8.2.0/src/util/ -L/usr/local/lib/ > -lMangledOSMesa32 > osdemo32.c: In function ‘Init’: > osdemo32.c:122:32: warning: cast to pointer from integer of different > size [-Wint-to-pointer-cast] > printf("GL_RENDERER = %s\n",(const char *) mglGetString(GL_RENDERER)); > ^ > osdemo32.c: In function ‘main’: > osdemo32.c:449:1: warning: format ‘%s’ expects argument of type ‘char > *’, but argument 2 has type ‘int’ [-Wformat=] > printf("Vendor: %s\n", mglGetString(GL_VENDOR)); > ^ > osdemo32.c:450:1: warning: format ‘%s’ expects argument of type ‘char > *’, but argument 2 has type ‘int’ [-Wformat=] > printf("Renderer: %s\n", mglGetString(GL_RENDERER)); > ^ > osdemo32.c:451:1: warning: format ‘%s’ expects argument of type ‘char > *’, but argument 2 has type ‘int’ [-Wformat=] > printf("Version: %s\n", mglGetString(GL_VERSION)); > ^ > osdemo32.c:452:46: warning: cast to pointer from integer of different > size [-Wint-to-pointer-cast] > printf("GL_PROGRAM_ERROR_STRING_ARB: = %s\n",(const char > *)mglGetString(GL_PROGRAM_ERROR_STRING_ARB)); > > > > Yuzhu > > > *From: *"Brian Paul" > *To: *"Yuzhu Lu" > *Cc: *mesa-dev@lists.freedesktop.org, mesa-us...@lists.freedesktop.org > *Sent: *Monday, August 24, 2015 6:07:19 PM > *Subject: *Re: [Mesa-users] [Mesa-dev] glClearColor is broken in a weird > way if compiled with mangling enabled > > On 08/24/2015 10:51 AM, Yuzhu Lu wrote: > > Hi Brian, > > > > It happens for all the configuration I tried. Here is one example: > > > > ./configure --disable-xvmc --disable-glx --disable-dri > > --with-dri-drivers="" --with-gallium-drivers="swrast" > > --enable-texture-float --enable-shared-glapi --disable-egl > > --enable-mangling --with-egl-platforms="" --enable-gallium-osmesa > > --enable-gallium-llvm=yes --disable-llvm-shared-libs > > > > I am not sure this is related. I am using 64bit Ubuntu. > > > > Here are the only warnings I get: > > > > nir/glsl_to_nir.cpp: In member function 'virtual void > > {anonymous}::nir_visitor::visit(ir_call*)': > > nir/glsl_to_nir.cpp:610:73: warning: 'op' may be used uninitialized in > > this function [-Wmaybe-uninitialized] > > nir_intrinsic_instr *instr = nir_intrinsic_instr_create(shader, op); > > > > nir/nir_lower_phis_to_scalar.c: In function 'is_phi_src_scalarizable': > > nir/nir_lower_phis_to_scalar.c:70:14: warning: 'or' of unmatched > > not-equal tests is always 1 > > src_alu->op != nir_op_vec4; > > ^ > > CXX nir/nir_lower_samplers.lo > > nir/nir_lower_samplers.cpp: In function 'void > > lower_sampler(nir_tex_instr*, gl_shader_program*, const gl_program*, > > void*)': > > nir/nir_lower_samplers.cpp:72:9: warning: unused variable 'has_indirect' > > [-Wunused-variable] > > bool has_indirect = false; > > I was asking about the compiler options/warnings when you compile your > mgl application, not Mesa itself. > > -Brian > > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Allow query of GL_VERTEX_BINDING_BUFFER
On Monday 24 August 2015, Brian Paul wrote: > On 08/19/2015 12:17 PM, Marta Lofstedt wrote: > > From: Marta Lofstedt > > > > According to OpenGL ES 3.1 specification table : 20.2 and > > OpenGL specification 4.4 table 23.4. The glGetIntegeri_v > > functions should report the name of the buffer bound > > when called with GL_VERTEX_BINDING_BUFFER. > > > > Signed-off-by: Marta Lofstedt > > --- > > src/mesa/main/get.c | 8 > > 1 file changed, 8 insertions(+) > > > > diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c > > index 307a5ff..ae2d0b7 100644 > > --- a/src/mesa/main/get.c > > +++ b/src/mesa/main/get.c > > @@ -1989,6 +1989,14 @@ find_value_indexed(const char *func, GLenum pname, > > GLuint index, union value *v) > > v->value_int = > > ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride; > > return TYPE_INT; > > > > + case GL_VERTEX_BINDING_BUFFER: > > + if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles31(ctx)) > > + goto invalid_enum; > > Looks like this enum/query was added in GL 4.3 so don't we need to check > for that version? It was also added in ARB_vertex_attrib_binding, which is always enabled on desktop GL. > > + if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) > > + goto invalid_value; > > Looks like you have 4 spaces of indentation there instead of 3. > > -Brian > > > + v->value_int = > > ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].BufferObj->Name; > > + return TYPE_INT; > > + > > /* ARB_shader_image_load_store */ > > case GL_IMAGE_BINDING_NAME: { > > struct gl_texture_object *t; > > > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] freedreno/ir3: fix build breaks due to nir changes
oh, I guess I should have checked mesa list first.. but already pushed fixes for the build breaks before I noticed this.. Btw, you can actually build freedreno on x86 (to at least compile test it).. hint, hint.. BR, -R On Mon, Aug 24, 2015 at 11:43 PM, Jason Ekstrand wrote: > For whatever it's worth, > > Reviewed-by: Jason Ekstrand > > On Mon, Aug 24, 2015 at 8:24 PM, Ilia Mirkin wrote: >> --- >> src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 2 +- >> src/gallium/drivers/freedreno/ir3/ir3_nir.h | 1 + >> 2 files changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c >> b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c >> index 13c395f..071901a 100644 >> --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c >> +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c >> @@ -2312,7 +2312,7 @@ emit_instructions(struct ir3_compile *ctx) >> ctx->ir = ir3_create(ctx->compiler, ninputs, noutputs); >> >> /* Create inputs in first block: */ >> - ctx->block = get_block(ctx, fxn->start_block); >> + ctx->block = get_block(ctx, nir_start_block(fxn)); >> ctx->in_block = ctx->block; >> list_addtail(&ctx->block->node, &ctx->ir->block_list); >> >> diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir.h >> b/src/gallium/drivers/freedreno/ir3/ir3_nir.h >> index f3d3075..ea72726 100644 >> --- a/src/gallium/drivers/freedreno/ir3/ir3_nir.h >> +++ b/src/gallium/drivers/freedreno/ir3/ir3_nir.h >> @@ -30,6 +30,7 @@ >> #define IR3_NIR_H_ >> >> #include "glsl/nir/nir.h" >> +#include "glsl/nir/nir_control_flow.h" >> >> bool ir3_nir_lower_if_else(nir_shader *shader); >> >> -- >> 2.4.6 >> >> ___ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/4] r600g: make all scissor states use single atom
But the original code only did 0, so maybe it's better to do it as a followup patch, so that functional change is separate from refactoring? Gražvydas On Tue, Aug 25, 2015 at 12:30 AM, Marek Olšák wrote: > The "workaround for a missing scissor enable on r600" must be applied > to all scissors, not just 0. That is, if scissor.enable is changed, > all scissors must be marked as dirty. > > Marek > > On Mon, Aug 24, 2015 at 2:24 AM, Grazvydas Ignotas wrote: >> As suggested by Marek Olšák, we can use single atom to track all scissor >> states. This will allow to simplify dirty atom handling later. >> --- >> src/gallium/drivers/r600/evergreen_state.c | 33 ++--- >> src/gallium/drivers/r600/r600_blit.c | 2 +- >> src/gallium/drivers/r600/r600_hw_context.c | 4 ++- >> src/gallium/drivers/r600/r600_pipe.h | 8 +++--- >> src/gallium/drivers/r600/r600_state.c| 43 >> +--- >> src/gallium/drivers/r600/r600_state_common.c | 6 ++-- >> 6 files changed, 60 insertions(+), 36 deletions(-) >> >> diff --git a/src/gallium/drivers/r600/evergreen_state.c >> b/src/gallium/drivers/r600/evergreen_state.c >> index 6a91d47..fbdcc9c 100644 >> --- a/src/gallium/drivers/r600/evergreen_state.c >> +++ b/src/gallium/drivers/r600/evergreen_state.c >> @@ -892,27 +892,39 @@ static void evergreen_set_scissor_states(struct >> pipe_context *ctx, >> const struct pipe_scissor_state >> *state) >> { >> struct r600_context *rctx = (struct r600_context *)ctx; >> + struct r600_scissor_state *rstate = &rctx->scissor; >> int i; >> >> for (i = start_slot; i < start_slot + num_scissors; i++) { >> - rctx->scissor[i].scissor = state[i - start_slot]; >> - r600_mark_atom_dirty(rctx, &rctx->scissor[i].atom); >> + rstate->scissor[i] = state[i - start_slot]; >> + rstate->dirty_mask |= 1 << i; >> } >> + rstate->atom.num_dw = util_bitcount(rstate->dirty_mask) * 4; >> + r600_mark_atom_dirty(rctx, &rstate->atom); >> } >> >> static void evergreen_emit_scissor_state(struct r600_context *rctx, struct >> r600_atom *atom) >> { >> struct radeon_winsys_cs *cs = rctx->b.rings.gfx.cs; >> - struct r600_scissor_state *rstate = (struct r600_scissor_state >> *)atom; >> - struct pipe_scissor_state *state = &rstate->scissor; >> - unsigned offset = rstate->idx * 4 * 2; >> + struct r600_scissor_state *rstate = &rctx->scissor; >> + struct pipe_scissor_state *state; >> + uint32_t dirty_mask; >> + unsigned i, offset; >> uint32_t tl, br; >> >> - evergreen_get_scissor_rect(rctx, state->minx, state->miny, >> state->maxx, state->maxy, &tl, &br); >> + dirty_mask = rstate->dirty_mask; >> + while (dirty_mask != 0) { >> + i = u_bit_scan(&dirty_mask); >> + state = &rstate->scissor[i]; >> + evergreen_get_scissor_rect(rctx, state->minx, state->miny, >> state->maxx, state->maxy, &tl, &br); >> >> - r600_write_context_reg_seq(cs, R_028250_PA_SC_VPORT_SCISSOR_0_TL + >> offset, 2); >> - radeon_emit(cs, tl); >> - radeon_emit(cs, br); >> + offset = i * 4 * 2; >> + r600_write_context_reg_seq(cs, >> R_028250_PA_SC_VPORT_SCISSOR_0_TL + offset, 2); >> + radeon_emit(cs, tl); >> + radeon_emit(cs, br); >> + } >> + rstate->dirty_mask = 0; >> + rstate->atom.num_dw = 0; >> } >> >> /** >> @@ -3484,11 +3496,10 @@ void evergreen_init_state_functions(struct >> r600_context *rctx) >> r600_init_atom(rctx, &rctx->dsa_state.atom, id++, >> r600_emit_cso_state, 0); >> r600_init_atom(rctx, &rctx->poly_offset_state.atom, id++, >> evergreen_emit_polygon_offset, 6); >> r600_init_atom(rctx, &rctx->rasterizer_state.atom, id++, >> r600_emit_cso_state, 0); >> + r600_init_atom(rctx, &rctx->scissor.atom, id++, >> evergreen_emit_scissor_state, 0); >> for (i = 0; i < R600_MAX_VIEWPORTS; i++) { >> r600_init_atom(rctx, &rctx->viewport[i].atom, id++, >> r600_emit_viewport_state, 8); >> - r600_init_atom(rctx, &rctx->scissor[i].atom, id++, >> evergreen_emit_scissor_state, 4); >> rctx->viewport[i].idx = i; >> - rctx->scissor[i].idx = i; >> } >> r600_init_atom(rctx, &rctx->stencil_ref.atom, id++, >> r600_emit_stencil_ref, 4); >> r600_init_atom(rctx, &rctx->vertex_fetch_shader.atom, id++, >> evergreen_emit_vertex_fetch_shader, 5); >> diff --git a/src/gallium/drivers/r600/r600_blit.c >> b/src/gallium/drivers/r600/r600_blit.c >> index 22a0950..6ecb8ee 100644 >> --- a/src/gallium/drivers/r600/r600_blit.c >> +++ b/src/gallium/drivers/r600/r600_blit.c >> @@ -66,7 +66,7 @@ static void r600_blitter_begin(struct pipe_context *ctx, >> enum r600_blitter_op op >> >> if (op &
Re: [Mesa-dev] r600 multiple stream support + one misc debug patch
This patch series is: Reviewed-by: Edward O'Callaghan P.S. thanks for polishing it Dave! -- Edward O'Callaghan edward.ocallag...@koparo.com On Tue, Aug 25, 2015, at 11:18 AM, Dave Airlie wrote: > This adds multiple stream support for ARB_gpu_shader5, and one > other patch. > > It doesn't expose ARB_gpu_shader5 yet, as I think we'd like > to try and get SB support for it into some sort of shape first. > > Dave. > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4] r600g: Use TGSI parse results instead of manually exfiltrating
From: Edward O'Callaghan This makes better use of the work that the TGSI API has done for us. Signed-off-by: Edward O'Callaghan --- src/gallium/drivers/r600/r600_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 009a8f2..c67c464 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1839,7 +1839,7 @@ static int r600_shader_from_tgsi(struct r600_context *rctx, shader->indirect_files = ctx.info.indirect_files; indirect_gprs = ctx.info.indirect_files & ~(1 << TGSI_FILE_CONSTANT); tgsi_parse_init(&ctx.parse, tokens); - ctx.type = ctx.parse.FullHeader.Processor.Processor; + ctx.type = ctx.info.processor; shader->processor_type = ctx.type; ctx.bc->type = shader->processor_type; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/4] r600g: Don't repeat tgsi_scan_shader(), just use result
From: Edward O'Callaghan tgsi_shader_scan() has already happened so just use the results. Signed-off-by: Edward O'Callaghan Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_shader.c | 35 ++ 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index b830479..009a8f2 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1809,7 +1809,6 @@ static int r600_shader_from_tgsi(struct r600_context *rctx, struct tgsi_token *tokens = pipeshader->selector->tokens; struct pipe_stream_output_info so = pipeshader->selector->so; struct tgsi_full_immediate *immediate; - struct tgsi_full_property *property; struct r600_shader_ctx ctx; struct r600_bytecode_output output[32]; unsigned output_done, noutput; @@ -1968,6 +1967,16 @@ static int r600_shader_from_tgsi(struct r600_context *rctx, ctx.nliterals = 0; ctx.literals = NULL; shader->fs_write_all = FALSE; + if (ctx.info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS]) + shader->fs_write_all = TRUE; + + shader->vs_position_window_space = FALSE; + if (ctx.info.properties[TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION]) + shader->vs_position_window_space = TRUE; + + pipeshader->selector->gs_output_prim = ctx.info.properties[TGSI_PROPERTY_GS_OUTPUT_PRIM]; + pipeshader->selector->gs_max_out_vertices = ctx.info.properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES]; + pipeshader->selector->gs_num_invocations = ctx.info.properties[TGSI_PROPERTY_GS_INVOCATIONS]; if (shader->vs_as_gs_a) vs_add_primid_output(&ctx, key.vs.prim_id_out); @@ -1994,31 +2003,7 @@ static int r600_shader_from_tgsi(struct r600_context *rctx, goto out_err; break; case TGSI_TOKEN_TYPE_INSTRUCTION: - break; case TGSI_TOKEN_TYPE_PROPERTY: - property = &ctx.parse.FullToken.FullProperty; - switch (property->Property.PropertyName) { - case TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS: - if (property->u[0].Data == 1) - shader->fs_write_all = TRUE; - break; - case TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION: - if (property->u[0].Data == 1) - shader->vs_position_window_space = TRUE; - break; - case TGSI_PROPERTY_VS_PROHIBIT_UCPS: - /* we don't need this one */ - break; - case TGSI_PROPERTY_GS_OUTPUT_PRIM: - pipeshader->selector->gs_output_prim = property->u[0].Data; - break; - case TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES: - pipeshader->selector->gs_max_out_vertices = property->u[0].Data; - break; - case TGSI_PROPERTY_GS_INVOCATIONS: - pipeshader->selector->gs_num_invocations = property->u[0].Data; - break; - } break; default: R600_ERR("unsupported token type %d\n", ctx.parse.FullToken.Token.Type); -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4] r600g: Move geometry properties state from shader to selector
From: Edward O'Callaghan Signed-off-by: Edward O'Callaghan --- src/gallium/drivers/r600/evergreen_state.c | 16 src/gallium/drivers/r600/r600_pipe.h | 5 + src/gallium/drivers/r600/r600_shader.c | 6 +++--- src/gallium/drivers/r600/r600_shader.h | 4 src/gallium/drivers/r600/r600_state.c| 12 ++-- src/gallium/drivers/r600/r600_state_common.c | 2 +- 6 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 6a91d47..d2c6ce3 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -2143,11 +2143,11 @@ static void evergreen_emit_shader_stages(struct r600_context *rctx, struct r600_ if (state->geom_enable) { uint32_t cut_val; - if (rctx->gs_shader->current->shader.gs_max_out_vertices <= 128) + if (rctx->gs_shader->current->selector->gs_max_out_vertices <= 128) cut_val = V_028A40_GS_CUT_128; - else if (rctx->gs_shader->current->shader.gs_max_out_vertices <= 256) + else if (rctx->gs_shader->current->selector->gs_max_out_vertices <= 256) cut_val = V_028A40_GS_CUT_256; - else if (rctx->gs_shader->current->shader.gs_max_out_vertices <= 512) + else if (rctx->gs_shader->current->selector->gs_max_out_vertices <= 512) cut_val = V_028A40_GS_CUT_512; else cut_val = V_028A40_GS_CUT_1024; @@ -3013,7 +3013,7 @@ void evergreen_update_gs_state(struct pipe_context *ctx, struct r600_pipe_shader struct r600_shader *rshader = &shader->shader; struct r600_shader *cp_shader = &shader->gs_copy_shader->shader; unsigned gsvs_itemsize = - (cp_shader->ring_item_size * rshader->gs_max_out_vertices) >> 2; + (cp_shader->ring_item_size * shader->selector->gs_max_out_vertices) >> 2; r600_init_command_buffer(cb, 64); @@ -3022,14 +3022,14 @@ void evergreen_update_gs_state(struct pipe_context *ctx, struct r600_pipe_shader r600_store_context_reg(cb, R_028AB8_VGT_VTX_CNT_EN, 1); r600_store_context_reg(cb, R_028B38_VGT_GS_MAX_VERT_OUT, - S_028B38_MAX_VERT_OUT(rshader->gs_max_out_vertices)); + S_028B38_MAX_VERT_OUT(shader->selector->gs_max_out_vertices)); r600_store_context_reg(cb, R_028A6C_VGT_GS_OUT_PRIM_TYPE, - r600_conv_prim_to_gs_out(rshader->gs_output_prim)); + r600_conv_prim_to_gs_out(shader->selector->gs_output_prim)); if (rctx->screen->b.info.drm_minor >= 35) { r600_store_context_reg(cb, R_028B90_VGT_GS_INSTANCE_CNT, - S_028B90_CNT(MIN2(rshader->gs_num_invocations, 127)) | - S_028B90_ENABLE(rshader->gs_num_invocations > 0)); + S_028B90_CNT(MIN2(shader->selector->gs_num_invocations, 127)) | + S_028B90_ENABLE(shader->selector->gs_num_invocations > 0)); } r600_store_context_reg_seq(cb, R_02891C_SQ_GS_VERT_ITEMSIZE, 4); r600_store_value(cb, cp_shader->ring_item_size >> 2); diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 384ba80..72f5ab8 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -311,6 +311,11 @@ struct r600_pipe_shader_selector { /* PIPE_SHADER_[VERTEX|FRAGMENT|...] */ unsignedtype; + /* geometry shader properties */ + unsignedgs_output_prim; + unsignedgs_max_out_vertices; + unsignedgs_num_invocations; + unsignednr_ps_max_color_exports; }; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 9d0d76f..b830479 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -2010,13 +2010,13 @@ static int r600_shader_from_tgsi(struct r600_context *rctx, /* we don't need this one */ break; case TGSI_PROPERTY_GS_OUTPUT_PRIM: - shader->gs_output_prim = property->u[0].Data; + pipeshader->selector->gs_output_prim = property->u[0].Data; break; case TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES: - shader->gs_max_out_vertices = property->u[0].Data; + pipeshader->selector->gs_max_out_vertices = property->u[0].Data; break; case TGSI_P
[Mesa-dev] [PATCH 0/4] r600g: Make better use of the TGSI API
From: Edward O'Callaghan Minor cleanups that intend to make better use of the TGSI parser API tgsi_scan_shader(). Edward O'Callaghan (4): r600g: Remove dead assigment to 'gs_input_prim' in shader state r600g: Move geometry properties state from shader to selector r600g: Don't repeat tgsi_scan_shader(), just use result r600g: Use TGSI parse results instead of manually exfiltrating src/gallium/drivers/r600/evergreen_state.c | 16 +-- src/gallium/drivers/r600/r600_pipe.h | 5 src/gallium/drivers/r600/r600_shader.c | 40 src/gallium/drivers/r600/r600_shader.h | 5 src/gallium/drivers/r600/r600_state.c| 12 - src/gallium/drivers/r600/r600_state_common.c | 2 +- 6 files changed, 31 insertions(+), 49 deletions(-) -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] r600g: Remove dead assigment to 'gs_input_prim' in shader state
From: Edward O'Callaghan Note that 'geometry shader properties' should be carried in the selector state over the shader state in any case. Signed-off-by: Edward O'Callaghan --- src/gallium/drivers/r600/r600_shader.c | 3 --- src/gallium/drivers/r600/r600_shader.h | 1 - 2 files changed, 4 deletions(-) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 6cbfd1b..9d0d76f 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -2009,9 +2009,6 @@ static int r600_shader_from_tgsi(struct r600_context *rctx, case TGSI_PROPERTY_VS_PROHIBIT_UCPS: /* we don't need this one */ break; - case TGSI_PROPERTY_GS_INPUT_PRIM: - shader->gs_input_prim = property->u[0].Data; - break; case TGSI_PROPERTY_GS_OUTPUT_PRIM: shader->gs_output_prim = property->u[0].Data; break; diff --git a/src/gallium/drivers/r600/r600_shader.h b/src/gallium/drivers/r600/r600_shader.h index 927bac5..2b99b22 100644 --- a/src/gallium/drivers/r600/r600_shader.h +++ b/src/gallium/drivers/r600/r600_shader.h @@ -79,7 +79,6 @@ struct r600_shader { boolean uses_index_registers; /* geometry shader properties */ - unsignedgs_input_prim; unsignedgs_output_prim; unsignedgs_max_out_vertices; unsignedgs_num_invocations; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 2/2] i965/vec4_nir: Load constants as integers
Hi! Jason, On lun, 2015-08-24 at 10:26 -0700, Jason Ekstrand wrote: > Could you please debase this patch (probably rewrite)? I *think* it > should fix https://bugs.freedesktop.org/show_bug.cgi?id=91716. What > were the shader-db results for it? This V2 of the patch is already rebased/rewritten taking into account the changes made in load_const to use fewer moves, sorry for not having said it explicitly. Because for loading the constants as integers we necessarily need to fix the saturation errors, we would be having Piglit regressions in: "shaders/glsl-clamp-vertex-color.shader_test" and "arb_color_buffer_float-render" tests otherwise, I have applied both patches to collect the shader-db results. Comparing master (commit 529acab22a3e21e0ed0c5243675aec6c0ee27e8f) and the version obtained by applying patches "i965/vec4: Fix saturation errors when coalescing registers" and "i965/vec4_nir: Load constants as integers", we have: * Shader-db results for vec4 on i965 (Haswell): total instructions in shared programs: 6402199 -> 6402200 (0.00%) instructions in affected programs: 81 -> 82 (1.23%) helped:0 HURT: 1 GAINED:0 LOST: 0 Printing the vec4 instructions generated by the hurt program, we can see that this extra instruction is the result of reaching a program where the register coalescing is not possible because saturation is required and the instruction we want to coalesce into is not a MOV (if it were a MOV, we could safely coalesce using the type of the final register, instead of the type of the register to be removed as it is currently done). I am detailing only the pseudo-code for the component x for brevity, the rest of the components would be equivalent: In the master branch, the following vec4 instructions: and vgrf8.0.x:D, vgrf7.:D, 1065353216U mov vgrf9.0.x:D, vgrf8.:D mov.sat m4:F, vgrf9.xyzw:F are reduced by opt_register_coalesce to: and.sat m4.x:D, vgrf7.:D, 1065353216U making the saturation modifier a no-op (type D). With the patches applied, opt_register_coalesce does not coalesce vgrf9, we have an extra mov but the saturation is effective: and vgrf9.0.x:D, vgrf7.:D, 1065353216U mov.sat m4:F, vgrf9.xyzw:F > On Aug 24, 2015 4:51 AM, "Antia Puentes" wrote: > Loads constants using integer as their register type, this is > done > for consistency with the FS backend. > --- > src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp > b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp > > index 632e409..23b2fab 100644 > --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp > +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp > @@ -456,7 +456,7 @@ void > vec4_visitor::nir_emit_load_const(nir_load_const_instr > *instr) > { > dst_reg reg = dst_reg(GRF, alloc.allocate(1)); > - reg.type = BRW_REGISTER_TYPE_F; > + reg.type = BRW_REGISTER_TYPE_D; > > > unsigned remaining = > brw_writemask_for_size(instr->def.num_components); > > @@ -477,7 +477,7 @@ > vec4_visitor::nir_emit_load_const(nir_load_const_instr *instr) >} > >reg.writemask = writemask; > - emit(MOV(reg, src_reg(instr->value.f[i]))); > + emit(MOV(reg, src_reg(instr->value.i[i]))); > > >remaining &= ~writemask; > } > -- > 2.1.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v4 (part2) 53/59] glapi: add ARB_shader_storage_block_buffer_object
On 25 August 2015 at 06:42, Samuel Iglesias Gonsálvez wrote: > On 24/08/15 16:10, Emil Velikov wrote: >> Hi Samuel, Iago, >> >> On 05/08/15 09:30, Iago Toral Quiroga wrote: >>> From: Samuel Iglesias Gonsalvez >>> >>> v2: >>> - Add ShaderStorageBlockBinding to static_data.py >>> >> Why (see comment below) ? >> >> >> v4: >> - Ship ARB_shader_storage_buffer_object.xml in the tarball. >> >> Seems like other patches are also missing v4 revision history :| >> > > We usually send a new version of the patch series when we have not > received more reviews for several days/weeks How about pinging individual patches (or a list in the series cover letter) ? > and we have enough number > of changes in different patches (because of reviews and/or major changes > in master that invalidate our code). > Just do a follow up revision of the said patch(es) ? > For that reason, some of our patches don't have new comments in the > revision history. > Afaics not even one patch in v4 does has revision history. Please don't do that. Another thing you can try is gradually sending patches rather than accumulating X months of work. This way the reviewer(s) will do (almost) all it in one go. >> >>> --- a/src/mapi/glapi/gen/static_data.py >>> +++ b/src/mapi/glapi/gen/static_data.py >>> @@ -1305,6 +1305,7 @@ functions = [ >>> "ShaderBinary", >>> "ShaderSource", >>> "ShaderSourceARB", >>> + "ShaderStorageBlockBinding", >> This list is for functions exported by libGL.so, which imho should not >> change (ever). If there is there a program that depends on this static >> symbol (and the binary drivers expose it), it should be noted in the >> commit message. >> > > This is a new function defined by ARB_shader_storage_buffer_object > specification [0]. > The spec does not say that the function should be statically available (via libGL.so). The OpenGL ABI has some information as to which functions should be available statically/dynamically [1] [1] https://www.opengl.org/registry/ABI/ > I have a test program that uses that function. If I remove the > static_data.py definition, I hit this linker error: > > : undefined reference to `glShaderStorageBlockBinding' > Sounds like a bug in the app. As mentioned by Ian, use libepoxy or alike which will fetch all the symbols using the appropriate method. > So following what how other functions are defined, I added it to > static_data.py. git log shows that the list of functions hasn't changed since day one, while at the same time other extensions were added/enabled in mesa. Hope this answers things from a different angle rather then flocking up a dead horse :) Thanks Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa/texgetimage: fix missing stencil check
Reviewed-by: Marek Olšák Marek On Tue, Aug 25, 2015 at 3:11 AM, Dave Airlie wrote: > From: Dave Airlie > > GetTexImage can read to stencil8 but only from > a stencil or depthstencil textures. > > This fixes a bunch of failures in CTS > GL33-CTS.gtf32.GL3Tests.packed_pixels > > Signed-off-by: Dave Airlie > --- > src/mesa/main/texgetimage.c | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c > index c0ccce3..56f5de1 100644 > --- a/src/mesa/main/texgetimage.c > +++ b/src/mesa/main/texgetimage.c > @@ -1213,6 +1213,13 @@ getteximage_error_check(struct gl_context *ctx, >"%s(format=GL_STENCIL_INDEX)", caller); >return true; > } > + else if (_mesa_is_stencil_format(format) > + && !_mesa_is_depthstencil_format(baseFormat) > + && !_mesa_is_stencil_format(baseFormat)) { > + _mesa_error(ctx, GL_INVALID_OPERATION, > + "%s(format mismatch)", caller); > + return true; > + } > else if (_mesa_is_ycbcr_format(format) > && !_mesa_is_ycbcr_format(baseFormat)) { >_mesa_error(ctx, GL_INVALID_OPERATION, > -- > 2.4.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v4 (part2) 53/59] glapi: add ARB_shader_storage_block_buffer_object
On 08/24/2015 10:53 PM, Ilia Mirkin wrote: > On Tue, Aug 25, 2015 at 1:42 AM, Samuel Iglesias Gonsálvez > wrote: >> This is a new function defined by ARB_shader_storage_buffer_object >> specification [0]. >> >> I have a test program that uses that function. If I remove the >> static_data.py definition, I hit this linker error: >> >> : undefined reference to `glShaderStorageBlockBinding' > > Hrm, I was about to tell you that libGL.so isn't supposed to expose > any of those, but... It's not. > $ nm -D /usr/lib/libGL.so | grep TexStorage > 0006b760 T glTexStorage1D > 0006b780 T glTexStorage2D > 0006ba00 T glTexStorage2DMultisample > 0006b7a0 T glTexStorage3D > 0006ba20 T glTexStorage3DMultisample > > $ nm -D /usr/lib/opengl/nvidia/lib/libGL.so | grep TexStorage > 000e0a80 T glTexStorage1D > 000f2f60 T glTexStorage1DEXT > 000e0ac0 T glTexStorage2D > 000f2fa0 T glTexStorage2DEXT > 000e1440 T glTexStorage2DMultisample > 000e0b00 T glTexStorage3D > 000f2fe0 T glTexStorage3DEXT > 000e1480 T glTexStorage3DMultisample > 000f56e0 T glTexStorage3DMultisampleOES > > wtf? I thought the whole point of Ian's thing was to not export that > stuff that we weren't supposed to be exporting. [And yeah, I also > tried it on a libGL built from master... same thing.] Is it because we > had been messing up for so long and he didn't want to break the ABI? Right. When I made changes in this area a few months ago I was just trying to prevent additional functions from leaking out. > Either way, your application needs to get its > glShaderStorageBlockBinding pointer from *GetProcAddress... Correct. If the test program is in piglit, the piglit infrastructure should "just work." Otherwise I'd suggest libepoxy or similar. > -ilia > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev