Simplify code

This commit is contained in:
luisangelsm
2026-01-18 13:56:29 +01:00
parent 6053fca005
commit 5e21657791

View File

@ -315,18 +315,13 @@ void YACReaderFlow3D::ensurePipeline()
// Determine the MSAA sample count to use // Determine the MSAA sample count to use
int requestedSamples = sampleCount(); int requestedSamples = sampleCount();
int samplesToUse = 1;
if (requestedSamples > 1 && m_rhi) { if (requestedSamples > 1 && m_rhi) {
QVector<int> supported = m_rhi->supportedSampleCounts(); QVector<int> supported = m_rhi->supportedSampleCounts();
int maxSupported = 1; auto it = std::upper_bound(supported.begin(), supported.end(), requestedSamples);
for (int s : std::as_const(supported)) { int samplesToUse = (it != supported.begin()) ? *std::prev(it) : 1;
if (s > maxSupported)
maxSupported = s;
}
samplesToUse = qMin(requestedSamples, qMin(4, maxSupported));
}
if (samplesToUse > 1) if (samplesToUse > 1)
scene.pipeline->setSampleCount(samplesToUse); scene.pipeline->setSampleCount(samplesToUse);
}
// Set shaders // Set shaders
scene.pipeline->setShaderStages({ { QRhiShaderStage::Vertex, vertShader }, scene.pipeline->setShaderStages({ { QRhiShaderStage::Vertex, vertShader },