Commit 35e90e22 by Ben Clayton

Reactor: Fix cast from bool -> RValue<Bool>.

This was previously taking the IntLiteral<T> path, resulting in an integer type instead of a bool type. Bug: b/128636885 Change-Id: I1a36a7ba0e7009431dc44645f90454d389be721b Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27250 Presubmit-Ready: Ben Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 36411219
...@@ -126,17 +126,23 @@ namespace rr ...@@ -126,17 +126,23 @@ namespace rr
}; };
template<class T> template<class T>
struct IntLiteral struct BoolLiteral
{ {
struct type; struct type;
}; };
template<> template<>
struct IntLiteral<Bool> struct BoolLiteral<Bool>
{ {
typedef bool type; typedef bool type;
}; };
template<class T>
struct IntLiteral
{
struct type;
};
template<> template<>
struct IntLiteral<Int> struct IntLiteral<Int>
{ {
...@@ -174,6 +180,7 @@ namespace rr ...@@ -174,6 +180,7 @@ namespace rr
explicit RValue(Value *rvalue); explicit RValue(Value *rvalue);
RValue(const T &lvalue); RValue(const T &lvalue);
RValue(typename BoolLiteral<T>::type i);
RValue(typename IntLiteral<T>::type i); RValue(typename IntLiteral<T>::type i);
RValue(typename FloatLiteral<T>::type f); RValue(typename FloatLiteral<T>::type f);
RValue(const Reference<T> &rhs); RValue(const Reference<T> &rhs);
...@@ -2396,6 +2403,12 @@ namespace rr ...@@ -2396,6 +2403,12 @@ namespace rr
} }
template<class T> template<class T>
RValue<T>::RValue(typename BoolLiteral<T>::type i)
{
value = Nucleus::createConstantBool(i);
}
template<class T>
RValue<T>::RValue(typename IntLiteral<T>::type i) RValue<T>::RValue(typename IntLiteral<T>::type i)
{ {
value = Nucleus::createConstantInt(i); value = Nucleus::createConstantInt(i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment