Shader: Add support for partial sanitization

This commit is contained in:
SirLynix
2022-03-25 12:54:51 +01:00
parent a54f70fd24
commit 8146ec251a
31 changed files with 1105 additions and 521 deletions

View File

@@ -76,9 +76,10 @@ namespace Nz
{
node.expr->Visit(*this);
const ShaderAst::ExpressionType& exprType = GetExpressionType(node);
const ShaderAst::ExpressionType* exprType = GetExpressionType(node);
assert(exprType);
UInt32 typeId = m_writer.GetTypeId(exprType);
UInt32 typeId = m_writer.GetTypeId(*exprType);
assert(node.indices.size() == 1);
UInt32 indexId = m_visitor.EvaluateExpression(node.indices.front());
@@ -88,7 +89,7 @@ namespace Nz
[&](const Pointer& pointer)
{
PointerChainAccess pointerChainAccess;
pointerChainAccess.exprType = &exprType;
pointerChainAccess.exprType = exprType;
pointerChainAccess.indices = { indexId };
pointerChainAccess.pointedTypeId = pointer.pointedTypeId;
pointerChainAccess.pointerId = pointer.pointerId;
@@ -98,7 +99,7 @@ namespace Nz
},
[&](PointerChainAccess& pointerChainAccess)
{
pointerChainAccess.exprType = &exprType;
pointerChainAccess.exprType = exprType;
pointerChainAccess.indices.push_back(indexId);
},
[&](const Value& value)