Re: [Mesa-dev] [PATCH 2/4] gallium: add new properties for clip and cull distance usage

2015-10-20 Thread Roland Scheidegger
Am 20.10.2015 um 15:40 schrieb Marek Olšák:
> On Tue, Oct 20, 2015 at 3:25 PM, Roland Scheidegger  
> wrote:
>> Am 19.10.2015 um 23:44 schrieb Marek Olšák:
>>> On Mon, Oct 19, 2015 at 11:31 PM, Roland Scheidegger  
>>> wrote:
 Yes, but I still don't see much change from getting this information
 from the property rather than how tgsi_scan does it now, which is by
 just using the usage mask from the output declaration. So the writes
 shouldn't have to be analyzed.
 (There's also a slight change in patch 4/4, namely these outputs
 absolutely must be in order (xyzw) now as usage mask is determined
 solely by the number of values. That might already have been the case at
 least for some drivers and is probably ok for other state trackers too,
 it wasn't in the docs however.)
>>>
>>> DCL OUT[1..2], ARRAY(1), CLIPDIST
>>>
>>> CLIPDIST became an array declaration recently, so the usage mask isn't
>>> useful unless it's extended to 8 bits.
>>>
>>> Also, st/mesa doesn't set the usage mask for anything, so I wonder
>>> whether we need it.
>>>
>>> Marek
>>>
>>
>> Actually thinking about this some more, the problem here really is that
>> we have vec4 only, but clip/culldist are scalar outputs. Thus, an array
>> size of 2 doesn't give you the information how many elements the array
>> actually has and needs to be put somewhere else. Can you actually
>> dynamically index into such an array? You'd have to translate the scalar
>> index to vec4 array index + component.
> 
> Yes, I believe that's what the GLSL compiler does - it divides the
> index by 4 and does some kind of vec4-extract-element operation.
> 
>> I guess another possibility instead of properties would be to encode
>> this scalar array information directly into the declaration instead,
>> tgsi_declaration for instance would have spare bits, and
>> tgsi_declaration_array even more so.
>> Albeit properties should be fine for now, it doesn't feel very clean (as
>> I can't really see a reason why this is "side-channel" information
>> rather than directly part of the register declaration).
> 
> Well, do we really need the usage mask? There are no real users (maybe
> nine), vec4 backends typically don't care about usage masks and
> optimizing scalar backends can walk the shader and check writemasks on
> the outputs.
> 

Honestly I don't see much point in removing that information. If the
state tracker doesn't emit it, that's really the fault of the state
tracker - some drivers do something with that information.
Also, this is really a somewhat orthogonal issue to missing the scalar
array information for clip/cull dist (except that of course for non-vec4
arrays UsageMask doesn't make sense).


Roland


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


Re: [Mesa-dev] [PATCH 2/4] gallium: add new properties for clip and cull distance usage

2015-10-20 Thread Roland Scheidegger
Am 19.10.2015 um 23:44 schrieb Marek Olšák:
> On Mon, Oct 19, 2015 at 11:31 PM, Roland Scheidegger  
> wrote:
>> Yes, but I still don't see much change from getting this information
>> from the property rather than how tgsi_scan does it now, which is by
>> just using the usage mask from the output declaration. So the writes
>> shouldn't have to be analyzed.
>> (There's also a slight change in patch 4/4, namely these outputs
>> absolutely must be in order (xyzw) now as usage mask is determined
>> solely by the number of values. That might already have been the case at
>> least for some drivers and is probably ok for other state trackers too,
>> it wasn't in the docs however.)
> 
> DCL OUT[1..2], ARRAY(1), CLIPDIST
> 
> CLIPDIST became an array declaration recently, so the usage mask isn't
> useful unless it's extended to 8 bits.
> 
> Also, st/mesa doesn't set the usage mask for anything, so I wonder
> whether we need it.
> 
> Marek
> 

Actually thinking about this some more, the problem here really is that
we have vec4 only, but clip/culldist are scalar outputs. Thus, an array
size of 2 doesn't give you the information how many elements the array
actually has and needs to be put somewhere else. Can you actually
dynamically index into such an array? You'd have to translate the scalar
index to vec4 array index + component.
I guess another possibility instead of properties would be to encode
this scalar array information directly into the declaration instead,
tgsi_declaration for instance would have spare bits, and
tgsi_declaration_array even more so.
Albeit properties should be fine for now, it doesn't feel very clean (as
I can't really see a reason why this is "side-channel" information
rather than directly part of the register declaration).

Roland

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


Re: [Mesa-dev] [PATCH 2/4] gallium: add new properties for clip and cull distance usage

2015-10-20 Thread Marek Olšák
On Tue, Oct 20, 2015 at 3:25 PM, Roland Scheidegger  wrote:
> Am 19.10.2015 um 23:44 schrieb Marek Olšák:
>> On Mon, Oct 19, 2015 at 11:31 PM, Roland Scheidegger  
>> wrote:
>>> Yes, but I still don't see much change from getting this information
>>> from the property rather than how tgsi_scan does it now, which is by
>>> just using the usage mask from the output declaration. So the writes
>>> shouldn't have to be analyzed.
>>> (There's also a slight change in patch 4/4, namely these outputs
>>> absolutely must be in order (xyzw) now as usage mask is determined
>>> solely by the number of values. That might already have been the case at
>>> least for some drivers and is probably ok for other state trackers too,
>>> it wasn't in the docs however.)
>>
>> DCL OUT[1..2], ARRAY(1), CLIPDIST
>>
>> CLIPDIST became an array declaration recently, so the usage mask isn't
>> useful unless it's extended to 8 bits.
>>
>> Also, st/mesa doesn't set the usage mask for anything, so I wonder
>> whether we need it.
>>
>> Marek
>>
>
> Actually thinking about this some more, the problem here really is that
> we have vec4 only, but clip/culldist are scalar outputs. Thus, an array
> size of 2 doesn't give you the information how many elements the array
> actually has and needs to be put somewhere else. Can you actually
> dynamically index into such an array? You'd have to translate the scalar
> index to vec4 array index + component.

Yes, I believe that's what the GLSL compiler does - it divides the
index by 4 and does some kind of vec4-extract-element operation.

> I guess another possibility instead of properties would be to encode
> this scalar array information directly into the declaration instead,
> tgsi_declaration for instance would have spare bits, and
> tgsi_declaration_array even more so.
> Albeit properties should be fine for now, it doesn't feel very clean (as
> I can't really see a reason why this is "side-channel" information
> rather than directly part of the register declaration).

Well, do we really need the usage mask? There are no real users (maybe
nine), vec4 backends typically don't care about usage masks and
optimizing scalar backends can walk the shader and check writemasks on
the outputs.

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


Re: [Mesa-dev] [PATCH 2/4] gallium: add new properties for clip and cull distance usage

2015-10-19 Thread Roland Scheidegger
I don't have anything against new properties but why exactly is it
needed? As far as I can tell, clip/cull distances aren't declared as
arrays but just (up to two each) ordinary outputs, thus using the usage
masks should work just fine. Or is this handled differently by some
shader stages?

Roland

Am 18.10.2015 um 19:14 schrieb Marek Olšák:
> From: Marek Olšák 
> 
> The TGSI usage mask can't be used, because these are declared as an output
> array of 2 elements.
> ---
>  src/gallium/auxiliary/tgsi/tgsi_strings.c  |  2 ++
>  src/gallium/docs/source/tgsi.rst   | 10 ++
>  src/gallium/include/pipe/p_shader_tokens.h |  4 +++-
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c 
> b/src/gallium/auxiliary/tgsi/tgsi_strings.c
> index 8271ea0..89369d6 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
> @@ -137,6 +137,8 @@ const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
> "TES_SPACING",
> "TES_VERTEX_ORDER_CW",
> "TES_POINT_MODE",
> +   "NUM_CLIPDIST_ENABLED",
> +   "NUM_CULLDIST_ENABLED",
>  };
>  
>  const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] =
> diff --git a/src/gallium/docs/source/tgsi.rst 
> b/src/gallium/docs/source/tgsi.rst
> index 314fe1b..01e18f3 100644
> --- a/src/gallium/docs/source/tgsi.rst
> +++ b/src/gallium/docs/source/tgsi.rst
> @@ -3126,6 +3126,16 @@ TES_POINT_MODE
>  If set to a non-zero value, this turns on point mode for the tessellator,
>  which means that points will be generated instead of primitives.
>  
> +NUM_CLIPDIST_ENABLED
> +
> +
> +How many clip distance scalar outputs are enabled.
> +
> +NUM_CULLDIST_ENABLED
> +
> +
> +How many cull distance scalar outputs are enabled.
> +
>  
>  Texture Sampling and Texture Formats
>  
> diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
> b/src/gallium/include/pipe/p_shader_tokens.h
> index b36e0a3..e0ab901 100644
> --- a/src/gallium/include/pipe/p_shader_tokens.h
> +++ b/src/gallium/include/pipe/p_shader_tokens.h
> @@ -267,7 +267,9 @@ union tgsi_immediate_data
>  #define TGSI_PROPERTY_TES_SPACING12
>  #define TGSI_PROPERTY_TES_VERTEX_ORDER_CW13
>  #define TGSI_PROPERTY_TES_POINT_MODE 14
> -#define TGSI_PROPERTY_COUNT  15
> +#define TGSI_PROPERTY_NUM_CLIPDIST_ENABLED   15
> +#define TGSI_PROPERTY_NUM_CULLDIST_ENABLED   16
> +#define TGSI_PROPERTY_COUNT  17
>  
>  struct tgsi_property {
> unsigned Type : 4;  /**< TGSI_TOKEN_TYPE_PROPERTY */
> 

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


Re: [Mesa-dev] [PATCH 2/4] gallium: add new properties for clip and cull distance usage

2015-10-19 Thread Ilia Mirkin
AMD/NVIDIA hardware has a limit on how many cull/clip distances can be
used at a time. On NVIDIA hw, there's a bitmask which you flip to
determine if a distance is meant to clip or cull. It's nice not to
have to analyze the output writes of a shader to tell how many clip
distances are used.

On Mon, Oct 19, 2015 at 5:02 PM, Roland Scheidegger  wrote:
> I don't have anything against new properties but why exactly is it
> needed? As far as I can tell, clip/cull distances aren't declared as
> arrays but just (up to two each) ordinary outputs, thus using the usage
> masks should work just fine. Or is this handled differently by some
> shader stages?
>
> Roland
>
> Am 18.10.2015 um 19:14 schrieb Marek Olšák:
>> From: Marek Olšák 
>>
>> The TGSI usage mask can't be used, because these are declared as an output
>> array of 2 elements.
>> ---
>>  src/gallium/auxiliary/tgsi/tgsi_strings.c  |  2 ++
>>  src/gallium/docs/source/tgsi.rst   | 10 ++
>>  src/gallium/include/pipe/p_shader_tokens.h |  4 +++-
>>  3 files changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c 
>> b/src/gallium/auxiliary/tgsi/tgsi_strings.c
>> index 8271ea0..89369d6 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
>> @@ -137,6 +137,8 @@ const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
>> "TES_SPACING",
>> "TES_VERTEX_ORDER_CW",
>> "TES_POINT_MODE",
>> +   "NUM_CLIPDIST_ENABLED",
>> +   "NUM_CULLDIST_ENABLED",
>>  };
>>
>>  const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] =
>> diff --git a/src/gallium/docs/source/tgsi.rst 
>> b/src/gallium/docs/source/tgsi.rst
>> index 314fe1b..01e18f3 100644
>> --- a/src/gallium/docs/source/tgsi.rst
>> +++ b/src/gallium/docs/source/tgsi.rst
>> @@ -3126,6 +3126,16 @@ TES_POINT_MODE
>>  If set to a non-zero value, this turns on point mode for the tessellator,
>>  which means that points will be generated instead of primitives.
>>
>> +NUM_CLIPDIST_ENABLED
>> +
>> +
>> +How many clip distance scalar outputs are enabled.
>> +
>> +NUM_CULLDIST_ENABLED
>> +
>> +
>> +How many cull distance scalar outputs are enabled.
>> +
>>
>>  Texture Sampling and Texture Formats
>>  
>> diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
>> b/src/gallium/include/pipe/p_shader_tokens.h
>> index b36e0a3..e0ab901 100644
>> --- a/src/gallium/include/pipe/p_shader_tokens.h
>> +++ b/src/gallium/include/pipe/p_shader_tokens.h
>> @@ -267,7 +267,9 @@ union tgsi_immediate_data
>>  #define TGSI_PROPERTY_TES_SPACING12
>>  #define TGSI_PROPERTY_TES_VERTEX_ORDER_CW13
>>  #define TGSI_PROPERTY_TES_POINT_MODE 14
>> -#define TGSI_PROPERTY_COUNT  15
>> +#define TGSI_PROPERTY_NUM_CLIPDIST_ENABLED   15
>> +#define TGSI_PROPERTY_NUM_CULLDIST_ENABLED   16
>> +#define TGSI_PROPERTY_COUNT  17
>>
>>  struct tgsi_property {
>> unsigned Type : 4;  /**< TGSI_TOKEN_TYPE_PROPERTY */
>>
>
> ___
> 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 2/4] gallium: add new properties for clip and cull distance usage

2015-10-19 Thread Roland Scheidegger
Yes, but I still don't see much change from getting this information
from the property rather than how tgsi_scan does it now, which is by
just using the usage mask from the output declaration. So the writes
shouldn't have to be analyzed.
(There's also a slight change in patch 4/4, namely these outputs
absolutely must be in order (xyzw) now as usage mask is determined
solely by the number of values. That might already have been the case at
least for some drivers and is probably ok for other state trackers too,
it wasn't in the docs however.)

Roland


Am 19.10.2015 um 23:10 schrieb Ilia Mirkin:
> AMD/NVIDIA hardware has a limit on how many cull/clip distances can be
> used at a time. On NVIDIA hw, there's a bitmask which you flip to
> determine if a distance is meant to clip or cull. It's nice not to
> have to analyze the output writes of a shader to tell how many clip
> distances are used.
> 
> On Mon, Oct 19, 2015 at 5:02 PM, Roland Scheidegger  
> wrote:
>> I don't have anything against new properties but why exactly is it
>> needed? As far as I can tell, clip/cull distances aren't declared as
>> arrays but just (up to two each) ordinary outputs, thus using the usage
>> masks should work just fine. Or is this handled differently by some
>> shader stages?
>>
>> Roland
>>
>> Am 18.10.2015 um 19:14 schrieb Marek Olšák:
>>> From: Marek Olšák 
>>>
>>> The TGSI usage mask can't be used, because these are declared as an output
>>> array of 2 elements.
>>> ---
>>>  src/gallium/auxiliary/tgsi/tgsi_strings.c  |  2 ++
>>>  src/gallium/docs/source/tgsi.rst   | 10 ++
>>>  src/gallium/include/pipe/p_shader_tokens.h |  4 +++-
>>>  3 files changed, 15 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c 
>>> b/src/gallium/auxiliary/tgsi/tgsi_strings.c
>>> index 8271ea0..89369d6 100644
>>> --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
>>> +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
>>> @@ -137,6 +137,8 @@ const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
>>> "TES_SPACING",
>>> "TES_VERTEX_ORDER_CW",
>>> "TES_POINT_MODE",
>>> +   "NUM_CLIPDIST_ENABLED",
>>> +   "NUM_CULLDIST_ENABLED",
>>>  };
>>>
>>>  const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] =
>>> diff --git a/src/gallium/docs/source/tgsi.rst 
>>> b/src/gallium/docs/source/tgsi.rst
>>> index 314fe1b..01e18f3 100644
>>> --- a/src/gallium/docs/source/tgsi.rst
>>> +++ b/src/gallium/docs/source/tgsi.rst
>>> @@ -3126,6 +3126,16 @@ TES_POINT_MODE
>>>  If set to a non-zero value, this turns on point mode for the tessellator,
>>>  which means that points will be generated instead of primitives.
>>>
>>> +NUM_CLIPDIST_ENABLED
>>> +
>>> +
>>> +How many clip distance scalar outputs are enabled.
>>> +
>>> +NUM_CULLDIST_ENABLED
>>> +
>>> +
>>> +How many cull distance scalar outputs are enabled.
>>> +
>>>
>>>  Texture Sampling and Texture Formats
>>>  
>>> diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
>>> b/src/gallium/include/pipe/p_shader_tokens.h
>>> index b36e0a3..e0ab901 100644
>>> --- a/src/gallium/include/pipe/p_shader_tokens.h
>>> +++ b/src/gallium/include/pipe/p_shader_tokens.h
>>> @@ -267,7 +267,9 @@ union tgsi_immediate_data
>>>  #define TGSI_PROPERTY_TES_SPACING12
>>>  #define TGSI_PROPERTY_TES_VERTEX_ORDER_CW13
>>>  #define TGSI_PROPERTY_TES_POINT_MODE 14
>>> -#define TGSI_PROPERTY_COUNT  15
>>> +#define TGSI_PROPERTY_NUM_CLIPDIST_ENABLED   15
>>> +#define TGSI_PROPERTY_NUM_CULLDIST_ENABLED   16
>>> +#define TGSI_PROPERTY_COUNT  17
>>>
>>>  struct tgsi_property {
>>> unsigned Type : 4;  /**< TGSI_TOKEN_TYPE_PROPERTY */
>>>
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev=BQIFaQ=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I=hQkE5ulMPapCOHVyT5YEDfNw9RQu-xe8U8BImEEQeLo=87jb0kUujQfEzRTRXPYeDmfp03eaVLdo_wK6I9QAyks=
>>  

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


Re: [Mesa-dev] [PATCH 2/4] gallium: add new properties for clip and cull distance usage

2015-10-19 Thread Marek Olšák
On Mon, Oct 19, 2015 at 11:31 PM, Roland Scheidegger  wrote:
> Yes, but I still don't see much change from getting this information
> from the property rather than how tgsi_scan does it now, which is by
> just using the usage mask from the output declaration. So the writes
> shouldn't have to be analyzed.
> (There's also a slight change in patch 4/4, namely these outputs
> absolutely must be in order (xyzw) now as usage mask is determined
> solely by the number of values. That might already have been the case at
> least for some drivers and is probably ok for other state trackers too,
> it wasn't in the docs however.)

DCL OUT[1..2], ARRAY(1), CLIPDIST

CLIPDIST became an array declaration recently, so the usage mask isn't
useful unless it's extended to 8 bits.

Also, st/mesa doesn't set the usage mask for anything, so I wonder
whether we need it.

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


Re: [Mesa-dev] [PATCH 2/4] gallium: add new properties for clip and cull distance usage

2015-10-19 Thread Roland Scheidegger
Am 19.10.2015 um 23:44 schrieb Marek Olšák:
> On Mon, Oct 19, 2015 at 11:31 PM, Roland Scheidegger  
> wrote:
>> Yes, but I still don't see much change from getting this information
>> from the property rather than how tgsi_scan does it now, which is by
>> just using the usage mask from the output declaration. So the writes
>> shouldn't have to be analyzed.
>> (There's also a slight change in patch 4/4, namely these outputs
>> absolutely must be in order (xyzw) now as usage mask is determined
>> solely by the number of values. That might already have been the case at
>> least for some drivers and is probably ok for other state trackers too,
>> it wasn't in the docs however.)
> 
> DCL OUT[1..2], ARRAY(1), CLIPDIST
> 
> CLIPDIST became an array declaration recently, so the usage mask isn't
> useful unless it's extended to 8 bits.
Oh, when and how did that happen? I totally can't find such a change
(hence my confusion). The docs don't really reflect that neither.
But I agree if that's the case then indeed this change looks good.
Albeit I don't think everybody could deal with clipdist being an array
suddenly now...

Roland


> 
> Also, st/mesa doesn't set the usage mask for anything, so I wonder
> whether we need it.
We do set this correctly in some of our code.


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


Re: [Mesa-dev] [PATCH 2/4] gallium: add new properties for clip and cull distance usage

2015-10-19 Thread Roland Scheidegger
Am 20.10.2015 um 01:26 schrieb Marek Olšák:
> On Tue, Oct 20, 2015 at 12:03 AM, Roland Scheidegger  
> wrote:
>> Am 19.10.2015 um 23:44 schrieb Marek Olšák:
>>> On Mon, Oct 19, 2015 at 11:31 PM, Roland Scheidegger  
>>> wrote:
 Yes, but I still don't see much change from getting this information
 from the property rather than how tgsi_scan does it now, which is by
 just using the usage mask from the output declaration. So the writes
 shouldn't have to be analyzed.
 (There's also a slight change in patch 4/4, namely these outputs
 absolutely must be in order (xyzw) now as usage mask is determined
 solely by the number of values. That might already have been the case at
 least for some drivers and is probably ok for other state trackers too,
 it wasn't in the docs however.)
>>>
>>> DCL OUT[1..2], ARRAY(1), CLIPDIST
>>>
>>> CLIPDIST became an array declaration recently, so the usage mask isn't
>>> useful unless it's extended to 8 bits.
>> Oh, when and how did that happen? I totally can't find such a change
>> (hence my confusion). The docs don't really reflect that neither.
>> But I agree if that's the case then indeed this change looks good.
>> Albeit I don't think everybody could deal with clipdist being an array
>> suddenly now...
> 
> There was a change required for proper indirect addressing that
> changed all inputs and outputs to array declarations for all variables
> that were arrays in GLSL.
> 
> If PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE == 0, tgsi/ureg unwinds
> all incoming in/out arrays into simple declarations.
> 
> So it's optional until all drivers support that cap.

Ah I see now. I missed that, there's some code in st_program.c which
will use individual clip dist outputs but I guess it gets changed into
an array later at another place (looks certainly confusing).

So this series looks ok then.

Roland


> 
> Marek
> 

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


Re: [Mesa-dev] [PATCH 2/4] gallium: add new properties for clip and cull distance usage

2015-10-19 Thread Marek Olšák
On Tue, Oct 20, 2015 at 12:03 AM, Roland Scheidegger  wrote:
> Am 19.10.2015 um 23:44 schrieb Marek Olšák:
>> On Mon, Oct 19, 2015 at 11:31 PM, Roland Scheidegger  
>> wrote:
>>> Yes, but I still don't see much change from getting this information
>>> from the property rather than how tgsi_scan does it now, which is by
>>> just using the usage mask from the output declaration. So the writes
>>> shouldn't have to be analyzed.
>>> (There's also a slight change in patch 4/4, namely these outputs
>>> absolutely must be in order (xyzw) now as usage mask is determined
>>> solely by the number of values. That might already have been the case at
>>> least for some drivers and is probably ok for other state trackers too,
>>> it wasn't in the docs however.)
>>
>> DCL OUT[1..2], ARRAY(1), CLIPDIST
>>
>> CLIPDIST became an array declaration recently, so the usage mask isn't
>> useful unless it's extended to 8 bits.
> Oh, when and how did that happen? I totally can't find such a change
> (hence my confusion). The docs don't really reflect that neither.
> But I agree if that's the case then indeed this change looks good.
> Albeit I don't think everybody could deal with clipdist being an array
> suddenly now...

There was a change required for proper indirect addressing that
changed all inputs and outputs to array declarations for all variables
that were arrays in GLSL.

If PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE == 0, tgsi/ureg unwinds
all incoming in/out arrays into simple declarations.

So it's optional until all drivers support that cap.

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


[Mesa-dev] [PATCH 2/4] gallium: add new properties for clip and cull distance usage

2015-10-18 Thread Marek Olšák
From: Marek Olšák 

The TGSI usage mask can't be used, because these are declared as an output
array of 2 elements.
---
 src/gallium/auxiliary/tgsi/tgsi_strings.c  |  2 ++
 src/gallium/docs/source/tgsi.rst   | 10 ++
 src/gallium/include/pipe/p_shader_tokens.h |  4 +++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c 
b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index 8271ea0..89369d6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -137,6 +137,8 @@ const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
"TES_SPACING",
"TES_VERTEX_ORDER_CW",
"TES_POINT_MODE",
+   "NUM_CLIPDIST_ENABLED",
+   "NUM_CULLDIST_ENABLED",
 };
 
 const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] =
diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index 314fe1b..01e18f3 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -3126,6 +3126,16 @@ TES_POINT_MODE
 If set to a non-zero value, this turns on point mode for the tessellator,
 which means that points will be generated instead of primitives.
 
+NUM_CLIPDIST_ENABLED
+
+
+How many clip distance scalar outputs are enabled.
+
+NUM_CULLDIST_ENABLED
+
+
+How many cull distance scalar outputs are enabled.
+
 
 Texture Sampling and Texture Formats
 
diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
b/src/gallium/include/pipe/p_shader_tokens.h
index b36e0a3..e0ab901 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -267,7 +267,9 @@ union tgsi_immediate_data
 #define TGSI_PROPERTY_TES_SPACING12
 #define TGSI_PROPERTY_TES_VERTEX_ORDER_CW13
 #define TGSI_PROPERTY_TES_POINT_MODE 14
-#define TGSI_PROPERTY_COUNT  15
+#define TGSI_PROPERTY_NUM_CLIPDIST_ENABLED   15
+#define TGSI_PROPERTY_NUM_CULLDIST_ENABLED   16
+#define TGSI_PROPERTY_COUNT  17
 
 struct tgsi_property {
unsigned Type : 4;  /**< TGSI_TOKEN_TYPE_PROPERTY */
-- 
2.1.4

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