diff --git a/src/dxbc/dxbc_compiler.cpp b/src/dxbc/dxbc_compiler.cpp index d1bead09c..dd1b8588c 100644 --- a/src/dxbc/dxbc_compiler.cpp +++ b/src/dxbc/dxbc_compiler.cpp @@ -985,6 +985,7 @@ namespace dxvk { uav.sampledTypeId = sampledTypeId; uav.imageTypeId = imageTypeId; uav.structStride = 0; + uav.structAlign = 0; m_uavs.at(registerId) = uav; } else { DxbcShaderResource res; @@ -998,6 +999,7 @@ namespace dxvk { res.colorTypeId = imageTypeId; res.depthTypeId = 0; res.structStride = 0; + res.structAlign = 0; if ((sampledType == DxbcScalarType::Float32) && (resourceType == DxbcResourceDim::Texture2D @@ -1065,6 +1067,10 @@ namespace dxvk { ? ins.imm[0].u32 : 0; + uint32_t resAlign = isStructured + ? (resStride & -resStride) + : 16; + // Compute the DXVK binding slot index for the resource. uint32_t bindingId = isUav ? computeUavBinding(m_programInfo.type(), registerId) @@ -1132,6 +1138,7 @@ namespace dxvk { uav.sampledTypeId = sampledTypeId; uav.imageTypeId = resTypeId; uav.structStride = resStride; + uav.structAlign = resAlign; m_uavs.at(registerId) = uav; } else { DxbcShaderResource res; @@ -1145,6 +1152,7 @@ namespace dxvk { res.colorTypeId = resTypeId; res.depthTypeId = 0; res.structStride = resStride; + res.structAlign = resAlign; m_textures.at(registerId) = res; } @@ -7298,6 +7306,7 @@ namespace dxvk { result.varId = m_textures.at(registerId).varId; result.specId = m_textures.at(registerId).specId; result.stride = m_textures.at(registerId).structStride; + result.align = m_textures.at(registerId).structAlign; return result; } break; @@ -7310,6 +7319,7 @@ namespace dxvk { result.varId = m_uavs.at(registerId).varId; result.specId = m_uavs.at(registerId).specId; result.stride = m_uavs.at(registerId).structStride; + result.align = m_uavs.at(registerId).structAlign; return result; } break; @@ -7324,6 +7334,7 @@ namespace dxvk { result.varId = m_gRegs.at(registerId).varId; result.specId = 0; result.stride = m_gRegs.at(registerId).elementStride; + result.align = 0; return result; } break; diff --git a/src/dxbc/dxbc_compiler.h b/src/dxbc/dxbc_compiler.h index e4f9eb0e5..8dd1913ed 100644 --- a/src/dxbc/dxbc_compiler.h +++ b/src/dxbc/dxbc_compiler.h @@ -347,6 +347,7 @@ namespace dxvk { uint32_t varId; uint32_t specId; uint32_t stride; + uint32_t align; }; diff --git a/src/dxbc/dxbc_decoder.h b/src/dxbc/dxbc_decoder.h index cb2c60ba5..65b5dafd1 100644 --- a/src/dxbc/dxbc_decoder.h +++ b/src/dxbc/dxbc_decoder.h @@ -81,6 +81,7 @@ namespace dxvk { uint32_t colorTypeId = 0; uint32_t depthTypeId = 0; uint32_t structStride = 0; + uint32_t structAlign = 0; }; @@ -100,6 +101,7 @@ namespace dxvk { uint32_t sampledTypeId = 0; uint32_t imageTypeId = 0; uint32_t structStride = 0; + uint32_t structAlign = 0; };