You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@sunag
I'm now getting a different issue where a TSL inline function (i.e a function that generates code inline within the main function) that calls a setLayout function is not properly defining the structType in every file where that struct type appears.
For instance my computeHeight function calls an inline TSL function GetNeighborValues() which calls a setLayout function GetNeighborIndices(). My computeSmooth function calls the exact same function. However, on compilation, while both functions will properly generate the GetNeighborIndices function in WGSL, the computeHeight function generates the NeighborIndicesStructType in WGSL while the computeSmooth function does not.
I've updated the link with these changes. Clicking the computeSmooth function call will result in this compilation error:
Reproduction steps
In webgpu_compute_water, replace the current call to getNeighborIndicesTSL with a defined function executing the same code, but created with set layout.
Have that function return a struct type for the relevant returned values.
Code
Relevant TSL calls are below. destructureStruct is simply a convenience function. The WGSL output does not meaningfully change irrespective of whether it is used or not
// Struct Definition
constNeighborIndicesStructure={northIndex: 'uint',eastIndex: 'uint',southIndex: 'uint',westIndex: 'uint',};constNeighborIndicesStruct=struct(NeighborIndicesStructure,'NeighborIndicesStructType');constNeighborValuesStruct=struct(NeighborValuesStructure,'NeighborValuesStructType');// Compute Height shader```ts// This codepath calls GetNeighborIndices and properly generates the NeighborIndicesStructType returned by GetNeighborIndicesconst{ north, south, east, west }=destructureStruct(NeighborValuesStructure,GetNeighborValues(instanceIndex,heightStorage));
// Compute smooth shader
// This code path calls GetNeighborIndices and does not generate the NeighborIndicesStructType returned by GetNeighborIndicesconst{north: northH,south: southH,east: eastH,west: westH}=destructureStruct(NeighborValuesStructure,GetNeighborValues(instanceIndex,heightStorage));
It seems to me here that the layout was defined in a function, but the structure was never used, so there was no declaration by NodeBuilder. I think if you return the structure this shouldn't happen? I couldn't see the error in your example.
It seems to me here that the layout was defined in a function, but the structure was never used, so there was no declaration by NodeBuilder. I think if you return the structure this shouldn't happen? I couldn't see the error in your example.
The compilation error should occur upon pressing the Compute Smooth button. I believe that function only gets compiled once the button is pressed.
Description
*Related Issues: #30394
@sunag
I'm now getting a different issue where a TSL inline function (i.e a function that generates code inline within the main function) that calls a setLayout function is not properly defining the structType in every file where that struct type appears.
For instance my computeHeight function calls an inline TSL function GetNeighborValues() which calls a setLayout function GetNeighborIndices(). My computeSmooth function calls the exact same function. However, on compilation, while both functions will properly generate the GetNeighborIndices function in WGSL, the computeHeight function generates the NeighborIndicesStructType in WGSL while the computeSmooth function does not.
I've updated the link with these changes. Clicking the computeSmooth function call will result in this compilation error:
Reproduction steps
Code
Relevant TSL calls are below. destructureStruct is simply a convenience function. The WGSL output does not meaningfully change irrespective of whether it is used or not
// Struct Definition
// Compute smooth shader
Live example
Live WebGPU Example
Screenshots
No response
Version
r173
Device
Desktop
Browser
Chrome
OS
Windows
The text was updated successfully, but these errors were encountered: