-
Notifications
You must be signed in to change notification settings - Fork 956
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[naga wgsl] Experimental 64-bit floating-point literals.
In the WGSL front and back ends, support an `lf` suffix on floating-point literals to yield 64-bit integer literals.
- Loading branch information
Showing
12 changed files
with
198 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
( | ||
god_mode: true, | ||
spv: ( | ||
version: (1, 0), | ||
), | ||
glsl: ( | ||
version: Desktop(420), | ||
writer_flags: (""), | ||
binding_map: { }, | ||
zero_initialize_workgroup_memory: true, | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var<private> v: f64 = 1lf; | ||
const k: f64 = 2.0lf; | ||
|
||
fn f(x: f64) -> f64 { | ||
let y: f64 = 3e1lf + 4.0e2lf; | ||
var z = y + f64(5); | ||
return x + y + k + 5.0lf; | ||
} | ||
|
||
@compute @workgroup_size(1) | ||
fn main() { | ||
f(6.0lf); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#version 420 core | ||
#extension GL_ARB_compute_shader : require | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
|
||
const double k = 2.0LF; | ||
|
||
|
||
double f(double x) { | ||
double z = 0.0; | ||
double y = (30.0LF + 400.0LF); | ||
z = (y + double(5)); | ||
return (((x + y) + k) + 5.0LF); | ||
} | ||
|
||
void main() { | ||
double _e1 = f(6.0LF); | ||
return; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
static const double k = 2.0L; | ||
|
||
static double v = 1.0L; | ||
|
||
double f(double x) | ||
{ | ||
double z = (double)0; | ||
|
||
double y = (30.0L + 400.0L); | ||
z = (y + double(5)); | ||
return (((x + y) + k) + 5.0L); | ||
} | ||
|
||
[numthreads(1, 1, 1)] | ||
void main() | ||
{ | ||
const double _e1 = f(6.0L); | ||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
( | ||
vertex:[ | ||
], | ||
fragment:[ | ||
], | ||
compute:[ | ||
( | ||
entry_point:"main", | ||
target_profile:"cs_5_1", | ||
), | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
; SPIR-V | ||
; Version: 1.0 | ||
; Generator: rspirv | ||
; Bound: 33 | ||
OpCapability Shader | ||
OpCapability Float64 | ||
%1 = OpExtInstImport "GLSL.std.450" | ||
OpMemoryModel Logical GLSL450 | ||
OpEntryPoint GLCompute %28 "main" | ||
OpExecutionMode %28 LocalSize 1 1 1 | ||
%2 = OpTypeVoid | ||
%3 = OpTypeFloat 64 | ||
%4 = OpConstant %3 1.0 | ||
%5 = OpConstant %3 2.0 | ||
%7 = OpTypePointer Private %3 | ||
%6 = OpVariable %7 Private %4 | ||
%11 = OpTypeFunction %3 %3 | ||
%12 = OpConstant %3 30.0 | ||
%13 = OpConstant %3 400.0 | ||
%14 = OpTypeInt 32 1 | ||
%15 = OpConstant %14 5 | ||
%16 = OpConstant %3 5.0 | ||
%18 = OpTypePointer Function %3 | ||
%19 = OpConstantNull %3 | ||
%29 = OpTypeFunction %2 | ||
%30 = OpConstant %3 6.0 | ||
%10 = OpFunction %3 None %11 | ||
%9 = OpFunctionParameter %3 | ||
%8 = OpLabel | ||
%17 = OpVariable %18 Function %19 | ||
OpBranch %20 | ||
%20 = OpLabel | ||
%21 = OpFAdd %3 %12 %13 | ||
%22 = OpConvertSToF %3 %15 | ||
%23 = OpFAdd %3 %21 %22 | ||
OpStore %17 %23 | ||
%24 = OpFAdd %3 %9 %21 | ||
%25 = OpFAdd %3 %24 %5 | ||
%26 = OpFAdd %3 %25 %16 | ||
OpReturnValue %26 | ||
OpFunctionEnd | ||
%28 = OpFunction %2 None %29 | ||
%27 = OpLabel | ||
OpBranch %31 | ||
%31 = OpLabel | ||
%32 = OpFunctionCall %3 %10 %30 | ||
OpReturn | ||
OpFunctionEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const k: f64 = 2.0lf; | ||
|
||
var<private> v: f64 = 1.0lf; | ||
|
||
fn f(x: f64) -> f64 { | ||
var z: f64; | ||
|
||
let y = (30.0lf + 400.0lf); | ||
z = (y + f64(5)); | ||
return (((x + y) + k) + 5.0lf); | ||
} | ||
|
||
@compute @workgroup_size(1, 1, 1) | ||
fn main() { | ||
let _e1 = f(6.0lf); | ||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters