Skip to content

Commit 0450ca6

Browse files
author
Tim Foley
authored
Fix some logic around legalization of sampler types (shader-slang#496)
The main error here was checking for `IRSamplerType` instead of `IRSamplerTypeBase`, which means the relevant logic only triggered for the `SamplerState` type and not the `SamplerComparisonState` type. The two affected places were type legalization (so that comparison samplers in `struct` types weren't being hoisted out) and the emit logic when deciding whether to introduce local temporaries (so we were emitting temporaries for comparison samplers, leading to GLSL errors).
1 parent 00389a1 commit 0450ca6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

source/slang/emit.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2076,7 +2076,7 @@ struct EmitVisitor
20762076
{
20772077
return true;
20782078
}
2079-
else if(as<IRSamplerStateType>(type))
2079+
else if(as<IRSamplerStateTypeBase>(type))
20802080
{
20812081
return true;
20822082
}

source/slang/legalize-types.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static bool isResourceType(IRType* type)
8888
{
8989
return true;
9090
}
91-
else if (auto samplerType = as<IRSamplerStateType>(type))
91+
else if (auto samplerType = as<IRSamplerStateTypeBase>(type))
9292
{
9393
return true;
9494
}

0 commit comments

Comments
 (0)