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

Make SpirvValue contain an enum for its value #219

Merged
merged 1 commit into from
Nov 11, 2020
Merged

Conversation

khyperia
Copy link
Contributor

This is a prerequisite for all sorts of work (panics, printf extension, builtin functions, nested constants, all sorts of fun stuff) - SpirvValueKind is eventually going to have a decent number of cases. However, just for a proof-of-concept, I've added one "extra" case: ConstantPointer. Not only does this work towards my goal of removing the horrible zombie_even_in_user_code hack, it significantly improves error messages, since we're able to report violations of using the constant pointer directly in the compiler, not the linker, and so we have span information.

Before:

  error: dynamic use of address of constant
    |
    = note: Stack:
            main_fs
            Unnamed function ID %343

After:

  error: Cannot use this pointer directly, it must be dereferenced first
     --> examples/shaders/sky-shader/src/lib.rs:184:5
      |
  184 |     f(&2);
      |     ^^^^^

@khyperia
Copy link
Contributor Author

Because this is such a huge change, it's going to merge conflict with pretty much any compiler change, so I'm going to just merge this now.

@khyperia khyperia merged commit 9c8cec3 into main Nov 11, 2020
@khyperia khyperia deleted the rich-spirvvalue branch November 11, 2020 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant