svga: lower images before ntt
ntt requires lowered images, so call gl_nir_lower_images first before
passing the shader to ntt.
Fixes piglit failures spec@glsl-4.30@execution@built-in-functions@cs*
Fixes: 0ac9541804
("gallium: Drop PIPE_SHADER_CAP_PREFERRED_IR")
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23697>
This commit is contained in:
@@ -92,6 +92,7 @@ libsvga = static_library(
|
||||
inc_src, inc_include, inc_gallium, inc_gallium_aux,
|
||||
include_directories('include')
|
||||
],
|
||||
link_with : [libglsl],
|
||||
dependencies : [idep_mesautil, idep_nir],
|
||||
)
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/**********************************************************
|
||||
* Copyright 2022 VMware, Inc. All rights reserved.
|
||||
* Copyright 2022-2023 VMware, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
@@ -23,7 +23,10 @@
|
||||
*
|
||||
**********************************************************/
|
||||
|
||||
#include "compiler/nir/nir.h"
|
||||
#include "compiler/glsl/gl_nir.h"
|
||||
#include "nir/nir_to_tgsi.h"
|
||||
|
||||
#include "util/u_inlines.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_bitmask.h"
|
||||
@@ -47,6 +50,7 @@ svga_create_compute_state(struct pipe_context *pipe,
|
||||
struct svga_context *svga = svga_context(pipe);
|
||||
|
||||
struct svga_compute_shader *cs = CALLOC_STRUCT(svga_compute_shader);
|
||||
nir_shader *nir = (nir_shader *)templ->prog;
|
||||
|
||||
if (!cs)
|
||||
return NULL;
|
||||
@@ -54,7 +58,10 @@ svga_create_compute_state(struct pipe_context *pipe,
|
||||
SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_CREATECS);
|
||||
|
||||
assert(templ->ir_type == PIPE_SHADER_IR_NIR);
|
||||
cs->base.tokens = nir_to_tgsi((void *)templ->prog, pipe->screen);
|
||||
/* nir_to_tgsi requires lowered images */
|
||||
NIR_PASS_V(nir, gl_nir_lower_images, false);
|
||||
|
||||
cs->base.tokens = nir_to_tgsi((void *)nir, pipe->screen);
|
||||
|
||||
struct svga_shader *shader = &cs->base;
|
||||
shader->id = svga->debug.shader_id++;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/**********************************************************
|
||||
* Copyright 2008-2022 VMware, Inc. All rights reserved.
|
||||
* Copyright 2008-2023 VMware, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
@@ -33,6 +33,9 @@
|
||||
#include "svga_tgsi.h"
|
||||
#include "svga_resource_texture.h"
|
||||
#include "VGPU10ShaderTokens.h"
|
||||
|
||||
#include "compiler/nir/nir.h"
|
||||
#include "compiler/glsl/gl_nir.h"
|
||||
#include "nir/nir_to_tgsi.h"
|
||||
|
||||
|
||||
@@ -918,6 +921,7 @@ svga_create_shader(struct pipe_context *pipe,
|
||||
{
|
||||
struct svga_context *svga = svga_context(pipe);
|
||||
struct svga_shader *shader = CALLOC(1, shader_structlen);
|
||||
nir_shader *nir = (nir_shader *)templ->ir.nir;
|
||||
|
||||
if (shader == NULL)
|
||||
return NULL;
|
||||
@@ -925,6 +929,10 @@ svga_create_shader(struct pipe_context *pipe,
|
||||
shader->id = svga->debug.shader_id++;
|
||||
shader->stage = stage;
|
||||
|
||||
if (templ->type == PIPE_SHADER_IR_NIR) {
|
||||
/* nir_to_tgsi requires lowered images */
|
||||
NIR_PASS_V(nir, gl_nir_lower_images, false);
|
||||
}
|
||||
shader->tokens = pipe_shader_state_to_tgsi_tokens(pipe->screen, templ);
|
||||
shader->type = PIPE_SHADER_IR_TGSI;
|
||||
|
||||
|
Reference in New Issue
Block a user