mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-12 13:08:50 +01:00
[d3d11] Ensure that all required inputs are defined by input layout
This commit is contained in:
parent
5540df955c
commit
3edb0ef114
@ -591,7 +591,10 @@ namespace dxvk {
|
||||
ID3D11InputLayout** ppInputLayout) {
|
||||
InitReturnPtr(ppInputLayout);
|
||||
|
||||
if (pInputElementDescs == nullptr)
|
||||
// This check is somehow even correct, passing null with zero
|
||||
// size will always fail but passing non-null with zero size
|
||||
// works, provided the shader does not have any actual inputs
|
||||
if (!pInputElementDescs)
|
||||
return E_INVALIDARG;
|
||||
|
||||
try {
|
||||
@ -603,6 +606,7 @@ namespace dxvk {
|
||||
|
||||
uint32_t attrMask = 0;
|
||||
uint32_t bindMask = 0;
|
||||
uint32_t locationMask = 0;
|
||||
uint32_t bindingsDefined = 0;
|
||||
|
||||
std::array<DxvkVertexAttribute, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT> attrList = { };
|
||||
@ -669,9 +673,19 @@ namespace dxvk {
|
||||
if (entry) {
|
||||
attrMask |= 1u << i;
|
||||
bindMask |= 1u << binding.binding;
|
||||
locationMask |= 1u << attrib.location;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that all inputs used by the shader are defined
|
||||
for (auto i = inputSignature->begin(); i != inputSignature->end(); i++) {
|
||||
bool isBuiltIn = DxbcIsgn::compareSemanticNames(i->semanticName, "sv_instanceid")
|
||||
|| DxbcIsgn::compareSemanticNames(i->semanticName, "sv_vertexid");
|
||||
|
||||
if (!isBuiltIn && !(locationMask & (1u << i->registerId)))
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// Compact the attribute and binding lists to filter
|
||||
// out attributes and bindings not used by the shader
|
||||
uint32_t attrCount = CompactSparseList(attrList.data(), attrMask);
|
||||
|
Loading…
Reference in New Issue
Block a user