diff options
| author | Quentin LADEVIE <qladevie@wanadev.fr> | 2022-03-03 17:49:03 +0100 |
|---|---|---|
| committer | Quentin LADEVIE <qladevie@wanadev.fr> | 2022-03-03 17:49:03 +0100 |
| commit | bdd35fc2af40496b4cff9121ea5a3a364259642d (patch) | |
| tree | 3286b7bad9a6daa3b85e1957c44a70c0e6569f55 /src/compute-renderpass.cpp | |
| parent | 6d98e9d8b07d5c8aa0358780c38f29ffddfbf45f (diff) | |
Primitive renderpass api & use handle for low level api resources
Diffstat (limited to 'src/compute-renderpass.cpp')
| -rw-r--r-- | src/compute-renderpass.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/compute-renderpass.cpp b/src/compute-renderpass.cpp index c680bac..7399ae3 100644 --- a/src/compute-renderpass.cpp +++ b/src/compute-renderpass.cpp @@ -11,8 +11,10 @@ void ComputeRenderpass::set_pipeline(std::string& shader_name) { void ComputeRenderpass::set_ouput_texture(Texture* output_texture) { this->output_texture = output_texture; + auto image = api.get_image(output_texture->device_image); + // TODO: Remove hardcoded offset - memcpy(constants.data() + 56, &output_texture->device_image.bindless_storage_index, sizeof(bindless_index)); + memcpy(constants.data() + 56, &image.bindless_storage_index, sizeof(bindless_index)); } void ComputeRenderpass::set_dispatch_size(size_t count_x, size_t count_y, size_t count_z) { @@ -26,17 +28,19 @@ void ComputeRenderpass::set_constant(off_t offset, uint64_t* constant) { } void ComputeRenderpass::set_constant(off_t offset, Texture* texture) { - memcpy(constants.data() + offset, (void*)&texture->device_image.bindless_storage_index, sizeof(bindless_index)); + auto image = api.get_image(texture->device_image); + + memcpy(constants.data() + offset, (void*)&image.bindless_storage_index, sizeof(bindless_index)); input_textures.push_back(texture); } void ComputeRenderpass::set_constant(off_t offset, Buffer* buffer) { - auto address = buffer->device_address(); - memcpy(constants.data() + offset, (void*)&address, sizeof(VkDeviceAddress)); + auto device_buffer = api.get_buffer(buffer->device_buffer); + memcpy(constants.data() + offset, (void*)&device_buffer.device_address, sizeof(VkDeviceAddress)); } -void ComputeRenderpass::execute(VkCommandBuffer command_buffer) { +void ComputeRenderpass::execute(vkrenderer& renderer, VkCommandBuffer command_buffer) { api.update_constants(command_buffer, VK_SHADER_STAGE_COMPUTE_BIT, 0, 64, (void*)&constants); for (auto& texture: input_textures) { |
