39 bool isInsideRenderingBlock =
false;
40 VkCommandBuffer commandBuffer = VK_NULL_HANDLE;
41 std::shared_ptr<RenderPassVk> currentRenderPass =
nullptr;
43 const std::shared_ptr<CommandQueueVk> owningQueue;
44 std::shared_ptr<RenderPipelineVk> currentRenderPipeline =
nullptr;
45 std::shared_ptr<struct ComputePipelineVk> currentComputePipeline =
nullptr;
47 std::unordered_set<struct SwapchainVK*> swapchainsToSignal;
48 std::unordered_set<const struct TextureVk*> swapchainImages;
51 VkImageLayout lastLayout = VK_IMAGE_LAYOUT_UNDEFINED;
61 return key.coveredMips == ALL_MIPS;
64 std::unordered_map<TextureLastUseKey, TextureLastUse> activeTextures;
65 std::unordered_map<const struct BufferVk*, BufferLastUse> activeBuffers;
76 RGLRenderPipelinePtr generic_pipeline;
81 const uint32_t offsetIntoBuffer;
82 const uint32_t bindingOffset;
83 VkPipelineBindPoint bindPoint;
87 std::byte data[256]{ };
93 RGLSamplerPtr sampler;
95 bool isCompute =
false;
126 const std::string label;
131 RGLRenderPassPtr pass;
135 RGLComputePipelinePtr inPipeline;
156 const Rect sourceRect;
158 RGLBufferPtr destBuffer;
162 RGLBufferPtr srcBuffer;
176 const VkDescriptorSet set;
177 const uint32_t binding;
181 const VkDescriptorSet set;
182 const uint32_t setIndex;
187 uint32_t fromMip, fromLayer, toMip, toLayer;
190 std::vector < std::variant <
220 void EncodeCommand(
auto&& commandValue) {
221 renderCommands.push_back(commandValue);
222 if (!isInsideRenderingBlock) {
224 EncodeQueuedCommands();
228 CommandBufferVk(
decltype(owningQueue) owningQueue);
236 void BindRenderPipeline(RGLRenderPipelinePtr) final;
238 void BeginRendering(RGLRenderPassPtr) final;
239 void EndRendering() final;
241 void BeginCompute(RGLComputePipelinePtr) final;
242 void EndCompute() final;
243 void DispatchCompute(uint32_t threadsX, uint32_t threadsY, uint32_t threadsZ, uint32_t threadsPerThreadgroupX = 1, uint32_t threadsPerThreadgroupY = 1, uint32_t threadsPerThreadgroupZ = 1) final;
245 void BindBuffer(RGLBufferPtr buffer, uint32_t bindingOffset, uint32_t offsetIntoBuffer = 0) final;
247 void BindComputeBuffer(RGLBufferPtr buffer, uint32_t binding, uint32_t offsetIntoBuffer = 0) final;
248 void SetVertexBuffer(RGLBufferPtr buffer, const VertexBufferBinding& bindingInfo = {})
final;
252 void SetVertexBytes(
const untyped_span data, uint32_t offset)
final;
253 void SetFragmentBytes(
const untyped_span data, uint32_t offset)
final;
254 void SetComputeBytes(
const untyped_span data, uint32_t offset)
final;
256 void SetIndexBuffer(RGLBufferPtr buffer)
final;
258 void SetVertexSampler(RGLSamplerPtr sampler, uint32_t index)
final;
259 void SetFragmentSampler(RGLSamplerPtr sampler, uint32_t index)
final;
260 void SetComputeSampler(RGLSamplerPtr sampler, uint32_t index)
final;
262 void BindBindlessBufferDescriptorSet(uint32_t set_idx)
final;
264 void SetVertexTexture(
const TextureView& texture, uint32_t index)
final;
265 void SetFragmentTexture(
const TextureView& texture, uint32_t index)
final;
266 void SetComputeTexture(
const TextureView& texture, uint32_t index)
final;
271 void CopyTextureToBuffer(TextureView& sourceTexture,
const Rect& sourceRect,
size_t offset, RGLBufferPtr destBuffer)
final;
272 void CopyBufferToTexture(RGLBufferPtr source, uint32_t size,
const TextureDestConfig& dest)
final;
273 void CopyBufferToBuffer(BufferCopyConfig from, BufferCopyConfig to, uint32_t size)
final;
274 void CopyTextureToTexture(
const TextureCopyConfig& from,
const TextureCopyConfig& to)
final;
276 void SetViewport(
const Viewport&)
final;
277 void SetScissor(
const Rect&)
final;
279 void UseResource(
const TextureView& tx)
final;
280 void UseResource(
const RGLBufferPtr buffer)
final;
282 void Commit(
const CommitConfig&)
final;
284 void ExecuteIndirectIndexed(
const IndirectConfig&)
final;
285 void ExecuteIndirect(
const IndirectConfig&)
final;
286 void DispatchIndirect(
const DispatchIndirectConfig&)
final;
288 void BeginRenderDebugMarker(
const std::string& label)
final;
289 void BeginComputeDebugMarker(
const std::string& label)
final;
291 void EndRenderDebugMarker() final;
292 void EndComputeDebugMarker() final;
294 void BlockUntilCompleted() final;
297 void GenericBindBuffer(RGLBufferPtr& buffer, const uint32_t& offsetIntoBuffer, const uint32_t& bindingOffset, VkPipelineBindPoint bindPoint);
298 void RecordBufferBinding(const BufferVk* buffer, BufferLastUse usage);
299 void RecordTextureBinding(const TextureView texture, TextureLastUse usage,
bool recordOnly = false);
300 void EncodeQueuedCommands();
301 bool IsBufferSlotWritable(uint32_t slot);
302 std::vector<VkBufferMemoryBarrier2> barriersToAdd;
303 void ApplyBarriers();
304 VkFence internalFence;
Definition VkCommandBuffer.hpp:175
Definition VkCommandBuffer.hpp:161
Definition VkCommandBuffer.hpp:154
Definition VkCommandBuffer.hpp:185
Definition VkCommandBuffer.hpp:98
Definition VkCommandBuffer.hpp:50
Definition CommandBuffer.hpp:159
Definition VkCommandBuffer.hpp:11
Definition Texture.hpp:43
Definition VkTexture.hpp:14