Repository navigation
Is it possible to input an array into a .effect file? How does gs_effect_set_val work? #10736
Replies: 1 comment
|
The effect parameter is the entire array; individual elements are not separate effect parameters. Therefore On current libobs, the intended pattern is: gs_eparam_t *points_param =
gs_effect_get_param_by_name(effect, "points");
struct vec2 points[26];
/* fill points */
gs_effect_set_val(points_param, points, sizeof(points));The C array must use OBS's The reported “expected 8” behavior came from the older effect-value path treating the parameter as one |
Uh oh!
There was an error while loading. Please reload this page.
If I have
uniform float2 points[26];, is there any way to initialize these values?points_cpp is a vec2[26] within my c++.
gs_effect_set_val(pointsParam, points_cpp, sizeof(points_cpp));error: Parameter 'points' set to invalid size 208, expected 8
gs_effect_set_vec2(pointsParam, points_cpp)error: gs_shader_set_val (GL): Size of shader param does not match the size of the input
error: effect_setval_inline: invalid param
Maybe I've missed something, but I can't find a way to input an array, so i'm left to mannually input 26 different points. Which seems a little inefficient, especially if I want to iterate over them within the shader...
I've tried to look for examples of working ".effect" shader files, that use arrays, but the best I could finrd was a commented array:
https://github.com/Oncorporation/obs-shaderfilter/blob/master/data/examples/gaussian-blur.effect
Any help would be greatfully appreciated! I relaize there's a high chance I overlooked something completely obvious....
All reactions