| 569 | } |
| 570 | |
| 571 | void CommandListWrapper::setGraphicsState(const GraphicsState& state) |
| 572 | { |
| 573 | if (!requireOpenState()) |
| 574 | return; |
| 575 | |
| 576 | if (!requireType(CommandQueue::Graphics, "setGraphicsState")) |
| 577 | return; |
| 578 | |
| 579 | bool anyErrors = false; |
| 580 | std::stringstream ss; |
| 581 | ss << "setGraphicsState: " << std::endl; |
| 582 | |
| 583 | if (!state.pipeline) |
| 584 | { |
| 585 | ss << "pipeline is NULL." << std::endl; |
| 586 | anyErrors = true; |
| 587 | } |
| 588 | |
| 589 | if (!state.framebuffer) |
| 590 | { |
| 591 | ss << "framebuffer is NULL." << std::endl; |
| 592 | anyErrors = true; |
| 593 | } |
| 594 | |
| 595 | if (state.indexBuffer.buffer && !state.indexBuffer.buffer->getDesc().isIndexBuffer) |
| 596 | { |
| 597 | ss << "Cannot use buffer '" << utils::DebugNameToString(state.indexBuffer.buffer->getDesc().debugName) << "' as an index buffer because it does not have the isIndexBuffer flag set." << std::endl; |
| 598 | anyErrors = true; |
| 599 | } |
| 600 | |
| 601 | for (size_t index = 0; index < state.vertexBuffers.size(); index++) |
| 602 | { |
| 603 | const VertexBufferBinding& vb = state.vertexBuffers[index]; |
| 604 | |
| 605 | if (!vb.buffer) |
| 606 | { |
| 607 | ss << "Vertex buffer at index " << index << " is NULL." << std::endl; |
| 608 | anyErrors = true; |
| 609 | } |
| 610 | else if (!vb.buffer->getDesc().isVertexBuffer) |
| 611 | { |
| 612 | ss << "Buffer '" << utils::DebugNameToString(vb.buffer->getDesc().debugName) << "' bound to vertex buffer slot " << index << " cannot be used as a vertex buffer because it does not have the isVertexBuffer flag set." << std::endl; |
| 613 | anyErrors = true; |
| 614 | } |
| 615 | |
| 616 | if (vb.slot >= c_MaxVertexAttributes) |
| 617 | { |
| 618 | ss << "Vertex buffer binding at index " << index << " uses an invalid slot " << vb.slot << "." << std::endl; |
| 619 | anyErrors = true; |
| 620 | } |
| 621 | } |
| 622 | |
| 623 | if (state.indirectParams && !state.indirectParams->getDesc().isDrawIndirectArgs) |
| 624 | { |
| 625 | ss << "Cannot use buffer '" << utils::DebugNameToString(state.indirectParams->getDesc().debugName) << "' as a DrawIndirect argument buffer because it does not have the isDrawIndirectArgs flag set." << std::endl; |
| 626 | anyErrors = true; |
| 627 | } |
| 628 |
nothing calls this directly
no test coverage detected