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

[dxbc] Fix incorrect pointer type when loading from baked ICBs

This commit is contained in:
Philip Rebohle 2018-07-30 21:08:52 +02:00
parent 2166769096
commit f8392b4f83
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 19 additions and 10 deletions

View File

@ -4309,21 +4309,19 @@ namespace dxvk {
DxbcRegisterPointer DxbcCompiler::emitGetImmConstBufPtr(
const DxbcRegister& operand) {
DxbcRegisterInfo ptrInfo;
ptrInfo.type.ctype = DxbcScalarType::Float32;
ptrInfo.type.ccount = 4;
ptrInfo.type.alength = 0;
DxbcRegisterPointer result;
result.type.ctype = ptrInfo.type.ctype;
result.type.ccount = ptrInfo.type.ccount;
const DxbcRegisterValue constId
= emitIndexLoad(operand.idx[0]);
if (m_immConstBuf != 0) {
DxbcRegisterInfo ptrInfo;
ptrInfo.type.ctype = DxbcScalarType::Uint32;
ptrInfo.type.ccount = 4;
ptrInfo.type.alength = 0;
ptrInfo.sclass = spv::StorageClassPrivate;
DxbcRegisterPointer result;
result.type.ctype = ptrInfo.type.ctype;
result.type.ccount = ptrInfo.type.ccount;
result.id = m_module.opAccessChain(
getPointerTypeId(ptrInfo),
m_immConstBuf, 1, &constId.id);
@ -4332,8 +4330,15 @@ namespace dxvk {
const std::array<uint32_t, 2> indices =
{{ m_module.consti32(0), constId.id }};
DxbcRegisterInfo ptrInfo;
ptrInfo.type.ctype = DxbcScalarType::Float32;
ptrInfo.type.ccount = 4;
ptrInfo.type.alength = 0;
ptrInfo.sclass = spv::StorageClassUniform;
DxbcRegisterPointer result;
result.type.ctype = ptrInfo.type.ctype;
result.type.ccount = ptrInfo.type.ccount;
result.id = m_module.opAccessChain(
getPointerTypeId(ptrInfo),
m_constantBuffers.at(Icb_BindingSlotId).varId,

View File

@ -31,11 +31,15 @@ const std::string g_vertexShaderCode =
" float4 pos : SV_POSITION;\n"
" float4 color : COLOR;\n"
"};\n"
"static const float4 g_pos[] = {\n"
" float4(-0.25f, -0.15f, 0.0f, 1.0f),\n"
" float4(-0.50f, -0.65f, 0.0f, 1.0f),\n"
" float4(-0.75f, -0.15f, 0.0f, 1.0f) };\n"
"vs_out main(float4 vsIn : IN_POSITION,\n"
" uint vid : SV_VERTEXID,\n"
" uint iid : SV_INSTANCEID) {\n"
" vs_out result;\n"
" result.pos = vsIn;\n"
" result.pos = g_pos[vid];\n"
" result.color.x = buf[vid].x;\n"
" result.color.y = buf[iid * 3].y;\n"
" result.color.z = buf[0].z;\n"