[spirv] report error for invalid tex2d multiplication (#3175)

Calling tex2D must report an error but the multiplication using it
crashes instead of an error report.
This commit is contained in:
Jaebaek Seo 2020-10-01 16:54:06 -04:00 коммит произвёл GitHub
Родитель 4ee59f6c2d
Коммит 7b5d547ea3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -5556,6 +5556,8 @@ SpirvInstruction *SpirvEmitter::processBinaryOp(
} else {
// Evalute lhs before rhs
lhsPtr = doExpr(lhs);
if (!lhsPtr)
return nullptr;
lhsVal = loadIfGLValue(lhs, lhsPtr);
rhsVal = loadIfGLValue(rhs);
}

Просмотреть файл

@ -0,0 +1,9 @@
// Run: %dxc -T ps_6_0 -E main
// CHECK: deprecated tex2D intrinsic function will not be supported
sampler Sampler;
float4 main(float2 texCoord : TEXCOORD0) : SV_TARGET0
{
return tex2D(Sampler, texCoord) * 1;
}

Просмотреть файл

@ -921,6 +921,9 @@ TEST_F(FileTest, TextureArraySampleCmpLevelZero) {
TEST_F(FileTest, TextureSampleInvalidImplicitLod) {
runFileTest("texture.sample-invalid-implicit-lod.hlsl", Expect::Failure);
}
TEST_F(FileTest, TextureInvalidTex2D) {
runFileTest("texture.sample.invalid.tex2d.hlsl", Expect::Failure);
}
// For structured buffer methods
TEST_F(FileTest, StructuredBufferLoad) {