Cleanup
This commit is contained in:
parent
275fb5e23f
commit
a8bdba8e3a
1 changed files with 7 additions and 8 deletions
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
#define PARTICLE_COUNT 3000 * 1024
|
#define PARTICLE_COUNT 2048 * 1024
|
||||||
|
|
||||||
class VulkanExample : public VulkanExampleBase
|
class VulkanExample : public VulkanExampleBase
|
||||||
{
|
{
|
||||||
|
|
@ -249,17 +249,16 @@ public:
|
||||||
{
|
{
|
||||||
|
|
||||||
std::mt19937 rGenerator;
|
std::mt19937 rGenerator;
|
||||||
std::uniform_real_distribution<float> rDistribution(-1.f, 1.f);
|
std::uniform_real_distribution<float> rDistribution(-1.0f, 1.0f);
|
||||||
|
|
||||||
// Initial particle positions
|
// Initial particle positions
|
||||||
std::vector<Particle> particleBuffer(PARTICLE_COUNT);
|
std::vector<Particle> particleBuffer(PARTICLE_COUNT);
|
||||||
for (auto& element : particleBuffer)
|
for (auto& element : particleBuffer)
|
||||||
{
|
{
|
||||||
element.pos = glm::vec2(rDistribution(rGenerator), rDistribution(rGenerator));
|
element.pos = glm::vec2(rDistribution(rGenerator), rDistribution(rGenerator));
|
||||||
element.vel = glm::vec2(0.f);
|
element.vel = glm::vec2(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Buffer size is the same for all storage buffers
|
|
||||||
uint32_t storageBufferSize = particleBuffer.size() * sizeof(Particle);
|
uint32_t storageBufferSize = particleBuffer.size() * sizeof(Particle);
|
||||||
|
|
||||||
// Staging
|
// Staging
|
||||||
|
|
@ -423,7 +422,7 @@ public:
|
||||||
|
|
||||||
VkPipelineMultisampleStateCreateInfo multisampleState =
|
VkPipelineMultisampleStateCreateInfo multisampleState =
|
||||||
vkTools::initializers::pipelineMultisampleStateCreateInfo(
|
vkTools::initializers::pipelineMultisampleStateCreateInfo(
|
||||||
VK_SAMPLE_COUNT_4_BIT,
|
VK_SAMPLE_COUNT_1_BIT,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
std::vector<VkDynamicState> dynamicStateEnables = {
|
std::vector<VkDynamicState> dynamicStateEnables = {
|
||||||
|
|
@ -577,7 +576,7 @@ public:
|
||||||
void updateUniformBuffers()
|
void updateUniformBuffers()
|
||||||
{
|
{
|
||||||
computeUbo.deltaT = frameTimer * 4.0f;
|
computeUbo.deltaT = frameTimer * 4.0f;
|
||||||
if (animate) // tmp
|
if (animate)
|
||||||
{
|
{
|
||||||
computeUbo.destX = sin(glm::radians(timer*360.0)) * 0.75f;
|
computeUbo.destX = sin(glm::radians(timer*360.0)) * 0.75f;
|
||||||
computeUbo.destY = 0.f;
|
computeUbo.destY = 0.f;
|
||||||
|
|
@ -640,9 +639,7 @@ public:
|
||||||
{
|
{
|
||||||
if (!prepared)
|
if (!prepared)
|
||||||
return;
|
return;
|
||||||
vkDeviceWaitIdle(device);
|
|
||||||
draw();
|
draw();
|
||||||
vkDeviceWaitIdle(device);
|
|
||||||
|
|
||||||
if (animate)
|
if (animate)
|
||||||
{
|
{
|
||||||
|
|
@ -657,6 +654,8 @@ public:
|
||||||
timer = 0.f;
|
timer = 0.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vkDeviceWaitIdle(device);
|
||||||
updateUniformBuffers();
|
updateUniformBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue