Enable device features, only display sample rate shading option if supported by device
This commit is contained in:
parent
a1530114ef
commit
2b04594fe3
2 changed files with 33 additions and 6 deletions
|
|
@ -215,6 +215,10 @@ public:
|
||||||
// Enable physical device features required for this example
|
// Enable physical device features required for this example
|
||||||
virtual void getEnabledFeatures()
|
virtual void getEnabledFeatures()
|
||||||
{
|
{
|
||||||
|
// Enable sample rate shading filtering if supported
|
||||||
|
if (deviceFeatures.sampleRateShading) {
|
||||||
|
enabledFeatures.sampleRateShading = VK_TRUE;
|
||||||
|
}
|
||||||
// Enable anisotropic filtering if supported
|
// Enable anisotropic filtering if supported
|
||||||
if (deviceFeatures.samplerAnisotropy) {
|
if (deviceFeatures.samplerAnisotropy) {
|
||||||
enabledFeatures.samplerAnisotropy = VK_TRUE;
|
enabledFeatures.samplerAnisotropy = VK_TRUE;
|
||||||
|
|
@ -1179,8 +1183,10 @@ public:
|
||||||
if (overlay->checkBox("MSAA", &useMSAA)) {
|
if (overlay->checkBox("MSAA", &useMSAA)) {
|
||||||
buildCommandBuffers();
|
buildCommandBuffers();
|
||||||
}
|
}
|
||||||
if (overlay->checkBox("Sample rate shading", &useSampleShading)) {
|
if (vulkanDevice->features.sampleRateShading) {
|
||||||
buildDeferredCommandBuffer();
|
if (overlay->checkBox("Sample rate shading", &useSampleShading)) {
|
||||||
|
buildDeferredCommandBuffer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,25 @@ public:
|
||||||
uniformBuffer.destroy();
|
uniformBuffer.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable physical device features required for this example
|
||||||
|
virtual void getEnabledFeatures()
|
||||||
|
{
|
||||||
|
// Enable sample rate shading filtering if supported
|
||||||
|
if (deviceFeatures.sampleRateShading) {
|
||||||
|
enabledFeatures.sampleRateShading = VK_TRUE;
|
||||||
|
}
|
||||||
|
// Enable texture compression
|
||||||
|
if (deviceFeatures.textureCompressionBC) {
|
||||||
|
enabledFeatures.textureCompressionBC = VK_TRUE;
|
||||||
|
}
|
||||||
|
else if (deviceFeatures.textureCompressionASTC_LDR) {
|
||||||
|
enabledFeatures.textureCompressionASTC_LDR = VK_TRUE;
|
||||||
|
}
|
||||||
|
else if (deviceFeatures.textureCompressionETC2) {
|
||||||
|
enabledFeatures.textureCompressionETC2 = VK_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Creates a multi sample render target (image and view) that is used to resolve
|
// Creates a multi sample render target (image and view) that is used to resolve
|
||||||
// into the visible frame buffer target in the render pass
|
// into the visible frame buffer target in the render pass
|
||||||
void setupMultisampleTarget()
|
void setupMultisampleTarget()
|
||||||
|
|
@ -628,7 +647,7 @@ public:
|
||||||
shaderStages[1] = loadShader(getAssetPath() + "shaders/mesh/mesh.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
|
shaderStages[1] = loadShader(getAssetPath() + "shaders/mesh/mesh.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
|
||||||
// Setup multi sampling
|
// Setup multi sampling
|
||||||
multisampleState.rasterizationSamples = sampleCount; // Number of samples to use for rasterization
|
multisampleState.rasterizationSamples = sampleCount; // Number of samples to use for rasterization
|
||||||
|
|
||||||
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.MSAA));
|
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCreateInfo, nullptr, &pipelines.MSAA));
|
||||||
|
|
||||||
// MSAA with sample shading pipeline
|
// MSAA with sample shading pipeline
|
||||||
|
|
@ -744,9 +763,11 @@ public:
|
||||||
|
|
||||||
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
||||||
{
|
{
|
||||||
if (overlay->header("Settings")) {
|
if (vulkanDevice->features.sampleRateShading) {
|
||||||
if (overlay->checkBox("Sample rate shading", &useSampleShading)) {
|
if (overlay->header("Settings")) {
|
||||||
buildCommandBuffers();
|
if (overlay->checkBox("Sample rate shading", &useSampleShading)) {
|
||||||
|
buildCommandBuffers();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue