Fix multisample texture operations crashing HLSL generation
This includes a partial implementation of multisample texture
operations on the HLSL backend. It can't be fully tested yet, since
the API side isn't implemented.
BUG=angleproject:1442
TEST=dEQP-GLES31.functional.shaders.builtin_functions.texture_size.*
(successfully compiles instead of crashing)
Change-Id: Ief782db28388a3f8fd8113cc86ce3c4f500f322a
Reviewed-on: https://chromium-review.googlesource.com/443264
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 60dcfd3..87a7767 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -1790,7 +1790,11 @@
{
TString name = TFunction::unmangleName(node->getFunctionSymbolInfo()->getName());
TBasicType samplerType = (*arguments)[0]->getAsTyped()->getType().getBasicType();
- int coords = (*arguments)[1]->getAsTyped()->getNominalSize();
+ int coords = 0; // textureSize(gsampler2DMS) doesn't have a second argument.
+ if (arguments->size() > 1)
+ {
+ coords = (*arguments)[1]->getAsTyped()->getNominalSize();
+ }
TString textureFunctionName = mTextureFunctionHLSL->useTextureFunction(
name, samplerType, coords, arguments->size(), lod0, mShaderType);
out << textureFunctionName << "(";