Godot Version
4.7.2
Question
How can I access the stencil buffer in a PostProcessShader?
I followed this tutorial for setting up the PostProcessShader: The Compositor — Godot Engine (stable) documentation in English
In that tutorial a part of the code has render_scene_buffers.get_color_layer(view), I tried to see if render_scene_buffers has anything related to the stencil buffer but I can only find functions for retrieving the depth layer, color layer and velocity layer, but nothing about the stencil buffer.
I want to access both the stencil buffer layer and depth layer, I already tried accessing the depth layer but failed with adding the following code:
var depth_image = render_scene_buffers.get_depth_layer(view)
var depth_uniform: RDUniform = RDUniform.new()
depth_uniform.uniform_type = RenderingDevice.UNIFORM_TYPE_IMAGE
depth_uniform.binding = 0
depth_uniform.add_id(depth_image)
var depth_uniform_set = UniformSetCacheRD.get_cache(shader, 1, [ depth_uniform ])
# Run our compute shader.
var compute_list:= rd.compute_list_begin()
rd.compute_list_bind_compute_pipeline(compute_list, pipeline)
rd.compute_list_bind_uniform_set(compute_list, uniform_set, 0)
rd.compute_list_bind_uniform_set(compute_list, depth_uniform_set, 1) # This doesn't really work
^ That code was added to the _render_callback and I also added this to the template_shader:
layout(rgba16f, set = 1, binding = 0) uniform image2D depth_image;
And I feel like I tried every combination with the set and binding parameters, both in the template shader as well as in _render_callback
So basically, how can I access the stencil buffer and the depth layer in a PostProcessShader?