mirror of
https://github.com/YACReader/yacreader
synced 2026-03-02 10:50:04 -05:00
Simplify code
This commit is contained in:
@ -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)
|
if (samplesToUse > 1)
|
||||||
maxSupported = s;
|
scene.pipeline->setSampleCount(samplesToUse);
|
||||||
}
|
|
||||||
samplesToUse = qMin(requestedSamples, qMin(4, maxSupported));
|
|
||||||
}
|
}
|
||||||
if (samplesToUse > 1)
|
|
||||||
scene.pipeline->setSampleCount(samplesToUse);
|
|
||||||
|
|
||||||
// Set shaders
|
// Set shaders
|
||||||
scene.pipeline->setShaderStages({ { QRhiShaderStage::Vertex, vertShader },
|
scene.pipeline->setShaderStages({ { QRhiShaderStage::Vertex, vertShader },
|
||||||
|
|||||||
Reference in New Issue
Block a user