[Mesa-dev] [PATCH 1/2] st/glsl_to_nir: gather next_stage in shader_info
Marek Olšák
maraeo at gmail.com
Mon Mar 19 21:10:39 UTC 2018
On Sun, Mar 18, 2018 at 11:10 PM, Timothy Arceri <tarceri at itsqueeze.com>
wrote:
>
>
> On 28/02/18 03:45, Marek Olšák wrote:
>
>> On Mon, Feb 26, 2018 at 10:43 AM, Timothy Arceri <tarceri at itsqueeze.com>
>> wrote:
>>
>>> ---
>>> src/compiler/shader_info.h | 5 +++++
>>> src/mesa/state_tracker/st_glsl_to_nir.cpp | 13 +++++++++++++
>>> 2 files changed, 18 insertions(+)
>>>
>>> diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
>>> index e7fd7dbe62..11a59ff6ac 100644
>>> --- a/src/compiler/shader_info.h
>>> +++ b/src/compiler/shader_info.h
>>> @@ -54,6 +54,11 @@ typedef struct shader_info {
>>> /** The shader stage, such as MESA_SHADER_VERTEX. */
>>> gl_shader_stage stage;
>>>
>>> + /** The shader stage in a non SSO linked program that follows this
>>> stage,
>>> + * such as MESA_SHADER_FRAGMENT.
>>> + */
>>> + gl_shader_stage next_stage;
>>> +
>>> /* Number of textures used by this shader */
>>> unsigned num_textures;
>>> /* Number of uniform buffers used by this shader */
>>> diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp
>>> b/src/mesa/state_tracker/st_glsl_to_nir.cpp
>>> index 765c827d93..914fd2e898 100644
>>> --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
>>> +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
>>> @@ -317,6 +317,19 @@ st_glsl_to_nir(struct st_context *st, struct
>>> gl_program *prog,
>>>
>>> nir_shader *nir = glsl_to_nir(shader_program, stage, options);
>>>
>>> + /* Set the next shader stage hint for VS and TES. */
>>> + if (!nir->info.separate_shader &&
>>> + (nir->info.stage == MESA_SHADER_VERTEX ||
>>> + nir->info.stage == MESA_SHADER_TESS_EVAL)) {
>>> +
>>> + unsigned prev_stages = (1 << (prog->info.stage + 1)) - 1;
>>> + unsigned stages_mask =
>>> + ~prev_stages & shader_program->data->linked_stages;
>>> +
>>> + nir->info.next_stage = stages_mask ?
>>> + (gl_shader_stage) u_bit_scan(&stages_mask) :
>>> MESA_SHADER_FRAGMENT;
>>>
>>
>> ffs would be better.
>>
>> Also, ureg sets ..._SHADER_FRAGMENT if st/mesa doesn't set anything
>> (e.g. it's a separate shader).
>>
>
> Yes the ureg function does that, which is what the "stages_mask ?" above
> does too. However separate shaders don't get set because
> ureg_set_next_shader_processor() won't get called for them.
>
> /* Set the next shader stage hint for VS and TES. */
> switch (procType) {
> case PIPE_SHADER_VERTEX:
> case PIPE_SHADER_TESS_EVAL:
> if (program->shader_program->SeparateShader)
> break;
>
> for (i = program->shader->Stage+1; i <= MESA_SHADER_FRAGMENT; i++) {
> if (program->shader_program->_LinkedShaders[i]) {
> ureg_set_next_shader_processor(
> ureg, pipe_shader_type_from_mesa((gl_shader_stage)i));
> break;
> }
> }
> break;
> }
>
Not here. See tgsi_ureg.c. It defaults to FRAGMENT.
Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180319/5a899be1/attachment.html>
More information about the mesa-dev
mailing list