From bcc71049bf84ba77cadd7004445285f123ed2d28 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 10 Dec 2019 18:02:22 +0800 Subject: [PATCH] fix error that depth/stencil buffer is not cleared (#1980) --- native/cocos/renderer/gfx-gles2/GLES2Window.cc | 4 ++-- native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h | 4 ++-- native/cocos/renderer/gfx-gles3/GLES3Window.cc | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/native/cocos/renderer/gfx-gles2/GLES2Window.cc b/native/cocos/renderer/gfx-gles2/GLES2Window.cc index 332d8de3c3..aa12b5427a 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Window.cc +++ b/native/cocos/renderer/gfx-gles2/GLES2Window.cc @@ -38,9 +38,9 @@ bool GLES2Window::Initialize(const GFXWindowInfo &info) { GFXDepthStencilAttachment& depth_stencil_attachment = render_pass_info.depth_stencil_attachment; render_pass_info.depth_stencil_attachment.format = depth_stencil_fmt_; - depth_stencil_attachment.depth_load_op = GFXLoadOp::LOAD; + depth_stencil_attachment.depth_load_op = GFXLoadOp::CLEAR; depth_stencil_attachment.depth_store_op = GFXStoreOp::STORE; - depth_stencil_attachment.stencil_load_op = GFXLoadOp::LOAD; + depth_stencil_attachment.stencil_load_op = GFXLoadOp::CLEAR; depth_stencil_attachment.stencil_store_op = GFXStoreOp::STORE; depth_stencil_attachment.sample_count = 1; depth_stencil_attachment.begin_layout = GFXTextureLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL; diff --git a/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h b/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h index 30dddbf763..3f637692d2 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h +++ b/native/cocos/renderer/gfx-gles3/GLES3GPUObjects.h @@ -158,8 +158,8 @@ class GLES3GPUInputAssembler : public Object { public: GFXAttributeList attribs; GLES3GPUBufferList gpu_vertex_buffers; - GLES3GPUBuffer* gpu_index_buffer; - GLES3GPUBuffer* gpu_indirect_buffer; + GLES3GPUBuffer* gpu_index_buffer = nullptr; + GLES3GPUBuffer* gpu_indirect_buffer = nullptr; GLES3GPUAttributeList gpu_attribs; GLenum gl_index_type; map::type gl_vaos; diff --git a/native/cocos/renderer/gfx-gles3/GLES3Window.cc b/native/cocos/renderer/gfx-gles3/GLES3Window.cc index 8209ef511a..9a5af40998 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Window.cc +++ b/native/cocos/renderer/gfx-gles3/GLES3Window.cc @@ -38,9 +38,9 @@ bool GLES3Window::Initialize(const GFXWindowInfo &info) { GFXDepthStencilAttachment& depth_stencil_attachment = render_pass_info.depth_stencil_attachment; render_pass_info.depth_stencil_attachment.format = depth_stencil_fmt_; - depth_stencil_attachment.depth_load_op = GFXLoadOp::LOAD; + depth_stencil_attachment.depth_load_op = GFXLoadOp::CLEAR; depth_stencil_attachment.depth_store_op = GFXStoreOp::STORE; - depth_stencil_attachment.stencil_load_op = GFXLoadOp::LOAD; + depth_stencil_attachment.stencil_load_op = GFXLoadOp::CLEAR; depth_stencil_attachment.stencil_store_op = GFXStoreOp::STORE; depth_stencil_attachment.sample_count = 1; depth_stencil_attachment.begin_layout = GFXTextureLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL;