Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions libobs-opengl/gl-shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You didn't add a matrix2x2 parameter handler?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have a struct matrix2 yet, I don't need it and see it as outside of the scope of this pull request.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of matrix2x2 parameters in this pull request, if its not to enable passing a matrix2x2 parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request helps obs-shaderfilter detecting types used so that it can provide better guidance on how to make the shader work for OBS.

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);
Expand Down
2 changes: 2 additions & 0 deletions libobs-opengl/gl-shaderparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions libobs/graphics/effect-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions libobs/graphics/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions libobs/graphics/shader-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down