Add SpirvRoutine::getValue helper
- Provides a point to complain if something is not yet defined.
- Allows avoiding ugly syntax from use of unique_ptr
Bug: b/124388146
Change-Id: Ib55023fff5c90b71a41c5f558544be65250bb67d
Reviewed-on: https://swiftshader-review.googlesource.com/c/24791
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Pipeline/VertexProgram.cpp b/src/Pipeline/VertexProgram.cpp
index b8ccf34..54cd408 100644
--- a/src/Pipeline/VertexProgram.cpp
+++ b/src/Pipeline/VertexProgram.cpp
@@ -37,7 +37,7 @@
{
// TODO: we could do better here; we know InstanceIndex is uniform across all lanes
assert(it->second.SizeInComponents == 1);
- (*routine.lvalues[it->second.Id])[it->second.FirstComponent] =
+ routine.getValue(it->second.Id)[it->second.FirstComponent] =
As<Float4>(Int4((*Pointer<Int>(data + OFFSET(DrawData, instanceID)))));
}
}
@@ -56,7 +56,7 @@
if (it != spirvShader->inputBuiltins.end())
{
assert(it->second.SizeInComponents == 1);
- (*routine.lvalues[it->second.Id])[it->second.FirstComponent] =
+ routine.getValue(it->second.Id)[it->second.FirstComponent] =
As<Float4>(Int4(index) + Int4(0, 1, 2, 3));
}