1
0

minor changes

This commit is contained in:
Niklas Birk 2020-03-31 18:38:58 +02:00
parent dd9a111ef6
commit 9c0188c389
6 changed files with 19 additions and 12 deletions

View File

@ -10,7 +10,7 @@ void shutdownGLFW(GLFWwindow *window)
void createInstance(Compute *compute, Graphics *graphics)
{
GLuint enabledLayerSize = 0;
const char **enabledLayer;
const char **enabledLayer = NULL;
GLuint extensionsSize;
const char **glfwExtensions = glfwGetRequiredInstanceExtensions(&extensionsSize);

View File

@ -14,7 +14,7 @@
#define ENGINE_NAME "rwu_particles"
#define ENGINE_VERSION VK_MAKE_VERSION(0, 0, 0)
#define PARTICLE_AMOUNT 1000000
#define PARTICLE_AMOUNT 10000000
#define PARTICLE_SIZE (3 * sizeof(vector3f) + sizeof(float))
#define WORKGROUP_SIZE_Y 1
#define WORKGROUP_SIZE_Z 1
@ -141,6 +141,8 @@ void createGraphicsPipeline(Graphics *graphics);
void createFramebuffer(Graphics *graphics);
void createGraphicsCommandBuffers(Graphics *graphics);
// ELse
// Else
void mapBufferMemory(Compute *compute, VkDeviceMemory memory, void *inputData, uint32_t dataSize);
void createSemaphore(VkDevice device, VkSemaphore *semaphore);

View File

@ -84,12 +84,6 @@ int main()
tFrame = time - tLast;
tLast = time;
/*** UPDATE ***/
glUseProgram(computeShaderProgram);
glUniform1f(dtUniformLocation, tFrame);
glDispatchCompute(PARTICLE_AMOUNT / WORKGROUP_SIZE_X, 1, 1);
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT | GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT);
/*** RENDER ***/
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glfwGetFramebufferSize(window, &width, &height);
@ -98,6 +92,12 @@ int main()
glDrawArrays(GL_POINTS, 0, PARTICLE_AMOUNT);
glBindVertexArray(0);
/*** UPDATE ***/
glUseProgram(computeShaderProgram);
glUniform1f(dtUniformLocation, tFrame);
glDispatchCompute(PARTICLE_AMOUNT / WORKGROUP_SIZE_X, 1, 1);
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT | GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT);
glfwSwapBuffers(window);
glfwPollEvents();
}

View File

@ -7,3 +7,6 @@ void main(void)
{
colOut = vec4(colV, 1);
}

View File

@ -10,3 +10,5 @@ void main(void)
colV = colIn;
gl_Position = vec4(pos, 1);
}

View File

@ -96,7 +96,6 @@ int main()
graphicsPresentInfo.swapchainCount = 1;
graphicsPresentInfo.pSwapchains = &(graphics.swapChain);
// Compute preparation
VkPipelineStageFlags computeWaitStageMask = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
@ -121,7 +120,8 @@ int main()
tLast = time;
/*** RENDER ***/
ASSERT_VK(vkAcquireNextImageKHR(graphics.device, graphics.swapChain, UINT64_MAX, graphics.presentComplete, VK_NULL_HANDLE, &imageIndex))
ASSERT_VK(vkAcquireNextImageKHR(graphics.device, graphics.swapChain, UINT64_MAX,
graphics.presentComplete, VK_NULL_HANDLE, &imageIndex))
graphicsSubmitInfo.pCommandBuffers = &(graphics.commandBuffers[imageIndex]);
ASSERT_VK(vkQueueSubmit(graphics.queue, 1, &graphicsSubmitInfo, VK_NULL_HANDLE))