summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-01-30 11:56:57 +1100
committerTimothy Arceri <[email protected]>2018-02-10 10:59:10 +1100
commit97efdc0d57b3b9b6af4a40715482a15f2b8c7d6e (patch)
tree8a2d6fe08814740f6bbdf099bd0bab477ebdbc08 /src/mesa
parentb5e23887fe86478a63b3b602de32909a641f268f (diff)
st/glsl_to_tgsi: move nir detection earlier
We move the nir check before the shader cache call so that we can call a nir based caching function in a following patch. Also with this change we simply check if vertex shaders support NIR rather than looping over the stages as mixing of shader types is not supported anyway. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 1f875918936..34e495864a5 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6984,15 +6984,20 @@ extern "C" {
GLboolean
st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
{
+ struct pipe_screen *pscreen = ctx->st->pipe->screen;
+
+ enum pipe_shader_ir preferred_ir = (enum pipe_shader_ir)
+ pscreen->get_shader_param(pscreen, PIPE_SHADER_VERTEX,
+ PIPE_SHADER_CAP_PREFERRED_IR);
+ bool use_nir = preferred_ir == PIPE_SHADER_IR_NIR;
+
/* Return early if we are loading the shader from on-disk cache */
if (st_load_tgsi_from_disk_cache(ctx, prog)) {
return GL_TRUE;
}
- struct pipe_screen *pscreen = ctx->st->pipe->screen;
assert(prog->data->LinkStatus);
- bool use_nir = false;
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
if (prog->_LinkedShaders[i] == NULL)
continue;
@@ -7012,12 +7017,6 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
unsigned if_threshold = pscreen->get_shader_param(pscreen, ptarget,
PIPE_SHADER_CAP_LOWER_IF_THRESHOLD);
- enum pipe_shader_ir preferred_ir = (enum pipe_shader_ir)
- pscreen->get_shader_param(pscreen, ptarget,
- PIPE_SHADER_CAP_PREFERRED_IR);
- if (preferred_ir == PIPE_SHADER_IR_NIR)
- use_nir = true;
-
/* If there are forms of indirect addressing that the driver
* cannot handle, perform the lowering pass.
*/