Commit 0a608184 by Ben Clayton

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/25016Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent d951f198
...@@ -152,49 +152,6 @@ namespace sw ...@@ -152,49 +152,6 @@ namespace sw
return v; 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>. // 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. // 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. // We cast the address '32' and subtract it again, because null-dereference is undefined behavior.
......
...@@ -34,10 +34,6 @@ namespace sw ...@@ -34,10 +34,6 @@ namespace sw
callStack(shader->getLimits().stack) callStack(shader->getLimits().stack)
{ {
auto limits = shader->getLimits(); auto limits = shader->getLimits();
ifDepth.setLimit(limits.ifs);
loopRepDepth.setLimit(limits.loops);
currentLabel.setLimit(limits.functions);
ifFalseBlock.resize(limits.ifs); ifFalseBlock.resize(limits.ifs);
loopRepTestBlock.resize(limits.loops); loopRepTestBlock.resize(limits.loops);
loopRepEndBlock.resize(limits.loops); loopRepEndBlock.resize(limits.loops);
......
...@@ -134,9 +134,9 @@ namespace sw ...@@ -134,9 +134,9 @@ namespace sw
void RET(); void RET();
void LEAVE(); void LEAVE();
BoundedIndex ifDepth = 0; int ifDepth = 0;
BoundedIndex loopRepDepth = 0; int loopRepDepth = 0;
BoundedIndex currentLabel = -1; int currentLabel = -1;
bool scalar = false; bool scalar = false;
std::vector<BasicBlock*> ifFalseBlock; std::vector<BasicBlock*> ifFalseBlock;
......
...@@ -33,10 +33,6 @@ namespace sw ...@@ -33,10 +33,6 @@ namespace sw
callStack(shader->getLimits().stack) callStack(shader->getLimits().stack)
{ {
auto limits = shader->getLimits(); auto limits = shader->getLimits();
ifDepth.setLimit(limits.ifs);
loopRepDepth.setLimit(limits.loops);
currentLabel.setLimit(limits.functions);
ifFalseBlock.resize(limits.ifs); ifFalseBlock.resize(limits.ifs);
loopRepTestBlock.resize(limits.loops); loopRepTestBlock.resize(limits.loops);
loopRepEndBlock.resize(limits.loops); loopRepEndBlock.resize(limits.loops);
......
...@@ -124,9 +124,9 @@ namespace sw ...@@ -124,9 +124,9 @@ namespace sw
Vector4f sampleTexture(const Src &s, Vector4f &uvwq, Float4 &lod, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function); 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); Vector4f sampleTexture(int sampler, Vector4f &uvwq, Float4 &lod, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function);
BoundedIndex ifDepth = 0; int ifDepth = 0;
BoundedIndex loopRepDepth = 0; int loopRepDepth = 0;
BoundedIndex currentLabel = -1; int currentLabel = -1;
bool scalar = false; bool scalar = false;
std::vector<BasicBlock*> ifFalseBlock; std::vector<BasicBlock*> ifFalseBlock;
......
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