Line data Source code
1 : /** 2 : Copyright (c) 2021 Roman Katuntsev <sbkarr@stappler.org> 3 : Copyright (c) 2023 Stappler LLC <admin@stappler.dev> 4 : 5 : Permission is hereby granted, free of charge, to any person obtaining a copy 6 : of this software and associated documentation files (the "Software"), to deal 7 : in the Software without restriction, including without limitation the rights 8 : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 : copies of the Software, and to permit persons to whom the Software is 10 : furnished to do so, subject to the following conditions: 11 : 12 : The above copyright notice and this permission notice shall be included in 13 : all copies or substantial portions of the Software. 14 : 15 : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 : THE SOFTWARE. 22 : **/ 23 : 24 : #ifndef XENOLITH_BACKEND_VK_XLVKPIPELINE_H_ 25 : #define XENOLITH_BACKEND_VK_XLVKPIPELINE_H_ 26 : 27 : #include "XLVk.h" 28 : #include "XLVkDevice.h" 29 : 30 : namespace STAPPLER_VERSIONIZED stappler::xenolith::vk { 31 : 32 : class Shader : public core::Shader { 33 : public: 34 3192 : virtual ~Shader() { } 35 : 36 : bool init(Device &dev, const ProgramData &); 37 : 38 1677 : VkShaderModule getModule() const { return _shaderModule; } 39 : 40 : protected: 41 : using core::Shader::init; 42 : 43 : bool setup(Device &dev, const ProgramData &, SpanView<uint32_t>); 44 : 45 : VkShaderModule _shaderModule = VK_NULL_HANDLE; 46 : }; 47 : 48 : class GraphicPipeline : public core::GraphicPipeline { 49 : public: 50 : static bool comparePipelineOrdering(const PipelineInfo &l, const PipelineInfo &r); 51 : 52 168 : virtual ~GraphicPipeline() { } 53 : 54 : bool init(Device &dev, const PipelineData ¶ms, const SubpassData &, const Queue &); 55 : 56 21362 : VkPipeline getPipeline() const { return _pipeline; } 57 : 58 : protected: 59 : using core::GraphicPipeline::init; 60 : 61 : VkPipeline _pipeline = VK_NULL_HANDLE; 62 : }; 63 : 64 : class ComputePipeline : public core::ComputePipeline { 65 : public: 66 3024 : virtual ~ComputePipeline() { } 67 : 68 : bool init(Device &dev, const PipelineData ¶ms, const SubpassData &, const Queue &); 69 : 70 1246349 : VkPipeline getPipeline() const { return _pipeline; } 71 : 72 968788 : uint32_t getLocalX() const { return _localX; } 73 424188 : uint32_t getLocalY() const { return _localY; } 74 554400 : uint32_t getLocalZ() const { return _localZ; } 75 : 76 : protected: 77 : using core::ComputePipeline::init; 78 : 79 : uint32_t _localX = 0; 80 : uint32_t _localY = 0; 81 : uint32_t _localZ = 0; 82 : VkPipeline _pipeline = VK_NULL_HANDLE; 83 : }; 84 : 85 : } 86 : 87 : #endif /* XENOLITH_BACKEND_VK_XLVKPIPELINE_H_ */