-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GLSL texture functions need to support int and uint types of samplers as well as float #4196
Comments
The regression happened because the first generic argument of the GLSL texture functions were changed from |
Closes shader-slang#4196 The issue was introduced when we tried to support the sampler-less textures for GLSL texture functions. And some of GLSL functions could no longer take int/uint typed sampler anymore. This commit fixes both problems. One of the findings is that GLSL supports only three types of samplers: `samplerXX`, `isamplerXX` and `usamplerXX`. They are not variable sized vectors and it means we need to support only three types with fixed number of components: vector<float,4>, vector<int,4> and vector<uint,4>. Depth textures are always float type.
I think that this should be WNF until we have a mechanism to handle the capability better. The texture sampling functions was working for I can think of two approaches to support the integer typed textures for GLSL and Metal while not supporting it for HLSL.
I am going to show examples to clarify what each approach means. The following example is what we currently have for
Note that For the first approach, the code will change to something like following,
Note that the code will be duplicated with For the second approach, the code will change to something like following,
Note that The second approach looks more ideal because the code is simpler and duplicates less. A downside with the second approach is that emitting an erroneous string, "invalid intrinsic", is not the same as erroring out with our capability system. Note that the capability checking happens before the evaluation of In order to properly error it out, we will need a new feature like
And the handling of such With the explanation, I think we should defer the integer type texture support until we have |
I realized that there is still I can do for this issue without a new feature like |
I tried to make some changes to glsl.meta.slang with keeping hlsl.meta.slang as it is. I think a right approach is to use |
I tried to extend
The idea is similar to how I am not clear on why but my guess is that there is an overlapping part between The failing tests are for autodiff tests, and the error message implies that |
GLSL spec requires all texture functions to take
gsamplerXXX
types as the first input argument whereg
indicatesfloat
,int
anduint
.It says,
According to the section 8.9 in the GLSL document, the following functions take
gsamplerXXX
as the first argument except for the shadow/depth samplers.This is a regression from one of recent changes. #3963
And it causes out nightly CTS test to fail.
The text was updated successfully, but these errors were encountered: