Added ETC2 and ASTC texture variants (Refs #174)
This commit is contained in:
parent
16841bb5eb
commit
04e2e96e61
5 changed files with 22 additions and 19 deletions
|
|
@ -7,45 +7,38 @@ import glob
|
|||
APK_NAME = "vulkanSubpasses"
|
||||
SHADER_DIR = "subpasses"
|
||||
ASSETS_MODELS = ["samplebuilding.dae", "samplebuilding_glass.dae"]
|
||||
ASSETS_TEXTURES = ["colored_glass_bc3.ktx"]
|
||||
ASSETS_TEXTURES = ["colored_glass_bc3_unorm.ktx", "colored_glass_etc2_unorm.ktx", "colored_glass_astc_8x8_unorm.ktx"]
|
||||
|
||||
if subprocess.call("ndk-build", shell=True) == 0:
|
||||
print("Build successful")
|
||||
|
||||
# Assets
|
||||
if not os.path.exists("./assets"):
|
||||
os.makedirs("./assets")
|
||||
os.makedirs("./assets/shaders/base", exist_ok=True)
|
||||
os.makedirs("./assets/shaders/%s" % SHADER_DIR, exist_ok=True)
|
||||
os.makedirs("./assets/textures", exist_ok=True)
|
||||
os.makedirs("./assets/models", exist_ok=True)
|
||||
os.makedirs("./res/drawable", exist_ok=True)
|
||||
|
||||
# Shaders
|
||||
# Base
|
||||
if not os.path.exists("./assets/shaders/base"):
|
||||
os.makedirs("./assets/shaders/base")
|
||||
for file in glob.glob("../../data/shaders/base/*.spv"):
|
||||
shutil.copy(file, "./assets/shaders/base")
|
||||
# Sample
|
||||
if not os.path.exists("./assets/shaders/%s" % SHADER_DIR):
|
||||
os.makedirs("./assets/shaders/%s" % SHADER_DIR)
|
||||
for file in glob.glob("../../data/shaders/%s/*.spv" %SHADER_DIR):
|
||||
shutil.copy(file, "./assets/shaders/%s" % SHADER_DIR)
|
||||
# Textures
|
||||
if not os.path.exists("./assets/textures"):
|
||||
os.makedirs("./assets/textures")
|
||||
for file in ASSETS_TEXTURES:
|
||||
shutil.copy("../../data/textures/%s" % file, "./assets/textures")
|
||||
# Models
|
||||
if not os.path.exists("./assets/models"):
|
||||
os.makedirs("./assets/models")
|
||||
for file in ASSETS_MODELS:
|
||||
shutil.copy("../../data/models/%s" % file, "./assets/models")
|
||||
|
||||
# Icon
|
||||
if not os.path.exists("./res/drawable"):
|
||||
os.makedirs("./res/drawable")
|
||||
shutil.copy("../../android/images/icon.png", "./res/drawable")
|
||||
|
||||
if subprocess.call("ant debug -Dout.final.file=%s.apk" % APK_NAME, shell=True) == 0:
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "-deploy":
|
||||
for arg in sys.argv[1:]:
|
||||
if arg == "-deploy":
|
||||
if subprocess.call("adb install -r %s.apk" % APK_NAME, shell=True) != 0:
|
||||
print("Could not deploy to device!")
|
||||
else:
|
||||
|
|
|
|||
BIN
data/textures/colored_glass_astc_8x8_unorm.ktx
Normal file
BIN
data/textures/colored_glass_astc_8x8_unorm.ktx
Normal file
Binary file not shown.
BIN
data/textures/colored_glass_etc2_unorm.ktx
Normal file
BIN
data/textures/colored_glass_etc2_unorm.ktx
Normal file
Binary file not shown.
|
|
@ -488,7 +488,19 @@ public:
|
|||
{
|
||||
models.scene.loadFromFile(getAssetPath() + "models/samplebuilding.dae", vertexLayout, 1.0f, vulkanDevice, queue);
|
||||
models.transparent.loadFromFile(getAssetPath() + "models/samplebuilding_glass.dae", vertexLayout, 1.0f, vulkanDevice, queue);
|
||||
textures.glass.loadFromFile(getAssetPath() + "textures/colored_glass_bc3.ktx", VK_FORMAT_BC3_UNORM_BLOCK, vulkanDevice, queue);
|
||||
// Textures
|
||||
if (vulkanDevice->features.textureCompressionBC) {
|
||||
textures.glass.loadFromFile(getAssetPath() + "textures/colored_glass_bc3_unorm.ktx", VK_FORMAT_BC3_UNORM_BLOCK, vulkanDevice, queue);
|
||||
}
|
||||
else if (vulkanDevice->features.textureCompressionASTC_LDR) {
|
||||
textures.glass.loadFromFile(getAssetPath() + "textures/colored_glass_astc_8x8_unorm.ktx", VK_FORMAT_ASTC_8x8_UNORM_BLOCK, vulkanDevice, queue);
|
||||
}
|
||||
else if (vulkanDevice->features.textureCompressionETC2) {
|
||||
textures.glass.loadFromFile(getAssetPath() + "textures/colored_glass_etc2_unorm.ktx", VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK, vulkanDevice, queue);
|
||||
}
|
||||
else {
|
||||
vks::tools::exitFatal("Device does not support any compressed texture format!", "Error");
|
||||
}
|
||||
}
|
||||
|
||||
void setupVertexDescriptions()
|
||||
|
|
@ -884,8 +896,6 @@ public:
|
|||
};
|
||||
vkUpdateDescriptorSets(device, static_cast<uint32_t>(writeDescriptorSets.size()), writeDescriptorSets.data(), 0, NULL);
|
||||
|
||||
//depthStencilState.depthWriteEnable = VK_TRUE;
|
||||
|
||||
// Enable blending
|
||||
blendAttachmentState.blendEnable = VK_TRUE;
|
||||
blendAttachmentState.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue