diff --git a/driver.h b/driver.h index 181b088939..fe15f6ccf2 100644 --- a/driver.h +++ b/driver.h @@ -331,7 +331,6 @@ typedef struct video_overlay_interface // Only used by RGUI atm. typedef struct video_poke_interface { - void (*set_blend)(void *data, bool enable); void (*set_filtering)(void *data, unsigned index, bool smooth); #ifdef HAVE_FBO uintptr_t (*get_current_framebuffer)(void *data); diff --git a/frontend/menu/rmenu.c b/frontend/menu/rmenu.c index cb412cb604..6c70034220 100644 --- a/frontend/menu/rmenu.c +++ b/frontend/menu/rmenu.c @@ -3435,12 +3435,6 @@ bool menu_iterate(void) } else { - if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_DRAW)) - { - if (driver.video_poke->set_blend) - driver.video_poke->set_blend(driver.video_data, true); - } - // draw last frame for loading messages if (driver.video_poke && driver.video_poke->set_texture_enable) { @@ -3582,12 +3576,6 @@ bool menu_iterate(void) device_ptr->ctx_driver->swap_buffers(); - if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_DRAW)) - { - if (driver.video_poke->set_blend) - driver.video_poke->set_blend(driver.video_data, false); - } - if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_INGAME_EXIT) && g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_INGAME)) { diff --git a/gfx/d3d9/d3d9.cpp b/gfx/d3d9/d3d9.cpp index 33788ca119..c2e2f9d903 100644 --- a/gfx/d3d9/d3d9.cpp +++ b/gfx/d3d9/d3d9.cpp @@ -963,18 +963,6 @@ void D3DVideo::resize(unsigned new_width, unsigned new_height) } } -void D3DVideo::set_blend(bool state) -{ - if (state) - { - dev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); - dev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); - dev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); - } - else - dev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); -} - void D3DVideo::set_filtering(unsigned index, bool smooth) { gfx_filter_type filter_type = smooth ? RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST; @@ -1112,7 +1100,9 @@ void D3DVideo::overlay_render(overlay_t &overlay) overlay.vert_buf->Unlock(); // enable alpha - set_blend(true); + dev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); + dev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); + dev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); // set vertex decl for overlay D3DVERTEXELEMENT9 vElems[4] = { @@ -1165,7 +1155,7 @@ void D3DVideo::overlay_render(overlay_t &overlay) } //restore previous state - set_blend(false); + dev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); dev->SetViewport(&final_viewport); } @@ -1399,11 +1389,6 @@ static void d3d9_get_overlay_interface(void *data, const video_overlay_interface } #endif -static void d3d9_set_blend(void *data, bool enable) -{ - reinterpret_cast(data)->set_blend(enable); -} - static void d3d9_set_filtering(void *data, unsigned index, bool smooth) { reinterpret_cast(data)->set_filtering(index, smooth); @@ -1457,7 +1442,6 @@ static void d3d9_set_rgui_texture_enable(void *data, bool state) #endif static const video_poke_interface_t d3d9_poke_interface = { - d3d9_set_blend, d3d9_set_filtering, #ifdef HAVE_FBO d3d9_get_current_framebuffer, diff --git a/gfx/d3d9/d3d9.hpp b/gfx/d3d9/d3d9.hpp index eb161da83d..a724598254 100644 --- a/gfx/d3d9/d3d9.hpp +++ b/gfx/d3d9/d3d9.hpp @@ -71,7 +71,6 @@ class D3DVideo bool set_shader(const std::string &path); void process_shader(); - void set_blend(bool state); void set_filtering(unsigned index, bool smooth); void set_font_rect(font_params_t *params); diff --git a/gfx/gl.c b/gfx/gl.c index 9e9b5ecfcb..1752bd6c69 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -1320,6 +1320,7 @@ static inline void gl_draw_texture(void *data) gl_shader_use_func(gl, 0); gl_shader_set_coords_func(gl, &gl->coords, &gl->mvp_no_rot); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDisable(GL_BLEND); @@ -1805,10 +1806,8 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo return NULL; } -#ifndef RARCH_CONSOLE context_update_window_title_func(true); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -#endif if (!resolve_extensions(gl)) { @@ -2328,17 +2327,6 @@ static void gl_set_aspect_ratio(void *data, unsigned aspectratio_index) gl->should_resize = true; } -static void gl_set_blend(void *data, bool enable) -{ - if (enable) - { - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - } - else - glDisable(GL_BLEND); -} - #if defined(HAVE_RGUI) || defined(HAVE_RMENU) static void gl_set_texture_frame(void *data, const void *frame, bool rgb32, unsigned width, unsigned height, @@ -2413,7 +2401,6 @@ static void gl_show_mouse(void *data, bool state) } static const video_poke_interface_t gl_poke_interface = { - gl_set_blend, gl_set_filtering, #ifdef HAVE_FBO gl_get_current_framebuffer, diff --git a/gfx/thread_wrapper.c b/gfx/thread_wrapper.c index 52c4e2cfde..61f2397c48 100644 --- a/gfx/thread_wrapper.c +++ b/gfx/thread_wrapper.c @@ -41,7 +41,6 @@ enum thread_cmd CMD_OVERLAY_SET_ALPHA, #endif - CMD_POKE_SET_BLEND, CMD_POKE_SET_FILTERING, #ifdef HAVE_FBO CMD_POKE_SET_FBO_STATE, @@ -276,11 +275,6 @@ static void thread_loop(void *data) break; #endif - case CMD_POKE_SET_BLEND: - thr->poke->set_blend(thr->driver_data, thr->cmd_data.b); - thread_reply(thr, CMD_POKE_SET_BLEND); - break; - case CMD_POKE_SET_FILTERING: thr->poke->set_filtering(thr->driver_data, thr->cmd_data.filtering.index, @@ -616,14 +610,6 @@ static void thread_get_overlay_interface(void *data, const video_overlay_interfa } #endif -static void thread_set_blend(void *data, bool enable) -{ - thread_video_t *thr = (thread_video_t*)data; - thr->cmd_data.b = enable; - thread_send_cmd(thr, CMD_POKE_SET_BLEND); - thread_wait_reply(thr, CMD_POKE_SET_BLEND); -} - static void thread_set_filtering(void *data, unsigned index, bool smooth) { thread_video_t *thr = (thread_video_t*)data; @@ -686,7 +672,6 @@ static void thread_apply_state_changes(void *data) } static const video_poke_interface_t thread_poke = { - thread_set_blend, thread_set_filtering, #ifdef HAVE_FBO NULL, diff --git a/xdk/xdk_d3d.cpp b/xdk/xdk_d3d.cpp index 8cdc6fdc94..f48c9d80e3 100644 --- a/xdk/xdk_d3d.cpp +++ b/xdk/xdk_d3d.cpp @@ -741,7 +741,11 @@ static inline void xdk_d3d_draw_texture(void *data) menu_texture->x = 0; menu_texture->y = 0; + d3d->d3d_render_device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); + d3d->d3d_render_device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); + d3d->d3d_render_device->SetRenderState(D3DRS_ALPHABLENDENABLE, true); texture_image_render(menu_texture); + d3d->d3d_render_device->SetRenderState(D3DRS_ALPHABLENDENABLE, false); #endif } #endif @@ -1012,18 +1016,6 @@ static void xdk_d3d_set_aspect_ratio(void *data, unsigned aspectratio_index) static void xdk_d3d_set_filtering(void *data, unsigned index, bool set_smooth) { } -static void xdk_d3d_set_blend(void *data, bool enable) -{ - xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data; - - if(enable) - { - d3d->d3d_render_device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); - d3d->d3d_render_device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); - } - d3d->d3d_render_device->SetRenderState(D3DRS_ALPHABLENDENABLE, enable); -} - static void xdk_d3d_apply_state_changes(void *data) { xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data; @@ -1059,7 +1051,6 @@ static void xdk_d3d_set_osd_msg(void *data, const char *msg, void *userdata) } static const video_poke_interface_t d3d_poke_interface = { - xdk_d3d_set_blend, xdk_d3d_set_filtering, #ifdef HAVE_FBO NULL,