Revert "writer/hlsl: Special case negative zero"
This reverts commit efceb83536
.
Reason for revert: Possibly broke tint -> dawn roll (again)
Original change's description:
> writer/hlsl: Special case negative zero
>
> Fixed: tint:960
> Change-Id: I04de8713fe299607f32fd93288a22b75a9dff381
> Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58760
> Reviewed-by: Ben Clayton <bclayton@chromium.org>
> Reviewed-by: James Price <jrprice@google.com>
> Commit-Queue: Ben Clayton <bclayton@google.com>
> Kokoro: Kokoro <noreply+kokoro@google.com>
TBR=bclayton@google.com,jrprice@google.com,bclayton@chromium.org,noreply+kokoro@google.com,tint-scoped@luci-project-accounts.iam.gserviceaccount.com
Change-Id: Ic3042dabbd5a399851185714a6dd5e33ba8a5fc6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59023
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
f6660aa125
commit
33afd6ce97
|
@ -2502,20 +2502,13 @@ bool GeneratorImpl::EmitLiteral(std::ostream& out, ast::Literal* lit) {
|
||||||
if (auto* l = lit->As<ast::BoolLiteral>()) {
|
if (auto* l = lit->As<ast::BoolLiteral>()) {
|
||||||
out << (l->IsTrue() ? "true" : "false");
|
out << (l->IsTrue() ? "true" : "false");
|
||||||
} else if (auto* fl = lit->As<ast::FloatLiteral>()) {
|
} else if (auto* fl = lit->As<ast::FloatLiteral>()) {
|
||||||
bool positive = !std::signbit(fl->value());
|
if (std::isinf(fl->value())) {
|
||||||
switch (std::fpclassify(fl->value())) {
|
out << (fl->value() >= 0 ? "asfloat(0x7f800000u)"
|
||||||
case FP_INFINITE:
|
: "asfloat(0xff800000u)");
|
||||||
out << (positive ? "asfloat(0x7f800000u)" : "asfloat(0xff800000u)");
|
} else if (std::isnan(fl->value())) {
|
||||||
break;
|
out << "asfloat(0x7fc00000u)";
|
||||||
case FP_NAN:
|
} else {
|
||||||
out << "asfloat(0x7fc00000u)";
|
out << FloatToString(fl->value()) << "f";
|
||||||
break;
|
|
||||||
case FP_ZERO:
|
|
||||||
out << (positive ? "0.0f" : "asfloat(0x80000000u)");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
out << FloatToString(fl->value()) << "f";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else if (auto* sl = lit->As<ast::SintLiteral>()) {
|
} else if (auto* sl = lit->As<ast::SintLiteral>()) {
|
||||||
out << sl->value();
|
out << sl->value();
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
OpCapability Shader
|
|
||||||
OpMemoryModel Logical GLSL450
|
|
||||||
OpEntryPoint Fragment %main "main" %out_var_SV_TARGET
|
|
||||||
OpExecutionMode %main OriginUpperLeft
|
|
||||||
OpSource HLSL 600
|
|
||||||
OpName %out_var_SV_TARGET "out.var.SV_TARGET"
|
|
||||||
OpName %main "main"
|
|
||||||
OpDecorate %out_var_SV_TARGET Location 0
|
|
||||||
%float = OpTypeFloat 32
|
|
||||||
%float_0x1p_128 = OpConstant %float -0
|
|
||||||
%v4float = OpTypeVector %float 4
|
|
||||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
|
||||||
%void = OpTypeVoid
|
|
||||||
%9 = OpTypeFunction %void
|
|
||||||
%out_var_SV_TARGET = OpVariable %_ptr_Output_v4float Output
|
|
||||||
%main = OpFunction %void None %9
|
|
||||||
%10 = OpLabel
|
|
||||||
%12 = OpCompositeConstruct %v4float %float_0x1p_128 %float_0x1p_128 %float_0x1p_128 %float_0x1p_128
|
|
||||||
OpStore %out_var_SV_TARGET %12
|
|
||||||
OpReturn
|
|
||||||
OpFunctionEnd
|
|
|
@ -1,20 +0,0 @@
|
||||||
static float4 out_var_SV_TARGET = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
|
||||||
|
|
||||||
void main_1() {
|
|
||||||
out_var_SV_TARGET = float4(asfloat(0x80000000u), asfloat(0x80000000u), asfloat(0x80000000u), asfloat(0x80000000u));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct main_out {
|
|
||||||
float4 out_var_SV_TARGET_1;
|
|
||||||
};
|
|
||||||
struct tint_symbol {
|
|
||||||
float4 out_var_SV_TARGET_1 : SV_Target0;
|
|
||||||
};
|
|
||||||
|
|
||||||
tint_symbol main() {
|
|
||||||
main_1();
|
|
||||||
const main_out tint_symbol_1 = {out_var_SV_TARGET};
|
|
||||||
const tint_symbol tint_symbol_2 = {tint_symbol_1.out_var_SV_TARGET_1};
|
|
||||||
return tint_symbol_2;
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
#include <metal_stdlib>
|
|
||||||
|
|
||||||
using namespace metal;
|
|
||||||
struct main_out {
|
|
||||||
float4 out_var_SV_TARGET_1;
|
|
||||||
};
|
|
||||||
struct tint_symbol_1 {
|
|
||||||
float4 out_var_SV_TARGET_1 [[color(0)]];
|
|
||||||
};
|
|
||||||
|
|
||||||
void main_1(thread float4* const tint_symbol_4) {
|
|
||||||
*(tint_symbol_4) = float4(-0.0f, -0.0f, -0.0f, -0.0f);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fragment tint_symbol_1 tint_symbol() {
|
|
||||||
thread float4 tint_symbol_5 = 0.0f;
|
|
||||||
main_1(&(tint_symbol_5));
|
|
||||||
main_out const tint_symbol_2 = {.out_var_SV_TARGET_1=tint_symbol_5};
|
|
||||||
tint_symbol_1 const tint_symbol_3 = {.out_var_SV_TARGET_1=tint_symbol_2.out_var_SV_TARGET_1};
|
|
||||||
return tint_symbol_3;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
; SPIR-V
|
|
||||||
; Version: 1.3
|
|
||||||
; Generator: Google Tint Compiler; 0
|
|
||||||
; Bound: 26
|
|
||||||
; Schema: 0
|
|
||||||
OpCapability Shader
|
|
||||||
OpMemoryModel Logical GLSL450
|
|
||||||
OpEntryPoint Fragment %main "main" %tint_symbol_1
|
|
||||||
OpExecutionMode %main OriginUpperLeft
|
|
||||||
OpName %out_var_SV_TARGET "out_var_SV_TARGET"
|
|
||||||
OpName %tint_symbol_1 "tint_symbol_1"
|
|
||||||
OpName %main_1 "main_1"
|
|
||||||
OpName %main_out "main_out"
|
|
||||||
OpMemberName %main_out 0 "out_var_SV_TARGET_1"
|
|
||||||
OpName %tint_symbol_2 "tint_symbol_2"
|
|
||||||
OpName %tint_symbol "tint_symbol"
|
|
||||||
OpName %main "main"
|
|
||||||
OpDecorate %tint_symbol_1 Location 0
|
|
||||||
OpMemberDecorate %main_out 0 Offset 0
|
|
||||||
%float = OpTypeFloat 32
|
|
||||||
%v4float = OpTypeVector %float 4
|
|
||||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
|
||||||
%5 = OpConstantNull %v4float
|
|
||||||
%out_var_SV_TARGET = OpVariable %_ptr_Private_v4float Private %5
|
|
||||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
|
||||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5
|
|
||||||
%void = OpTypeVoid
|
|
||||||
%8 = OpTypeFunction %void
|
|
||||||
%float_n0 = OpConstant %float -0
|
|
||||||
%13 = OpConstantComposite %v4float %float_n0 %float_n0 %float_n0 %float_n0
|
|
||||||
%main_out = OpTypeStruct %v4float
|
|
||||||
%14 = OpTypeFunction %void %main_out
|
|
||||||
%main_1 = OpFunction %void None %8
|
|
||||||
%11 = OpLabel
|
|
||||||
OpStore %out_var_SV_TARGET %13
|
|
||||||
OpReturn
|
|
||||||
OpFunctionEnd
|
|
||||||
%tint_symbol_2 = OpFunction %void None %14
|
|
||||||
%tint_symbol = OpFunctionParameter %main_out
|
|
||||||
%18 = OpLabel
|
|
||||||
%19 = OpCompositeExtract %v4float %tint_symbol 0
|
|
||||||
OpStore %tint_symbol_1 %19
|
|
||||||
OpReturn
|
|
||||||
OpFunctionEnd
|
|
||||||
%main = OpFunction %void None %8
|
|
||||||
%21 = OpLabel
|
|
||||||
%22 = OpFunctionCall %void %main_1
|
|
||||||
%24 = OpLoad %v4float %out_var_SV_TARGET
|
|
||||||
%25 = OpCompositeConstruct %main_out %24
|
|
||||||
%23 = OpFunctionCall %void %tint_symbol_2 %25
|
|
||||||
OpReturn
|
|
||||||
OpFunctionEnd
|
|
|
@ -1,17 +0,0 @@
|
||||||
var<private> out_var_SV_TARGET : vec4<f32>;
|
|
||||||
|
|
||||||
fn main_1() {
|
|
||||||
out_var_SV_TARGET = vec4<f32>(-0.0, -0.0, -0.0, -0.0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct main_out {
|
|
||||||
[[location(0)]]
|
|
||||||
out_var_SV_TARGET_1 : vec4<f32>;
|
|
||||||
};
|
|
||||||
|
|
||||||
[[stage(fragment)]]
|
|
||||||
fn main() -> main_out {
|
|
||||||
main_1();
|
|
||||||
return main_out(out_var_SV_TARGET);
|
|
||||||
}
|
|
Loading…
Reference in New Issue