summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/glspirv.c
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-06-10 20:14:44 +0200
committerEduardo Lima Mitev <[email protected]>2017-12-12 08:18:32 +0100
commit74f98ab76f2a21ef511e6bbddaa08ac1748aca2e (patch)
tree9045907c78662e5c420dfa0ffb95e5e2551cb317 /src/mesa/main/glspirv.c
parent46b21b8f9060faafdb838aa94f2aef35de03901a (diff)
mesa/glspirv: Add struct gl_spirv_module
v2: * Make the SPIR-V module struct part of a larger gl_shader_spirv_data struct that will be introduced later, and don't reference it directly in gl_shader. (Eduardo Lima) * Readability improvements (Ian Romanick) Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main/glspirv.c')
-rw-r--r--src/mesa/main/glspirv.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c
index 3989f424241..d4832db549d 100644
--- a/src/mesa/main/glspirv.c
+++ b/src/mesa/main/glspirv.c
@@ -25,6 +25,23 @@
#include "errors.h"
+#include "util/u_atomic.h"
+
+void
+_mesa_spirv_module_reference(struct gl_spirv_module **dest,
+ struct gl_spirv_module *src)
+{
+ struct gl_spirv_module *old = *dest;
+
+ if (old && p_atomic_dec_zero(&old->RefCount))
+ free(old);
+
+ *dest = src;
+
+ if (src)
+ p_atomic_inc(&src->RefCount);
+}
+
void GLAPIENTRY
_mesa_SpecializeShaderARB(GLuint shader,
const GLchar *pEntryPoint,