From 431a02459dd850fbd080b922c4ea048371c1b2ed Mon Sep 17 00:00:00 2001 From: John Bradley Date: Fri, 22 May 2015 12:53:36 -0500 Subject: [PATCH] libobs/graphics: Add int vector support to shaders --- libobs-opengl/gl-shaderparser.c | 6 ++++++ libobs/graphics/graphics.h | 3 +++ libobs/graphics/shader-parser.c | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/libobs-opengl/gl-shaderparser.c b/libobs-opengl/gl-shaderparser.c index 7dc505d06..d4bbfe774 100644 --- a/libobs-opengl/gl-shaderparser.c +++ b/libobs-opengl/gl-shaderparser.c @@ -63,6 +63,12 @@ static bool gl_write_type_n(struct gl_shader_parser *glsp, dstr_cat(&glsp->gl_string, "vec3"); else if (cmp_type(type, len, "float4", 6) == 0) dstr_cat(&glsp->gl_string, "vec4"); + else if (cmp_type(type, len, "int2", 4) == 0) + dstr_cat(&glsp->gl_string, "ivec2"); + else if (cmp_type(type, len, "int3", 4) == 0) + dstr_cat(&glsp->gl_string, "ivec3"); + else if (cmp_type(type, len, "int4", 4) == 0) + dstr_cat(&glsp->gl_string, "ivec4"); 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/graphics.h b/libobs/graphics/graphics.h index 8d753d3ad..584d29e5b 100644 --- a/libobs/graphics/graphics.h +++ b/libobs/graphics/graphics.h @@ -284,6 +284,9 @@ enum gs_shader_param_type { GS_SHADER_PARAM_VEC2, GS_SHADER_PARAM_VEC3, GS_SHADER_PARAM_VEC4, + GS_SHADER_PARAM_INT2, + GS_SHADER_PARAM_INT3, + GS_SHADER_PARAM_INT4, GS_SHADER_PARAM_MATRIX4X4, GS_SHADER_PARAM_TEXTURE, }; diff --git a/libobs/graphics/shader-parser.c b/libobs/graphics/shader-parser.c index cfd3fdeb7..2d852bdd2 100644 --- a/libobs/graphics/shader-parser.c +++ b/libobs/graphics/shader-parser.c @@ -28,6 +28,12 @@ enum gs_shader_param_type get_shader_param_type(const char *type) return GS_SHADER_PARAM_VEC3; else if (strcmp(type, "float4") == 0) return GS_SHADER_PARAM_VEC4; + else if (strcmp(type, "int2") == 0) + return GS_SHADER_PARAM_INT2; + else if (strcmp(type, "int3") == 0) + return GS_SHADER_PARAM_INT3; + else if (strcmp(type, "int4") == 0) + return GS_SHADER_PARAM_INT4; else if (astrcmp_n(type, "texture", 7) == 0) return GS_SHADER_PARAM_TEXTURE; else if (strcmp(type, "float4x4") == 0)