13 #define SET_UNIFORM(typeName, valueName) \
14 dispatch_semaphore_wait((dispatch_semaphore_t)shader->lock, DISPATCH_TIME_FOREVER); \
17 for (int i = 0; i < shader->uniformsCount; ++i) \
18 if (strcmp(shader->uniforms[i].name, uniformIdentifier) == 0) \
20 VuoRelease(shader->uniforms[i].type); \
21 shader->uniforms[i].type = VuoText_make(#typeName); \
22 VuoRetain(shader->uniforms[i].type); \
24 shader->uniforms[i].value.valueName = valueName; \
26 dispatch_semaphore_signal((dispatch_semaphore_t)shader->lock); \
32 ++shader->uniformsCount; \
33 shader->uniforms = (VuoShaderUniform *)realloc(shader->uniforms, sizeof(VuoShaderUniform) * shader->uniformsCount); \
37 u.name = VuoText_make(uniformIdentifier); \
40 u.type = VuoText_make(#typeName); \
43 u.value.valueName = valueName; \
45 u.compiledTextureTarget = 0; \
47 shader->uniforms[shader->uniformsCount-1] = u; \
50 dispatch_semaphore_signal((dispatch_semaphore_t)shader->lock);
55 #define SET_UNIFORM_HEAP(typeName, valueName) \
56 dispatch_semaphore_wait((dispatch_semaphore_t)shader->lock, DISPATCH_TIME_FOREVER); \
59 for (int i = 0; i < shader->uniformsCount; ++i) \
60 if (strcmp(shader->uniforms[i].name, uniformIdentifier) == 0) \
62 VuoRelease(shader->uniforms[i].type); \
63 shader->uniforms[i].type = VuoText_make(#typeName); \
64 VuoRetain(shader->uniforms[i].type); \
66 VuoRelease(shader->uniforms[i].value.valueName); \
67 shader->uniforms[i].value.valueName = valueName; \
68 VuoRetain(shader->uniforms[i].value.valueName); \
70 dispatch_semaphore_signal((dispatch_semaphore_t)shader->lock); \
76 ++shader->uniformsCount; \
77 shader->uniforms = (VuoShaderUniform *)realloc(shader->uniforms, sizeof(VuoShaderUniform) * shader->uniformsCount); \
81 u.name = VuoText_make(uniformIdentifier); \
84 u.type = VuoText_make(#typeName); \
87 u.value.valueName = valueName; \
88 VuoRetain(u.value.valueName); \
90 u.compiledTextureTarget = 0; \
92 shader->uniforms[shader->uniformsCount-1] = u; \
95 dispatch_semaphore_signal((dispatch_semaphore_t)shader->lock);
262 for (
size_t i = 0; i < colorCount; ++i)
306 dispatch_semaphore_wait((dispatch_semaphore_t)shader->
lock, DISPATCH_TIME_FOREVER);
308 for (
int i = 0; i < shader->uniformsCount; ++i)
309 if (strcmp(shader->uniforms[i].type,
"VuoImage") == 0
310 && strcmp(shader->uniforms[i].name, uniformIdentifier) == 0)
312 VuoImage image = shader->uniforms[i].value.image;
313 dispatch_semaphore_signal((dispatch_semaphore_t)shader->
lock);
317 dispatch_semaphore_signal((dispatch_semaphore_t)shader->
lock);
327 dispatch_semaphore_wait((dispatch_semaphore_t)shader->
lock, DISPATCH_TIME_FOREVER);
329 for (
int i = 0; i < shader->uniformsCount; ++i)
330 if (strcmp(shader->uniforms[i].type,
"VuoImage") == 0)
332 VuoImage image = shader->uniforms[i].value.image;
333 dispatch_semaphore_signal((dispatch_semaphore_t)shader->
lock);
337 dispatch_semaphore_signal((dispatch_semaphore_t)shader->
lock);