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
2 changes: 1 addition & 1 deletion obs-browser-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ void RegisterBrowserSource()
info.id = "browser_source";
info.type = OBS_SOURCE_TYPE_INPUT;
info.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_AUDIO | OBS_SOURCE_CUSTOM_DRAW | OBS_SOURCE_INTERACTION |
OBS_SOURCE_DO_NOT_DUPLICATE | OBS_SOURCE_SRGB;
OBS_SOURCE_DO_NOT_DUPLICATE | OBS_SOURCE_SRGB | OBS_SOURCE_INITIAL_BLEND_METHOD_SRGB_OFF;
info.get_properties = browser_source_get_properties;
info.get_defaults = browser_source_get_defaults;
info.icon_type = OBS_ICON_TYPE_BROWSER;
Expand Down
18 changes: 5 additions & 13 deletions obs-browser-source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,33 +597,25 @@ void BrowserSource::Render()
gs_effect_t *effect = obs_get_base_effect(OBS_EFFECT_DEFAULT);
#endif

bool linear_sample = extra_texture == NULL;
gs_texture_t *draw_texture = texture;
if (!linear_sample && !obs_source_get_texcoords_centered(source)) {
if (extra_texture && !obs_source_get_texcoords_centered(source)) {
gs_copy_texture(extra_texture, texture);
draw_texture = extra_texture;

linear_sample = true;
}

const bool linear_srgb = gs_get_linear_srgb();
const bool previous = gs_framebuffer_srgb_enabled();
gs_enable_framebuffer_srgb(true);
gs_enable_framebuffer_srgb(linear_srgb);

gs_blend_state_push();
gs_blend_function(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA);

gs_eparam_t *const image = gs_effect_get_param_by_name(effect, "image");

const char *tech;
if (linear_sample) {
gs_effect_set_texture_srgb(image, draw_texture);
tech = "Draw";
} else {
gs_effect_set_texture(image, draw_texture);
tech = "DrawSrgbDecompress";
}
gs_effect_set_texture(image, draw_texture);

const uint32_t flip_flag = flip ? GS_FLIP_V : 0;
const char *tech = linear_srgb ? "DrawSrgbDecompressPremultiplied" : "Draw";
while (gs_effect_loop(effect, tech))
gs_draw_sprite(draw_texture, flip_flag, 0, 0);

Expand Down