linker_optimisation_loop(ctx, prog->_LinkedShaders[i]->ir, i);
/* Call opts after lowering const arrays to copy propagate things. */
- if (lower_const_arrays_to_uniforms(prog->_LinkedShaders[i]->ir, i))
+ if (ctx->Const.GLSLLowerConstArrays &&
+ lower_const_arrays_to_uniforms(prog->_LinkedShaders[i]->ir, i))
linker_optimisation_loop(ctx, prog->_LinkedShaders[i]->ir, i);
propagate_invariance(prog->_LinkedShaders[i]->ir);
*/
return 1;
+ case PIPE_CAP_PREFER_IMM_ARRAYS_AS_CONSTBUF:
+ /* Don't unset this unless your driver can do better */
+ return 1;
+
case PIPE_CAP_POST_DEPTH_COVERAGE:
case PIPE_CAP_BINDLESS_TEXTURE:
case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
types with texture functions having interaction with LOD of texture lookup.
* ``PIPE_CAP_SHADER_SAMPLES_IDENTICAL``: True if the driver supports a shader query to tell whether all samples of a multisampled surface are definitely identical.
* ``PIPE_CAP_TGSI_ATOMINC_WRAP``: Atomic increment/decrement + wrap around are supported.
+* ``PIPE_CAP_PREFER_IMM_ARRAYS_AS_CONSTBUF``: True if the state tracker should
+ turn arrays whose contents can be deduced at compile time into constant
+ buffer loads, or false if the driver can handle such arrays itself in a more
+ efficient manner.
.. _pipe_capf:
PIPE_CAP_TEXTURE_SHADOW_LOD,
PIPE_CAP_SHADER_SAMPLES_IDENTICAL,
PIPE_CAP_TGSI_ATOMINC_WRAP,
+ PIPE_CAP_PREFER_IMM_ARRAYS_AS_CONSTBUF,
};
/**
consts->GLSLVersion = api == API_OPENGL_CORE ? 130 : 120;
consts->GLSLVersionCompat = consts->GLSLVersion;
+ consts->GLSLLowerConstArrays = true;
+
/* Assume that if GLSL 1.30+ (or GLSL ES 3.00+) is supported that
* gl_VertexID is implemented using a native hardware register with OpenGL
* semantics.
*/
bool GLSLOptimizeConservatively;
+ /**
+ * Whether to call lower_const_arrays_to_uniforms() during linking.
+ */
+ bool GLSLLowerConstArrays;
+
/**
* True if gl_TessLevelInner/Outer[] in the TES should be inputs
* (otherwise, they're system values).
c->GLSLOptimizeConservatively =
screen->get_param(screen, PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY);
+ c->GLSLLowerConstArrays =
+ screen->get_param(screen, PIPE_CAP_PREFER_IMM_ARRAYS_AS_CONSTBUF);
c->GLSLTessLevelsAsInputs =
screen->get_param(screen, PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS);
c->LowerTessLevel =