Commit 3246ca29 by Ben Clayton

SpirvShader: Add Intermediate::replace()

This lets us use Intermediate for building intermediates in loops without the need of an alloca. Bug: b/128527271 Change-Id: Id36db83d0b1cedd7700bbf2431eed9b4a03a7997 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27769 Presubmit-Ready: Ben Clayton <bclayton@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 64f78f56
...@@ -85,6 +85,14 @@ namespace sw ...@@ -85,6 +85,14 @@ namespace sw
void move(uint32_t i, const RValue<SIMD::Int> &scalar) { emplace(i, scalar.value); } void move(uint32_t i, const RValue<SIMD::Int> &scalar) { emplace(i, scalar.value); }
void move(uint32_t i, const RValue<SIMD::UInt> &scalar) { emplace(i, scalar.value); } void move(uint32_t i, const RValue<SIMD::UInt> &scalar) { emplace(i, scalar.value); }
void replace(uint32_t i, RValue<SIMD::Float> &&scalar) { replace(i, scalar.value); }
void replace(uint32_t i, RValue<SIMD::Int> &&scalar) { replace(i, scalar.value); }
void replace(uint32_t i, RValue<SIMD::UInt> &&scalar) { replace(i, scalar.value); }
void replace(uint32_t i, const RValue<SIMD::Float> &scalar) { replace(i, scalar.value); }
void replace(uint32_t i, const RValue<SIMD::Int> &scalar) { replace(i, scalar.value); }
void replace(uint32_t i, const RValue<SIMD::UInt> &scalar) { replace(i, scalar.value); }
// Value retrieval functions. // Value retrieval functions.
RValue<SIMD::Float> Float(uint32_t i) const RValue<SIMD::Float> Float(uint32_t i) const
{ {
...@@ -121,6 +129,12 @@ namespace sw ...@@ -121,6 +129,12 @@ namespace sw
scalar[i] = value; scalar[i] = value;
} }
void replace(uint32_t i, rr::Value *value)
{
ASSERT(i < size);
scalar[i] = value;
}
rr::Value **const scalar; rr::Value **const scalar;
uint32_t size; uint32_t size;
}; };
......
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