[Piglit] [PATCH V2 1/3] util: add infrastructure to look-up glMemoryBarrier() enums via names
Timothy Arceri
timothy.arceri at collabora.com
Thu Dec 10 14:42:27 PST 2015
V2: make the existing piglit_get_gl_enum_from_name() function handle the
memory barrier enums (Suggested by Jordan).
Cc: Jordan Justen <jordan.l.justen at intel.com>
---
tests/util/gen_dispatch.py | 15 ++++++++++++++-
tests/util/piglit-util-gl.h | 3 +++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/tests/util/gen_dispatch.py b/tests/util/gen_dispatch.py
index 80099ad..708c1f8 100644
--- a/tests/util/gen_dispatch.py
+++ b/tests/util/gen_dispatch.py
@@ -142,8 +142,11 @@ class EnumCode(object):
def emit(cls, out_dir, gl_registry):
assert isinstance(gl_registry, registry.gl.Registry)
enums = cls.get_enums_in_default_namespace(gl_registry)
+ memory_barrier = cls.get_enums_in_memory_barrier_group(gl_registry)
+ combined_enums = list(enums)
+ combined_enums.extend(memory_barrier)
unique_enums = cls.get_unique_enums(enums)
- enums_by_name = cls.get_enums_by_name(enums)
+ enums_by_name = cls.get_enums_by_name(combined_enums)
render_template(
cls.C_TEMPLATE,
out_dir,
@@ -161,6 +164,16 @@ class EnumCode(object):
return enums
@classmethod
+ def get_enums_in_memory_barrier_group(cls, gl_registry):
+ enums = []
+ for enum_group in gl_registry.enum_groups:
+ if enum_group.name == 'MemoryBarrierMask':
+ if enum_group.type == 'bitmask':
+ for enum in enum_group.enums:
+ enums.append(enum)
+ return enums
+
+ @classmethod
def get_unique_enums(cls, enums):
def append_enum_if_new_value(enum_list, enum):
if enum_list[-1].num_value < enum.num_value:
diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h
index 5a8c82b..4ba0aa3 100644
--- a/tests/util/piglit-util-gl.h
+++ b/tests/util/piglit-util-gl.h
@@ -95,6 +95,9 @@ const char *piglit_get_gl_enum_name(GLenum param);
*/
GLenum piglit_get_gl_enum_from_name(const char *name);
+GLenum
+piglit_get_gl_memory_barrier_enum_from_name(const char *name);
+
/**
* \brief Convert a GL primitive type enum value to a string.
*
--
2.4.3
More information about the Piglit
mailing list