Add PrimitiveMode packed GLenum.
Bug: angleproject:2574
Change-Id: I3d7bd7ca0d69a364a611dc04799ea34906fc4a6c
Reviewed-on: https://chromium-review.googlesource.com/1067114
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/src/common/PackedGLEnums_autogen.cpp b/src/common/PackedGLEnums_autogen.cpp
index d7b7026..c79831a 100644
--- a/src/common/PackedGLEnums_autogen.cpp
+++ b/src/common/PackedGLEnums_autogen.cpp
@@ -552,6 +552,70 @@
}
template <>
+PrimitiveMode FromGLenum<PrimitiveMode>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_POINTS:
+ return PrimitiveMode::Points;
+ case GL_LINES:
+ return PrimitiveMode::Lines;
+ case GL_LINE_LOOP:
+ return PrimitiveMode::LineLoop;
+ case GL_LINE_STRIP:
+ return PrimitiveMode::LineStrip;
+ case GL_TRIANGLES:
+ return PrimitiveMode::Triangles;
+ case GL_TRIANGLE_STRIP:
+ return PrimitiveMode::TriangleStrip;
+ case GL_TRIANGLE_FAN:
+ return PrimitiveMode::TriangleFan;
+ case GL_LINES_ADJACENCY_EXT:
+ return PrimitiveMode::LinesAdjacency;
+ case GL_LINE_STRIP_ADJACENCY_EXT:
+ return PrimitiveMode::LineStripAdjacency;
+ case GL_TRIANGLES_ADJACENCY_EXT:
+ return PrimitiveMode::TrianglesAdjacency;
+ case GL_TRIANGLE_STRIP_ADJACENCY_EXT:
+ return PrimitiveMode::TriangleStripAdjacency;
+ default:
+ return PrimitiveMode::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(PrimitiveMode from)
+{
+ switch (from)
+ {
+ case PrimitiveMode::Points:
+ return GL_POINTS;
+ case PrimitiveMode::Lines:
+ return GL_LINES;
+ case PrimitiveMode::LineLoop:
+ return GL_LINE_LOOP;
+ case PrimitiveMode::LineStrip:
+ return GL_LINE_STRIP;
+ case PrimitiveMode::Triangles:
+ return GL_TRIANGLES;
+ case PrimitiveMode::TriangleStrip:
+ return GL_TRIANGLE_STRIP;
+ case PrimitiveMode::TriangleFan:
+ return GL_TRIANGLE_FAN;
+ case PrimitiveMode::LinesAdjacency:
+ return GL_LINES_ADJACENCY_EXT;
+ case PrimitiveMode::LineStripAdjacency:
+ return GL_LINE_STRIP_ADJACENCY_EXT;
+ case PrimitiveMode::TrianglesAdjacency:
+ return GL_TRIANGLES_ADJACENCY_EXT;
+ case PrimitiveMode::TriangleStripAdjacency:
+ return GL_TRIANGLE_STRIP_ADJACENCY_EXT;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+template <>
QueryType FromGLenum<QueryType>(GLenum from)
{
switch (from)
diff --git a/src/common/PackedGLEnums_autogen.h b/src/common/PackedGLEnums_autogen.h
index ba02a22..1ffe2a7 100644
--- a/src/common/PackedGLEnums_autogen.h
+++ b/src/common/PackedGLEnums_autogen.h
@@ -224,6 +224,28 @@
MatrixType FromGLenum<MatrixType>(GLenum from);
GLenum ToGLenum(MatrixType from);
+enum class PrimitiveMode : uint8_t
+{
+ Points = 0,
+ Lines = 1,
+ LineLoop = 2,
+ LineStrip = 3,
+ Triangles = 4,
+ TriangleStrip = 5,
+ TriangleFan = 6,
+ LinesAdjacency = 7,
+ LineStripAdjacency = 8,
+ TrianglesAdjacency = 9,
+ TriangleStripAdjacency = 10,
+
+ InvalidEnum = 11,
+ EnumCount = 11,
+};
+
+template <>
+PrimitiveMode FromGLenum<PrimitiveMode>(GLenum from);
+GLenum ToGLenum(PrimitiveMode from);
+
enum class QueryType : uint8_t
{
AnySamples = 0,
diff --git a/src/common/packed_gl_enums.json b/src/common/packed_gl_enums.json
index 050d5d1..e385b1a 100644
--- a/src/common/packed_gl_enums.json
+++ b/src/common/packed_gl_enums.json
@@ -199,5 +199,19 @@
"SpotCutoff": "GL_SPOT_CUTOFF",
"SpotDirection": "GL_SPOT_DIRECTION",
"SpotExponent": "GL_SPOT_EXPONENT"
+ },
+ "PrimitiveMode":
+ {
+ "Points": "GL_POINTS",
+ "Lines": "GL_LINES",
+ "LineLoop": "GL_LINE_LOOP",
+ "LineStrip": "GL_LINE_STRIP",
+ "Triangles": "GL_TRIANGLES",
+ "TriangleStrip": "GL_TRIANGLE_STRIP",
+ "TriangleFan": "GL_TRIANGLE_FAN",
+ "LinesAdjacency": "GL_LINES_ADJACENCY_EXT",
+ "LineStripAdjacency": "GL_LINE_STRIP_ADJACENCY_EXT",
+ "TrianglesAdjacency": "GL_TRIANGLES_ADJACENCY_EXT",
+ "TriangleStripAdjacency": "GL_TRIANGLE_STRIP_ADJACENCY_EXT"
}
}
diff --git a/src/common/utilities.cpp b/src/common/utilities.cpp
index 644e46b..460845c 100644
--- a/src/common/utilities.cpp
+++ b/src/common/utilities.cpp
@@ -14,10 +14,10 @@
#include <set>
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
-# include <wrl.h>
-# include <wrl/wrappers/corewrappers.h>
-# include <windows.applicationmodel.core.h>
-# include <windows.graphics.display.h>
+#include <windows.applicationmodel.core.h>
+#include <windows.graphics.display.h>
+#include <wrl.h>
+#include <wrl/wrappers/corewrappers.h>
#endif
namespace
@@ -102,72 +102,72 @@
GLenum VariableComponentType(GLenum type)
{
- switch(type)
+ switch (type)
{
- case GL_BOOL:
- case GL_BOOL_VEC2:
- case GL_BOOL_VEC3:
- case GL_BOOL_VEC4:
- return GL_BOOL;
- case GL_FLOAT:
- case GL_FLOAT_VEC2:
- case GL_FLOAT_VEC3:
- case GL_FLOAT_VEC4:
- case GL_FLOAT_MAT2:
- case GL_FLOAT_MAT3:
- case GL_FLOAT_MAT4:
- case GL_FLOAT_MAT2x3:
- case GL_FLOAT_MAT3x2:
- case GL_FLOAT_MAT2x4:
- case GL_FLOAT_MAT4x2:
- case GL_FLOAT_MAT3x4:
- case GL_FLOAT_MAT4x3:
- return GL_FLOAT;
- case GL_INT:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_2D_RECT_ANGLE:
- case GL_SAMPLER_3D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_EXTERNAL_OES:
- case GL_SAMPLER_2D_MULTISAMPLE:
- case GL_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_INT_VEC2:
- case GL_INT_VEC3:
- case GL_INT_VEC4:
- case GL_IMAGE_2D:
- case GL_INT_IMAGE_2D:
- case GL_UNSIGNED_INT_IMAGE_2D:
- case GL_IMAGE_3D:
- case GL_INT_IMAGE_3D:
- case GL_UNSIGNED_INT_IMAGE_3D:
- case GL_IMAGE_2D_ARRAY:
- case GL_INT_IMAGE_2D_ARRAY:
- case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
- case GL_IMAGE_CUBE:
- case GL_INT_IMAGE_CUBE:
- case GL_UNSIGNED_INT_IMAGE_CUBE:
- case GL_UNSIGNED_INT_ATOMIC_COUNTER:
- return GL_INT;
- case GL_UNSIGNED_INT:
- case GL_UNSIGNED_INT_VEC2:
- case GL_UNSIGNED_INT_VEC3:
- case GL_UNSIGNED_INT_VEC4:
- return GL_UNSIGNED_INT;
- default:
- UNREACHABLE();
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ return GL_BOOL;
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT3x2:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT3x4:
+ case GL_FLOAT_MAT4x3:
+ return GL_FLOAT;
+ case GL_INT:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_2D_RECT_ANGLE:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_IMAGE_2D:
+ case GL_INT_IMAGE_2D:
+ case GL_UNSIGNED_INT_IMAGE_2D:
+ case GL_IMAGE_3D:
+ case GL_INT_IMAGE_3D:
+ case GL_UNSIGNED_INT_IMAGE_3D:
+ case GL_IMAGE_2D_ARRAY:
+ case GL_INT_IMAGE_2D_ARRAY:
+ case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+ case GL_IMAGE_CUBE:
+ case GL_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+ return GL_INT;
+ case GL_UNSIGNED_INT:
+ case GL_UNSIGNED_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC4:
+ return GL_UNSIGNED_INT;
+ default:
+ UNREACHABLE();
}
return GL_NONE;
@@ -175,13 +175,18 @@
size_t VariableComponentSize(GLenum type)
{
- switch(type)
+ switch (type)
{
- case GL_BOOL: return sizeof(GLint);
- case GL_FLOAT: return sizeof(GLfloat);
- case GL_INT: return sizeof(GLint);
- case GL_UNSIGNED_INT: return sizeof(GLuint);
- default: UNREACHABLE();
+ case GL_BOOL:
+ return sizeof(GLint);
+ case GL_FLOAT:
+ return sizeof(GLfloat);
+ case GL_INT:
+ return sizeof(GLint);
+ case GL_UNSIGNED_INT:
+ return sizeof(GLuint);
+ default:
+ UNREACHABLE();
}
return 0;
@@ -202,26 +207,26 @@
{
switch (type)
{
- case GL_FLOAT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- return GL_BOOL;
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_UNSIGNED_INT_VEC2:
- return GL_BOOL_VEC2;
- case GL_FLOAT_VEC3:
- case GL_INT_VEC3:
- case GL_UNSIGNED_INT_VEC3:
- return GL_BOOL_VEC3;
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- case GL_UNSIGNED_INT_VEC4:
- return GL_BOOL_VEC4;
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ return GL_BOOL;
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ return GL_BOOL_VEC2;
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ return GL_BOOL_VEC3;
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ return GL_BOOL_VEC4;
- default:
- UNREACHABLE();
- return GL_NONE;
+ default:
+ UNREACHABLE();
+ return GL_NONE;
}
}
@@ -229,72 +234,72 @@
{
switch (type)
{
- case GL_NONE:
- return 0;
- case GL_BOOL:
- case GL_FLOAT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_BOOL_VEC2:
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_UNSIGNED_INT_VEC2:
- case GL_BOOL_VEC3:
- case GL_FLOAT_VEC3:
- case GL_INT_VEC3:
- case GL_UNSIGNED_INT_VEC3:
- case GL_BOOL_VEC4:
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- case GL_UNSIGNED_INT_VEC4:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_3D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_EXTERNAL_OES:
- case GL_SAMPLER_2D_RECT_ANGLE:
- case GL_SAMPLER_2D_MULTISAMPLE:
- case GL_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_IMAGE_2D:
- case GL_INT_IMAGE_2D:
- case GL_UNSIGNED_INT_IMAGE_2D:
- case GL_IMAGE_2D_ARRAY:
- case GL_INT_IMAGE_2D_ARRAY:
- case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
- case GL_IMAGE_3D:
- case GL_INT_IMAGE_3D:
- case GL_UNSIGNED_INT_IMAGE_3D:
- case GL_IMAGE_CUBE:
- case GL_INT_IMAGE_CUBE:
- case GL_UNSIGNED_INT_IMAGE_CUBE:
- case GL_UNSIGNED_INT_ATOMIC_COUNTER:
- return 1;
- case GL_FLOAT_MAT2:
- case GL_FLOAT_MAT3x2:
- case GL_FLOAT_MAT4x2:
- return 2;
- case GL_FLOAT_MAT3:
- case GL_FLOAT_MAT2x3:
- case GL_FLOAT_MAT4x3:
- return 3;
- case GL_FLOAT_MAT4:
- case GL_FLOAT_MAT2x4:
- case GL_FLOAT_MAT3x4:
- return 4;
- default:
- UNREACHABLE();
+ case GL_NONE:
+ return 0;
+ case GL_BOOL:
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_BOOL_VEC2:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_RECT_ANGLE:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ case GL_IMAGE_2D:
+ case GL_INT_IMAGE_2D:
+ case GL_UNSIGNED_INT_IMAGE_2D:
+ case GL_IMAGE_2D_ARRAY:
+ case GL_INT_IMAGE_2D_ARRAY:
+ case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+ case GL_IMAGE_3D:
+ case GL_INT_IMAGE_3D:
+ case GL_UNSIGNED_INT_IMAGE_3D:
+ case GL_IMAGE_CUBE:
+ case GL_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+ return 1;
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3x2:
+ case GL_FLOAT_MAT4x2:
+ return 2;
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT4x3:
+ return 3;
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT3x4:
+ return 4;
+ default:
+ UNREACHABLE();
}
return 0;
@@ -304,72 +309,72 @@
{
switch (type)
{
- case GL_NONE:
- return 0;
- case GL_BOOL:
- case GL_FLOAT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_3D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_2D_MULTISAMPLE:
- case GL_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_SAMPLER_EXTERNAL_OES:
- case GL_SAMPLER_2D_RECT_ANGLE:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_IMAGE_2D:
- case GL_INT_IMAGE_2D:
- case GL_UNSIGNED_INT_IMAGE_2D:
- case GL_IMAGE_3D:
- case GL_INT_IMAGE_3D:
- case GL_UNSIGNED_INT_IMAGE_3D:
- case GL_IMAGE_2D_ARRAY:
- case GL_INT_IMAGE_2D_ARRAY:
- case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
- case GL_IMAGE_CUBE:
- case GL_INT_IMAGE_CUBE:
- case GL_UNSIGNED_INT_IMAGE_CUBE:
- case GL_UNSIGNED_INT_ATOMIC_COUNTER:
- return 1;
- case GL_BOOL_VEC2:
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_UNSIGNED_INT_VEC2:
- case GL_FLOAT_MAT2:
- case GL_FLOAT_MAT2x3:
- case GL_FLOAT_MAT2x4:
- return 2;
- case GL_BOOL_VEC3:
- case GL_FLOAT_VEC3:
- case GL_INT_VEC3:
- case GL_UNSIGNED_INT_VEC3:
- case GL_FLOAT_MAT3:
- case GL_FLOAT_MAT3x2:
- case GL_FLOAT_MAT3x4:
- return 3;
- case GL_BOOL_VEC4:
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- case GL_UNSIGNED_INT_VEC4:
- case GL_FLOAT_MAT4:
- case GL_FLOAT_MAT4x2:
- case GL_FLOAT_MAT4x3:
- return 4;
- default:
- UNREACHABLE();
+ case GL_NONE:
+ return 0;
+ case GL_BOOL:
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_RECT_ANGLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ case GL_IMAGE_2D:
+ case GL_INT_IMAGE_2D:
+ case GL_UNSIGNED_INT_IMAGE_2D:
+ case GL_IMAGE_3D:
+ case GL_INT_IMAGE_3D:
+ case GL_UNSIGNED_INT_IMAGE_3D:
+ case GL_IMAGE_2D_ARRAY:
+ case GL_INT_IMAGE_2D_ARRAY:
+ case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+ case GL_IMAGE_CUBE:
+ case GL_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+ return 1;
+ case GL_BOOL_VEC2:
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT2x4:
+ return 2;
+ case GL_BOOL_VEC3:
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT3x2:
+ case GL_FLOAT_MAT3x4:
+ return 3;
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT4x3:
+ return 4;
+ default:
+ UNREACHABLE();
}
return 0;
@@ -379,27 +384,27 @@
{
switch (type)
{
- case GL_SAMPLER_2D:
- case GL_SAMPLER_3D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_EXTERNAL_OES:
- case GL_SAMPLER_2D_MULTISAMPLE:
- case GL_SAMPLER_2D_RECT_ANGLE:
- case GL_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- return true;
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_RECT_ANGLE:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ return true;
}
return false;
@@ -451,16 +456,27 @@
switch (type)
{
- case GL_FLOAT_MAT2: return GL_FLOAT_MAT2;
- case GL_FLOAT_MAT3: return GL_FLOAT_MAT3;
- case GL_FLOAT_MAT4: return GL_FLOAT_MAT4;
- case GL_FLOAT_MAT2x3: return GL_FLOAT_MAT3x2;
- case GL_FLOAT_MAT3x2: return GL_FLOAT_MAT2x3;
- case GL_FLOAT_MAT2x4: return GL_FLOAT_MAT4x2;
- case GL_FLOAT_MAT4x2: return GL_FLOAT_MAT2x4;
- case GL_FLOAT_MAT3x4: return GL_FLOAT_MAT4x3;
- case GL_FLOAT_MAT4x3: return GL_FLOAT_MAT3x4;
- default: UNREACHABLE(); return GL_NONE;
+ case GL_FLOAT_MAT2:
+ return GL_FLOAT_MAT2;
+ case GL_FLOAT_MAT3:
+ return GL_FLOAT_MAT3;
+ case GL_FLOAT_MAT4:
+ return GL_FLOAT_MAT4;
+ case GL_FLOAT_MAT2x3:
+ return GL_FLOAT_MAT3x2;
+ case GL_FLOAT_MAT3x2:
+ return GL_FLOAT_MAT2x3;
+ case GL_FLOAT_MAT2x4:
+ return GL_FLOAT_MAT4x2;
+ case GL_FLOAT_MAT4x2:
+ return GL_FLOAT_MAT2x4;
+ case GL_FLOAT_MAT3x4:
+ return GL_FLOAT_MAT4x3;
+ case GL_FLOAT_MAT4x3:
+ return GL_FLOAT_MAT3x4;
+ default:
+ UNREACHABLE();
+ return GL_NONE;
}
}
@@ -485,7 +501,8 @@
{
ASSERT(allocationSize <= bitsSize);
- unsigned int mask = std::numeric_limits<unsigned int>::max() >> (std::numeric_limits<unsigned int>::digits - allocationSize);
+ unsigned int mask = std::numeric_limits<unsigned int>::max() >>
+ (std::numeric_limits<unsigned int>::digits - allocationSize);
for (unsigned int i = 0; i < bitsSize - allocationSize + 1; i++)
{
@@ -542,20 +559,21 @@
}
}
-bool IsTriangleMode(GLenum drawMode)
+bool IsTriangleMode(PrimitiveMode drawMode)
{
switch (drawMode)
{
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- return true;
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- return false;
- default: UNREACHABLE();
+ case PrimitiveMode::Triangles:
+ case PrimitiveMode::TriangleFan:
+ case PrimitiveMode::TriangleStrip:
+ return true;
+ case PrimitiveMode::Points:
+ case PrimitiveMode::Lines:
+ case PrimitiveMode::LineLoop:
+ case PrimitiveMode::LineStrip:
+ return false;
+ default:
+ UNREACHABLE();
}
return false;
@@ -582,90 +600,90 @@
{
switch (type)
{
- // 1. Arrays of mat4 and mat4
- // Non-square matrices of type matCxR consume the same space as a square
- // matrix of type matN where N is the greater of C and R
- case GL_FLOAT_MAT4:
- case GL_FLOAT_MAT2x4:
- case GL_FLOAT_MAT3x4:
- case GL_FLOAT_MAT4x2:
- case GL_FLOAT_MAT4x3:
- return 0;
+ // 1. Arrays of mat4 and mat4
+ // Non-square matrices of type matCxR consume the same space as a square
+ // matrix of type matN where N is the greater of C and R
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT3x4:
+ case GL_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT4x3:
+ return 0;
- // 2. Arrays of mat2 and mat2 (since they occupy full rows)
- case GL_FLOAT_MAT2:
- return 1;
+ // 2. Arrays of mat2 and mat2 (since they occupy full rows)
+ case GL_FLOAT_MAT2:
+ return 1;
- // 3. Arrays of vec4 and vec4
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- case GL_BOOL_VEC4:
- case GL_UNSIGNED_INT_VEC4:
- return 2;
+ // 3. Arrays of vec4 and vec4
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ return 2;
- // 4. Arrays of mat3 and mat3
- case GL_FLOAT_MAT3:
- case GL_FLOAT_MAT2x3:
- case GL_FLOAT_MAT3x2:
- return 3;
+ // 4. Arrays of mat3 and mat3
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT3x2:
+ return 3;
- // 5. Arrays of vec3 and vec3
- case GL_FLOAT_VEC3:
- case GL_INT_VEC3:
- case GL_BOOL_VEC3:
- case GL_UNSIGNED_INT_VEC3:
- return 4;
+ // 5. Arrays of vec3 and vec3
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_BOOL_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ return 4;
- // 6. Arrays of vec2 and vec2
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_BOOL_VEC2:
- case GL_UNSIGNED_INT_VEC2:
- return 5;
+ // 6. Arrays of vec2 and vec2
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_BOOL_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ return 5;
- // 7. Single component types
- case GL_FLOAT:
- case GL_INT:
- case GL_BOOL:
- case GL_UNSIGNED_INT:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_EXTERNAL_OES:
- case GL_SAMPLER_2D_RECT_ANGLE:
- case GL_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_2D_MULTISAMPLE:
- case GL_SAMPLER_3D:
- case GL_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_IMAGE_2D:
- case GL_INT_IMAGE_2D:
- case GL_UNSIGNED_INT_IMAGE_2D:
- case GL_IMAGE_3D:
- case GL_INT_IMAGE_3D:
- case GL_UNSIGNED_INT_IMAGE_3D:
- case GL_IMAGE_2D_ARRAY:
- case GL_INT_IMAGE_2D_ARRAY:
- case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
- case GL_IMAGE_CUBE:
- case GL_INT_IMAGE_CUBE:
- case GL_UNSIGNED_INT_IMAGE_CUBE:
- case GL_UNSIGNED_INT_ATOMIC_COUNTER:
- return 6;
+ // 7. Single component types
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_BOOL:
+ case GL_UNSIGNED_INT:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_RECT_ANGLE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_3D:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_IMAGE_2D:
+ case GL_INT_IMAGE_2D:
+ case GL_UNSIGNED_INT_IMAGE_2D:
+ case GL_IMAGE_3D:
+ case GL_INT_IMAGE_3D:
+ case GL_UNSIGNED_INT_IMAGE_3D:
+ case GL_IMAGE_2D_ARRAY:
+ case GL_INT_IMAGE_2D_ARRAY:
+ case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+ case GL_IMAGE_CUBE:
+ case GL_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+ return 6;
- default:
- UNREACHABLE();
- return 0;
+ default:
+ UNREACHABLE();
+ return 0;
}
}
@@ -980,9 +998,9 @@
#endif
}
-void writeFile(const char* path, const void* content, size_t size)
+void writeFile(const char *path, const void *content, size_t size)
{
- FILE* file = fopen(path, "w");
+ FILE *file = fopen(path, "w");
if (!file)
{
UNREACHABLE();
@@ -992,9 +1010,9 @@
fwrite(content, sizeof(char), size, file);
fclose(file);
}
-#endif // !ANGLE_ENABLE_WINDOWS_STORE
+#endif // !ANGLE_ENABLE_WINDOWS_STORE
-#if defined (ANGLE_PLATFORM_WINDOWS)
+#if defined(ANGLE_PLATFORM_WINDOWS)
// Causes the thread to relinquish the remainder of its time slice to any
// other thread that is ready to run.If there are no other threads ready
diff --git a/src/common/utilities.h b/src/common/utilities.h
index 8fc2848..b162cff 100644
--- a/src/common/utilities.h
+++ b/src/common/utilities.h
@@ -17,6 +17,7 @@
#include <vector>
#include "angle_gl.h"
+#include "common/PackedEnums.h"
#include "common/mathutil.h"
namespace sh
@@ -70,7 +71,7 @@
// Get the primitive restart index value for the given index type.
GLuint GetPrimitiveRestartIndex(GLenum indexType);
-bool IsTriangleMode(GLenum drawMode);
+bool IsTriangleMode(PrimitiveMode drawMode);
bool IsIntegerFormat(GLenum unsizedFormat);
// Returns the product of the sizes in the vector, or 1 if the vector is empty. Doesn't currently
@@ -142,7 +143,7 @@
namespace egl
{
static const EGLenum FirstCubeMapTextureTarget = EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR;
-static const EGLenum LastCubeMapTextureTarget = EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR;
+static const EGLenum LastCubeMapTextureTarget = EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR;
bool IsCubeMapTextureTarget(EGLenum target);
size_t CubeMapTextureTargetToLayerIndex(EGLenum target);
EGLenum LayerIndexToCubeMapTextureTarget(size_t index);
@@ -164,10 +165,10 @@
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
std::string getTempPath();
-void writeFile(const char* path, const void* data, size_t size);
+void writeFile(const char *path, const void *data, size_t size);
#endif
-#if defined (ANGLE_PLATFORM_WINDOWS)
+#if defined(ANGLE_PLATFORM_WINDOWS)
void ScheduleYield();
#endif