KhronosGroup / KhronosGroup/WebGL

D3D11 missing shadow sampler functions

Open
#1,870 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
2.9k
Forks
704
Avg merge
2d 9h
Merged PRs (30d)
4

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the listed deqp shader texture-function tests, especially the sampler2dshadow vertex and fragment cases, and compare their failures with the HLSL SampleCmp limitations described here. The work is complete only after a decision is made about consistent behavior and the affected shadow-sampler functions are handled accordingly.

Written by the indexing model from the issue text.

Assessment

Domain
compilers, testing-qa
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.