| 804 | } |
| 805 | |
| 806 | void GnmCommandBufferDraw::updateInputLayout( |
| 807 | gcn::VertexInputSemanticTable& semantic, |
| 808 | const uint32_t* vertexTable, |
| 809 | uint32_t bufferCount) |
| 810 | { |
| 811 | bool singleBinding = (bufferCount == 1); |
| 812 | |
| 813 | std::array<VltVertexAttribute, kMaxVertexBufferCount> attributes; |
| 814 | std::array<VltVertexBinding, kMaxVertexBufferCount> bindings; |
| 815 | |
| 816 | size_t firstAttributeOffset = 0; |
| 817 | uint32_t semanticCount = semantic.size(); |
| 818 | for (uint32_t i = 0; i != semanticCount; ++i) |
| 819 | { |
| 820 | auto& sema = semantic[i]; |
| 821 | uint32_t offsetInDwords = sema.m_semantic * ShaderConstantDwordSize::kDwordSizeVertexBuffer; |
| 822 | // We need to trust format info in V#, not instructions in fetch shader. |
| 823 | // From GPU ISA: |
| 824 | // The number of bytes loaded is determined solely by sV#.dfmt, |
| 825 | // even if the instruction op count does not match. |
| 826 | const Buffer* vsharp = reinterpret_cast<const Buffer*>(vertexTable + offsetInDwords); |
| 827 | |
| 828 | if (firstAttributeOffset == 0) |
| 829 | { |
| 830 | firstAttributeOffset = reinterpret_cast<size_t>(vsharp->getBaseAddress()); |
| 831 | } |
| 832 | |
| 833 | LOG_ASSERT(sema.m_semantic == i, "semantic index is not equal to table index."); |
| 834 | |
| 835 | // Attributes |
| 836 | attributes[i].location = sema.m_semantic; |
| 837 | attributes[i].binding = singleBinding ? 0 : sema.m_semantic; |
| 838 | attributes[i].format = cvt::convertDataFormat(vsharp->getDataFormat()); |
| 839 | attributes[i].offset = singleBinding |
| 840 | ? reinterpret_cast<size_t>(vsharp->getBaseAddress()) - firstAttributeOffset |
| 841 | : 0; |
| 842 | |
| 843 | // Bindings |
| 844 | bindings[i].binding = sema.m_semantic; |
| 845 | bindings[i].fetchRate = 0; |
| 846 | bindings[i].inputRate = VK_VERTEX_INPUT_RATE_VERTEX; |
| 847 | |
| 848 | // Fix element count |
| 849 | sema.m_sizeInElements = std::min(static_cast<uint32_t>(sema.m_sizeInElements), |
| 850 | vsharp->getDataFormat().getNumComponents()); |
| 851 | } |
| 852 | |
| 853 | m_context->setInputLayout( |
| 854 | semanticCount, |
| 855 | attributes.data(), |
| 856 | singleBinding ? 1 : semanticCount, |
| 857 | bindings.data()); |
| 858 | } |
| 859 | |
| 860 | void GnmCommandBufferDraw::updateIndexBuffer( |
| 861 | const void* indexAddr, |
nothing calls this directly
no test coverage detected