Commit d5952b1f authored by Laszlo Agocs's avatar Laszlo Agocs
Browse files

Fix msaa option in triquadcube example

parent 0c9d9458
...@@ -119,7 +119,6 @@ QString graphicsApiName() ...@@ -119,7 +119,6 @@ QString graphicsApiName()
QRhi::Flags rhiFlags = 0; QRhi::Flags rhiFlags = 0;
int sampleCount = 1; int sampleCount = 1;
QRhiSwapChain::Flags scFlags = 0; QRhiSwapChain::Flags scFlags = 0;
void (*preInitFunc)() = nullptr;
class Window : public QWindow class Window : public QWindow
{ {
...@@ -439,10 +438,17 @@ int main(int argc, char **argv) ...@@ -439,10 +438,17 @@ int main(int argc, char **argv)
qDebug("Selected graphics API is %s", qPrintable(graphicsApiName())); qDebug("Selected graphics API is %s", qPrintable(graphicsApiName()));
qDebug("This is a multi-api example, use command line arguments to override:\n%s", qPrintable(cmdLineParser.helpText())); qDebug("This is a multi-api example, use command line arguments to override:\n%s", qPrintable(cmdLineParser.helpText()));
#ifdef EXAMPLEFW_PREINIT
void preInit();
preInit();
#endif
// OpenGL specifics. // OpenGL specifics.
QSurfaceFormat fmt; QSurfaceFormat fmt;
fmt.setDepthBufferSize(24); fmt.setDepthBufferSize(24);
fmt.setStencilBufferSize(8); fmt.setStencilBufferSize(8);
if (sampleCount > 1)
fmt.setSamples(sampleCount);
QSurfaceFormat::setDefaultFormat(fmt); QSurfaceFormat::setDefaultFormat(fmt);
// Vulkan setup. // Vulkan setup.
...@@ -468,11 +474,6 @@ int main(int argc, char **argv) ...@@ -468,11 +474,6 @@ int main(int argc, char **argv)
} }
#endif #endif
#ifdef EXAMPLEFW_PREINIT
void preInit();
preInit();
#endif
// Create and show the window. // Create and show the window.
Window w; Window w;
#if QT_CONFIG(vulkan) #if QT_CONFIG(vulkan)
......
...@@ -74,7 +74,6 @@ struct { ...@@ -74,7 +74,6 @@ struct {
QuadRenderer quadRenderer; QuadRenderer quadRenderer;
TexturedCubeRenderer cubeRenderer; TexturedCubeRenderer cubeRenderer;
TriangleOnCubeRenderer liveTexCubeRenderer; TriangleOnCubeRenderer liveTexCubeRenderer;
int sampleCount = 1;
bool onScreenOnly = false; bool onScreenOnly = false;
bool triangleOnly = false; bool triangleOnly = false;
QSize lastOutputSize; QSize lastOutputSize;
...@@ -114,27 +113,27 @@ void Window::customInit() ...@@ -114,27 +113,27 @@ void Window::customInit()
#endif #endif
d.triRenderer.setRhi(m_r); d.triRenderer.setRhi(m_r);
d.triRenderer.setSampleCount(d.sampleCount); d.triRenderer.setSampleCount(sampleCount);
d.triRenderer.initResources(m_rp); d.triRenderer.initResources(m_rp);
if (!d.triangleOnly) { if (!d.triangleOnly) {
d.triRenderer.setTranslation(QVector3D(0, 0.5f, 0)); d.triRenderer.setTranslation(QVector3D(0, 0.5f, 0));
d.quadRenderer.setRhi(m_r); d.quadRenderer.setRhi(m_r);
d.quadRenderer.setSampleCount(d.sampleCount); d.quadRenderer.setSampleCount(sampleCount);
d.quadRenderer.setPipeline(d.triRenderer.pipeline()); d.quadRenderer.setPipeline(d.triRenderer.pipeline());
d.quadRenderer.initResources(m_rp); d.quadRenderer.initResources(m_rp);
d.quadRenderer.setTranslation(QVector3D(1.5f, -0.5f, 0)); d.quadRenderer.setTranslation(QVector3D(1.5f, -0.5f, 0));
d.cubeRenderer.setRhi(m_r); d.cubeRenderer.setRhi(m_r);
d.cubeRenderer.setSampleCount(d.sampleCount); d.cubeRenderer.setSampleCount(sampleCount);
d.cubeRenderer.initResources(m_rp); d.cubeRenderer.initResources(m_rp);
d.cubeRenderer.setTranslation(QVector3D(0, -0.5f, 0)); d.cubeRenderer.setTranslation(QVector3D(0, -0.5f, 0));
} }
if (!d.onScreenOnly) { if (!d.onScreenOnly) {
d.liveTexCubeRenderer.setRhi(m_r); d.liveTexCubeRenderer.setRhi(m_r);
d.liveTexCubeRenderer.setSampleCount(d.sampleCount); d.liveTexCubeRenderer.setSampleCount(sampleCount);
d.liveTexCubeRenderer.initResources(m_rp); d.liveTexCubeRenderer.initResources(m_rp);
d.liveTexCubeRenderer.setTranslation(QVector3D(-2.0f, 0, 0)); d.liveTexCubeRenderer.setTranslation(QVector3D(-2.0f, 0, 0));
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment