rhi: gl: reduce uniform location table prealloc to 32
Not sure why we used 256 given the typical shaders used with Qt. A prealloc of 256 means 8328 bytes on the stack, which feels excessive, and shows up in profiler hotspots for some reason. Task-number: QTBUG-125087 Pick-to: 6.7 6.6 6.5 Change-Id: Ibae26dae95cbc8d0e9ea53423daa151e768a93b2 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit fb2e33b65aea28609996c4e1ac59c3ee75e5b839) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
9745c3d708
commit
a682cb9596
@ -4991,7 +4991,7 @@ void QRhiGles2::registerUniformIfActive(const QShaderDescription::BlockVariable
|
||||
int binding,
|
||||
int baseOffset,
|
||||
GLuint program,
|
||||
QDuplicateTracker<int, 256> *activeUniformLocations,
|
||||
ActiveUniformLocationTracker *activeUniformLocations,
|
||||
QGles2UniformDescriptionVector *dst)
|
||||
{
|
||||
if (var.type == QShaderDescription::Struct) {
|
||||
@ -5024,7 +5024,7 @@ void QRhiGles2::registerUniformIfActive(const QShaderDescription::BlockVariable
|
||||
|
||||
void QRhiGles2::gatherUniforms(GLuint program,
|
||||
const QShaderDescription::UniformBlock &ub,
|
||||
QDuplicateTracker<int, 256> *activeUniformLocations,
|
||||
ActiveUniformLocationTracker *activeUniformLocations,
|
||||
QGles2UniformDescriptionVector *dst)
|
||||
{
|
||||
QByteArray prefix = ub.structName + '.';
|
||||
@ -6379,7 +6379,7 @@ bool QGles2GraphicsPipeline::create()
|
||||
// Use the same work area for the vertex & fragment stages, thus ensuring
|
||||
// that we will not do superfluous glUniform calls for uniforms that are
|
||||
// present in both shaders.
|
||||
QDuplicateTracker<int, 256> activeUniformLocations;
|
||||
QRhiGles2::ActiveUniformLocationTracker activeUniformLocations;
|
||||
|
||||
for (const QRhiShaderStage &shaderStage : std::as_const(m_shaderStages)) {
|
||||
if (isGraphicsStage(shaderStage)) {
|
||||
@ -6496,7 +6496,7 @@ bool QGles2ComputePipeline::create()
|
||||
}
|
||||
}
|
||||
|
||||
QDuplicateTracker<int, 256> activeUniformLocations;
|
||||
QRhiGles2::ActiveUniformLocationTracker activeUniformLocations;
|
||||
for (const QShaderDescription::UniformBlock &ub : csDesc.uniformBlocks())
|
||||
rhiD->gatherUniforms(program, ub, &activeUniformLocations, &uniforms);
|
||||
for (const QShaderDescription::InOutVariable &v : csDesc.combinedImageSamplers())
|
||||
|
@ -901,13 +901,14 @@ public:
|
||||
QByteArray shaderSource(const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
|
||||
bool compileShader(GLuint program, const QRhiShaderStage &shaderStage, QShaderVersion *shaderVersion);
|
||||
bool linkProgram(GLuint program);
|
||||
using ActiveUniformLocationTracker = QDuplicateTracker<int, 32>;
|
||||
void registerUniformIfActive(const QShaderDescription::BlockVariable &var,
|
||||
const QByteArray &namePrefix, int binding, int baseOffset,
|
||||
GLuint program,
|
||||
QDuplicateTracker<int, 256> *activeUniformLocations,
|
||||
ActiveUniformLocationTracker *activeUniformLocations,
|
||||
QGles2UniformDescriptionVector *dst);
|
||||
void gatherUniforms(GLuint program, const QShaderDescription::UniformBlock &ub,
|
||||
QDuplicateTracker<int, 256> *activeUniformLocations, QGles2UniformDescriptionVector *dst);
|
||||
ActiveUniformLocationTracker *activeUniformLocations, QGles2UniformDescriptionVector *dst);
|
||||
void gatherSamplers(GLuint program, const QShaderDescription::InOutVariable &v,
|
||||
QGles2SamplerDescriptionVector *dst);
|
||||
void gatherGeneratedSamplers(GLuint program,
|
||||
|
Loading…
x
Reference in New Issue
Block a user