[Mesa-dev] [PATCH v2 09/12] st/glsl_to_nir: copy nir compiler options to context

Marek Olšák maraeo at gmail.com
Tue Jan 30 12:18:32 UTC 2018


On Tue, Jan 30, 2018 at 4:55 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> Various nir passes may expect this to be here as does the nir
> serialisation pass.
> ---
>  src/mesa/state_tracker/st_extensions.c    | 17 +++++++++++++++++
>  src/mesa/state_tracker/st_glsl_to_nir.cpp | 10 ++--------
>  2 files changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index d00ee83c05..ea77aa6ed1 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -26,6 +26,8 @@
>   *
>   **************************************************************************/
>
> +#include "compiler/nir/nir.h"
> +
>  #include "main/imports.h"
>  #include "main/context.h"
>  #include "main/macros.h"
> @@ -156,31 +158,46 @@ void st_init_limits(struct pipe_screen *screen,
>     for (sh = 0; sh < PIPE_SHADER_TYPES; ++sh) {
>        struct gl_shader_compiler_options *options;
>        struct gl_program_constants *pc;
> +      const nir_shader_compiler_options *nir_options =
> +         (const nir_shader_compiler_options *)
> +            screen->get_compiler_options(screen, PIPE_SHADER_IR_NIR, sh);

This will crash with drivers that don't set the get_compiler_options callback.

Marek


More information about the mesa-dev mailing list