Comments (7)
@nicolasstucki Apologies for the slow response. I've gone ahead and made this my problem (probably was anyway!).
This PR makes Ultraviolet compatible with 3.4.2-RC1-bin-20240311-02c2a6e-NIGHTLY
, and happily, works just fine with 3.4.1
, too.
So that will be in the next release, which will be soon.
from ultraviolet.
Digging into this a bit, the error messages is:
Exception occurred while executing macro expansion.
ultraviolet.datatypes.ShaderError$UBORead: [ultraviolet] A UBO field was misread.
Coming from here:
What's happening (don't know why yet) is that it tries to summon an equal number of "precision", label, and type name entries. The type names and the precisions come back with 2 values, not doubt corresponding to the two fields (see below), but the labels are missing (empty list). This is the test case class it's trying to read:
case class UBO1(TIME: highp[Float], val VIEWPORT_SIZE: vec2)
I've grabbed a snapshot of the syntax tree, and I'll see if I can work out where it's going wrong...
from ultraviolet.
Ok, so what's happened is that the expected structure has changed. I can make it compile by adding one new case clause. The tests fail after that, but that's another problem, screenshot below for anyone interested:
The request was to minimise the issue, @nicolasstucki. 🤔
Well, the expected structure was this:
case Inlined(
_,
_,
Typed(
Block(
List(
ValDef(
_,
_,
Some(
TypeApply(
Select(
Select(
Apply(
_,
List(Literal(StringConstant(label)))
),
_
),
_
),
_
)
)
)
),
_
),
_
)
) =>
...and is now this:
case Inlined(
_,
_,
Typed(
Block(
List(
ValDef(
_,
_,
Some(TypeApply(Select(Literal(StringConstant(label)), _), _))
)
),
_
),
_
)
) =>
However, I expect this is a me problem, and what I should be doing is less fragile matching. Pro-tips welcome, but I'm thinking I just need to walk the tree until I find the Literal(StringConstant
that I'm after and discard everything else.
from ultraviolet.
The request was to minimise the issue, @nicolasstucki. 🤔
Minimize, find differences, find issues.... Anything that can helps us make sure this will work with your project when we eventually stabilize it.
from ultraviolet.
The difference in the pattern is in
- Some(TypeApply(Select(Select(Apply(_/*f*/, List(Literal(StringConstant(label)))), _/*x*/), /*g*/), _/*T1,..Tn*/))
+ Some(TypeApply(Select(Literal(StringConstant(label)), _/*h*/), _/*U1,..Un*/))
which makes seems to indicate that we are matching on an expression of the form
- f("label").x.g[T1,..,Tn]
+ "label".h[U1,..,Un]
@davesmith00000 what is the actual expression you are matching on? The tree.show
and tree.show(using Printer.TreeStructure)
.
I assume that it is something like
```diff
- f("label").x.asInstanceOf[T]
+ "label".asInstanceOf[T]
from ultraviolet.
Do you know statically which f
, x
you want to match on?
from ultraviolet.
Thanks @nicolasstucki, I'm not immediately following all of that (sorry, my macro-fu is weak 😅), but I'll try and work through what you're saying a little later and see if I can come up with anything helpful.
The test case that's failing however, is already pretty minimal. You can simplify it a bit further by removing the second UBO, but there's not much to it.
What happens is that you define a case class like this:
case class UBO1(TIME: highp[Float], val VIEWPORT_SIZE: vec2)
Then within the shader block you say:
ubo[UBO1]
And it outputs this:
layout (std140) uniform UBO1 {
highp float TIME;
vec2 VIEWPORT_SIZE;
};
from ultraviolet.
Related Issues (20)
- Can we support `~==` for floating point comparison?
- Invalid comparisons HOT 1
- Upgrade to Scala.js 1.15.0 HOT 1
- Missing != operator
- Remove current usage of Indigo from the sandbox HOT 1
- Upgrade to Scala ~3.3.3~ 3.4.1
- Upgrade to Scala.js 1.16.0
- BUG: Int `%` is rewritten to `mod()` HOT 1
- Possible bug: Using `!` in if statement predicate
- Add support for overloaded methods / functions
- Bug: Cellular noise in shaders project generates an error around if syntax HOT 3
- `-=` is an unsupported operator of `vec2` HOT 3
- Add support for assigning to swizzles
- Inline colour conversion syntax
- Possible missing `clamp` variations
- Bug Swizzles not working correctly with bracketed values
- Upgrade to Scala.js 1.14.0
- Add support for foreach?
- Nested inlines support?
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 ultraviolet.