Enable required device features (validation) (Refs #277)
This commit is contained in:
parent
153e555447
commit
4094aa0ea0
5 changed files with 88 additions and 6 deletions
|
|
@ -210,6 +210,25 @@ public:
|
||||||
vkDestroySemaphore(device, offscreenSemaphore, nullptr);
|
vkDestroySemaphore(device, offscreenSemaphore, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable physical device features required for this example
|
||||||
|
virtual void getEnabledFeatures()
|
||||||
|
{
|
||||||
|
// Enable anisotropic filtering if supported
|
||||||
|
if (deviceFeatures.samplerAnisotropy) {
|
||||||
|
enabledFeatures.samplerAnisotropy = 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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Create a frame buffer attachment
|
// Create a frame buffer attachment
|
||||||
void createAttachment(
|
void createAttachment(
|
||||||
VkFormat format,
|
VkFormat format,
|
||||||
|
|
@ -407,7 +426,7 @@ public:
|
||||||
sampler.addressModeV = sampler.addressModeU;
|
sampler.addressModeV = sampler.addressModeU;
|
||||||
sampler.addressModeW = sampler.addressModeU;
|
sampler.addressModeW = sampler.addressModeU;
|
||||||
sampler.mipLodBias = 0.0f;
|
sampler.mipLodBias = 0.0f;
|
||||||
sampler.maxAnisotropy = 0;
|
sampler.maxAnisotropy = 1.0f;
|
||||||
sampler.minLod = 0.0f;
|
sampler.minLod = 0.0f;
|
||||||
sampler.maxLod = 1.0f;
|
sampler.maxLod = 1.0f;
|
||||||
sampler.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
|
sampler.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,25 @@ public:
|
||||||
vkDestroySemaphore(device, offscreenSemaphore, nullptr);
|
vkDestroySemaphore(device, offscreenSemaphore, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable physical device features required for this example
|
||||||
|
virtual void getEnabledFeatures()
|
||||||
|
{
|
||||||
|
// Enable anisotropic filtering if supported
|
||||||
|
if (deviceFeatures.samplerAnisotropy) {
|
||||||
|
enabledFeatures.samplerAnisotropy = 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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Create a frame buffer attachment
|
// Create a frame buffer attachment
|
||||||
void createAttachment(
|
void createAttachment(
|
||||||
VkFormat format,
|
VkFormat format,
|
||||||
|
|
@ -427,7 +446,7 @@ public:
|
||||||
sampler.addressModeV = sampler.addressModeU;
|
sampler.addressModeV = sampler.addressModeU;
|
||||||
sampler.addressModeW = sampler.addressModeU;
|
sampler.addressModeW = sampler.addressModeU;
|
||||||
sampler.mipLodBias = 0.0f;
|
sampler.mipLodBias = 0.0f;
|
||||||
sampler.maxAnisotropy = 0;
|
sampler.maxAnisotropy = 1.0f;
|
||||||
sampler.minLod = 0.0f;
|
sampler.minLod = 0.0f;
|
||||||
sampler.maxLod = 1.0f;
|
sampler.maxLod = 1.0f;
|
||||||
sampler.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
|
sampler.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,20 @@ public:
|
||||||
else {
|
else {
|
||||||
vks::tools::exitFatal("Selected GPU does not support geometry shaders!", "Feature not supported");
|
vks::tools::exitFatal("Selected GPU does not support geometry shaders!", "Feature not supported");
|
||||||
}
|
}
|
||||||
|
// Enable anisotropic filtering if supported
|
||||||
|
if (deviceFeatures.samplerAnisotropy) {
|
||||||
|
enabledFeatures.samplerAnisotropy = 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare a layered shadow map with each layer containing depth from a light's point of view
|
// Prepare a layered shadow map with each layer containing depth from a light's point of view
|
||||||
|
|
|
||||||
|
|
@ -152,14 +152,25 @@ public:
|
||||||
// Enable physical device features required for this example
|
// Enable physical device features required for this example
|
||||||
virtual void getEnabledFeatures()
|
virtual void getEnabledFeatures()
|
||||||
{
|
{
|
||||||
// Example uses multi draw indirect (if available)
|
// Example uses multi draw indirect if available
|
||||||
if (deviceFeatures.multiDrawIndirect) {
|
if (deviceFeatures.multiDrawIndirect) {
|
||||||
enabledFeatures.multiDrawIndirect = VK_TRUE;
|
enabledFeatures.multiDrawIndirect = VK_TRUE;
|
||||||
}
|
}
|
||||||
else {
|
// Enable anisotropic filtering if supported
|
||||||
std::cout << "MultiDrawIndirect not supported" << std::endl;
|
if (deviceFeatures.samplerAnisotropy) {
|
||||||
|
enabledFeatures.samplerAnisotropy = 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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void buildCommandBuffers()
|
void buildCommandBuffers()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,25 @@ public:
|
||||||
uniformBuffers.lights.destroy();
|
uniformBuffers.lights.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable physical device features required for this example
|
||||||
|
virtual void getEnabledFeatures()
|
||||||
|
{
|
||||||
|
// Enable anisotropic filtering if supported
|
||||||
|
if (deviceFeatures.samplerAnisotropy) {
|
||||||
|
enabledFeatures.samplerAnisotropy = 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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Create a frame buffer attachment
|
// Create a frame buffer attachment
|
||||||
void createAttachment(VkFormat format, VkImageUsageFlags usage, FrameBufferAttachment *attachment)
|
void createAttachment(VkFormat format, VkImageUsageFlags usage, FrameBufferAttachment *attachment)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue