Re: [Mesa-dev] [PATCH 02/29] mesa: Set normalized=true for float array formats.

2014-11-21 Thread Jason Ekstrand
On Thu, Nov 20, 2014 at 11:33 PM, Iago Toral ito...@igalia.com wrote:

 On Thu, 2014-11-20 at 10:40 -0800, Jason Ekstrand wrote:
 
 
  On Wed, Nov 19, 2014 at 11:24 PM, Iago Toral ito...@igalia.com
  wrote:
  Hi Jason,
 
  we discussed this some weeks ago actually, the detailed
  explanation is
  here:
  https://bugs.freedesktop.org/show_bug.cgi?id=84566#c5
 
  the short answer is that this is necessary because there is a
  normalized
  parameter to _mesa_swizzle_and_convert, and when we deal with
  float
  types we want to set this to true.
 
 
  I went back and looked at that and I thought the result of the
  discussion was to fix the assert in mesa_format_convert and compute
  the normalized parameter correctly.  After that, I thought this
  shouldn't be strictly needed.  It may still be a good idea for
  consistency, but I want to make sure we're doing the right thing in
  mesa_format_convert

 With this patch, in mesa_format_convert we simply take the normalized
 value for mesa_swizzle_and_convert from the normalized field of the
 array format, since we make sure that all float array formats will have
 this set to 1.

 Without this patch we would have to do something like this (pseudocode)
 in mesa_format_convert:

 normalized = array_format.normalized || array_format.type == FLOAT ||
  array_format.type == HALF_FLOAT;

 We can do it either way, I just think that the latter is a bit
 inconsistent because:

 a) why would we want to generate array formats with a normalized setting
 of 0 if we then want to set normalized to true when they are involved?.

 b) Other parts of Mesa check if a format is normalized by doing
 normalized = !_mesa_is_enum_format_integer(srcFormat), which will make
 float types normalized.

 Iago


That's fine.  I just wanted to make sure that this wasn't hiding some
fundamental breakage of the mesa_format_convert function.
--Jason



  Iago
 
  On Wed, 2014-11-19 at 11:31 -0800, Jason Ekstrand wrote:
   I'm not sure what I think about this.  Does it make a
  functional
   change other than consistancy?
  
   --Jason
  
  
   On Tue, Nov 18, 2014 at 1:23 AM, Iago Toral Quiroga
   ito...@igalia.com wrote:
   In order to check if a format is normalized Mesa
  does
   something like this:
   normalized = !
  _mesa_is_enum_format_integer(srcFormat);
  
   So all float types will set normalized to true.
  Since our
   mesa_array_format
   includes a normalized flag for each type we want to
  make it
   consistent with
   this.
   ---
src/mesa/main/format_info.py | 3 ++-
src/mesa/main/format_utils.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
  
   diff --git a/src/mesa/main/format_info.py
   b/src/mesa/main/format_info.py
   index 315767d..d4bc276 100644
   --- a/src/mesa/main/format_info.py
   +++ b/src/mesa/main/format_info.py
   @@ -220,9 +220,10 @@ for fmat in formats:
   print '  {{ {0} }},'.format(',
  '.join(map(str,
   fmat.swizzle)))
   if fmat.is_array() and fmat.colorspace in
  ('rgb', 'srgb'):
  chan = fmat.array_element()
   +  norm = chan.norm or chan.type == parser.FLOAT
  print '   {0} ,'.format(',
  '.join([
 get_array_format_datatype(chan),
   - str(int(chan.norm)),
   + str(int(norm)),
 str(len(fmat.channels)),
 str(fmat.swizzle[0]),
 str(fmat.swizzle[1]),
   diff --git a/src/mesa/main/format_utils.c
   b/src/mesa/main/format_utils.c
   index c3815cb..1d65f2b 100644
   --- a/src/mesa/main/format_utils.c
   +++ b/src/mesa/main/format_utils.c
   @@ -30,7 +30,7 @@
  
mesa_array_format RGBA_FLOAT = {{
   MESA_ARRAY_FORMAT_TYPE_FLOAT,
   -   0,
   +   1,
   4,
   0, 1, 2, 3,
   0, 1
   --
   1.9.1
  
   ___
   mesa-dev mailing list
   mesa-dev@lists.freedesktop.org
  
   http://lists.freedesktop.org/mailman/listinfo/mesa-dev
  

Re: [Mesa-dev] [PATCH 02/29] mesa: Set normalized=true for float array formats.

2014-11-20 Thread Jason Ekstrand
On Wed, Nov 19, 2014 at 11:24 PM, Iago Toral ito...@igalia.com wrote:

 Hi Jason,

 we discussed this some weeks ago actually, the detailed explanation is
 here:
 https://bugs.freedesktop.org/show_bug.cgi?id=84566#c5

 the short answer is that this is necessary because there is a normalized
 parameter to _mesa_swizzle_and_convert, and when we deal with float
 types we want to set this to true.


I went back and looked at that and I thought the result of the discussion
was to fix the assert in mesa_format_convert and compute the normalized
parameter correctly.  After that, I thought this shouldn't be strictly
needed.  It may still be a good idea for consistency, but I want to make
sure we're doing the right thing in mesa_format_convert
--Jason


 Iago

 On Wed, 2014-11-19 at 11:31 -0800, Jason Ekstrand wrote:
  I'm not sure what I think about this.  Does it make a functional
  change other than consistancy?
 
  --Jason
 
 
  On Tue, Nov 18, 2014 at 1:23 AM, Iago Toral Quiroga
  ito...@igalia.com wrote:
  In order to check if a format is normalized Mesa does
  something like this:
  normalized = !_mesa_is_enum_format_integer(srcFormat);
 
  So all float types will set normalized to true. Since our
  mesa_array_format
  includes a normalized flag for each type we want to make it
  consistent with
  this.
  ---
   src/mesa/main/format_info.py | 3 ++-
   src/mesa/main/format_utils.c | 2 +-
   2 files changed, 3 insertions(+), 2 deletions(-)
 
  diff --git a/src/mesa/main/format_info.py
  b/src/mesa/main/format_info.py
  index 315767d..d4bc276 100644
  --- a/src/mesa/main/format_info.py
  +++ b/src/mesa/main/format_info.py
  @@ -220,9 +220,10 @@ for fmat in formats:
  print '  {{ {0} }},'.format(', '.join(map(str,
  fmat.swizzle)))
  if fmat.is_array() and fmat.colorspace in ('rgb', 'srgb'):
 chan = fmat.array_element()
  +  norm = chan.norm or chan.type == parser.FLOAT
 print '   {0} ,'.format(', '.join([
get_array_format_datatype(chan),
  - str(int(chan.norm)),
  + str(int(norm)),
str(len(fmat.channels)),
str(fmat.swizzle[0]),
str(fmat.swizzle[1]),
  diff --git a/src/mesa/main/format_utils.c
  b/src/mesa/main/format_utils.c
  index c3815cb..1d65f2b 100644
  --- a/src/mesa/main/format_utils.c
  +++ b/src/mesa/main/format_utils.c
  @@ -30,7 +30,7 @@
 
   mesa_array_format RGBA_FLOAT = {{
  MESA_ARRAY_FORMAT_TYPE_FLOAT,
  -   0,
  +   1,
  4,
  0, 1, 2, 3,
  0, 1
  --
  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


Re: [Mesa-dev] [PATCH 02/29] mesa: Set normalized=true for float array formats.

2014-11-20 Thread Iago Toral
On Thu, 2014-11-20 at 10:40 -0800, Jason Ekstrand wrote:
 
 
 On Wed, Nov 19, 2014 at 11:24 PM, Iago Toral ito...@igalia.com
 wrote:
 Hi Jason,
 
 we discussed this some weeks ago actually, the detailed
 explanation is
 here:
 https://bugs.freedesktop.org/show_bug.cgi?id=84566#c5
 
 the short answer is that this is necessary because there is a
 normalized
 parameter to _mesa_swizzle_and_convert, and when we deal with
 float
 types we want to set this to true.
 
 
 I went back and looked at that and I thought the result of the
 discussion was to fix the assert in mesa_format_convert and compute
 the normalized parameter correctly.  After that, I thought this
 shouldn't be strictly needed.  It may still be a good idea for
 consistency, but I want to make sure we're doing the right thing in
 mesa_format_convert

With this patch, in mesa_format_convert we simply take the normalized
value for mesa_swizzle_and_convert from the normalized field of the
array format, since we make sure that all float array formats will have
this set to 1.

Without this patch we would have to do something like this (pseudocode)
in mesa_format_convert:

normalized = array_format.normalized || array_format.type == FLOAT ||  
 array_format.type == HALF_FLOAT;

We can do it either way, I just think that the latter is a bit
inconsistent because:

a) why would we want to generate array formats with a normalized setting
of 0 if we then want to set normalized to true when they are involved?.

b) Other parts of Mesa check if a format is normalized by doing
normalized = !_mesa_is_enum_format_integer(srcFormat), which will make
float types normalized.

Iago

 Iago
 
 On Wed, 2014-11-19 at 11:31 -0800, Jason Ekstrand wrote:
  I'm not sure what I think about this.  Does it make a
 functional
  change other than consistancy?
 
  --Jason
 
 
  On Tue, Nov 18, 2014 at 1:23 AM, Iago Toral Quiroga
  ito...@igalia.com wrote:
  In order to check if a format is normalized Mesa
 does
  something like this:
  normalized = !
 _mesa_is_enum_format_integer(srcFormat);
 
  So all float types will set normalized to true.
 Since our
  mesa_array_format
  includes a normalized flag for each type we want to
 make it
  consistent with
  this.
  ---
   src/mesa/main/format_info.py | 3 ++-
   src/mesa/main/format_utils.c | 2 +-
   2 files changed, 3 insertions(+), 2 deletions(-)
 
  diff --git a/src/mesa/main/format_info.py
  b/src/mesa/main/format_info.py
  index 315767d..d4bc276 100644
  --- a/src/mesa/main/format_info.py
  +++ b/src/mesa/main/format_info.py
  @@ -220,9 +220,10 @@ for fmat in formats:
  print '  {{ {0} }},'.format(',
 '.join(map(str,
  fmat.swizzle)))
  if fmat.is_array() and fmat.colorspace in
 ('rgb', 'srgb'):
 chan = fmat.array_element()
  +  norm = chan.norm or chan.type == parser.FLOAT
 print '   {0} ,'.format(',
 '.join([
get_array_format_datatype(chan),
  - str(int(chan.norm)),
  + str(int(norm)),
str(len(fmat.channels)),
str(fmat.swizzle[0]),
str(fmat.swizzle[1]),
  diff --git a/src/mesa/main/format_utils.c
  b/src/mesa/main/format_utils.c
  index c3815cb..1d65f2b 100644
  --- a/src/mesa/main/format_utils.c
  +++ b/src/mesa/main/format_utils.c
  @@ -30,7 +30,7 @@
 
   mesa_array_format RGBA_FLOAT = {{
  MESA_ARRAY_FORMAT_TYPE_FLOAT,
  -   0,
  +   1,
  4,
  0, 1, 2, 3,
  0, 1
  --
  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


Re: [Mesa-dev] [PATCH 02/29] mesa: Set normalized=true for float array formats.

2014-11-19 Thread Jason Ekstrand
I'm not sure what I think about this.  Does it make a functional change
other than consistancy?
--Jason

On Tue, Nov 18, 2014 at 1:23 AM, Iago Toral Quiroga ito...@igalia.com
wrote:

 In order to check if a format is normalized Mesa does something like this:
 normalized = !_mesa_is_enum_format_integer(srcFormat);

 So all float types will set normalized to true. Since our mesa_array_format
 includes a normalized flag for each type we want to make it consistent with
 this.
 ---
  src/mesa/main/format_info.py | 3 ++-
  src/mesa/main/format_utils.c | 2 +-
  2 files changed, 3 insertions(+), 2 deletions(-)

 diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py
 index 315767d..d4bc276 100644
 --- a/src/mesa/main/format_info.py
 +++ b/src/mesa/main/format_info.py
 @@ -220,9 +220,10 @@ for fmat in formats:
 print '  {{ {0} }},'.format(', '.join(map(str, fmat.swizzle)))
 if fmat.is_array() and fmat.colorspace in ('rgb', 'srgb'):
chan = fmat.array_element()
 +  norm = chan.norm or chan.type == parser.FLOAT
print '   {0} ,'.format(', '.join([
   get_array_format_datatype(chan),
 - str(int(chan.norm)),
 + str(int(norm)),
   str(len(fmat.channels)),
   str(fmat.swizzle[0]),
   str(fmat.swizzle[1]),
 diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c
 index c3815cb..1d65f2b 100644
 --- a/src/mesa/main/format_utils.c
 +++ b/src/mesa/main/format_utils.c
 @@ -30,7 +30,7 @@

  mesa_array_format RGBA_FLOAT = {{
 MESA_ARRAY_FORMAT_TYPE_FLOAT,
 -   0,
 +   1,
 4,
 0, 1, 2, 3,
 0, 1
 --
 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


Re: [Mesa-dev] [PATCH 02/29] mesa: Set normalized=true for float array formats.

2014-11-19 Thread Iago Toral
Hi Jason,

we discussed this some weeks ago actually, the detailed explanation is
here:
https://bugs.freedesktop.org/show_bug.cgi?id=84566#c5

the short answer is that this is necessary because there is a normalized
parameter to _mesa_swizzle_and_convert, and when we deal with float
types we want to set this to true.

Iago

On Wed, 2014-11-19 at 11:31 -0800, Jason Ekstrand wrote:
 I'm not sure what I think about this.  Does it make a functional
 change other than consistancy?
 
 --Jason
 
 
 On Tue, Nov 18, 2014 at 1:23 AM, Iago Toral Quiroga
 ito...@igalia.com wrote:
 In order to check if a format is normalized Mesa does
 something like this:
 normalized = !_mesa_is_enum_format_integer(srcFormat);
 
 So all float types will set normalized to true. Since our
 mesa_array_format
 includes a normalized flag for each type we want to make it
 consistent with
 this.
 ---
  src/mesa/main/format_info.py | 3 ++-
  src/mesa/main/format_utils.c | 2 +-
  2 files changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/src/mesa/main/format_info.py
 b/src/mesa/main/format_info.py
 index 315767d..d4bc276 100644
 --- a/src/mesa/main/format_info.py
 +++ b/src/mesa/main/format_info.py
 @@ -220,9 +220,10 @@ for fmat in formats:
 print '  {{ {0} }},'.format(', '.join(map(str,
 fmat.swizzle)))
 if fmat.is_array() and fmat.colorspace in ('rgb', 'srgb'):
chan = fmat.array_element()
 +  norm = chan.norm or chan.type == parser.FLOAT
print '   {0} ,'.format(', '.join([
   get_array_format_datatype(chan),
 - str(int(chan.norm)),
 + str(int(norm)),
   str(len(fmat.channels)),
   str(fmat.swizzle[0]),
   str(fmat.swizzle[1]),
 diff --git a/src/mesa/main/format_utils.c
 b/src/mesa/main/format_utils.c
 index c3815cb..1d65f2b 100644
 --- a/src/mesa/main/format_utils.c
 +++ b/src/mesa/main/format_utils.c
 @@ -30,7 +30,7 @@
 
  mesa_array_format RGBA_FLOAT = {{
 MESA_ARRAY_FORMAT_TYPE_FLOAT,
 -   0,
 +   1,
 4,
 0, 1, 2, 3,
 0, 1
 --
 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] [PATCH 02/29] mesa: Set normalized=true for float array formats.

2014-11-18 Thread Iago Toral Quiroga
In order to check if a format is normalized Mesa does something like this:
normalized = !_mesa_is_enum_format_integer(srcFormat);

So all float types will set normalized to true. Since our mesa_array_format
includes a normalized flag for each type we want to make it consistent with
this.
---
 src/mesa/main/format_info.py | 3 ++-
 src/mesa/main/format_utils.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py
index 315767d..d4bc276 100644
--- a/src/mesa/main/format_info.py
+++ b/src/mesa/main/format_info.py
@@ -220,9 +220,10 @@ for fmat in formats:
print '  {{ {0} }},'.format(', '.join(map(str, fmat.swizzle)))
if fmat.is_array() and fmat.colorspace in ('rgb', 'srgb'):
   chan = fmat.array_element()
+  norm = chan.norm or chan.type == parser.FLOAT
   print '   {0} ,'.format(', '.join([
  get_array_format_datatype(chan),
- str(int(chan.norm)),
+ str(int(norm)),
  str(len(fmat.channels)),
  str(fmat.swizzle[0]),
  str(fmat.swizzle[1]),
diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c
index c3815cb..1d65f2b 100644
--- a/src/mesa/main/format_utils.c
+++ b/src/mesa/main/format_utils.c
@@ -30,7 +30,7 @@
 
 mesa_array_format RGBA_FLOAT = {{
MESA_ARRAY_FORMAT_TYPE_FLOAT,
-   0,
+   1,
4,
0, 1, 2, 3,
0, 1
-- 
1.9.1

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