(controller, draw)
| 70 | |
| 71 | # Get a list of MeshData objects describing the vertex inputs at this draw |
| 72 | def getMeshInputs(controller, draw): |
| 73 | state = controller.GetPipelineState() |
| 74 | |
| 75 | # Get the index & vertex buffers, and fixed vertex inputs |
| 76 | ib = state.GetIBuffer() |
| 77 | vbs = state.GetVBuffers() |
| 78 | attrs = state.GetVertexInputs() |
| 79 | |
| 80 | meshInputs = [] |
| 81 | |
| 82 | for attr in attrs: |
| 83 | |
| 84 | # We don't handle instance attributes |
| 85 | if attr.perInstance: |
| 86 | raise RuntimeError("Instanced properties are not supported!") |
| 87 | |
| 88 | meshInput = MeshData() |
| 89 | meshInput.indexResourceId = ib.resourceId |
| 90 | meshInput.indexByteOffset = ib.byteOffset |
| 91 | meshInput.indexByteStride = ib.byteStride |
| 92 | meshInput.baseVertex = draw.baseVertex |
| 93 | meshInput.indexOffset = draw.indexOffset |
| 94 | meshInput.numIndices = draw.numIndices |
| 95 | |
| 96 | # If the draw doesn't use an index buffer, don't use it even if bound |
| 97 | if not (draw.flags & rd.ActionFlags.Indexed): |
| 98 | meshInput.indexResourceId = rd.ResourceId.Null() |
| 99 | |
| 100 | # The total offset is the attribute offset from the base of the vertex |
| 101 | meshInput.vertexByteOffset = attr.byteOffset + vbs[attr.vertexBuffer].byteOffset + draw.vertexOffset * vbs[attr.vertexBuffer].byteStride |
| 102 | meshInput.format = attr.format |
| 103 | meshInput.vertexResourceId = vbs[attr.vertexBuffer].resourceId |
| 104 | meshInput.vertexByteStride = vbs[attr.vertexBuffer].byteStride |
| 105 | meshInput.name = attr.name |
| 106 | |
| 107 | meshInputs.append(meshInput) |
| 108 | |
| 109 | return meshInputs |
| 110 | |
| 111 | # Get a list of MeshData objects describing the vertex outputs at this draw |
| 112 | def getMeshOutputs(controller, postvs): |
no test coverage detected