From 0fdd5a58e972da54fd378cfce1456af3b08c9dea Mon Sep 17 00:00:00 2001 From: Niklas Birk Date: Tue, 31 Mar 2020 15:56:36 +0200 Subject: [PATCH] WORKGROUP_SIZE_X in utils.h erstellt --- initVulkan.c | 4 ++-- initVulkan.h | 1 - openglMain.c | 2 +- utils.h | 2 ++ 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/initVulkan.c b/initVulkan.c index 0ee5c5f..12b23d3 100644 --- a/initVulkan.c +++ b/initVulkan.c @@ -501,7 +501,7 @@ void createComputeCommandBuffer(Compute *compute) vkCmdBindDescriptorSets(compute->commandBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, compute->pipelineLayout, 0, 3, descriptorSets, 0, NULL); - vkCmdDispatch(compute->commandBuffer, WORKGROUP_SIZE_X, WORKGROUP_SIZE_Y, WORKGROUP_SIZE_Z); + vkCmdDispatch(compute->commandBuffer, PARTICLE_AMOUNT / WORKGROUP_SIZE_X, WORKGROUP_SIZE_Y, WORKGROUP_SIZE_Z); ASSERT_VK(vkEndCommandBuffer(compute->commandBuffer)) } @@ -509,7 +509,7 @@ void createComputeCommandBuffer(Compute *compute) void createSemaphore(VkDevice device, VkSemaphore *semaphore) { VkSemaphoreCreateInfo semaphoreCreateInfo = { .sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO }; - ASSERT_VK(vkCreateSemaphore(device, &semaphoreCreateInfo, NULL, semaphore)); + ASSERT_VK(vkCreateSemaphore(device, &semaphoreCreateInfo, NULL, semaphore)) } void shutdownComputeVulkan(Compute *compute) diff --git a/initVulkan.h b/initVulkan.h index 9c706d7..0adaca5 100644 --- a/initVulkan.h +++ b/initVulkan.h @@ -16,7 +16,6 @@ #define PARTICLE_AMOUNT 1000000 #define PARTICLE_SIZE (3 * sizeof(vector3f) + sizeof(float)) -#define WORKGROUP_SIZE_X 1024 #define WORKGROUP_SIZE_Y 1 #define WORKGROUP_SIZE_Z 1 diff --git a/openglMain.c b/openglMain.c index 9ae730e..50dd67a 100644 --- a/openglMain.c +++ b/openglMain.c @@ -87,7 +87,7 @@ int main() /*** UPDATE ***/ glUseProgram(computeShaderProgram); glUniform1f(dtUniformLocation, tFrame); - glDispatchCompute(PARTICLE_AMOUNT / 1024, 1, 1); + glDispatchCompute(PARTICLE_AMOUNT / WORKGROUP_SIZE_X, 1, 1); glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT | GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT); /*** RENDER ***/ diff --git a/utils.h b/utils.h index 2027fa2..046f3ec 100644 --- a/utils.h +++ b/utils.h @@ -4,4 +4,6 @@ #define UPPER_AGE 250 #define LOWER_AGE 60 +#define WORKGROUP_SIZE_X 1024 + char *readFile(char *filename, char *mode, long *size); \ No newline at end of file