]> git.tdb.fi Git - libs/gl.git/commitdiff
Ensure that render targets are writable when clearing
authorMikko Rasa <tdb@tdb.fi>
Mon, 10 Oct 2022 09:25:13 +0000 (12:25 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 10 Oct 2022 09:27:34 +0000 (12:27 +0300)
source/core/pipelinestate.h
source/render/renderer.cpp

index a836c4070b368e4103b80c5ed656cf790d2f15ba..16fd5bc8e0fb3326331088bdf39429f44269d19a 100644 (file)
@@ -120,6 +120,9 @@ public:
        const VertexSetup *get_vertex_setup() const { return vertex_setup; }
        FaceWinding get_front_face() const { return front_face; }
        CullMode get_face_cull() const { return face_cull; }
+       const DepthTest &get_depth_test() const { return depth_test; }
+       const StencilTest &get_stencil_test() const { return stencil_test; }
+       const Blend &get_blend() const { return blend; }
 
 private:
        void check_bound_resources() const;
index b74b0773b2bd88751ffdf0afd1319914cb7be1fc..97c492eb989b9ca17786da013c8338608284218d 100644 (file)
@@ -272,7 +272,12 @@ void Renderer::set_object_lod_bias(unsigned b)
 void Renderer::clear(const ClearValue *values)
 {
        apply_framebuffer();
-       commands.use_pipeline(&get_pipeline_state());
+       PipelineState &ps = get_pipeline_state();
+       if(!ps.get_depth_test().write)
+               ps.set_depth_test(DepthTest());
+       if(!ps.get_blend().write_mask)
+               ps.set_blend(Blend());
+       commands.use_pipeline(&ps);
        commands.clear(values);
 }