libobs: Always have a transparent blank texture available
Allows transitions to be able to return a blank texture to transitions if a transition is transitioning from/to a NULL source.
This commit is contained in:
parent
46feac7f8f
commit
bdd7577a1a
@ -257,6 +257,8 @@ struct obs_core_video {
|
||||
uint32_t base_height;
|
||||
float color_matrix[16];
|
||||
enum obs_scale_type scale_type;
|
||||
|
||||
gs_texture_t *transparent_texture;
|
||||
};
|
||||
|
||||
struct obs_core_audio {
|
||||
|
@ -218,6 +218,8 @@ static bool obs_init_textures(struct obs_video_info *ovi)
|
||||
static int obs_init_graphics(struct obs_video_info *ovi)
|
||||
{
|
||||
struct obs_core_video *video = &obs->video;
|
||||
uint8_t transparent_tex_data[2*2*4] = {0};
|
||||
const uint8_t *transparent_tex = transparent_tex_data;
|
||||
bool success = true;
|
||||
int errorcode;
|
||||
|
||||
@ -278,6 +280,9 @@ static int obs_init_graphics(struct obs_video_info *ovi)
|
||||
NULL);
|
||||
bfree(filename);
|
||||
|
||||
obs->video.transparent_texture = gs_texture_create(2, 2, GS_RGBA, 1,
|
||||
&transparent_tex, 0);
|
||||
|
||||
if (!video->default_effect)
|
||||
success = false;
|
||||
if (gs_get_device_type() == GS_DEVICE_OPENGL) {
|
||||
@ -290,6 +295,8 @@ static int obs_init_graphics(struct obs_video_info *ovi)
|
||||
success = false;
|
||||
if (!video->conversion_effect)
|
||||
success = false;
|
||||
if (!video->transparent_texture)
|
||||
success = false;
|
||||
|
||||
gs_leave_context();
|
||||
return success ? OBS_VIDEO_SUCCESS : OBS_VIDEO_FAIL;
|
||||
@ -432,6 +439,8 @@ static void obs_free_graphics(void)
|
||||
if (video->graphics) {
|
||||
gs_enter_context(video->graphics);
|
||||
|
||||
gs_texture_destroy(video->transparent_texture);
|
||||
|
||||
gs_effect_destroy(video->default_effect);
|
||||
gs_effect_destroy(video->default_rect_effect);
|
||||
gs_effect_destroy(video->opaque_effect);
|
||||
|
Loading…
x
Reference in New Issue
Block a user