Skip to content
Snippets Groups Projects

vkd3d-shader/hlsl: Add some more constant folding operations.

Merged Nikolay Sivov requested to merge nsivov/vkd3d:fold2 into master
1 unresolved thread

Merge request reports

Checking pipeline status.

Approved by

Merged by Alexandre JulliardAlexandre Julliard 1 year ago (Aug 14, 2023 7:00pm UTC)

Merge details

  • Changes merged into master with 98f63c46.
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Giovanni Mascellani
    Giovanni Mascellani @giomasce started a thread on commit d331dcf4
  • 133 133 VKD3D_SHADER_ERROR_HLSL_MISSING_ATTRIBUTE = 5024,
    134 134 VKD3D_SHADER_ERROR_HLSL_RECURSIVE_CALL = 5025,
    135 135 VKD3D_SHADER_ERROR_HLSL_INCONSISTENT_SAMPLER = 5026,
    136 VKD3D_SHADER_ERROR_HLSL_NON_FINITE_RESULT = 5027,
    136 137
    137 138 VKD3D_SHADER_WARNING_HLSL_IMPLICIT_TRUNCATION = 5300,
    138 139 VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO = 5301,
    139 140 VKD3D_SHADER_WARNING_HLSL_UNKNOWN_ATTRIBUTE = 5302,
    141 VKD3D_SHADER_WARNING_HLSL_IMAGINARY_NUMERIC_RESULT = 5303,
    • I am not sure of what is the general philosophy for the error identifiers in vkd3d. Honestly, my general feeling is they are a bit too specific. It's good to give a specific error message when this is meant for a human, as we do. But the error identifier is likely meant for a program, and I am not sure of which circumstances would make a program behave differently depending on whether the shader compilation failed because of a "non finite result", of a "division by zero or of an "offset out of bounds". Probably the only sensible thing a program can do in any of these occasions is to just report an error to the human, for whom the natural language error message is more useful than the error identifier; for that a single "HLSL compiler failed compilation" error identifier is probably more than enough.

      OTOH, if we decide that for some reason we want to be specific with error identifiers, then let's really be specific. We already have "division by zero", so "non finite result" would be a useless generalization of that. Then let's call it "square root of a negative number".

      As I said, I guess that's going to be pretty useless anyway, because I can't see any reasonable way to extract useful information from the error identifier, so leaving stuff as it is is fine for me too. I'm just a bit puzzled by the inconsistency.

    • Author Developer

      For some reason we have multiple errors instead of just a couple, so I added to that. Not sure if your comment is for my changes specifically or situation in general.

    • No, just a random remark. You're right that the philosophy right now is to have a lot of different errors, I just can't understand the reason. But it should do no particular harm.

      Let me just point out that native doesn't return any warning for log2(0.0) for SM4. It just returns -Inf.

    • Let me just point out that native doesn't return any warning for log2(0.0) for SM4. It just returns -Inf.

      Ah, your code does that too. Sorry, screw that.

    • Author Developer

      Yes, it checks for strictly negative currently.

    • Please register or sign in to reply
  • Nikolay Sivov added 3 commits

    added 3 commits

    • 67b58b5e - vkd3d-shader/hlsl: Add constant folding for 'sqrt'.
    • ee01e6f6 - vkd3d-shader/hlsl: Add constant folding for 'log2'.
    • 31c0de8c - vkd3d-shader/hlsl: Use type width in fold_rcp().

    Compare with previous version

  • Giovanni Mascellani approved this merge request

    approved this merge request

  • Nikolay Sivov added 70 commits

    added 70 commits

    • 31c0de8c...f95ab2a5 - 67 commits from branch wine:master
    • 2456915b - vkd3d-shader/hlsl: Add constant folding for 'sqrt'.
    • cd81cd1e - vkd3d-shader/hlsl: Add constant folding for 'log2'.
    • bd9232cc - vkd3d-shader/hlsl: Use type width in fold_rcp().

    Compare with previous version

  • Francisco Casas approved this merge request

    approved this merge request

  • Nikolay Sivov added 41 commits

    added 41 commits

    • bd9232cc...5d75731d - 38 commits from branch wine:master
    • fddbc8fa - vkd3d-shader/hlsl: Add constant folding for 'sqrt'.
    • 0784c58d - vkd3d-shader/hlsl: Add constant folding for 'log2'.
    • 6dca036f - vkd3d-shader/hlsl: Use type width in fold_rcp().

    Compare with previous version

  • Elizabeth Figura approved this merge request

    approved this merge request

  • Henri Verbeet approved this merge request

    approved this merge request

  • Alexandre Julliard approved this merge request

    approved this merge request

  • Please register or sign in to reply
    Loading