Shader/LangWriter: Fix texture sampling output

This commit is contained in:
Jérôme Leclercq 2021-06-05 01:29:48 +02:00
parent 50bf26d92f
commit da664d51ba
1 changed files with 6 additions and 2 deletions

View File

@ -717,6 +717,7 @@ namespace Nz
void LangWriter::Visit(ShaderAst::IntrinsicExpression& node)
{
bool method = false;
switch (node.intrinsic)
{
case ShaderAst::IntrinsicType::CrossProduct:
@ -740,12 +741,15 @@ namespace Nz
break;
case ShaderAst::IntrinsicType::SampleTexture:
Append("texture");
assert(!node.parameters.empty());
Visit(node.parameters.front(), true);
Append(".Sample");
method = true;
break;
}
Append("(");
for (std::size_t i = 0; i < node.parameters.size(); ++i)
for (std::size_t i = (method) ? 1 : 0; i < node.parameters.size(); ++i)
{
if (i != 0)
Append(", ");