Re: [Mesa-dev] [PATCH 14/20] mesa: Add non-normalized formats support for ubyte packing functions
On Thu, 2014-11-20 at 08:15 +0100, Samuel Iglesias Gonsálvez wrote: On Tue, 2014-11-18 at 11:08 -0800, Jason Ekstrand wrote: On Tue, Nov 18, 2014 at 12:44 AM, Iago Toral Quiroga ito...@igalia.com wrote: From: Samuel Iglesias Gonsalvez sigles...@igalia.com Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com --- src/mesa/main/format_pack.c.mako | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/format_pack.c.mako b/src/mesa/main/format_pack.c.mako index b9f4656..97adf6e 100644 --- a/src/mesa/main/format_pack.c.mako +++ b/src/mesa/main/format_pack.c.mako @@ -84,7 +84,15 @@ pack_ubyte_${f.short_name()}(const GLubyte src[4], void *dst) %endif ${channel_datatype(c)} ${c.name} = - %if c.type == parser.UNSIGNED: + %if not f.is_normalized(): + %if c.type == parser.FLOAT and c.size == 32: +UBYTE_TO_FLOAT(src[${i}]); + %elif c.type == parser.FLOAT and c.size == 16: +_mesa_float_to_half(UBYTE_TO_FLOAT(src[${i}])); Same question here as in the previous patch. Why are we using UBYTE_TO_FLOAT? This is what current format_pack.c is doing for those formats and some piglit tests complain if it is not there. Jason, this looks correct to me: we are packing from an ubyte type to a half float type, so first we need to convert from ubyte to float and then downgrade the float to a half float, we don't currently have means to convert directly from an ubyte to a half float, right? Iago + %else: +(${channel_datatype(c)}) src[${i}]; + %endif + %elif c.type == parser.UNSIGNED: %if f.colorspace == 'srgb' and c.name in 'rgb': util_format_linear_to_srgb_8unorm(src[${i}]); %else: -- 1.9.1 ___ 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 14/20] mesa: Add non-normalized formats support for ubyte packing functions
On Thu, 2014-11-20 at 09:55 +0100, Iago Toral wrote: On Thu, 2014-11-20 at 08:15 +0100, Samuel Iglesias Gonsálvez wrote: On Tue, 2014-11-18 at 11:08 -0800, Jason Ekstrand wrote: On Tue, Nov 18, 2014 at 12:44 AM, Iago Toral Quiroga ito...@igalia.com wrote: From: Samuel Iglesias Gonsalvez sigles...@igalia.com Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com --- src/mesa/main/format_pack.c.mako | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/format_pack.c.mako b/src/mesa/main/format_pack.c.mako index b9f4656..97adf6e 100644 --- a/src/mesa/main/format_pack.c.mako +++ b/src/mesa/main/format_pack.c.mako @@ -84,7 +84,15 @@ pack_ubyte_${f.short_name()}(const GLubyte src[4], void *dst) %endif ${channel_datatype(c)} ${c.name} = - %if c.type == parser.UNSIGNED: + %if not f.is_normalized(): + %if c.type == parser.FLOAT and c.size == 32: +UBYTE_TO_FLOAT(src[${i}]); + %elif c.type == parser.FLOAT and c.size == 16: +_mesa_float_to_half(UBYTE_TO_FLOAT(src[${i}])); Same question here as in the previous patch. Why are we using UBYTE_TO_FLOAT? This is what current format_pack.c is doing for those formats and some piglit tests complain if it is not there. Jason, this looks correct to me: we are packing from an ubyte type to a half float type, so first we need to convert from ubyte to float and then downgrade the float to a half float, we don't currently have means to convert directly from an ubyte to a half float, right? Iago Notice that we are converting from ubyte type source to float formats, hence the use of UBYTE_TO_FLOAT(). I'm going to split the conditions in two (one for converting to non integer formats, other for non normalized integer formats) to make it clearer. Sam + %else: +(${channel_datatype(c)}) src[${i}]; + %endif + %elif c.type == parser.UNSIGNED: %if f.colorspace == 'srgb' and c.name in 'rgb': util_format_linear_to_srgb_8unorm(src[${i}]); %else: -- 1.9.1 ___ 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 signature.asc Description: This is a digitally signed message part ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 14/20] mesa: Add non-normalized formats support for ubyte packing functions
On Thu, 2014-11-20 at 12:14 +0100, Samuel Iglesias Gonsálvez wrote: On Thu, 2014-11-20 at 09:55 +0100, Iago Toral wrote: On Thu, 2014-11-20 at 08:15 +0100, Samuel Iglesias Gonsálvez wrote: On Tue, 2014-11-18 at 11:08 -0800, Jason Ekstrand wrote: On Tue, Nov 18, 2014 at 12:44 AM, Iago Toral Quiroga ito...@igalia.com wrote: From: Samuel Iglesias Gonsalvez sigles...@igalia.com Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com --- src/mesa/main/format_pack.c.mako | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/format_pack.c.mako b/src/mesa/main/format_pack.c.mako index b9f4656..97adf6e 100644 --- a/src/mesa/main/format_pack.c.mako +++ b/src/mesa/main/format_pack.c.mako @@ -84,7 +84,15 @@ pack_ubyte_${f.short_name()}(const GLubyte src[4], void *dst) %endif ${channel_datatype(c)} ${c.name} = - %if c.type == parser.UNSIGNED: + %if not f.is_normalized(): + %if c.type == parser.FLOAT and c.size == 32: +UBYTE_TO_FLOAT(src[${i}]); + %elif c.type == parser.FLOAT and c.size == 16: +_mesa_float_to_half(UBYTE_TO_FLOAT(src[${i}])); Same question here as in the previous patch. Why are we using UBYTE_TO_FLOAT? This is what current format_pack.c is doing for those formats and some piglit tests complain if it is not there. Jason, this looks correct to me: we are packing from an ubyte type to a half float type, so first we need to convert from ubyte to float and then downgrade the float to a half float, we don't currently have means to convert directly from an ubyte to a half float, right? Iago Notice that we are converting from ubyte type source to float formats, hence the use of UBYTE_TO_FLOAT(). I'm going to split the conditions in two (one for converting to non integer formats, other for non normalized integer formats) to make it clearer. Sam OK, forget all what we said here. I see your point: we are adding a float conversion (using UBYTE_TO_FLOAT macro) when it is already covered later. I'm going to rewrite this patch. Sorry for the noise. Sam + %else: +(${channel_datatype(c)}) src[${i}]; + %endif + %elif c.type == parser.UNSIGNED: %if f.colorspace == 'srgb' and c.name in 'rgb': util_format_linear_to_srgb_8unorm(src[${i}]); %else: -- 1.9.1 ___ 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 signature.asc Description: This is a digitally signed message part ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 14/20] mesa: Add non-normalized formats support for ubyte packing functions
On Tue, 2014-11-18 at 11:08 -0800, Jason Ekstrand wrote: On Tue, Nov 18, 2014 at 12:44 AM, Iago Toral Quiroga ito...@igalia.com wrote: From: Samuel Iglesias Gonsalvez sigles...@igalia.com Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com --- src/mesa/main/format_pack.c.mako | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/format_pack.c.mako b/src/mesa/main/format_pack.c.mako index b9f4656..97adf6e 100644 --- a/src/mesa/main/format_pack.c.mako +++ b/src/mesa/main/format_pack.c.mako @@ -84,7 +84,15 @@ pack_ubyte_${f.short_name()}(const GLubyte src[4], void *dst) %endif ${channel_datatype(c)} ${c.name} = - %if c.type == parser.UNSIGNED: + %if not f.is_normalized(): + %if c.type == parser.FLOAT and c.size == 32: +UBYTE_TO_FLOAT(src[${i}]); + %elif c.type == parser.FLOAT and c.size == 16: +_mesa_float_to_half(UBYTE_TO_FLOAT(src[${i}])); Same question here as in the previous patch. Why are we using UBYTE_TO_FLOAT? This is what current format_pack.c is doing for those formats and some piglit tests complain if it is not there. Sam + %else: +(${channel_datatype(c)}) src[${i}]; + %endif + %elif c.type == parser.UNSIGNED: %if f.colorspace == 'srgb' and c.name in 'rgb': util_format_linear_to_srgb_8unorm(src[${i}]); %else: -- 1.9.1 ___ 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 signature.asc Description: This is a digitally signed message part ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 14/20] mesa: Add non-normalized formats support for ubyte packing functions
From: Samuel Iglesias Gonsalvez sigles...@igalia.com Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com --- src/mesa/main/format_pack.c.mako | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/format_pack.c.mako b/src/mesa/main/format_pack.c.mako index b9f4656..97adf6e 100644 --- a/src/mesa/main/format_pack.c.mako +++ b/src/mesa/main/format_pack.c.mako @@ -84,7 +84,15 @@ pack_ubyte_${f.short_name()}(const GLubyte src[4], void *dst) %endif ${channel_datatype(c)} ${c.name} = - %if c.type == parser.UNSIGNED: + %if not f.is_normalized(): + %if c.type == parser.FLOAT and c.size == 32: +UBYTE_TO_FLOAT(src[${i}]); + %elif c.type == parser.FLOAT and c.size == 16: +_mesa_float_to_half(UBYTE_TO_FLOAT(src[${i}])); + %else: +(${channel_datatype(c)}) src[${i}]; + %endif + %elif c.type == parser.UNSIGNED: %if f.colorspace == 'srgb' and c.name in 'rgb': util_format_linear_to_srgb_8unorm(src[${i}]); %else: -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 14/20] mesa: Add non-normalized formats support for ubyte packing functions
On Tue, Nov 18, 2014 at 12:44 AM, Iago Toral Quiroga ito...@igalia.com wrote: From: Samuel Iglesias Gonsalvez sigles...@igalia.com Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com --- src/mesa/main/format_pack.c.mako | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/format_pack.c.mako b/src/mesa/main/format_pack.c.mako index b9f4656..97adf6e 100644 --- a/src/mesa/main/format_pack.c.mako +++ b/src/mesa/main/format_pack.c.mako @@ -84,7 +84,15 @@ pack_ubyte_${f.short_name()}(const GLubyte src[4], void *dst) %endif ${channel_datatype(c)} ${c.name} = - %if c.type == parser.UNSIGNED: + %if not f.is_normalized(): + %if c.type == parser.FLOAT and c.size == 32: +UBYTE_TO_FLOAT(src[${i}]); + %elif c.type == parser.FLOAT and c.size == 16: +_mesa_float_to_half(UBYTE_TO_FLOAT(src[${i}])); Same question here as in the previous patch. Why are we using UBYTE_TO_FLOAT? + %else: +(${channel_datatype(c)}) src[${i}]; + %endif + %elif c.type == parser.UNSIGNED: %if f.colorspace == 'srgb' and c.name in 'rgb': util_format_linear_to_srgb_8unorm(src[${i}]); %else: -- 1.9.1 ___ 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