[Mesa-dev] [v2 PATCH 5/6] spirv_extensions: add spirv_supported_extensions on gl_constants
Alejandro PiƱeiro
apinheiro at igalia.com
Thu Mar 8 15:00:18 UTC 2018
We can use it to get real values for ARB_spirv_extensions methods.
v2: Rebase update after changes on previous patches.
---
src/mesa/main/mtypes.h | 3 +++
src/mesa/main/spirv_extensions.c | 20 +++++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index e265663dae4..69e17e59e54 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4163,6 +4163,9 @@ struct gl_constants
/** GL_ARB_gl_spirv */
struct spirv_supported_capabilities SpirVCapabilities;
+
+ /** GL_ARB_spirv_extensions */
+ struct spirv_supported_extensions *SpirVExtensions;
};
diff --git a/src/mesa/main/spirv_extensions.c b/src/mesa/main/spirv_extensions.c
index 40a89c133aa..2bb29461fd4 100644
--- a/src/mesa/main/spirv_extensions.c
+++ b/src/mesa/main/spirv_extensions.c
@@ -27,16 +27,34 @@
*/
#include "spirv_extensions.h"
+#include "compiler/spirv/spirv_extensions.h"
GLuint
_mesa_get_spirv_extension_count(struct gl_context *ctx)
{
- return 0;
+ if (ctx->Const.SpirVExtensions == NULL)
+ return 0;
+
+ return ctx->Const.SpirVExtensions->count;
}
const GLubyte *
_mesa_get_enabled_spirv_extension(struct gl_context *ctx,
GLuint index)
{
+ unsigned int n = 0;
+
+ if (ctx->Const.SpirVExtensions == NULL)
+ return (const GLubyte *) 0;
+
+ for (unsigned int i = 0; i < SPV_EXTENSIONS_COUNT; i++) {
+ if (ctx->Const.SpirVExtensions->supported[i]) {
+ if (n == index)
+ return (const GLubyte *) spirv_extensions_to_string(i);
+ else
+ n++;
+ }
+ }
+
return (const GLubyte *) 0;
}
--
2.14.1
More information about the mesa-dev
mailing list