No longer submit initial depth/stencil image barrier outside of setup command buffer (#57), updated swapChain usage to recent refactorings
This commit is contained in:
parent
0e00f30fb1
commit
edc92112df
3 changed files with 19 additions and 16 deletions
|
|
@ -245,8 +245,8 @@ struct VulkanExample
|
|||
vkGetPhysicalDeviceMemoryProperties(physicalDevice, &deviceMemoryProperties);
|
||||
|
||||
// Swap chain
|
||||
swapChain.init(instance, physicalDevice, device);
|
||||
swapChain.initSwapChain(app->window);
|
||||
swapChain.connect(instance, physicalDevice, device);
|
||||
swapChain.initSurface(app->window);
|
||||
|
||||
// Command buffer pool
|
||||
VkCommandPoolCreateInfo cmdPoolInfo = {};
|
||||
|
|
@ -264,15 +264,17 @@ struct VulkanExample
|
|||
|
||||
createSetupCommandBuffer();
|
||||
startSetupCommandBuffer();
|
||||
swapChain.setup(setupCmdBuffer, &width, &height);
|
||||
flushSetupCommandBuffer();
|
||||
|
||||
createCommandBuffers();
|
||||
swapChain.create(setupCmdBuffer, &width, &height);
|
||||
|
||||
setupDepthStencil();
|
||||
setupRenderPass();
|
||||
setupFrameBuffer();
|
||||
|
||||
flushSetupCommandBuffer();
|
||||
|
||||
createCommandBuffers();
|
||||
|
||||
prepareVertices();
|
||||
prepareUniformBuffers();
|
||||
setupDescriptorSetLayout();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <android/asset_manager.h>
|
||||
|
||||
#define GLM_FORCE_RADIANS
|
||||
#define GLM_DEPTH_ZERO_TO_ONE
|
||||
#include "glm/glm.hpp"
|
||||
#include "glm/gtc/matrix_transform.hpp"
|
||||
|
||||
|
|
@ -24,7 +25,6 @@
|
|||
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "AndroidProject1.NativeActivity", __VA_ARGS__))
|
||||
|
||||
#define VERTEX_BUFFER_BIND_ID 0
|
||||
#define deg_to_rad(deg) deg * float(M_PI / 180)
|
||||
|
||||
struct saved_state {
|
||||
glm::vec3 rotation;
|
||||
|
|
@ -558,8 +558,8 @@ struct VulkanExample
|
|||
vkGetPhysicalDeviceMemoryProperties(physicalDevice, &deviceMemoryProperties);
|
||||
|
||||
// Swap chain
|
||||
swapChain.init(instance, physicalDevice, device);
|
||||
swapChain.initSwapChain(app->window);
|
||||
swapChain.connect(instance, physicalDevice, device);
|
||||
swapChain.initSurface(app->window);
|
||||
|
||||
// Command buffer pool
|
||||
VkCommandPoolCreateInfo cmdPoolInfo = {};
|
||||
|
|
@ -577,20 +577,22 @@ struct VulkanExample
|
|||
|
||||
createSetupCommandBuffer();
|
||||
startSetupCommandBuffer();
|
||||
swapChain.setup(setupCmdBuffer, &width, &height);
|
||||
flushSetupCommandBuffer();
|
||||
|
||||
createCommandBuffers();
|
||||
swapChain.create(setupCmdBuffer, &width, &height);
|
||||
|
||||
setupDepthStencil();
|
||||
setupRenderPass();
|
||||
setupFrameBuffer();
|
||||
|
||||
flushSetupCommandBuffer();
|
||||
|
||||
loadTexture(
|
||||
"textures/vulkan_android_robot.ktx",
|
||||
VK_FORMAT_R8G8B8A8_UNORM,
|
||||
false);
|
||||
|
||||
createCommandBuffers();
|
||||
|
||||
prepareVertices();
|
||||
prepareUniformBuffers();
|
||||
setupDescriptorSetLayout();
|
||||
|
|
@ -831,14 +833,14 @@ struct VulkanExample
|
|||
void updateUniformBuffers()
|
||||
{
|
||||
// Update matrices
|
||||
uboVS.projection = glm::perspective(deg_to_rad(60.0f), (float)width / (float)height, 0.1f, 256.0f);
|
||||
uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f);
|
||||
|
||||
glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, state.zoom));
|
||||
|
||||
uboVS.model = viewMatrix;
|
||||
uboVS.model = glm::rotate(uboVS.model, deg_to_rad(state.rotation.x), glm::vec3(1.0f, 0.0f, 0.0f));
|
||||
uboVS.model = glm::rotate(uboVS.model, deg_to_rad(state.rotation.y), glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
uboVS.model = glm::rotate(uboVS.model, deg_to_rad(state.rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
uboVS.model = glm::rotate(uboVS.model, glm::radians(state.rotation.x), glm::vec3(1.0f, 0.0f, 0.0f));
|
||||
uboVS.model = glm::rotate(uboVS.model, glm::radians(state.rotation.y), glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
uboVS.model = glm::rotate(uboVS.model, glm::radians(state.rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
|
||||
// Map uniform buffer and update it
|
||||
uint8_t *pData;
|
||||
|
|
|
|||
|
|
@ -252,7 +252,6 @@ struct VulkanExample
|
|||
assert(!err);
|
||||
|
||||
createSetupCommandBuffer();
|
||||
|
||||
startSetupCommandBuffer();
|
||||
|
||||
swapChain.create(setupCmdBuffer, &width, &height);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue