diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2022-02-13 07:30:30 +0100 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2022-02-13 07:30:30 +0100 |
| commit | bbb45f80298dc4a41d31805416bad19363c8eff8 (patch) | |
| tree | 24f98eadcfc5a0611d4c4c70be4f1c2718236d56 /include/compute-renderpass.hpp | |
| parent | 4ae9a520d97dcaf69f4a0cd044a4fc3fe689924d (diff) | |
Improve image barrier code
Diffstat (limited to 'include/compute-renderpass.hpp')
| -rw-r--r-- | include/compute-renderpass.hpp | 116 |
1 files changed, 59 insertions, 57 deletions
diff --git a/include/compute-renderpass.hpp b/include/compute-renderpass.hpp index 5393032..39cbf79 100644 --- a/include/compute-renderpass.hpp +++ b/include/compute-renderpass.hpp @@ -1,57 +1,59 @@ -#pragma once
-
-#include "vk-api.hpp"
-#include <array>
-
-class Texture;
-class Renderpass {
- public:
-
- Renderpass(vkapi& api)
- :api(api)
- {};
-
- virtual ~Renderpass() {
- api.destroy_pipeline(pipeline);
- }
-
- void set_pipeline(pipeline pipeline) {
- this->pipeline = pipeline;
- }
-
- // TODO: Do not use vulkan api type
- virtual void execute(VkCommandBuffer command_buffer) = 0;
-
- protected:
- vkapi &api;
-
- pipeline pipeline;
-};
-
-class ComputeRenderpass : public Renderpass {
- public:
-
- ComputeRenderpass(vkapi& api)
- : Renderpass(api)
- {}
-
- void set_dispatch_size(size_t count_x, size_t count_y, size_t count_z);
-
- void set_ouput_texture(Texture* ouput_texture);
-
- void set_constant(off_t offset, uint64_t* constant);
- void set_constant(off_t offset, Texture* texture);
-
- // TODO: Do not use vulkan api type
- void execute(VkCommandBuffer command_buffer) override final;
-
- Texture* output_texture;
-
- private:
-
- std::array<uint8_t, 64> constants;
-
- size_t group_count_x;
- size_t group_count_y;
- size_t group_count_z;
-};
+#pragma once + +#include "vk-api.hpp" +#include <array> + +class Texture; +class Renderpass { + public: + + Renderpass(vkapi& api) + :api(api) + {}; + + virtual ~Renderpass() { + api.destroy_pipeline(pipeline); + } + + void set_pipeline(pipeline pipeline) { + this->pipeline = pipeline; + } + + // TODO: Do not use vulkan api type + virtual void execute(VkCommandBuffer command_buffer) = 0; + + protected: + vkapi &api; + + pipeline pipeline; +}; + +class ComputeRenderpass : public Renderpass { + public: + + ComputeRenderpass(vkapi& api) + : Renderpass(api) + {} + + void set_dispatch_size(size_t count_x, size_t count_y, size_t count_z); + + void set_ouput_texture(Texture* ouput_texture); + + void set_constant(off_t offset, uint64_t* constant); + void set_constant(off_t offset, Texture* texture); + + // TODO: Do not use vulkan api type + void execute(VkCommandBuffer command_buffer) override final; + + Texture* output_texture; + + private: + + std::vector<Texture*> input_textures; + + std::array<uint8_t, 64> constants; + + size_t group_count_x; + size_t group_count_y; + size_t group_count_z; +}; |
