Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 1 | // Copyright 2018 The SwiftShader Authors. All Rights Reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | #include "VkCommandBuffer.hpp" |
| 16 | |
Chris Forbes | f8374cf | 2018-12-06 13:25:59 -0800 | [diff] [blame^] | 17 | #include <cstring> |
| 18 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 19 | namespace vk |
| 20 | { |
| 21 | |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 22 | class CommandBuffer::Command |
| 23 | { |
| 24 | public: |
| 25 | // FIXME (b/119421344): change the commandBuffer argument to a CommandBuffer state |
| 26 | virtual void play(CommandBuffer* commandBuffer) = 0; |
| 27 | virtual ~Command() {} |
| 28 | }; |
| 29 | |
| 30 | class BeginRenderPass : public CommandBuffer::Command |
| 31 | { |
| 32 | public: |
| 33 | BeginRenderPass(VkRenderPass pRenderPass, VkFramebuffer pFramebuffer, VkRect2D pRenderArea, |
| 34 | uint32_t pClearValueCount, const VkClearValue* pClearValues) : |
| 35 | renderPass(pRenderPass), framebuffer(pFramebuffer), renderArea(pRenderArea), |
| 36 | clearValueCount(pClearValueCount) |
| 37 | { |
| 38 | // FIXME (b/119409619): use an allocator here so we can control all memory allocations |
| 39 | clearValues = new VkClearValue[clearValueCount]; |
| 40 | memcpy(clearValues, pClearValues, clearValueCount * sizeof(VkClearValue)); |
| 41 | } |
| 42 | |
| 43 | ~BeginRenderPass() override |
| 44 | { |
| 45 | delete clearValues; |
| 46 | } |
| 47 | |
| 48 | protected: |
| 49 | void play(CommandBuffer* commandBuffer) |
| 50 | { |
| 51 | UNIMPLEMENTED(); |
| 52 | } |
| 53 | |
| 54 | private: |
| 55 | VkRenderPass renderPass; |
| 56 | VkFramebuffer framebuffer; |
| 57 | VkRect2D renderArea; |
| 58 | uint32_t clearValueCount; |
| 59 | VkClearValue* clearValues; |
| 60 | }; |
| 61 | |
| 62 | class EndRenderPass : public CommandBuffer::Command |
| 63 | { |
| 64 | public: |
| 65 | EndRenderPass() |
| 66 | { |
| 67 | } |
| 68 | |
| 69 | protected: |
| 70 | void play(CommandBuffer* commandBuffer) |
| 71 | { |
| 72 | UNIMPLEMENTED(); |
| 73 | } |
| 74 | |
| 75 | private: |
| 76 | }; |
| 77 | |
| 78 | class PipelineBind : public CommandBuffer::Command |
| 79 | { |
| 80 | public: |
| 81 | PipelineBind(VkPipelineBindPoint pPipelineBindPoint, VkPipeline pPipeline) : |
| 82 | pipelineBindPoint(pPipelineBindPoint), pipeline(pPipeline) |
| 83 | { |
| 84 | } |
| 85 | |
| 86 | protected: |
| 87 | void play(CommandBuffer* commandBuffer) |
| 88 | { |
| 89 | UNIMPLEMENTED(); |
| 90 | } |
| 91 | |
| 92 | private: |
| 93 | VkPipelineBindPoint pipelineBindPoint; |
| 94 | VkPipeline pipeline; |
| 95 | }; |
| 96 | |
| 97 | struct VertexBufferBind : public CommandBuffer::Command |
| 98 | { |
| 99 | VertexBufferBind(uint32_t pBinding, const VkBuffer pBuffer, const VkDeviceSize pOffset) : |
| 100 | binding(pBinding), buffer(pBuffer), offset(pOffset) |
| 101 | { |
| 102 | } |
| 103 | |
| 104 | void play(CommandBuffer* commandBuffer) |
| 105 | { |
| 106 | UNIMPLEMENTED(); |
| 107 | } |
| 108 | |
| 109 | uint32_t binding; |
| 110 | const VkBuffer buffer; |
| 111 | const VkDeviceSize offset; |
| 112 | }; |
| 113 | |
| 114 | struct Draw : public CommandBuffer::Command |
| 115 | { |
| 116 | Draw(uint32_t pVertexCount) : vertexCount(pVertexCount) |
| 117 | { |
| 118 | } |
| 119 | |
| 120 | void play(CommandBuffer* commandBuffer) |
| 121 | { |
| 122 | UNIMPLEMENTED(); |
| 123 | } |
| 124 | |
| 125 | uint32_t vertexCount; |
| 126 | }; |
| 127 | |
| 128 | struct ImageToBufferCopy : public CommandBuffer::Command |
| 129 | { |
| 130 | ImageToBufferCopy(VkImage pSrcImage, VkBuffer pDstBuffer, const VkBufferImageCopy& pRegion) : |
| 131 | srcImage(pSrcImage), dstBuffer(pDstBuffer), region(pRegion) |
| 132 | { |
| 133 | } |
| 134 | |
| 135 | void play(CommandBuffer* commandBuffer) |
| 136 | { |
| 137 | UNIMPLEMENTED(); |
| 138 | } |
| 139 | |
| 140 | private: |
| 141 | VkImage srcImage; |
| 142 | VkBuffer dstBuffer; |
| 143 | const VkBufferImageCopy region; |
| 144 | }; |
| 145 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 146 | CommandBuffer::CommandBuffer(VkCommandBufferLevel pLevel) : level(pLevel) |
| 147 | { |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 148 | // FIXME (b/119409619): replace this vector by an allocator so we can control all memory allocations |
| 149 | commands = new std::vector<std::unique_ptr<Command> >(); |
| 150 | |
Alexis Hetu | 767b41b | 2018-09-26 11:25:46 -0400 | [diff] [blame] | 151 | pipelines[VK_PIPELINE_BIND_POINT_GRAPHICS] = VK_NULL_HANDLE; |
| 152 | pipelines[VK_PIPELINE_BIND_POINT_COMPUTE] = VK_NULL_HANDLE; |
| 153 | } |
| 154 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 155 | void CommandBuffer::destroy(const VkAllocationCallbacks* pAllocator) |
| 156 | { |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 157 | deleteCommands(); |
| 158 | } |
| 159 | |
| 160 | void CommandBuffer::deleteCommands() |
| 161 | { |
| 162 | // FIXME (b/119409619): replace this vector by an allocator so we can control all memory allocations |
| 163 | delete commands; |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | VkResult CommandBuffer::begin(VkCommandBufferUsageFlags flags, const VkCommandBufferInheritanceInfo* pInheritanceInfo) |
| 167 | { |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 168 | ASSERT((state != RECORDING) && (state != PENDING)); |
| 169 |
|
| 170 | if((flags != VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT) || pInheritanceInfo)
|
| 171 | {
|
| 172 | UNIMPLEMENTED();
|
| 173 | }
|
| 174 |
|
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 175 | state = RECORDING; |
| 176 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 177 | return VK_SUCCESS; |
| 178 | } |
| 179 | |
| 180 | VkResult CommandBuffer::end() |
| 181 | { |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 182 | ASSERT(state == RECORDING); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 183 | |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 184 | state = EXECUTABLE; |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 185 | |
| 186 | return VK_SUCCESS; |
| 187 | } |
| 188 | |
| 189 | VkResult CommandBuffer::reset(VkCommandPoolResetFlags flags) |
| 190 | { |
| 191 | ASSERT(state != PENDING); |
| 192 | |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 193 | deleteCommands(); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 194 | |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 195 | state = INITIAL; |
| 196 | |
| 197 | return VK_SUCCESS; |
| 198 | } |
| 199 | |
| 200 | void CommandBuffer::beginRenderPass(VkRenderPass renderPass, VkFramebuffer framebuffer, VkRect2D renderArea, |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 201 | uint32_t clearValueCount, const VkClearValue* clearValues, VkSubpassContents contents) |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 202 | { |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 203 | ASSERT(state == RECORDING); |
| 204 | |
| 205 | if(contents != VK_SUBPASS_CONTENTS_INLINE)
|
| 206 | {
|
| 207 | UNIMPLEMENTED();
|
| 208 | } |
| 209 | |
| 210 | commands->push_back(std::make_unique<BeginRenderPass>(renderPass, framebuffer, renderArea, clearValueCount, clearValues)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | void CommandBuffer::nextSubpass(VkSubpassContents contents) |
| 214 | { |
| 215 | UNIMPLEMENTED(); |
| 216 | } |
| 217 | |
| 218 | void CommandBuffer::endRenderPass() |
| 219 | { |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 220 | commands->push_back(std::make_unique<EndRenderPass>()); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | void CommandBuffer::executeCommands(uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers) |
| 224 | { |
| 225 | UNIMPLEMENTED(); |
| 226 | } |
| 227 | |
| 228 | void CommandBuffer::setDeviceMask(uint32_t deviceMask) |
| 229 | { |
| 230 | UNIMPLEMENTED(); |
| 231 | } |
| 232 | |
| 233 | void CommandBuffer::dispatchBase(uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, |
| 234 | uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) |
| 235 | { |
| 236 | UNIMPLEMENTED(); |
| 237 | } |
| 238 | |
| 239 | void CommandBuffer::pipelineBarrier(VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, |
| 240 | VkDependencyFlags dependencyFlags, |
| 241 | uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, |
| 242 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, |
| 243 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers) |
| 244 | { |
| 245 | UNIMPLEMENTED(); |
| 246 | } |
| 247 | |
| 248 | void CommandBuffer::bindPipeline(VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) |
| 249 | { |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 250 | if(pipelineBindPoint != VK_PIPELINE_BIND_POINT_GRAPHICS) |
| 251 | { |
| 252 | UNIMPLEMENTED(); |
| 253 | } |
| 254 | |
| 255 | commands->push_back(std::make_unique<PipelineBind>(pipelineBindPoint, pipeline)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | void CommandBuffer::bindVertexBuffers(uint32_t firstBinding, uint32_t bindingCount, |
| 259 | const VkBuffer* pBuffers, const VkDeviceSize* pOffsets) |
| 260 | { |
| 261 | for(uint32_t i = firstBinding; i < (firstBinding + bindingCount); ++i) |
| 262 | { |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 263 | commands->push_back(std::make_unique<VertexBufferBind>(i, pBuffers[i], pOffsets[i])); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 264 | } |
| 265 | } |
| 266 | |
| 267 | void CommandBuffer::beginQuery(VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags) |
| 268 | { |
| 269 | UNIMPLEMENTED(); |
| 270 | } |
| 271 | |
| 272 | void CommandBuffer::endQuery(VkQueryPool queryPool, uint32_t query) |
| 273 | { |
| 274 | UNIMPLEMENTED(); |
| 275 | } |
| 276 | |
| 277 | void CommandBuffer::resetQueryPool(VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) |
| 278 | { |
| 279 | UNIMPLEMENTED(); |
| 280 | } |
| 281 | |
| 282 | void CommandBuffer::writeTimestamp(VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query) |
| 283 | { |
| 284 | UNIMPLEMENTED(); |
| 285 | } |
| 286 | |
| 287 | void CommandBuffer::copyQueryPoolResults(VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, |
| 288 | VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) |
| 289 | { |
| 290 | UNIMPLEMENTED(); |
| 291 | } |
| 292 | |
| 293 | void CommandBuffer::pushConstants(VkPipelineLayout layout, VkShaderStageFlags stageFlags, |
| 294 | uint32_t offset, uint32_t size, const void* pValues) |
| 295 | { |
| 296 | UNIMPLEMENTED(); |
| 297 | } |
| 298 | |
| 299 | void CommandBuffer::setViewport(uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) |
| 300 | { |
| 301 | // Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_VIEWPORT dynamic state enabled |
| 302 | UNIMPLEMENTED(); |
| 303 | } |
| 304 | |
| 305 | void CommandBuffer::setScissor(uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) |
| 306 | { |
| 307 | // Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_SCISSOR dynamic state enabled |
| 308 | UNIMPLEMENTED(); |
| 309 | } |
| 310 | |
| 311 | void CommandBuffer::setLineWidth(float lineWidth) |
| 312 | { |
| 313 | // Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_LINE_WIDTH dynamic state enabled |
| 314 | |
| 315 | // If the wide lines feature is not enabled, lineWidth must be 1.0 |
| 316 | ASSERT(lineWidth == 1.0f); |
| 317 | |
| 318 | UNIMPLEMENTED(); |
| 319 | } |
| 320 | |
| 321 | void CommandBuffer::setDepthBias(float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) |
| 322 | { |
| 323 | // Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_DEPTH_BIAS dynamic state enabled |
| 324 | |
| 325 | // If the depth bias clamping feature is not enabled, depthBiasClamp must be 0.0 |
| 326 | ASSERT(depthBiasClamp == 0.0f); |
| 327 | |
| 328 | UNIMPLEMENTED(); |
| 329 | } |
| 330 | |
| 331 | void CommandBuffer::setBlendConstants(const float blendConstants[4]) |
| 332 | { |
| 333 | // Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_BLEND_CONSTANTS dynamic state enabled |
| 334 | |
| 335 | // blendConstants is an array of four values specifying the R, G, B, and A components |
| 336 | // of the blend constant color used in blending, depending on the blend factor. |
| 337 | |
| 338 | UNIMPLEMENTED(); |
| 339 | } |
| 340 | |
| 341 | void CommandBuffer::setDepthBounds(float minDepthBounds, float maxDepthBounds) |
| 342 | { |
| 343 | // Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_DEPTH_BOUNDS dynamic state enabled |
| 344 | |
| 345 | // Unless the VK_EXT_depth_range_unrestricted extension is enabled minDepthBounds and maxDepthBounds must be between 0.0 and 1.0, inclusive |
| 346 | ASSERT(minDepthBounds >= 0.0f && minDepthBounds <= 1.0f); |
| 347 | ASSERT(maxDepthBounds >= 0.0f && maxDepthBounds <= 1.0f); |
| 348 | |
| 349 | UNIMPLEMENTED(); |
| 350 | } |
| 351 | |
| 352 | void CommandBuffer::setStencilCompareMask(VkStencilFaceFlags faceMask, uint32_t compareMask) |
| 353 | { |
| 354 | // Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK dynamic state enabled |
| 355 | |
| 356 | // faceMask must not be 0 |
| 357 | ASSERT(faceMask != 0); |
| 358 | |
| 359 | UNIMPLEMENTED(); |
| 360 | } |
| 361 | |
| 362 | void CommandBuffer::setStencilWriteMask(VkStencilFaceFlags faceMask, uint32_t writeMask) |
| 363 | { |
| 364 | // Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_STENCIL_WRITE_MASK dynamic state enabled |
| 365 | |
| 366 | // faceMask must not be 0 |
| 367 | ASSERT(faceMask != 0); |
| 368 | |
| 369 | UNIMPLEMENTED(); |
| 370 | } |
| 371 | |
| 372 | void CommandBuffer::setStencilReference(VkStencilFaceFlags faceMask, uint32_t reference) |
| 373 | { |
| 374 | // Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_STENCIL_REFERENCE dynamic state enabled |
| 375 | |
| 376 | // faceMask must not be 0 |
| 377 | ASSERT(faceMask != 0); |
| 378 | |
| 379 | UNIMPLEMENTED(); |
| 380 | } |
| 381 | |
| 382 | void CommandBuffer::bindDescriptorSets(VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, |
| 383 | uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, |
| 384 | uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets) |
| 385 | { |
| 386 | UNIMPLEMENTED(); |
| 387 | } |
| 388 | |
| 389 | void CommandBuffer::bindIndexBuffer(VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) |
| 390 | { |
| 391 | UNIMPLEMENTED(); |
| 392 | } |
| 393 | |
| 394 | void CommandBuffer::dispatch(uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) |
| 395 | { |
| 396 | UNIMPLEMENTED(); |
| 397 | } |
| 398 | |
| 399 | void CommandBuffer::dispatchIndirect(VkBuffer buffer, VkDeviceSize offset) |
| 400 | { |
| 401 | UNIMPLEMENTED(); |
| 402 | } |
| 403 | |
| 404 | void CommandBuffer::copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) |
| 405 | { |
| 406 | UNIMPLEMENTED(); |
| 407 | } |
| 408 | |
| 409 | void CommandBuffer::copyImage(VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, |
| 410 | uint32_t regionCount, const VkImageCopy* pRegions) |
| 411 | { |
| 412 | UNIMPLEMENTED(); |
| 413 | } |
| 414 | |
| 415 | void CommandBuffer::blitImage(VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, |
| 416 | uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter) |
| 417 | { |
| 418 | UNIMPLEMENTED(); |
| 419 | } |
| 420 | |
| 421 | void CommandBuffer::copyBufferToImage(VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, |
| 422 | uint32_t regionCount, const VkBufferImageCopy* pRegions) |
| 423 | { |
| 424 | UNIMPLEMENTED(); |
| 425 | } |
| 426 | |
| 427 | void CommandBuffer::copyImageToBuffer(VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, |
| 428 | uint32_t regionCount, const VkBufferImageCopy* pRegions) |
| 429 | { |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 430 | ASSERT(srcImageLayout == VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL); |
| 431 | |
| 432 | for(uint32_t i = 0; i < regionCount; i++) |
| 433 | { |
| 434 | commands->push_back(std::make_unique<ImageToBufferCopy>(srcImage, dstBuffer, pRegions[i])); |
| 435 | } |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 436 | } |
| 437 | |
| 438 | void CommandBuffer::updateBuffer(VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData) |
| 439 | { |
| 440 | UNIMPLEMENTED(); |
| 441 | } |
| 442 | |
| 443 | void CommandBuffer::fillBuffer(VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) |
| 444 | { |
| 445 | UNIMPLEMENTED(); |
| 446 | } |
| 447 | |
| 448 | void CommandBuffer::clearColorImage(VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, |
| 449 | uint32_t rangeCount, const VkImageSubresourceRange* pRanges) |
| 450 | { |
| 451 | UNIMPLEMENTED(); |
| 452 | } |
| 453 | |
| 454 | void CommandBuffer::clearDepthStencilImage(VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, |
| 455 | uint32_t rangeCount, const VkImageSubresourceRange* pRanges) |
| 456 | { |
| 457 | UNIMPLEMENTED(); |
| 458 | } |
| 459 | |
| 460 | void CommandBuffer::clearAttachments(uint32_t attachmentCount, const VkClearAttachment* pAttachments, |
| 461 | uint32_t rectCount, const VkClearRect* pRects) |
| 462 | { |
| 463 | UNIMPLEMENTED(); |
| 464 | } |
| 465 | |
| 466 | void CommandBuffer::resolveImage(VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, |
| 467 | uint32_t regionCount, const VkImageResolve* pRegions) |
| 468 | { |
| 469 | UNIMPLEMENTED(); |
| 470 | } |
| 471 | |
| 472 | void CommandBuffer::setEvent(VkEvent event, VkPipelineStageFlags stageMask) |
| 473 | { |
| 474 | UNIMPLEMENTED(); |
| 475 | } |
| 476 | |
| 477 | void CommandBuffer::resetEvent(VkEvent event, VkPipelineStageFlags stageMask) |
| 478 | { |
| 479 | UNIMPLEMENTED(); |
| 480 | } |
| 481 | |
| 482 | void CommandBuffer::waitEvents(uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, |
| 483 | VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, |
| 484 | uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, |
| 485 | uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers) |
| 486 | { |
| 487 | UNIMPLEMENTED(); |
| 488 | } |
| 489 | |
| 490 | void CommandBuffer::draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) |
| 491 | { |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 492 | if(instanceCount > 1 || firstVertex != 0 || firstInstance != 0)
|
| 493 | {
|
| 494 | UNIMPLEMENTED();
|
| 495 | } |
| 496 | |
| 497 | commands->push_back(std::make_unique<Draw>(vertexCount)); |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 498 | } |
| 499 | |
| 500 | void CommandBuffer::drawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) |
| 501 | { |
| 502 | UNIMPLEMENTED(); |
| 503 | } |
| 504 | |
| 505 | void CommandBuffer::drawIndirect(VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) |
| 506 | { |
| 507 | UNIMPLEMENTED(); |
| 508 | } |
| 509 | |
| 510 | void CommandBuffer::drawIndexedIndirect(VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) |
| 511 | { |
| 512 | UNIMPLEMENTED(); |
| 513 | } |
| 514 | |
| 515 | void CommandBuffer::submit() |
| 516 | { |
| 517 | // Perform recorded work |
| 518 | state = PENDING; |
| 519 | |
Alexis Hetu | 072dc0d | 2018-10-31 11:41:25 -0400 | [diff] [blame] | 520 | for(auto& command : *commands) |
| 521 | { |
| 522 | command->play(this); |
| 523 | } |
Alexis Hetu | a9999ce | 2018-10-17 08:00:43 -0400 | [diff] [blame] | 524 | |
| 525 | // After work is completed |
| 526 | state = EXECUTABLE; |
| 527 | } |
| 528 | |
Chris Forbes | f8374cf | 2018-12-06 13:25:59 -0800 | [diff] [blame^] | 529 | } // namespace vk |