[Mesa-dev] [PATCH 3/4] r600g: Set geometry properties in r600_create_shader_state()

Marek Olšák maraeo at gmail.com
Sat Aug 29 14:16:15 PDT 2015


On Sat, Aug 29, 2015 at 10:31 AM, Edward O'Callaghan
<edward.ocallaghan at koparo.com> wrote:
> From: Edward O'Callaghan <eocallaghan at alterapraxis.com>
>
> The selector is shared by all shader variants, so the
> individual shaders shouldn't change it. Use tgsi_shader_scan()
> results to set geometry properties within a
> r600_create_shader_state() call and treat said propertices in
> the selector as read-only within r600_shader_from_tgsi().
>
> Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
> ---
>  src/gallium/drivers/r600/r600_pipe.h         |  3 +++
>  src/gallium/drivers/r600/r600_shader.c       | 31 ++++++----------------------
>  src/gallium/drivers/r600/r600_state_common.c | 14 +++++++++++++
>  3 files changed, 23 insertions(+), 25 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
> index eb70360..4bd3d7c 100644
> --- a/src/gallium/drivers/r600/r600_pipe.h
> +++ b/src/gallium/drivers/r600/r600_pipe.h
> @@ -36,6 +36,8 @@
>  #include "util/list.h"
>  #include "util/u_transfer.h"
>
> +#include "tgsi/tgsi_scan.h"
> +
>  #define R600_NUM_ATOMS 75
>
>  #define R600_MAX_VIEWPORTS 16
> @@ -305,6 +307,7 @@ struct r600_pipe_shader_selector {
>
>         struct tgsi_token       *tokens;
>         struct pipe_stream_output_info  so;
> +       struct tgsi_shader_info         info;
>
>         unsigned        num_shaders;
>
> diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
> index f0b794c..a265fb8 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,12 @@ 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;

For the two above, you can just do:
shader->... = ctx.info.properties[...];

Marek


More information about the mesa-dev mailing list