Add missing asset to host image copy sample
Minor code cleanup
This commit is contained in:
parent
d68ec09f22
commit
02ed0eebb3
2 changed files with 16 additions and 12 deletions
|
|
@ -60,6 +60,11 @@ task copyTask {
|
||||||
include 'metalplate01_rgba.ktx'
|
include 'metalplate01_rgba.ktx'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy {
|
||||||
|
from rootProject.ext.assetPath + 'models'
|
||||||
|
into 'assets/models'
|
||||||
|
include 'plane_z.gltf'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ public:
|
||||||
deviceCreatepNextChain = &enabledPhysicalDeviceHostImageCopyFeaturesEXT;
|
deviceCreatepNextChain = &enabledPhysicalDeviceHostImageCopyFeaturesEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
~VulkanExample()
|
~VulkanExample() override
|
||||||
{
|
{
|
||||||
if (device) {
|
if (device) {
|
||||||
destroyTextureImage(texture);
|
destroyTextureImage(texture);
|
||||||
|
|
@ -82,7 +82,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable physical device features required for this example
|
// Enable physical device features required for this example
|
||||||
virtual void getEnabledFeatures()
|
void getEnabledFeatures() override
|
||||||
{
|
{
|
||||||
// Enable anisotropic filtering if supported
|
// Enable anisotropic filtering if supported
|
||||||
if (deviceFeatures.samplerAnisotropy) {
|
if (deviceFeatures.samplerAnisotropy) {
|
||||||
|
|
@ -134,7 +134,6 @@ public:
|
||||||
texture.height = ktxTexture->baseHeight;
|
texture.height = ktxTexture->baseHeight;
|
||||||
texture.mipLevels = ktxTexture->numLevels;
|
texture.mipLevels = ktxTexture->numLevels;
|
||||||
ktx_uint8_t *ktxTextureData = ktxTexture_GetData(ktxTexture);
|
ktx_uint8_t *ktxTextureData = ktxTexture_GetData(ktxTexture);
|
||||||
ktx_size_t ktxTextureSize = ktxTexture_GetSize(ktxTexture);
|
|
||||||
|
|
||||||
const VkFormat imageFormat = VK_FORMAT_R8G8B8A8_UNORM;
|
const VkFormat imageFormat = VK_FORMAT_R8G8B8A8_UNORM;
|
||||||
|
|
||||||
|
|
@ -271,7 +270,7 @@ public:
|
||||||
vkFreeMemory(device, texture.deviceMemory, nullptr);
|
vkFreeMemory(device, texture.deviceMemory, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildCommandBuffers()
|
void buildCommandBuffers() override
|
||||||
{
|
{
|
||||||
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
||||||
|
|
||||||
|
|
@ -371,11 +370,11 @@ public:
|
||||||
VkPipelineMultisampleStateCreateInfo multisampleState = vks::initializers::pipelineMultisampleStateCreateInfo(VK_SAMPLE_COUNT_1_BIT, 0);
|
VkPipelineMultisampleStateCreateInfo multisampleState = vks::initializers::pipelineMultisampleStateCreateInfo(VK_SAMPLE_COUNT_1_BIT, 0);
|
||||||
std::vector<VkDynamicState> dynamicStateEnables = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
|
std::vector<VkDynamicState> dynamicStateEnables = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
|
||||||
VkPipelineDynamicStateCreateInfo dynamicState = vks::initializers::pipelineDynamicStateCreateInfo(dynamicStateEnables);
|
VkPipelineDynamicStateCreateInfo dynamicState = vks::initializers::pipelineDynamicStateCreateInfo(dynamicStateEnables);
|
||||||
std::array<VkPipelineShaderStageCreateInfo,2> shaderStages;
|
|
||||||
|
|
||||||
// Shaders
|
// Shaders
|
||||||
shaderStages[0] = loadShader(getShadersPath() + "texture/texture.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
|
std::array<VkPipelineShaderStageCreateInfo,2> shaderStages = {
|
||||||
shaderStages[1] = loadShader(getShadersPath() + "texture/texture.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
|
loadShader(getShadersPath() + "texture/texture.vert.spv", VK_SHADER_STAGE_VERTEX_BIT),
|
||||||
|
loadShader(getShadersPath() + "texture/texture.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT)
|
||||||
|
};
|
||||||
|
|
||||||
VkGraphicsPipelineCreateInfo pipelineCreateInfo = vks::initializers::pipelineCreateInfo(pipelineLayout, renderPass, 0);
|
VkGraphicsPipelineCreateInfo pipelineCreateInfo = vks::initializers::pipelineCreateInfo(pipelineLayout, renderPass, 0);
|
||||||
pipelineCreateInfo.pInputAssemblyState = &inputAssemblyState;
|
pipelineCreateInfo.pInputAssemblyState = &inputAssemblyState;
|
||||||
|
|
@ -413,7 +412,7 @@ public:
|
||||||
plane.loadFromFile(getAssetPath() + "models/plane_z.gltf", vulkanDevice, queue, glTFLoadingFlags);
|
plane.loadFromFile(getAssetPath() + "models/plane_z.gltf", vulkanDevice, queue, glTFLoadingFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepare()
|
void prepare() override
|
||||||
{
|
{
|
||||||
VulkanExampleBase::prepare();
|
VulkanExampleBase::prepare();
|
||||||
|
|
||||||
|
|
@ -440,7 +439,7 @@ public:
|
||||||
VulkanExampleBase::submitFrame();
|
VulkanExampleBase::submitFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void render()
|
void render() override
|
||||||
{
|
{
|
||||||
if (!prepared)
|
if (!prepared)
|
||||||
return;
|
return;
|
||||||
|
|
@ -448,7 +447,7 @@ public:
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
void OnUpdateUIOverlay(vks::UIOverlay *overlay) override
|
||||||
{
|
{
|
||||||
if (overlay->header("Settings")) {
|
if (overlay->header("Settings")) {
|
||||||
if (overlay->sliderFloat("LOD bias", &uniformData.lodBias, 0.0f, (float)texture.mipLevels)) {
|
if (overlay->sliderFloat("LOD bias", &uniformData.lodBias, 0.0f, (float)texture.mipLevels)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue