| 560 | } |
| 561 | |
| 562 | void DbgCommandBuffer::SetResource( |
| 563 | Resource& resource, |
| 564 | std::uint32_t slot, |
| 565 | long bindFlags, |
| 566 | long stageFlags) |
| 567 | { |
| 568 | if (debugger_) |
| 569 | { |
| 570 | LLGL_DBG_SOURCE; |
| 571 | AssertRecording(); |
| 572 | |
| 573 | if (!features_.hasDirectResourceBinding) |
| 574 | LLGL_DBG_ERROR(ErrorType::UnsupportedFeature, "direct resource binding not supported"); |
| 575 | |
| 576 | ValidateStageFlags(stageFlags, StageFlags::AllStages); |
| 577 | } |
| 578 | |
| 579 | if (perfProfilerEnabled_) |
| 580 | StartTimer("SetResource"); |
| 581 | |
| 582 | switch (resource.GetResourceType()) |
| 583 | { |
| 584 | case ResourceType::Undefined: |
| 585 | break; |
| 586 | |
| 587 | case ResourceType::Buffer: |
| 588 | { |
| 589 | /* Forward buffer resource to wrapped instance */ |
| 590 | auto& bufferDbg = LLGL_CAST(DbgBuffer&, resource); |
| 591 | |
| 592 | ValidateBindFlags( |
| 593 | bufferDbg.desc.bindFlags, |
| 594 | bindFlags, |
| 595 | (BindFlags::ConstantBuffer | BindFlags::Sampled | BindFlags::Storage), |
| 596 | GetLabelOrDefault(bufferDbg.label, "LLGL::Buffer") |
| 597 | ); |
| 598 | |
| 599 | instance.SetResource(bufferDbg.instance, slot, bindFlags, stageFlags); |
| 600 | |
| 601 | /* Record binding for profiling */ |
| 602 | if ((bindFlags & BindFlags::ConstantBuffer) != 0) |
| 603 | profile_.constantBufferBindings++; |
| 604 | if ((bindFlags & BindFlags::Sampled) != 0) |
| 605 | profile_.sampledBufferBindings++; |
| 606 | if ((bindFlags & BindFlags::Storage) != 0) |
| 607 | profile_.storageBufferBindings++; |
| 608 | } |
| 609 | break; |
| 610 | |
| 611 | case ResourceType::Texture: |
| 612 | { |
| 613 | /* Forward texture resource to wrapped instance */ |
| 614 | auto& textureDbg = LLGL_CAST(DbgTexture&, resource); |
| 615 | |
| 616 | ValidateBindFlags( |
| 617 | textureDbg.desc.bindFlags, |
| 618 | bindFlags, |
| 619 | (BindFlags::Sampled | BindFlags::Storage | BindFlags::CombinedSampler), |
nothing calls this directly
no test coverage detected