1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d9+dxso] Switch constant buffer order

This commit is contained in:
Robin Kertels 2021-09-10 00:15:15 +02:00 committed by Joshie
parent 791d533a1d
commit 869f75895c
4 changed files with 17 additions and 17 deletions

View File

@ -21,9 +21,9 @@ namespace dxvk {
: 0; : 0;
} }
uint32_t floatOffset() const { return 0; } uint32_t intOffset() const { return 0; }
uint32_t intOffset() const { return floatOffset() + floatSize(); } uint32_t floatOffset() const { return intOffset() + intSize(); }
uint32_t bitmaskOffset() const { return intOffset() + intSize(); } uint32_t bitmaskOffset() const { return floatOffset() + floatSize(); }
uint32_t totalSize() const { return floatSize() + intSize() + bitmaskSize(); } uint32_t totalSize() const { return floatSize() + intSize() + bitmaskSize(); }
}; };

View File

@ -21,20 +21,20 @@ namespace dxvk {
// We make an assumption later based on the packing of this struct for copying. // We make an assumption later based on the packing of this struct for copying.
struct D3D9ShaderConstantsVSSoftware { struct D3D9ShaderConstantsVSSoftware {
Vector4 fConsts[caps::MaxFloatConstantsSoftware];
Vector4i iConsts[caps::MaxOtherConstantsSoftware]; Vector4i iConsts[caps::MaxOtherConstantsSoftware];
Vector4 fConsts[caps::MaxFloatConstantsSoftware];
uint32_t bConsts[caps::MaxOtherConstantsSoftware / 32]; uint32_t bConsts[caps::MaxOtherConstantsSoftware / 32];
}; };
struct D3D9ShaderConstantsVSHardware { struct D3D9ShaderConstantsVSHardware {
Vector4 fConsts[caps::MaxFloatConstantsVS];
Vector4i iConsts[caps::MaxOtherConstants]; Vector4i iConsts[caps::MaxOtherConstants];
Vector4 fConsts[caps::MaxFloatConstantsVS];
uint32_t bConsts[1]; uint32_t bConsts[1];
}; };
struct D3D9ShaderConstantsPS { struct D3D9ShaderConstantsPS {
Vector4 fConsts[caps::MaxFloatConstantsPS];
Vector4i iConsts[caps::MaxOtherConstants]; Vector4i iConsts[caps::MaxOtherConstants];
Vector4 fConsts[caps::MaxFloatConstantsPS];
uint32_t bConsts[1]; uint32_t bConsts[1];
}; };

View File

@ -4979,7 +4979,7 @@ namespace dxvk {
std::memcpy(dst->iConsts, Src.iConsts, constSet.meta.maxConstIndexI * sizeof(Vector4i)); std::memcpy(dst->iConsts, Src.iConsts, constSet.meta.maxConstIndexI * sizeof(Vector4i));
if (constSet.meta.needsConstantCopies) { if (constSet.meta.needsConstantCopies) {
Vector4* data = reinterpret_cast<Vector4*>(slice.mapPtr); Vector4* data = reinterpret_cast<Vector4*>(dst->fConsts);
auto& shaderConsts = GetCommonShader(Shader)->GetConstants(); auto& shaderConsts = GetCommonShader(Shader)->GetConstants();

View File

@ -289,15 +289,15 @@ namespace dxvk {
void DxsoCompiler::emitDclConstantBuffer() { void DxsoCompiler::emitDclConstantBuffer() {
std::array<uint32_t, 2> members = { std::array<uint32_t, 2> members = {
// float f[256 or 224 or 8192]
m_module.defArrayTypeUnique(
getVectorTypeId({ DxsoScalarType::Float32, 4 }),
m_module.constu32(m_layout->floatCount)),
// int i[16 or 2048] // int i[16 or 2048]
m_module.defArrayTypeUnique( m_module.defArrayTypeUnique(
getVectorTypeId({ DxsoScalarType::Sint32, 4 }), getVectorTypeId({ DxsoScalarType::Sint32, 4 }),
m_module.constu32(m_layout->intCount)) m_module.constu32(m_layout->intCount)),
// float f[256 or 224 or 8192]
m_module.defArrayTypeUnique(
getVectorTypeId({ DxsoScalarType::Float32, 4 }),
m_module.constu32(m_layout->floatCount))
}; };
// Decorate array strides, this is required. // Decorate array strides, this is required.
@ -311,8 +311,8 @@ namespace dxvk {
? spv::DecorationBufferBlock ? spv::DecorationBufferBlock
: spv::DecorationBlock); : spv::DecorationBlock);
m_module.memberDecorateOffset(structType, 0, m_layout->floatOffset()); m_module.memberDecorateOffset(structType, 0, m_layout->intOffset());
m_module.memberDecorateOffset(structType, 1, m_layout->intOffset()); m_module.memberDecorateOffset(structType, 1, m_layout->floatOffset());
m_module.setDebugName(structType, "cbuffer_t"); m_module.setDebugName(structType, "cbuffer_t");
m_module.setDebugMemberName(structType, 0, "f"); m_module.setDebugMemberName(structType, 0, "f");
@ -1007,7 +1007,7 @@ namespace dxvk {
structIdx = m_module.constu32(0); structIdx = m_module.constu32(0);
cBufferId = m_cFloatBuffer; cBufferId = m_cFloatBuffer;
} else { } else {
structIdx = m_module.constu32(0); structIdx = m_module.constu32(1);
cBufferId = m_cBuffer; cBufferId = m_cBuffer;
} }
} else { } else {
@ -1015,7 +1015,7 @@ namespace dxvk {
structIdx = m_module.constu32(0); structIdx = m_module.constu32(0);
cBufferId = m_cIntBuffer; cBufferId = m_cIntBuffer;
} else { } else {
structIdx = m_module.constu32(1); structIdx = m_module.constu32(0);
cBufferId = m_cBuffer; cBufferId = m_cBuffer;
} }
} }