Comments (8)
The check should be a part of #59, but it's not there yet
from naga.
Sounds simple enough, will try adding to glsl-in
from naga.
Thank you for the issue! I tested it, and found out that this is an issue not at the SPIR-V back-end, but rather at the front-end and/or IR.
SPIR-V always requires a termination at the end of a block. So in this case it is a void return, which is simply just return
at the end of a function. However, for now you need to explicitly specify the return
in the function.
A long term fix would be for the IR to check if a function has an explicit return, if not implicitly add it.
from naga.
Ok, so should we add explicit return
in the Rosetta test until this is fixed?
FYI: I added return
support for glsl-new in #179
from naga.
I say for now that would be the best thing to do, as the validation pass is not yet implemented. But first we need #179 for that, then it would be trivial to add the explicit return
.
from naga.
I don't know spirv well at all, but why can't we just do something like
block
.termination
.as_ref()
.unwrap_or(&super::instructions::instruction_return())
.to_words(sink);
Is it just to benefit the other backends as well that it needs to be a validator pass, or should it sometimes do something else than a simple return?
from naga.
Yes that is possible, but the point is that it should never reach a back-end whenever a terminate isn't present. So there will probably be two options as far as I can think of now:
- We check it at the validator pass and throw an compiler error.
- We add a check to the optimization pass and "magically" add a return, when the source code does not contain it. The problem is when the return is not a void return, and requires a value. Do we assign it the default value or still throw a compiler error?
from naga.
The IR has to have a non-valued return
regardless of what we do here. So we might as well require this at IR level that all control flow paths from a function end up in this return
. I suppose the changes to frontends would be fairly trivial?
from naga.
Related Issues (20)
- Panic: gsamplerCubeArrayShadow isn't supported HOT 3
- [wgsl-in] Comparing scalar with vector type incorrectly passes validation
- Support for the .glsl extension HOT 3
- [wgsl-in] `sign()` incorrectly does not accept i32 arguments
- WGSL backend writes invalid WGSL in some cases HOT 7
- `indexmap` dependency is out of date HOT 1
- [hlsl-out] Miscompilation of array return types HOT 5
- Implement WGSL abstract types HOT 2
- In Firefox, Naga may prefer `std`'s default DOS-resistant hash functions HOT 2
- Missing validation: Adding initializer to workgroup variable declaration in WGSL causes shader compiler error
- Show exact place where shader failed in Firefox Nightly HOT 1
- [wgsl-in] vector constructor and splat constructors require decimal point for float types HOT 2
- Shader translation error, no function with name 'fwidth' HOT 11
- [wgsl-in] Why can't I use mat2x2<f32> as an instance input? HOT 1
- wgpu error: Validation Error HOT 1
- OOM triggered when compiling wgsl shader HOT 1
- Index out of bounds in lower/mod.rs
- Wrong number of arguments error is wrong/misleading HOT 9
- DO NOT FILE ISSUES ON THIS REPOSITORY
- A stack overflow vulnerability was found HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from naga.