Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLSLCrossCompiler: Fix NULL pointer dereference on dcl_uav_structured #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions src/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,20 +745,21 @@ const uint32_t* DecodeDeclaration(Shader* psShader, const uint32_t* pui32Token,
psDecl->sUAV.ui32BufferSize = 0;
DecodeOperand(pui32Token+ui32OperandOffset, &psDecl->asOperands[0]);

GetResourceFromBindingPoint(RGROUP_UAV, psDecl->asOperands[0].ui32RegisterNumber, &psShader->sInfo, &psBinding);

GetConstantBufferFromBindingPoint(RGROUP_UAV, psBinding->ui32BindPoint, &psShader->sInfo, &psBuffer);
psDecl->sUAV.ui32BufferSize = psBuffer->ui32TotalSizeInBytes;
switch(psBinding->eType)
{
case RTYPE_UAV_RWSTRUCTURED_WITH_COUNTER:
case RTYPE_UAV_APPEND_STRUCTURED:
case RTYPE_UAV_CONSUME_STRUCTURED:
psDecl->sUAV.bCounter = 1;
break;
default:
break;
}
if (GetResourceFromBindingPoint(RGROUP_UAV, psDecl->asOperands[0].ui32RegisterNumber, &psShader->sInfo, &psBinding))
{
GetConstantBufferFromBindingPoint(RGROUP_UAV, psBinding->ui32BindPoint, &psShader->sInfo, &psBuffer);
psDecl->sUAV.ui32BufferSize = psBuffer->ui32TotalSizeInBytes;
switch(psBinding->eType)
{
case RTYPE_UAV_RWSTRUCTURED_WITH_COUNTER:
case RTYPE_UAV_APPEND_STRUCTURED:
case RTYPE_UAV_CONSUME_STRUCTURED:
psDecl->sUAV.bCounter = 1;
break;
default:
break;
}
}
break;
}
case OPCODE_DCL_RESOURCE_STRUCTURED:
Expand Down