mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-03 11:46:09 +00:00
More WGSL syntax updates
This CL updates more #'s to //'s and a missing set to group. Change-Id: If417ed019319ed760e3b672770397857c6dfc40c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39065 Commit-Queue: dan sinclair <dsinclair@chromium.org> Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com> Auto-Submit: dan sinclair <dsinclair@chromium.org> Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
parent
e6f58411a9
commit
aae37c2ea3
@ -70,20 +70,20 @@ namespace dawn_native {
|
|||||||
|
|
||||||
var timestamp : Timestamp = timestamps.t[index];
|
var timestamp : Timestamp = timestamps.t[index];
|
||||||
|
|
||||||
# Return 0 for the unavailable value.
|
// Return 0 for the unavailable value.
|
||||||
if (availability.v[index] == 0u) {
|
if (availability.v[index] == 0u) {
|
||||||
timestamps.t[index].low = 0u;
|
timestamps.t[index].low = 0u;
|
||||||
timestamps.t[index].high = 0u;
|
timestamps.t[index].high = 0u;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Multiply the values in timestamps buffer by the period.
|
// Multiply the values in timestamps buffer by the period.
|
||||||
var period : f32 = params.period;
|
var period : f32 = params.period;
|
||||||
var w : u32 = 0u;
|
var w : u32 = 0u;
|
||||||
|
|
||||||
# If the product of low 32-bits and the period does not exceed the maximum of u32,
|
// If the product of low 32-bits and the period does not exceed the maximum of u32,
|
||||||
# directly do the multiplication, otherwise, use two u32 to represent the high
|
// directly do the multiplication, otherwise, use two u32 to represent the high
|
||||||
# 16-bits and low 16-bits of this u32, then multiply them by the period separately.
|
// 16-bits and low 16-bits of this u32, then multiply them by the period separately.
|
||||||
if (timestamp.low <= u32(f32(0xFFFFFFFFu) / period)) {
|
if (timestamp.low <= u32(f32(0xFFFFFFFFu) / period)) {
|
||||||
timestamps.t[index].low = u32(round(f32(timestamp.low) * period));
|
timestamps.t[index].low = u32(round(f32(timestamp.low) * period));
|
||||||
} else {
|
} else {
|
||||||
@ -99,8 +99,8 @@ namespace dawn_native {
|
|||||||
timestamps.t[index].low = result;
|
timestamps.t[index].low = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the nearest integer to the float result. For high 32-bits, the round
|
// Get the nearest integer to the float result. For high 32-bits, the round
|
||||||
# function will greatly help reduce the accuracy loss of the final result.
|
// function will greatly help reduce the accuracy loss of the final result.
|
||||||
timestamps.t[index].high = u32(round(f32(timestamp.high) * period)) + w;
|
timestamps.t[index].high = u32(round(f32(timestamp.high) * period)) + w;
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
@ -65,10 +65,10 @@ class DepthStencilStateTest : public DawnTest {
|
|||||||
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
||||||
vec2<f32>(-1.0, 1.0),
|
vec2<f32>(-1.0, 1.0),
|
||||||
vec2<f32>(-1.0, -1.0),
|
vec2<f32>(-1.0, -1.0),
|
||||||
vec2<f32>( 1.0, -1.0), # front-facing
|
vec2<f32>( 1.0, -1.0), // front-facing
|
||||||
vec2<f32>(-1.0, 1.0),
|
vec2<f32>(-1.0, 1.0),
|
||||||
vec2<f32>( 1.0, 1.0),
|
vec2<f32>( 1.0, 1.0),
|
||||||
vec2<f32>( 1.0, -1.0)); # back-facing
|
vec2<f32>( 1.0, -1.0)); // back-facing
|
||||||
Position = vec4<f32>(pos[VertexIndex], ubo.depth, 1.0);
|
Position = vec4<f32>(pos[VertexIndex], ubo.depth, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ void FirstIndexOffsetTests::TestImpl(DrawMode mode,
|
|||||||
[[offset(4)]] instance_index : u32;
|
[[offset(4)]] instance_index : u32;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[set(0), binding(0)]] var<storage_buffer> idx_vals : [[access(read_write)]] IndexVals;
|
[[group(0), binding(0)]] var<storage_buffer> idx_vals : [[access(read_write)]] IndexVals;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
)";
|
)";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user