1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 20:52:10 +01:00

[dxbc] Store alignment for raw and structured buffers

This commit is contained in:
Philip Rebohle 2019-06-05 00:58:25 +02:00
parent acab2bd8ce
commit 163e6aaa50
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 14 additions and 0 deletions

View File

@ -985,6 +985,7 @@ namespace dxvk {
uav.sampledTypeId = sampledTypeId; uav.sampledTypeId = sampledTypeId;
uav.imageTypeId = imageTypeId; uav.imageTypeId = imageTypeId;
uav.structStride = 0; uav.structStride = 0;
uav.structAlign = 0;
m_uavs.at(registerId) = uav; m_uavs.at(registerId) = uav;
} else { } else {
DxbcShaderResource res; DxbcShaderResource res;
@ -998,6 +999,7 @@ namespace dxvk {
res.colorTypeId = imageTypeId; res.colorTypeId = imageTypeId;
res.depthTypeId = 0; res.depthTypeId = 0;
res.structStride = 0; res.structStride = 0;
res.structAlign = 0;
if ((sampledType == DxbcScalarType::Float32) if ((sampledType == DxbcScalarType::Float32)
&& (resourceType == DxbcResourceDim::Texture2D && (resourceType == DxbcResourceDim::Texture2D
@ -1065,6 +1067,10 @@ namespace dxvk {
? ins.imm[0].u32 ? ins.imm[0].u32
: 0; : 0;
uint32_t resAlign = isStructured
? (resStride & -resStride)
: 16;
// Compute the DXVK binding slot index for the resource. // Compute the DXVK binding slot index for the resource.
uint32_t bindingId = isUav uint32_t bindingId = isUav
? computeUavBinding(m_programInfo.type(), registerId) ? computeUavBinding(m_programInfo.type(), registerId)
@ -1132,6 +1138,7 @@ namespace dxvk {
uav.sampledTypeId = sampledTypeId; uav.sampledTypeId = sampledTypeId;
uav.imageTypeId = resTypeId; uav.imageTypeId = resTypeId;
uav.structStride = resStride; uav.structStride = resStride;
uav.structAlign = resAlign;
m_uavs.at(registerId) = uav; m_uavs.at(registerId) = uav;
} else { } else {
DxbcShaderResource res; DxbcShaderResource res;
@ -1145,6 +1152,7 @@ namespace dxvk {
res.colorTypeId = resTypeId; res.colorTypeId = resTypeId;
res.depthTypeId = 0; res.depthTypeId = 0;
res.structStride = resStride; res.structStride = resStride;
res.structAlign = resAlign;
m_textures.at(registerId) = res; m_textures.at(registerId) = res;
} }
@ -7298,6 +7306,7 @@ namespace dxvk {
result.varId = m_textures.at(registerId).varId; result.varId = m_textures.at(registerId).varId;
result.specId = m_textures.at(registerId).specId; result.specId = m_textures.at(registerId).specId;
result.stride = m_textures.at(registerId).structStride; result.stride = m_textures.at(registerId).structStride;
result.align = m_textures.at(registerId).structAlign;
return result; return result;
} break; } break;
@ -7310,6 +7319,7 @@ namespace dxvk {
result.varId = m_uavs.at(registerId).varId; result.varId = m_uavs.at(registerId).varId;
result.specId = m_uavs.at(registerId).specId; result.specId = m_uavs.at(registerId).specId;
result.stride = m_uavs.at(registerId).structStride; result.stride = m_uavs.at(registerId).structStride;
result.align = m_uavs.at(registerId).structAlign;
return result; return result;
} break; } break;
@ -7324,6 +7334,7 @@ namespace dxvk {
result.varId = m_gRegs.at(registerId).varId; result.varId = m_gRegs.at(registerId).varId;
result.specId = 0; result.specId = 0;
result.stride = m_gRegs.at(registerId).elementStride; result.stride = m_gRegs.at(registerId).elementStride;
result.align = 0;
return result; return result;
} break; } break;

View File

@ -347,6 +347,7 @@ namespace dxvk {
uint32_t varId; uint32_t varId;
uint32_t specId; uint32_t specId;
uint32_t stride; uint32_t stride;
uint32_t align;
}; };

View File

@ -81,6 +81,7 @@ namespace dxvk {
uint32_t colorTypeId = 0; uint32_t colorTypeId = 0;
uint32_t depthTypeId = 0; uint32_t depthTypeId = 0;
uint32_t structStride = 0; uint32_t structStride = 0;
uint32_t structAlign = 0;
}; };
@ -100,6 +101,7 @@ namespace dxvk {
uint32_t sampledTypeId = 0; uint32_t sampledTypeId = 0;
uint32_t imageTypeId = 0; uint32_t imageTypeId = 0;
uint32_t structStride = 0; uint32_t structStride = 0;
uint32_t structAlign = 0;
}; };