Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Depth prepass causes z-fighting.

  1. #11
    Senior Member
    Join Date
    Mar 2016
    Posts
    314
    Hmmm, try to simplify the expressions. Try just:

    Code :
    void main() {
        vec3 pos = inPos * (32767.0 / 1024.0);
        gl_Position = projection(transInv(pos, par.pos, par.rot));
        ...
    }

    To be fair it does seem to do some weird stuff in SPIR-V inside projAndGetPos in the depth-prepass vs the draw.

    Heh, it's weird that the SPIR-V shows OpConstant %6 511.984, but 32767.0 / 1024.0 is 31.999 on my calculator...

  2. #12
    Junior Member
    Join Date
    Apr 2018
    Posts
    11
    Quote Originally Posted by krOoze View Post
    Hmmm, try to simplify the expressions. Try just:
    Did not specially mention, but when i was hunting for the cause of divergence - i pretty much tried everything. Including expanding ALL my functions into plain code in main etc. Separating 'pos' calculation in 'projection' and 'sOut.pos' calculation. None of it matters as common sub-expression elimination will rewrite it all to the same code anyway - as expected (ie. no driver errors there it seems).

    Also, it seemed (ie. it can be purely coincidence also) that nvidia drivers are able to optimize (eliminate dead code for example) over shader boundaries as i was able trigger/solve the error purely with changes in fragment shader (using 'sOut.pos' from vertex shader vs not using it).

    Quote Originally Posted by krOoze View Post
    To be fair it does seem to do some weird stuff in SPIR-V inside projAndGetPos in the depth-prepass vs the draw.
    Thous definitely should not differ in any way :/ ... unless dead code elimination rewrote thous (while still adhering 'invariant' restrictions). Did not notice differences, but i might have looked at the wrong place without realizing (SPIR-V is a bit hard to read to say the least). Investigating ...

    Quote Originally Posted by krOoze View Post
    Heh, it's weird that the SPIR-V shows OpConstant %6 511.984, but 32767.0 / 1024.0 is 31.999 on my calculator...
    My apologies. There was a scale change between the posts of source and spir-v, the division changed to 64.0 (~= 511.984). The change was so minor that i forgot to point it out later when posting SPIR-V.

  3. #13
    Junior Member
    Join Date
    Apr 2018
    Posts
    11
    projAndGetPos investigation. The function seems to be the last in both spir-v pastebin posts (%31). As far as i can see:

    * depth prepass one starts at line 184.
    * draw pass one starts at line 248.
    * both are completely identical (inc. all % reference numbers).

  4. #14
    Senior Member
    Join Date
    Mar 2016
    Posts
    314
    Well, I am giving increasingly desperate suggestions... The gl_position actually seems to be written outside the projAndGetPos function in the SPIR-V. And main() seems unused; but I won't pretend to understand auto-generated SPIR-V.

    SDK 77 is out, any luck? You may also try precompiled master at https://github.com/KhronosGroup/glslang/releases

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean