提交 bdd7577a 编写于 作者: J jp9000

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.
上级 46feac7f
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册