libobs: Expose blending operation types

This commit is contained in:
jw0z96
2021-10-24 16:18:58 +01:00
committed by Jim
parent 257715d31f
commit 33a6d2a5fd
10 changed files with 116 additions and 13 deletions

View File

@@ -1262,6 +1262,17 @@ void device_blend_function_separate(gs_device_t *device,
UNUSED_PARAMETER(device);
}
void device_blend_op(gs_device_t *device, enum gs_blend_op_type op)
{
GLenum gl_blend_op = convert_gs_blend_op_type(op);
glBlendEquation(gl_blend_op);
if (!gl_success("glBlendEquation"))
blog(LOG_ERROR, "device_blend_op (GL) failed");
UNUSED_PARAMETER(device);
}
void device_depth_function(gs_device_t *device, enum gs_depth_test test)
{
GLenum gl_test = convert_gs_depth_test(test);

View File

@@ -294,6 +294,24 @@ static inline GLenum convert_gs_blend_type(enum gs_blend_type type)
return GL_ONE;
}
static inline GLenum convert_gs_blend_op_type(enum gs_blend_op_type type)
{
switch (type) {
case GS_BLEND_OP_ADD:
return GL_FUNC_ADD;
case GS_BLEND_OP_SUBTRACT:
return GL_FUNC_SUBTRACT;
case GS_BLEND_OP_REVERSE_SUBTRACT:
return GL_FUNC_REVERSE_SUBTRACT;
case GS_BLEND_OP_MIN:
return GL_MIN;
case GS_BLEND_OP_MAX:
return GL_MAX;
}
return GL_FUNC_ADD;
}
static inline GLenum convert_shader_type(enum gs_shader_type type)
{
switch (type) {