-
Notifications
You must be signed in to change notification settings - Fork 353
"zero"/null of storable types, rework initializers #764
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
Conversation
| </xmp> | ||
| </div> | ||
|
|
||
| ## Storable types ## {#storable-types} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this up above pointer types, since pointer types are not storable.
Fixes gpuweb#685 The generically zero-able types (or nullable types) correspond exactly with storable types, so I tied nullability to the storable type concept. Eliminate the concept of a "default" type. Instead define the null value of a storable type. Clarify that a variable declaration can have an initializer. Specify the initial value of a variable, and it's the null value for the store type if the declaration had no intializer. This still leaves up in the air exactly when a variable is "created" as we haven't specfiied an execution order or even the concept of execution of a statement. Initializers are only permitted for 3 storage classes Remove "Initializers" section later on, as its content is now mostly abosrbed into the "Variables" section. Hint at future reorganization, to insert a "Evaluation and Execution" section between "Types" and "Grammar" major sections.
|
This was a bit more sprawling a change than I had hoped. It touched variables and "default values" and add type rules. It feels like we're missing a big section in the middle to describe actual execution, something between Types and the Grammar. |
| `mat3x4<f32>()` : mat3x4<f32><br> | ||
| `mat4x4<f32>()` : mat4x4<f32> | ||
| <td>Null value (OpConstantNull) | ||
| <tr> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add struct and array in here as well for completeness?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This table is only for matrix constructors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I mean add a table for structs and arrays similar to the ones we have for other types add show the null value converts to OpConstantNull
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 747e677
|
|
I'd be ok with that, or with "nil". |
|
One thing to keep in mind is that, for shader languages that have C-like pointers, the all-zero-bits pointer into workgroup storage (local or shared) is often a valid address; the nullptr has non-zero bit pattern. But we're not there yet, and can leave that conceptual challenge to the future. |
|
Discussed at the 2020-05-19 meeting. Resolution was to use zero. |
Sometimes, the English seems to read better when writing "zero-valued" instead of just "zero".
|
I believe fall feedback is addressed. PTAL |
grunt-http-server hasn't been updated in 4 years and depends on a broken version of http-server that causes infinite redirects on Windows.
Fixes #685
The generically zero-able types (or nullable types) correspond exactly with
storable types, so I tied nullability to the storable type concept.
Eliminate the concept of a "default" type. Instead define the null
value of a storable type.
Clarify that a variable declaration can have an initializer.
Specify the initial value of a variable, and it's the null value for
the store type if the declaration had no intializer.
This still leaves up in the air exactly when a variable is "created"
as we haven't specfiied an execution order or even the concept of
execution of a statement.
Initializers are only permitted for 3 storage classes
Remove "Initializers" section later on, as its content is now mostly
abosrbed into the "Variables" section.
Hint at future reorganization, to insert a "Evaluation and Execution"
section between "Types" and "Grammar" major sections.