[Piglit] [PATCH 02/10] sso: Add utility function to select the GLSL version
Ian Romanick
idr at freedesktop.org
Sun Apr 27 14:12:05 PDT 2014
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
.../spec/arb_separate_shader_objects/sso-common.c | 56 ++++++++++++++++++++++
.../spec/arb_separate_shader_objects/sso-common.h | 29 +++++++++++
2 files changed, 85 insertions(+)
create mode 100644 tests/spec/arb_separate_shader_objects/sso-common.c
create mode 100644 tests/spec/arb_separate_shader_objects/sso-common.h
diff --git a/tests/spec/arb_separate_shader_objects/sso-common.c b/tests/spec/arb_separate_shader_objects/sso-common.c
new file mode 100644
index 0000000..fc43ce9
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/sso-common.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * \file sso-common.c
+ * Utility functions used by multiple separate shader objects tests.
+ */
+#include "piglit-util-gl-common.h"
+#include "sso-common.h"
+
+/**
+ * Pick a GLSL version that will work with explicit location layout qualifiers
+ *
+ * Some NVIDIA drivers have issues with layout qualifiers, 'in' keywords, and
+ * 'out' keywords in "lower" GLSL versions. If the driver supports GLSL >=
+ * 1.40, use 1.40. Otherwise, pick the highest version that the driver
+ * supports.
+ *
+ * 1.40 is selected as the maximum version because core-profile contexts
+ * aren't required to support versions earlier than 1.40. Otherwise, 1.30
+ * would also work.
+ */
+unsigned
+pick_a_glsl_version(void)
+{
+ unsigned glsl_version;
+ bool es;
+ int glsl_major;
+ int glsl_minor;
+
+ piglit_get_glsl_version(&es, &glsl_major, &glsl_minor);
+ glsl_version = ((glsl_major * 100) + glsl_minor) >= 140
+ ? 140 : ((glsl_major * 100) + glsl_minor);
+
+ return glsl_version;
+}
diff --git a/tests/spec/arb_separate_shader_objects/sso-common.h b/tests/spec/arb_separate_shader_objects/sso-common.h
new file mode 100644
index 0000000..23e962c
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/sso-common.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef SSO_COMMON_H
+#define SSO_COMMON_H
+
+unsigned pick_a_glsl_version(void);
+
+#endif /* SSO_COMMON_H */
--
1.8.1.4
More information about the Piglit
mailing list