Skip to content
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

D3D11 missing shadow sampler functions #1870

Open
vonture opened this issue Jul 12, 2016 · 2 comments
Open

D3D11 missing shadow sampler functions #1870

vonture opened this issue Jul 12, 2016 · 2 comments

Comments

@vonture
Copy link
Contributor

@vonture vonture commented Jul 12, 2016

After investigation failing WebGL2 tests in ANGLE, I determined that a few sampler functions related to shadow samplers are missing from HLSL. The missing functions are:

Vertex Shader: Any sampling from sampler2DShadow and samplerCubeShadow sampler. The corresponding HLSL function, SampleCmp, is not available in the vertex shader. ANGLE currently fails shader compilation if these functions are used.

Fragment Shader: Sampling from a sampler2DShadow or samplerCubeShadow sampler using the textureLod, textureLodOffset, textureProjLod, textureGrad, textureProjGrad, textureProjGradOffset functions (pretty much any sampling function that uses Lod or Grad). The HLSL SampleCmp function is not overloaded as much as the other HLSL sampling functions and does not include these parameters. ANGLE currently ignores these parameters and does the equivalent of the regular texture function.

As far as I can tell, the only solution is to emulate this missing functionality by passing parameters of the sampler (compare mode and compare func) into the shader as uniforms and using a switch statement to perform the operations. This work will be done but for the sake of pushing WebGL2 out faster, I propose that these tests are moved to the 2.0.1 suite.

In the mean-time, is there a preference for making the behaviour when using these functions consistent? Should ANGLE fail shader compilation in all of these cases or should the vertex shader case be updated to return some dummy value?

For reference, the failing webgl tests are:
deqp/functional/gles3/shadertexturefunction/texturelod.html
deqp/functional/gles3/shadertexturefunction/texturelodoffset.html
deqp/functional/gles3/shadertexturefunction/textureprojlod.html
deqp/functional/gles3/shadertexturefunction/textureprojlodoffset.html
deqp/functional/gles3/shadertexturefunction/texturegrad.html
deqp/functional/gles3/shadertexturefunction/texturegradoffset.html
deqp/functional/gles3/shadertexturefunction/textureprojgrad.html
deqp/functional/gles3/shadertexturefunction/textureprojgradoffset.html

And the specific failing deqp tests are:
dEQP-GLES3.functional.shaders.texture_functions.texturelod.sampler2dshadow_vertex
dEQP-GLES3.functional.shaders.texture_functions.texturelod.sampler2dshadow_fragment
dEQP-GLES3.functional.shaders.texture_functions.texturelodoffset.sampler2dshadow_vertex
dEQP-GLES3.functional.shaders.texture_functions.texturelodoffset.sampler2dshadow_fragment
dEQP-GLES3.functional.shaders.texture_functions.textureprojlod.sampler2dshadow_vertex
dEQP-GLES3.functional.shaders.texture_functions.textureprojlod.sampler2dshadow_fragment
dEQP-GLES3.functional.shaders.texture_functions.textureprojlodoffset.sampler2dshadow_vertex
dEQP-GLES3.functional.shaders.texture_functions.textureprojlodoffset.sampler2dshadow_fragment
dEQP-GLES3.functional.shaders.texture_functions.texturegrad.sampler2dshadow_vertex
dEQP-GLES3.functional.shaders.texture_functions.texturegrad.sampler2dshadow_fragment
dEQP-GLES3.functional.shaders.texture_functions.texturegrad.sampler2darrayshadow_vertex
dEQP-GLES3.functional.shaders.texture_functions.texturegrad.sampler2darrayshadow_fragment
dEQP-GLES3.functional.shaders.texture_functions.texturegradoffset.sampler2dshadow_vertex
dEQP-GLES3.functional.shaders.texture_functions.texturegradoffset.sampler2dshadow_fragment
dEQP-GLES3.functional.shaders.texture_functions.texturegradoffset.sampler2darrayshadow_vertex
dEQP-GLES3.functional.shaders.texture_functions.texturegradoffset.sampler2darrayshadow_fragment
dEQP-GLES3.functional.shaders.texture_functions.textureprojgrad.sampler2dshadow_vertex
dEQP-GLES3.functional.shaders.texture_functions.textureprojgrad.sampler2dshadow_fragment
dEQP-GLES3.functional.shaders.texture_functions.textureprojgradoffset.sampler2dshadow_vertex
dEQP-GLES3.functional.shaders.texture_functions.textureprojgradoffset.sampler2dshadow_fragment

zhenyao pushed a commit to zhenyao/WebGL that referenced this issue Jul 12, 2016
It's not supported in D3D11. Let's move them out of WebGL 2.0.0.

See KhronosGroup#1870

They should be added back for later versions of WebGL 2.
@kenrussell
Copy link
Member

@kenrussell kenrussell commented Jul 12, 2016

LGTM to me to push off passing these tests until the first dot release. I'm undecided as to the best behavior in the meantime. While it would be good to get something on the screen by ignoring the unsupported arguments to these sampling functions, something close but wrong might be worse for developers than nothing at all. Perhaps failing shader compilation with a clear error message that these variants aren't supported on Windows yet is appropriate -- since generally shader compilation is allowed to fail for any reason.

@vonture
Copy link
Contributor Author

@vonture vonture commented Jul 12, 2016

I'd agree that it's probably best to just fail compilation for these functions.

vonture added a commit to vonture/WebGL that referenced this issue Aug 25, 2016
It falls into the same bucket as the other missing D3D11 shadow sampling
functions but was missed on the first pass of supressions.

See KhronosGroup#1870
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants