diff --git a/libobs-opengl/gl-shader.c b/libobs-opengl/gl-shader.c index 56eefca6964518..449ef5a2c0d295 100644 --- a/libobs-opengl/gl-shader.c +++ b/libobs-opengl/gl-shader.c @@ -514,6 +514,12 @@ static void program_set_param_data(struct gs_program *program, gl_success("glUniform4fv"); } + } else if (pp->param->type == GS_SHADER_PARAM_MATRIX3X3) { + if (validate_param(pp, sizeof(struct matrix3))) { + glUniformMatrix3fv(pp->obj, 1, false, (float *)array); + gl_success("glUniformMatrix3fv"); + } + } else if (pp->param->type == GS_SHADER_PARAM_MATRIX4X4) { if (validate_param(pp, sizeof(struct matrix4))) { glUniformMatrix4fv(pp->obj, 1, false, (float *)array); diff --git a/libobs-opengl/gl-shaderparser.c b/libobs-opengl/gl-shaderparser.c index 49f48859ba9637..094250616efb23 100644 --- a/libobs-opengl/gl-shaderparser.c +++ b/libobs-opengl/gl-shaderparser.c @@ -77,6 +77,8 @@ static bool gl_write_type_n(struct gl_shader_parser *glsp, const char *type, dstr_cat(&glsp->gl_string, "uvec3"); else if (cmp_type(type, len, "uint4", 5) == 0) dstr_cat(&glsp->gl_string, "uvec4"); + else if (cmp_type(type, len, "float2x2", 8) == 0) + dstr_cat(&glsp->gl_string, "mat2x2"); else if (cmp_type(type, len, "float3x3", 8) == 0) dstr_cat(&glsp->gl_string, "mat3x3"); else if (cmp_type(type, len, "float3x4", 8) == 0) diff --git a/libobs/graphics/effect-parser.c b/libobs/graphics/effect-parser.c index d260f9c676c308..aa4534cf6f8580 100644 --- a/libobs/graphics/effect-parser.c +++ b/libobs/graphics/effect-parser.c @@ -44,6 +44,10 @@ static enum gs_shader_param_type get_effect_param_type(const char *type) return GS_SHADER_PARAM_INT4; else if (astrcmp_n(type, "texture", 7) == 0) return GS_SHADER_PARAM_TEXTURE; + else if (strcmp(type, "float2x2") == 0) + return GS_SHADER_PARAM_MATRIX2X2; + else if (strcmp(type, "float3x3") == 0) + return GS_SHADER_PARAM_MATRIX3X3; else if (strcmp(type, "float4x4") == 0) return GS_SHADER_PARAM_MATRIX4X4; else if (strcmp(type, "bool") == 0) @@ -1372,6 +1376,12 @@ static void debug_param(struct gs_effect_param *param, case GS_SHADER_PARAM_VEC4: snprintf(_debug_type, sizeof(_debug_type), "float4"); break; + case GS_SHADER_PARAM_MATRIX2X2: + snprintf(_debug_type, sizeof(_debug_type), "float2x2"); + break; + case GS_SHADER_PARAM_MATRIX3X3: + snprintf(_debug_type, sizeof(_debug_type), "float3x3"); + break; case GS_SHADER_PARAM_MATRIX4X4: snprintf(_debug_type, sizeof(_debug_type), "float4x4"); break; diff --git a/libobs/graphics/graphics.h b/libobs/graphics/graphics.h index 2237e666215bb8..e003843b2d62d5 100644 --- a/libobs/graphics/graphics.h +++ b/libobs/graphics/graphics.h @@ -319,6 +319,8 @@ enum gs_shader_param_type { GS_SHADER_PARAM_INT4, GS_SHADER_PARAM_MATRIX4X4, GS_SHADER_PARAM_TEXTURE, + GS_SHADER_PARAM_MATRIX2X2, + GS_SHADER_PARAM_MATRIX3X3, }; struct gs_shader_texture { diff --git a/libobs/graphics/shader-parser.c b/libobs/graphics/shader-parser.c index 23d7add641f686..2bca3c07ac9486 100644 --- a/libobs/graphics/shader-parser.c +++ b/libobs/graphics/shader-parser.c @@ -36,6 +36,10 @@ enum gs_shader_param_type get_shader_param_type(const char *type) return GS_SHADER_PARAM_INT4; else if (astrcmp_n(type, "texture", 7) == 0) return GS_SHADER_PARAM_TEXTURE; + else if (strcmp(type, "float2x2") == 0) + return GS_SHADER_PARAM_MATRIX2X2; + else if (strcmp(type, "float3x3") == 0) + return GS_SHADER_PARAM_MATRIX3X3; else if (strcmp(type, "float4x4") == 0) return GS_SHADER_PARAM_MATRIX4X4; else if (strcmp(type, "bool") == 0)