Implement implicit broadcast of scalar constants
This change enables syntax such as `v + 0.5f` where `v` is a Float4
vector. The 0.5f is implicitly converted to an RValue<Float4>. Note that
this also works for any C++ float values, including variables, but from
Reactor's perspective it's a constant.
Explicit operators for adding RValue<Int> and RValue<Int4> have been
removed since they caused ambiguity. This was only used by one instance
of adding Int and SIMD::Int, which was changed to use an explicit
broadcast.
Bug: b/221072484
Change-Id: I50ba159b8f62fa3c7198b7dc55a9832ea7cff03c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/63550
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Sean Risser <srisser@google.com>
diff --git a/src/Pipeline/PixelProgram.cpp b/src/Pipeline/PixelProgram.cpp
index d6cbe0a..5d4da9b 100644
--- a/src/Pipeline/PixelProgram.cpp
+++ b/src/Pipeline/PixelProgram.cpp
@@ -96,8 +96,8 @@
routine.invocationsPerSubgroup = SIMD::Width;
routine.helperInvocation = ~maskAny(cMask, samples);
- routine.windowSpacePosition[0] = x + SIMD::Int(0, 1, 0, 1);
- routine.windowSpacePosition[1] = y + SIMD::Int(0, 0, 1, 1);
+ routine.windowSpacePosition[0] = SIMD::Int(x) + SIMD::Int(0, 1, 0, 1);
+ routine.windowSpacePosition[1] = SIMD::Int(y) + SIMD::Int(0, 0, 1, 1);
routine.layer = *Pointer<Int>(data + OFFSET(DrawData, layer));
// PointCoord formula reference: https://www.khronos.org/registry/vulkan/specs/1.2/html/vkspec.html#primsrast-points-basic