Added ETC2 and ASTC texture variants (Refs #174)
This commit is contained in:
parent
32f4b240fc
commit
ecb688e8c7
4 changed files with 26 additions and 4 deletions
BIN
data/textures/cubemap_yokohama_astc_8x8_unorm.ktx
Normal file
BIN
data/textures/cubemap_yokohama_astc_8x8_unorm.ktx
Normal file
Binary file not shown.
BIN
data/textures/cubemap_yokohama_etc2_unorm.ktx
Normal file
BIN
data/textures/cubemap_yokohama_etc2_unorm.ktx
Normal file
Binary file not shown.
|
|
@ -299,6 +299,31 @@ public:
|
|||
vkDestroyBuffer(device, stagingBuffer, nullptr);
|
||||
}
|
||||
|
||||
void loadTextures()
|
||||
{
|
||||
// Vulkan core supports three different compressed texture formats
|
||||
// As the support differs between implemementations we need to check device features and select a proper format and file
|
||||
std::string filename;
|
||||
VkFormat format;
|
||||
if (deviceFeatures.textureCompressionBC) {
|
||||
filename = "cubemap_yokohama_bc3_unorm.ktx";
|
||||
format = VK_FORMAT_BC2_UNORM_BLOCK;
|
||||
}
|
||||
else if (deviceFeatures.textureCompressionASTC_LDR) {
|
||||
filename = "cubemap_yokohama_astc_8x8_unorm.ktx";
|
||||
format = VK_FORMAT_ASTC_8x8_UNORM_BLOCK;
|
||||
}
|
||||
else if (deviceFeatures.textureCompressionETC2) {
|
||||
filename = "cubemap_yokohama_etc2_unorm.ktx";
|
||||
format = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;
|
||||
}
|
||||
else {
|
||||
vks::tools::exitFatal("Device does not support any compressed texture format!", "Error");
|
||||
}
|
||||
|
||||
loadCubemap(getAssetPath() + "textures/" + filename, format, false);
|
||||
}
|
||||
|
||||
void reBuildCommandBuffers()
|
||||
{
|
||||
if (!checkCommandBuffers())
|
||||
|
|
@ -676,13 +701,10 @@ public:
|
|||
void prepare()
|
||||
{
|
||||
VulkanExampleBase::prepare();
|
||||
loadTextures();
|
||||
loadMeshes();
|
||||
setupVertexDescriptions();
|
||||
prepareUniformBuffers();
|
||||
loadCubemap(
|
||||
getAssetPath() + "textures/cubemap_yokohama.ktx",
|
||||
VK_FORMAT_BC3_UNORM_BLOCK,
|
||||
false);
|
||||
setupDescriptorSetLayout();
|
||||
preparePipelines();
|
||||
setupDescriptorPool();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue