Fix a corner-case bug in _copy_texscreen in the gles3 renderer

Fixes #17698

(cherry picked from commit ee52d12921)
This commit is contained in:
Bojidar Marinov 2018-05-15 14:35:46 +03:00 committed by Rémi Verschelde
parent 46f091bfcb
commit 761bfb156d
2 changed files with 5 additions and 5 deletions

View File

@ -191,11 +191,11 @@ void RasterizerCanvasGLES3::canvas_end() {
state.using_ninepatch = false; state.using_ninepatch = false;
} }
RasterizerStorageGLES3::Texture *RasterizerCanvasGLES3::_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map) { RasterizerStorageGLES3::Texture *RasterizerCanvasGLES3::_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map, bool p_force) {
RasterizerStorageGLES3::Texture *tex_return = NULL; RasterizerStorageGLES3::Texture *tex_return = NULL;
if (p_texture == state.current_tex) { if (p_texture == state.current_tex && !p_force) {
tex_return = state.current_tex_ptr; tex_return = state.current_tex_ptr;
} else if (p_texture.is_valid()) { } else if (p_texture.is_valid()) {
@ -230,7 +230,7 @@ RasterizerStorageGLES3::Texture *RasterizerCanvasGLES3::_bind_canvas_texture(con
state.current_tex_ptr = NULL; state.current_tex_ptr = NULL;
} }
if (p_normal_map == state.current_normal) { if (p_normal_map == state.current_normal && !p_force) {
//do none //do none
state.canvas_shader.set_uniform(CanvasShaderGLES3::USE_DEFAULT_NORMAL, state.current_normal.is_valid()); state.canvas_shader.set_uniform(CanvasShaderGLES3::USE_DEFAULT_NORMAL, state.current_normal.is_valid());
@ -997,7 +997,7 @@ void RasterizerCanvasGLES3::_copy_texscreen(const Rect2 &p_rect) {
state.using_texture_rect = true; state.using_texture_rect = true;
_set_texture_rect_mode(false); _set_texture_rect_mode(false);
_bind_canvas_texture(state.current_tex, state.current_normal); _bind_canvas_texture(state.current_tex, state.current_normal, true);
glEnable(GL_BLEND); glEnable(GL_BLEND);
} }

View File

@ -120,7 +120,7 @@ public:
virtual void canvas_end(); virtual void canvas_end();
_FORCE_INLINE_ void _set_texture_rect_mode(bool p_enable, bool p_ninepatch = false); _FORCE_INLINE_ void _set_texture_rect_mode(bool p_enable, bool p_ninepatch = false);
_FORCE_INLINE_ RasterizerStorageGLES3::Texture *_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map); _FORCE_INLINE_ RasterizerStorageGLES3::Texture *_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map, bool p_force = false);
_FORCE_INLINE_ void _draw_gui_primitive(int p_points, const Vector2 *p_vertices, const Color *p_colors, const Vector2 *p_uvs); _FORCE_INLINE_ void _draw_gui_primitive(int p_points, const Vector2 *p_vertices, const Color *p_colors, const Vector2 *p_uvs);
_FORCE_INLINE_ void _draw_polygon(const int *p_indices, int p_index_count, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor); _FORCE_INLINE_ void _draw_polygon(const int *p_indices, int p_index_count, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor);