summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/libANGLE/ImageIndex.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /gfx/angle/src/libANGLE/ImageIndex.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'gfx/angle/src/libANGLE/ImageIndex.h')
-rwxr-xr-xgfx/angle/src/libANGLE/ImageIndex.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/gfx/angle/src/libANGLE/ImageIndex.h b/gfx/angle/src/libANGLE/ImageIndex.h
new file mode 100755
index 000000000..5961f0cb0
--- /dev/null
+++ b/gfx/angle/src/libANGLE/ImageIndex.h
@@ -0,0 +1,83 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ImageIndex.h: A helper struct for indexing into an Image array
+
+#ifndef LIBANGLE_IMAGE_INDEX_H_
+#define LIBANGLE_IMAGE_INDEX_H_
+
+#include "common/mathutil.h"
+
+#include "angle_gl.h"
+
+namespace gl
+{
+
+class ImageIndexIterator;
+
+struct ImageIndex
+{
+ GLenum type;
+ GLint mipIndex;
+ GLint layerIndex;
+
+ ImageIndex(const ImageIndex &other);
+ ImageIndex &operator=(const ImageIndex &other);
+
+ bool hasLayer() const { return layerIndex != ENTIRE_LEVEL; }
+ bool is3D() const;
+
+ static ImageIndex Make2D(GLint mipIndex);
+ static ImageIndex MakeCube(GLenum target, GLint mipIndex);
+ static ImageIndex Make2DArray(GLint mipIndex, GLint layerIndex);
+ static ImageIndex Make3D(GLint mipIndex, GLint layerIndex = ENTIRE_LEVEL);
+ static ImageIndex MakeGeneric(GLenum target, GLint mipIndex);
+
+ static ImageIndex MakeInvalid();
+
+ static const GLint ENTIRE_LEVEL = static_cast<GLint>(-1);
+
+ bool operator<(const ImageIndex &other) const;
+ bool operator==(const ImageIndex &other) const;
+ bool operator!=(const ImageIndex &other) const;
+
+ private:
+ friend class ImageIndexIterator;
+
+ ImageIndex(GLenum typeIn, GLint mipIndexIn, GLint layerIndexIn);
+};
+
+class ImageIndexIterator
+{
+ public:
+ static ImageIndexIterator Make2D(GLint minMip, GLint maxMip);
+ static ImageIndexIterator MakeCube(GLint minMip, GLint maxMip);
+ static ImageIndexIterator Make3D(GLint minMip, GLint maxMip, GLint minLayer, GLint maxLayer);
+ static ImageIndexIterator Make2DArray(GLint minMip, GLint maxMip, const GLsizei *layerCounts);
+
+ ImageIndex next();
+ ImageIndex current() const;
+ bool hasNext() const;
+
+ private:
+
+ ImageIndexIterator(GLenum type, const Range<GLint> &mipRange,
+ const Range<GLint> &layerRange, const GLsizei *layerCounts);
+
+ GLint maxLayer() const;
+ void done();
+
+ GLenum mType;
+ Range<GLint> mMipRange;
+ Range<GLint> mLayerRange;
+ const GLsizei *mLayerCounts;
+ GLint mCurrentMip;
+ GLint mCurrentLayer;
+};
+
+}
+
+#endif // LIBANGLE_IMAGE_INDEX_H_