1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 05:52:11 +01:00

[dxbc] Explicitly store whether a resource is a raw SSBO

This commit is contained in:
Philip Rebohle 2022-08-22 05:04:24 +02:00
parent d6613f50c5
commit 336aafcdf7
3 changed files with 15 additions and 24 deletions

View File

@ -1000,7 +1000,7 @@ namespace dxvk {
uav.sampledTypeId = sampledTypeId;
uav.imageTypeId = imageTypeId;
uav.structStride = 0;
uav.structAlign = 0;
uav.isRawSsbo = false;
m_uavs.at(registerId) = uav;
} else {
DxbcShaderResource res;
@ -1013,7 +1013,7 @@ namespace dxvk {
res.colorTypeId = imageTypeId;
res.depthTypeId = 0;
res.structStride = 0;
res.structAlign = 0;
res.isRawSsbo = false;
if ((sampledType == DxbcScalarType::Float32)
&& (resourceType == DxbcResourceDim::Texture2D
@ -1149,7 +1149,7 @@ namespace dxvk {
uav.sampledTypeId = sampledTypeId;
uav.imageTypeId = resTypeId;
uav.structStride = resStride;
uav.structAlign = resAlign;
uav.isRawSsbo = useRawSsbo;
m_uavs.at(registerId) = uav;
} else {
DxbcShaderResource res;
@ -1162,7 +1162,7 @@ namespace dxvk {
res.colorTypeId = resTypeId;
res.depthTypeId = 0;
res.structStride = resStride;
res.structAlign = resAlign;
res.isRawSsbo = useRawSsbo;
m_textures.at(registerId) = res;
}
@ -2271,10 +2271,7 @@ namespace dxvk {
bool isImm = ins.dstCount == 2;
bool isUav = ins.dst[ins.dstCount - 1].type == DxbcOperandType::UnorderedAccessView;
bool isSsbo = m_moduleInfo.options.minSsboAlignment <= bufferInfo.align
&& bufferInfo.type != DxbcResourceType::Typed
&& isUav;
bool isSsbo = bufferInfo.isSsbo;
// Retrieve destination pointer for the atomic operation>
const DxbcRegisterPointer pointer = emitGetAtomicPointer(
@ -2719,9 +2716,7 @@ namespace dxvk {
// (dst0) The destination register
// (src0) The buffer register to query
const DxbcBufferInfo bufferInfo = getBufferInfo(ins.src[0]);
bool isSsbo = m_moduleInfo.options.minSsboAlignment <= bufferInfo.align
&& bufferInfo.type != DxbcResourceType::Typed;
bool isSsbo = bufferInfo.isSsbo;
// We'll store this as a scalar unsigned integer
DxbcRegisterValue result = isSsbo
@ -5058,9 +5053,7 @@ namespace dxvk {
// For UAVs and shared memory, different methods
// of obtaining the final pointer are used.
bool isTgsm = operand.type == DxbcOperandType::ThreadGroupSharedMemory;
bool isSsbo = m_moduleInfo.options.minSsboAlignment <= resourceInfo.align
&& resourceInfo.type != DxbcResourceType::Typed
&& !isTgsm;
bool isSsbo = resourceInfo.isSsbo;
// Compute the actual address into the resource
const DxbcRegisterValue addressValue = [&] {
@ -5124,8 +5117,7 @@ namespace dxvk {
// Shared memory is the only type of buffer that
// is not accessed through a texel buffer view
bool isTgsm = operand.type == DxbcOperandType::ThreadGroupSharedMemory;
bool isSsbo = m_moduleInfo.options.minSsboAlignment <= bufferInfo.align
&& !isTgsm;
bool isSsbo = bufferInfo.isSsbo;
// Common types and IDs used while loading the data
uint32_t bufferId = isTgsm || isSsbo ? 0 : m_module.opLoad(bufferInfo.typeId, bufferInfo.varId);
@ -5233,8 +5225,7 @@ namespace dxvk {
// Thread Group Shared Memory is not accessed through a texel buffer view
bool isTgsm = operand.type == DxbcOperandType::ThreadGroupSharedMemory;
bool isSsbo = m_moduleInfo.options.minSsboAlignment <= bufferInfo.align
&& !isTgsm;
bool isSsbo = bufferInfo.isSsbo;
// Perform the actual write operation
uint32_t bufferId = isTgsm || isSsbo ? 0 : m_module.opLoad(bufferInfo.typeId, bufferInfo.varId);
@ -7488,7 +7479,7 @@ namespace dxvk {
result.typeId = texture.imageTypeId;
result.varId = texture.varId;
result.stride = texture.structStride;
result.align = texture.structAlign;
result.isSsbo = texture.isRawSsbo;
return result;
} break;
@ -7502,7 +7493,7 @@ namespace dxvk {
result.typeId = uav.imageTypeId;
result.varId = uav.varId;
result.stride = uav.structStride;
result.align = uav.structAlign;
result.isSsbo = uav.isRawSsbo;
return result;
} break;
@ -7516,7 +7507,7 @@ namespace dxvk {
spv::StorageClassWorkgroup);
result.varId = m_gRegs.at(registerId).varId;
result.stride = m_gRegs.at(registerId).elementStride;
result.align = 0;
result.isSsbo = false;
return result;
} break;

View File

@ -346,7 +346,7 @@ namespace dxvk {
uint32_t typeId;
uint32_t varId;
uint32_t stride;
uint32_t align;
bool isSsbo;
};

View File

@ -80,7 +80,7 @@ namespace dxvk {
uint32_t colorTypeId = 0;
uint32_t depthTypeId = 0;
uint32_t structStride = 0;
uint32_t structAlign = 0;
bool isRawSsbo = false;
};
@ -100,7 +100,7 @@ namespace dxvk {
uint32_t sampledTypeId = 0;
uint32_t imageTypeId = 0;
uint32_t structStride = 0;
uint32_t structAlign = 0;
bool isRawSsbo = false;
};