Hash :
9d41585e
Author :
Date :
2022-08-12T14:20:34
Make PLS coherent on D3D 11.3 Adds a new internal memory qualifier to the compiler called "rasterOrdered", which we set in RewritePixelLocalStorage.cpp when D3D 11.3 Rasterizer Order Views are supported. The HLSL translator then generates RasterizerOrderedTexture2D<> instead of RWTexture2D<> when this qualifier is set. Bug: angleproject:7279 Change-Id: I39b8c3279b7bff93b7e57272e8fb84d9c0312616 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3830288 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561
//
// Copyright 2022 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "compiler/translator/tree_ops/RewritePixelLocalStorage.h"
#include "common/angleutils.h"
#include "compiler/translator/StaticType.h"
#include "compiler/translator/SymbolTable.h"
#include "compiler/translator/tree_ops/MonomorphizeUnsupportedFunctions.h"
#include "compiler/translator/tree_util/BuiltIn.h"
#include "compiler/translator/tree_util/FindMain.h"
#include "compiler/translator/tree_util/IntermNode_util.h"
#include "compiler/translator/tree_util/IntermTraverse.h"
namespace sh
{
namespace
{
constexpr static TBasicType DataTypeOfPLSType(TBasicType plsType)
{
switch (plsType)
{
case EbtPixelLocalANGLE:
return EbtFloat;
case EbtIPixelLocalANGLE:
return EbtInt;
case EbtUPixelLocalANGLE:
return EbtUInt;
default:
UNREACHABLE();
return EbtVoid;
}
}
constexpr static TBasicType DataTypeOfImageType(TBasicType imageType)
{
switch (imageType)
{
case EbtImage2D:
return EbtFloat;
case EbtIImage2D:
return EbtInt;
case EbtUImage2D:
return EbtUInt;
default:
UNREACHABLE();
return EbtVoid;
}
}
// Delimits the beginning of a per-pixel critical section. Makes pixel local storage coherent.
//
// Either: GL_NV_fragment_shader_interlock
// GL_INTEL_fragment_shader_ordering
// GL_ARB_fragment_shader_interlock (also compiles to SPV_EXT_fragment_shader_interlock)
static TIntermNode *CreateBuiltInInterlockBeginCall(const ShCompileOptions &compileOptions,
TSymbolTable &symbolTable)
{
switch (compileOptions.pls.fragmentSynchronizationType)
{
case ShFragmentSynchronizationType::FragmentShaderInterlock_NV_GL:
return CreateBuiltInFunctionCallNode("beginInvocationInterlockNV", {}, symbolTable,
kESSLInternalBackendBuiltIns);
case ShFragmentSynchronizationType::FragmentShaderOrdering_INTEL_GL:
return CreateBuiltInFunctionCallNode("beginFragmentShaderOrderingINTEL", {},
symbolTable, kESSLInternalBackendBuiltIns);
case ShFragmentSynchronizationType::FragmentShaderInterlock_ARB_GL:
return CreateBuiltInFunctionCallNode("beginInvocationInterlockARB", {}, symbolTable,
kESSLInternalBackendBuiltIns);
default:
return nullptr;
}
}
// Delimits the end of a per-pixel critical section. Makes pixel local storage coherent.
//
// Either: GL_NV_fragment_shader_interlock
// GL_ARB_fragment_shader_interlock (also compiles to SPV_EXT_fragment_shader_interlock)
//
// GL_INTEL_fragment_shader_ordering doesn't have an "end()" delimiter.
static TIntermNode *CreateBuiltInInterlockEndCall(const ShCompileOptions &compileOptions,
TSymbolTable &symbolTable)
{
switch (compileOptions.pls.fragmentSynchronizationType)
{
case ShFragmentSynchronizationType::FragmentShaderInterlock_NV_GL:
return CreateBuiltInFunctionCallNode("endInvocationInterlockNV", {}, symbolTable,
kESSLInternalBackendBuiltIns);
case ShFragmentSynchronizationType::FragmentShaderOrdering_INTEL_GL:
return nullptr; // GL_INTEL_fragment_shader_ordering doesn't have an "end()" call.
case ShFragmentSynchronizationType::FragmentShaderInterlock_ARB_GL:
return CreateBuiltInFunctionCallNode("endInvocationInterlockARB", {}, symbolTable,
kESSLInternalBackendBuiltIns);
default:
return nullptr;
}
}
// Rewrites high level PLS operations to shader image operations.
class RewriteToImagesTraverser : public TIntermTraverser
{
public:
RewriteToImagesTraverser(TCompiler *compiler,
TSymbolTable &symbolTable,
const ShCompileOptions &compileOptions,
int shaderVersion)
: TIntermTraverser(true, false, false, &symbolTable),
mCompiler(compiler),
mCompileOptions(&compileOptions),
mShaderVersion(shaderVersion)
{}
bool visitDeclaration(Visit, TIntermDeclaration *decl) override
{
TIntermTyped *declVariable = (decl->getSequence())->front()->getAsTyped();
ASSERT(declVariable);
if (!IsPixelLocal(declVariable->getBasicType()))
{
return true;
}
// PLS is not allowed in arrays.
ASSERT(!declVariable->isArray());
// This visitDeclaration doesn't get called for function arguments, and opaque types can
// otherwise only be uniforms.
ASSERT(declVariable->getQualifier() == EvqUniform);
TIntermSymbol *plsSymbol = declVariable->getAsSymbolNode();
ASSERT(plsSymbol);
// Insert a global to hold the pixel coordinate as soon as we see PLS declared. This will be
// initialized at the beginning of main().
if (!mGlobalPixelCoord)
{
TType *coordType = new TType(EbtInt, EbpHigh, EvqGlobal, 2);
mGlobalPixelCoord = CreateTempVariable(mSymbolTable, coordType);
insertStatementInParentBlock(CreateTempDeclarationNode(mGlobalPixelCoord));
}
// Replace the PLS declaration with an image2D.
TVariable *image2D = createPLSImageReplacement(plsSymbol);
insertNewPLSImage(plsSymbol, image2D);
queueReplacement(new TIntermDeclaration({new TIntermSymbol(image2D)}),
OriginalNode::IS_DROPPED);
return false;
}
bool visitAggregate(Visit, TIntermAggregate *aggregate) override
{
if (!BuiltInGroup::IsPixelLocal(aggregate->getOp()))
{
return true;
}
const TIntermSequence &args = *aggregate->getSequence();
ASSERT(args.size() >= 1);
TIntermSymbol *plsSymbol = args[0]->getAsSymbolNode();
TVariable *image2D = findPLSImage(plsSymbol);
ASSERT(mGlobalPixelCoord);
// Rewrite pixelLocalLoadANGLE -> imageLoad.
if (aggregate->getOp() == EOpPixelLocalLoadANGLE)
{
// Replace the pixelLocalLoadANGLE with imageLoad.
TIntermTyped *pls;
pls = CreateBuiltInFunctionCallNode(
"imageLoad", {new TIntermSymbol(image2D), new TIntermSymbol(mGlobalPixelCoord)},
*mSymbolTable, mShaderVersion);
pls = unpackImageDataIfNecessary(pls, plsSymbol, image2D);
queueReplacement(pls, OriginalNode::IS_DROPPED);
return false; // No need to recurse since this node is being dropped.
}
// Rewrite pixelLocalStoreANGLE -> imageStore.
if (aggregate->getOp() == EOpPixelLocalStoreANGLE)
{
// Surround the store with memoryBarrierImage calls in order to ensure dependent stores
// and loads in a single shader invocation are coherent. From the ES 3.1 spec:
//
// Using variables declared as "coherent" guarantees only that the results of stores
// will be immediately visible to shader invocations using similarly-declared
// variables; calling MemoryBarrier is required to ensure that the stores are visible
// to other operations.
//
// Also hoist the 'value' expression into a temp. In the event of
// "pixelLocalStoreANGLE(..., pixelLocalLoadANGLE(...))", this ensures the load occurs
// _before_ the memoryBarrierImage.
//
// NOTE: It is generally unsafe to hoist function arguments due to short circuiting,
// e.g., "if (false && function(...))", but pixelLocalStoreANGLE returns type void, so
// it is safe in this particular case.
TType *valueType = new TType(DataTypeOfPLSType(plsSymbol->getBasicType()),
plsSymbol->getPrecision(), EvqTemporary, 4);
TVariable *valueVar = CreateTempVariable(mSymbolTable, valueType);
TIntermDeclaration *valueDecl =
CreateTempInitDeclarationNode(valueVar, args[1]->getAsTyped());
valueDecl->traverse(this); // Rewrite any potential pixelLocalLoadANGLEs in valueDecl.
insertStatementsInParentBlock(
{valueDecl, CreateBuiltInFunctionCallNode("memoryBarrierImage", {}, *mSymbolTable,
mShaderVersion)}, // Before.
{CreateBuiltInFunctionCallNode("memoryBarrierImage", {}, *mSymbolTable,
mShaderVersion)}); // After.
// Rewrite the pixelLocalStoreANGLE with imageStore.
queueReplacement(CreateBuiltInFunctionCallNode(
"imageStore",
{new TIntermSymbol(image2D), new TIntermSymbol(mGlobalPixelCoord),
clampAndPackPLSDataIfNecessary(valueVar, plsSymbol, image2D)},
*mSymbolTable, mShaderVersion),
OriginalNode::IS_DROPPED);
return false; // No need to recurse since this node is being dropped.
}
return true;
}
TVariable *globalPixelCoord() const { return mGlobalPixelCoord; }
private:
// Do all PLS formats need to be packed into r32f, r32i, or r32ui image2Ds?
bool needsR32Packing() const
{
// ES images can only have both read and write access if their format is r32f, r32i, r32ui.
// D3D 11.0 UAVs only support R32_FLOAT, R32_UINT, R32_SINT formats.
return mCompiler->getOutputType() == ShShaderOutput::SH_ESSL_OUTPUT ||
mCompiler->getOutputType() == ShShaderOutput::SH_HLSL_4_1_OUTPUT;
}
// Sets the given image2D as the backing storage for the plsSymbol's binding point. An entry
// must not already exist in the map for this binding point.
void insertNewPLSImage(TIntermSymbol *plsSymbol, TVariable *image2D)
{
ASSERT(plsSymbol);
ASSERT(IsPixelLocal(plsSymbol->getBasicType()));
int binding = plsSymbol->getType().getLayoutQualifier().binding;
ASSERT(binding >= 0);
auto result = mPLSImages.insert({binding, image2D});
ASSERT(result.second); // Ensure an image didn't already exist for this symbol.
}
// Looks up the image2D backing storage for the given plsSymbol's binding point. An entry
// must already exist in the map for this binding point.
TVariable *findPLSImage(TIntermSymbol *plsSymbol)
{
ASSERT(plsSymbol);
ASSERT(IsPixelLocal(plsSymbol->getBasicType()));
int binding = plsSymbol->getType().getLayoutQualifier().binding;
ASSERT(binding >= 0);
auto iter = mPLSImages.find(binding);
ASSERT(iter != mPLSImages.end()); // Ensure PLSImages already exist for this symbol.
return iter->second;
}
// Creates an image2D that replaces a pixel local storage handle.
TVariable *createPLSImageReplacement(const TIntermSymbol *plsSymbol)
{
ASSERT(plsSymbol);
ASSERT(IsPixelLocal(plsSymbol->getBasicType()));
TType *imageType = new TType(plsSymbol->getType());
TLayoutQualifier layoutQualifier = imageType->getLayoutQualifier();
switch (layoutQualifier.imageInternalFormat)
{
case TLayoutImageInternalFormat::EiifRGBA8:
if (needsR32Packing())
{
layoutQualifier.imageInternalFormat = EiifR32UI;
imageType->setPrecision(EbpHigh);
imageType->setBasicType(EbtUImage2D);
}
else
{
imageType->setBasicType(EbtImage2D);
}
break;
case TLayoutImageInternalFormat::EiifRGBA8I:
if (needsR32Packing())
{
layoutQualifier.imageInternalFormat = EiifR32I;
imageType->setPrecision(EbpHigh);
}
imageType->setBasicType(EbtIImage2D);
break;
case TLayoutImageInternalFormat::EiifRGBA8UI:
if (needsR32Packing())
{
layoutQualifier.imageInternalFormat = EiifR32UI;
imageType->setPrecision(EbpHigh);
}
imageType->setBasicType(EbtUImage2D);
break;
case TLayoutImageInternalFormat::EiifR32F:
imageType->setBasicType(EbtImage2D);
break;
case TLayoutImageInternalFormat::EiifR32UI:
imageType->setBasicType(EbtUImage2D);
break;
default:
UNREACHABLE();
}
layoutQualifier.rasterOrdered = mCompileOptions->pls.fragmentSynchronizationType ==
ShFragmentSynchronizationType::RasterizerOrderViews_D3D;
imageType->setLayoutQualifier(layoutQualifier);
TMemoryQualifier memoryQualifier{};
memoryQualifier.coherent = true;
memoryQualifier.restrictQualifier = true;
memoryQualifier.volatileQualifier = false;
// TODO(anglebug.com/7279): Maybe we could walk the tree first and see which PLS is used
// how. If the PLS is never loaded, we could add a writeonly qualifier, for example.
memoryQualifier.readonly = false;
memoryQualifier.writeonly = false;
imageType->setMemoryQualifier(memoryQualifier);
const TVariable &plsVar = plsSymbol->variable();
return new TVariable(plsVar.uniqueId(), plsVar.name(), plsVar.symbolType(),
plsVar.extensions(), imageType);
}
// Unpacks the raw PLS data if the output shader language needs r32* packing.
TIntermTyped *unpackImageDataIfNecessary(TIntermTyped *data,
TIntermSymbol *plsSymbol,
TVariable *image2D)
{
TLayoutImageInternalFormat plsFormat =
plsSymbol->getType().getLayoutQualifier().imageInternalFormat;
TLayoutImageInternalFormat imageFormat =
image2D->getType().getLayoutQualifier().imageInternalFormat;
if (plsFormat == imageFormat)
{
return data; // This PLS storage isn't packed.
}
ASSERT(needsR32Packing());
switch (plsFormat)
{
case EiifRGBA8:
// Unpack and normalize r,g,b,a from a single 32-bit unsigned int:
//
// unpackUnorm4x8(data.r)
//
data = CreateBuiltInFunctionCallNode("unpackUnorm4x8", {CreateSwizzle(data, 0)},
*mSymbolTable, mShaderVersion);
break;
case EiifRGBA8I:
case EiifRGBA8UI:
{
constexpr unsigned shifts[] = {24, 16, 8, 0};
// Unpack r,g,b,a form a single (signed or unsigned) 32-bit int. Shift left,
// then right, to preserve the sign for ints. (highp integers are exactly
// 32-bit, two's compliment.)
//
// data.rrrr << uvec4(24, 16, 8, 0) >> 24u
//
data = CreateSwizzle(data, 0, 0, 0, 0);
data = new TIntermBinary(EOpBitShiftLeft, data, CreateUVecNode(shifts, 4, EbpHigh));
data = new TIntermBinary(EOpBitShiftRight, data, CreateUIntNode(24));
break;
}
default:
UNREACHABLE();
}
return data;
}
// Packs the PLS to raw data if the output shader language needs r32* packing.
TIntermTyped *clampAndPackPLSDataIfNecessary(TVariable *plsVar,
TIntermSymbol *plsSymbol,
TVariable *image2D)
{
TLayoutImageInternalFormat plsFormat =
plsSymbol->getType().getLayoutQualifier().imageInternalFormat;
// anglebug.com/7524: Storing to integer formats with values larger than can be represented
// is specified differently on different APIs. Clamp integer formats here to make it uniform
// and more GL-like.
switch (plsFormat)
{
case EiifRGBA8I:
{
// Clamp r,g,b,a to their min/max 8-bit values:
//
// plsVar = clamp(plsVar, -128, 127) & 0xff
//
TIntermTyped *newPLSValue = CreateBuiltInFunctionCallNode(
"clamp",
{new TIntermSymbol(plsVar), CreateIndexNode(-128), CreateIndexNode(127)},
*mSymbolTable, mShaderVersion);
insertStatementInParentBlock(CreateTempAssignmentNode(plsVar, newPLSValue));
break;
}
case EiifRGBA8UI:
{
// Clamp r,g,b,a to their max 8-bit values:
//
// plsVar = min(plsVar, 255)
//
TIntermTyped *newPLSValue = CreateBuiltInFunctionCallNode(
"min", {new TIntermSymbol(plsVar), CreateUIntNode(255)}, *mSymbolTable,
mShaderVersion);
insertStatementInParentBlock(CreateTempAssignmentNode(plsVar, newPLSValue));
break;
}
default:
break;
}
TIntermTyped *result = new TIntermSymbol(plsVar);
TLayoutImageInternalFormat imageFormat =
image2D->getType().getLayoutQualifier().imageInternalFormat;
if (plsFormat == imageFormat)
{
return result; // This PLS storage isn't packed.
}
ASSERT(needsR32Packing());
switch (plsFormat)
{
case EiifRGBA8:
{
if (mCompileOptions->passHighpToPackUnormSnormBuiltins)
{
// anglebug.com/7527: unpackUnorm4x8 doesn't work on Pixel 4 when passed
// a mediump vec4. Use an intermediate highp vec4.
//
// It's safe to inject a variable here because it happens right before
// pixelLocalStoreANGLE, which returns type void. (See visitAggregate.)
TType *highpType = new TType(EbtFloat, EbpHigh, EvqTemporary, 4);
TVariable *workaroundHighpVar = CreateTempVariable(mSymbolTable, highpType);
insertStatementInParentBlock(
CreateTempInitDeclarationNode(workaroundHighpVar, result));
result = new TIntermSymbol(workaroundHighpVar);
}
// Denormalize and pack r,g,b,a into a single 32-bit unsigned int:
//
// packUnorm4x8(workaroundHighpVar)
//
result = CreateBuiltInFunctionCallNode("packUnorm4x8", {result}, *mSymbolTable,
mShaderVersion);
break;
}
case EiifRGBA8I:
case EiifRGBA8UI:
{
if (plsFormat == EiifRGBA8I)
{
// Mask off extra sign bits beyond 8.
//
// plsVar &= 0xff
//
insertStatementInParentBlock(new TIntermBinary(
EOpBitwiseAndAssign, new TIntermSymbol(plsVar), CreateIndexNode(0xff)));
}
// Pack r,g,b,a into a single 32-bit (signed or unsigned) int:
//
// r | (g << 8) | (b << 16) | (a << 24)
//
auto shiftComponent = [=](int componentIdx) {
return new TIntermBinary(EOpBitShiftLeft,
CreateSwizzle(new TIntermSymbol(plsVar), componentIdx),
CreateUIntNode(componentIdx * 8));
};
result = CreateSwizzle(result, 0);
result = new TIntermBinary(EOpBitwiseOr, result, shiftComponent(1));
result = new TIntermBinary(EOpBitwiseOr, result, shiftComponent(2));
result = new TIntermBinary(EOpBitwiseOr, result, shiftComponent(3));
break;
}
default:
UNREACHABLE();
}
// Convert the packed data to a {u,i}vec4 for imageStore.
TType imageStoreType(DataTypeOfImageType(image2D->getType().getBasicType()), 4);
return TIntermAggregate::CreateConstructor(imageStoreType, {result});
}
const TCompiler *const mCompiler;
const ShCompileOptions *const mCompileOptions;
const int mShaderVersion;
// Stores the shader invocation's pixel coordinate as "ivec2(floor(gl_FragCoord.xy))".
TVariable *mGlobalPixelCoord = nullptr;
// Maps PLS variables to their image2D backing storage.
angle::HashMap<int, TVariable *> mPLSImages;
};
} // anonymous namespace
bool RewritePixelLocalStorageToImages(TCompiler *compiler,
TIntermBlock *root,
TSymbolTable &symbolTable,
const ShCompileOptions &compileOptions,
int shaderVersion)
{
// If any functions take PLS arguments, monomorphize the functions by removing said parameters
// and making the PLS calls from main() instead, using the global uniform from the call site
// instead of the function argument. This is necessary because function arguments don't carry
// the necessary "binding" or "format" layout qualifiers.
if (!MonomorphizeUnsupportedFunctions(
compiler, root, &symbolTable, compileOptions,
UnsupportedFunctionArgsBitSet{UnsupportedFunctionArgs::PixelLocalStorage}))
{
return false;
}
TIntermBlock *mainBody = FindMainBody(root);
// Surround the critical section of PLS operations in fragment synchronization calls, if
// supported. This makes pixel local storage coherent.
TIntermNode *interlockBeginCall = CreateBuiltInInterlockBeginCall(compileOptions, symbolTable);
if (interlockBeginCall)
{
// TODO(anglebug.com/7279): Inject these functions in a tight critical section, instead of
// just locking the entire main() function:
// - Monomorphize all PLS calls into main().
// - Insert begin/end calls around the first/last PLS calls (and outside of flow control).
mainBody->insertStatement(0, interlockBeginCall);
TIntermNode *interlockEndCall = CreateBuiltInInterlockEndCall(compileOptions, symbolTable);
if (interlockEndCall)
{
// Not all fragment synchronization extensions have an end() call.
mainBody->appendStatement(interlockEndCall);
}
}
// Rewrite PLS operations to image operations.
RewriteToImagesTraverser traverser(compiler, symbolTable, compileOptions, shaderVersion);
root->traverse(&traverser);
if (!traverser.updateTree(compiler, root))
{
return false;
}
// Initialize the global pixel coord at the beginning of main():
//
// pixelCoord = ivec2(floor(gl_FragCoord.xy));
//
if (traverser.globalPixelCoord())
{
TIntermTyped *exp;
exp = ReferenceBuiltInVariable(ImmutableString("gl_FragCoord"), symbolTable, shaderVersion);
exp = CreateSwizzle(exp, 0, 1);
exp = CreateBuiltInFunctionCallNode("floor", {exp}, symbolTable, shaderVersion);
exp = TIntermAggregate::CreateConstructor(TType(EbtInt, 2), {exp});
exp = CreateTempAssignmentNode(traverser.globalPixelCoord(), exp);
mainBody->insertStatement(0, exp);
}
return compiler->validateAST(root);
}
} // namespace sh