Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions naga/src/proc/constant_evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1945,6 +1945,7 @@ impl<'a> ConstantEvaluator<'a> {
Literal::I64(v) => Literal::I64(v.wrapping_neg()),
Literal::F32(v) => Literal::F32(-v),
Literal::F16(v) => Literal::F16(-v),
Literal::F64(v) => Literal::F64(-v),
Literal::AbstractInt(v) => Literal::AbstractInt(v.wrapping_neg()),
Literal::AbstractFloat(v) => Literal::AbstractFloat(-v),
_ => return Err(ConstantEvaluatorError::InvalidUnaryOpArg),
Expand Down
1 change: 1 addition & 0 deletions naga/tests/in/wgsl/f64.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const k: f64 = 2.0lf;
fn f(x: f64) -> f64 {
let y: f64 = 3e1lf + 4.0e2lf;
var z = y + f64(5);
var w = -1.0lf;
return x + y + k + 5.0lf;
}

Expand Down
1 change: 1 addition & 0 deletions naga/tests/out/glsl/f64.main.Compute.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const double k = 2.0LF;

double f(double x) {
double z = 0.0;
double w = -1.0LF;
double y = (30.0LF + 400.0LF);
z = (y + 5.0LF);
return (((x + y) + k) + 5.0LF);
Expand Down
1 change: 1 addition & 0 deletions naga/tests/out/hlsl/f64.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ static double v = 1.0L;
double f(double x)
{
double z = (double)0;
double w = -1.0L;

double y = (30.0L + 400.0L);
z = (y + 5.0L);
Expand Down
46 changes: 24 additions & 22 deletions naga/tests/out/spv/f64.spvasm
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
; SPIR-V
; Version: 1.0
; Generator: rspirv
; Bound: 30
; Bound: 32
OpCapability Shader
OpCapability Float64
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %25 "main"
OpExecutionMode %25 LocalSize 1 1 1
OpEntryPoint GLCompute %27 "main"
OpExecutionMode %27 LocalSize 1 1 1
%2 = OpTypeVoid
%3 = OpTypeFloat 64
%4 = OpConstant %3 1.0
Expand All @@ -18,28 +18,30 @@ OpExecutionMode %25 LocalSize 1 1 1
%12 = OpConstant %3 30.0
%13 = OpConstant %3 400.0
%14 = OpConstant %3 5.0
%16 = OpTypePointer Function %3
%17 = OpConstantNull %3
%26 = OpTypeFunction %2
%27 = OpConstant %3 6.0
%15 = OpConstant %3 -1.0
%17 = OpTypePointer Function %3
%18 = OpConstantNull %3
%28 = OpTypeFunction %2
%29 = OpConstant %3 6.0
%10 = OpFunction %3 None %11
%9 = OpFunctionParameter %3
%8 = OpLabel
%15 = OpVariable %16 Function %17
OpBranch %18
%18 = OpLabel
%19 = OpFAdd %3 %12 %13
%20 = OpFAdd %3 %19 %14
OpStore %15 %20
%21 = OpFAdd %3 %9 %19
%22 = OpFAdd %3 %21 %5
%23 = OpFAdd %3 %22 %14
OpReturnValue %23
%16 = OpVariable %17 Function %18
%19 = OpVariable %17 Function %15
OpBranch %20
%20 = OpLabel
%21 = OpFAdd %3 %12 %13
%22 = OpFAdd %3 %21 %14
OpStore %16 %22
%23 = OpFAdd %3 %9 %21
%24 = OpFAdd %3 %23 %5
%25 = OpFAdd %3 %24 %14
OpReturnValue %25
OpFunctionEnd
%25 = OpFunction %2 None %26
%24 = OpLabel
OpBranch %28
%28 = OpLabel
%29 = OpFunctionCall %3 %10 %27
%27 = OpFunction %2 None %28
%26 = OpLabel
OpBranch %30
%30 = OpLabel
%31 = OpFunctionCall %3 %10 %29
OpReturn
OpFunctionEnd
1 change: 1 addition & 0 deletions naga/tests/out/wgsl/f64.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var<private> v: f64 = 1.0lf;

fn f(x: f64) -> f64 {
var z: f64;
var w: f64 = -1.0lf;

let y = (30.0lf + 400.0lf);
z = (y + 5.0lf);
Expand Down