Remove sw::BoundedIndex
Not longer needed after https://swiftshader-review.googlesource.com/c/SwiftShader/+/24668
Change-Id: Ib345e5f288123387d44d230438da899120be830a
Reviewed-on: https://swiftshader-review.googlesource.com/c/25016
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Common/Types.hpp b/src/Common/Types.hpp
index 7259b20..dfbf45a 100644
--- a/src/Common/Types.hpp
+++ b/src/Common/Types.hpp
@@ -152,49 +152,6 @@
return v;
}
- class BoundedIndex
- {
- public:
- BoundedIndex(int index) : index(index) {}
-
- inline void setLimit(int limit) { this->limit = limit; }
-
- inline int operator++(int) { return index++; }
- inline int operator--(int) { return index--; }
- inline void operator=(int i) { index = i; }
-
- inline bool operator==(int i) { return index == i; }
- inline bool operator!=(int i) { return index != i; }
- inline bool operator<(int i) { return index < i; }
- inline bool operator>(int i) { return index > i; }
- inline bool operator<=(int i) { return index <= i; }
- inline bool operator>=(int i) { return index >= i; }
-
- inline operator int()
- {
- if(index < 0)
- {
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
- assert(false);
-#endif
- return 0;
- }
- else if(index >= limit)
- {
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
- assert(false);
-#endif
- return limit - 1;
- }
-
- return index;
- }
-
- private:
- int index = 0;
- int limit = 0;
- };
-
// The OFFSET macro is a generalization of the offsetof() macro defined in <cstddef>.
// It allows e.g. getting the offset of array elements, even when indexed dynamically.
// We cast the address '32' and subtract it again, because null-dereference is undefined behavior.
diff --git a/src/Shader/PixelProgram.cpp b/src/Shader/PixelProgram.cpp
index 843ba32..632de99 100644
--- a/src/Shader/PixelProgram.cpp
+++ b/src/Shader/PixelProgram.cpp
@@ -34,10 +34,6 @@
callStack(shader->getLimits().stack)
{
auto limits = shader->getLimits();
- ifDepth.setLimit(limits.ifs);
- loopRepDepth.setLimit(limits.loops);
- currentLabel.setLimit(limits.functions);
-
ifFalseBlock.resize(limits.ifs);
loopRepTestBlock.resize(limits.loops);
loopRepEndBlock.resize(limits.loops);
diff --git a/src/Shader/PixelProgram.hpp b/src/Shader/PixelProgram.hpp
index 44b5d21..351e12e 100644
--- a/src/Shader/PixelProgram.hpp
+++ b/src/Shader/PixelProgram.hpp
@@ -134,9 +134,9 @@
void RET();
void LEAVE();
- BoundedIndex ifDepth = 0;
- BoundedIndex loopRepDepth = 0;
- BoundedIndex currentLabel = -1;
+ int ifDepth = 0;
+ int loopRepDepth = 0;
+ int currentLabel = -1;
bool scalar = false;
std::vector<BasicBlock*> ifFalseBlock;
diff --git a/src/Shader/VertexProgram.cpp b/src/Shader/VertexProgram.cpp
index 0463ea6..25c1b0e 100644
--- a/src/Shader/VertexProgram.cpp
+++ b/src/Shader/VertexProgram.cpp
@@ -33,10 +33,6 @@
callStack(shader->getLimits().stack)
{
auto limits = shader->getLimits();
- ifDepth.setLimit(limits.ifs);
- loopRepDepth.setLimit(limits.loops);
- currentLabel.setLimit(limits.functions);
-
ifFalseBlock.resize(limits.ifs);
loopRepTestBlock.resize(limits.loops);
loopRepEndBlock.resize(limits.loops);
diff --git a/src/Shader/VertexProgram.hpp b/src/Shader/VertexProgram.hpp
index 3f794fa..bfccb18 100644
--- a/src/Shader/VertexProgram.hpp
+++ b/src/Shader/VertexProgram.hpp
@@ -124,9 +124,9 @@
Vector4f sampleTexture(const Src &s, Vector4f &uvwq, Float4 &lod, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function);
Vector4f sampleTexture(int sampler, Vector4f &uvwq, Float4 &lod, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function);
- BoundedIndex ifDepth = 0;
- BoundedIndex loopRepDepth = 0;
- BoundedIndex currentLabel = -1;
+ int ifDepth = 0;
+ int loopRepDepth = 0;
+ int currentLabel = -1;
bool scalar = false;
std::vector<BasicBlock*> ifFalseBlock;