summaryrefslogtreecommitdiffstats
path: root/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp
diff options
context:
space:
mode:
authorGeorge L. Albany <Megacake1234@gmail.com>2024-11-27 21:15:49 +0000
committerGitHub <noreply@github.com>2024-11-27 21:15:49 +0000
commit85d87116e184e7923b8d6804cab2681b61c62d83 (patch)
tree55ec5bfa061a5c27272b831e697b78ed1b756a70 /servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp
parentb06d20bf39d15ec736d08d4e4fcb32e0c3c1ce1e (diff)
parent721f53fde47c2727d99e3ecccdb789a67df36de0 (diff)
downloadredot-engine-master.tar.gz
Merge pull request #886 from Spartan322/merge/f128f38HEADmaster
Merge commit godotengine/godot@f128f38
Diffstat (limited to 'servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp')
-rw-r--r--servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp
index 19636463e2..d8ea30aa0d 100644
--- a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp
@@ -50,7 +50,7 @@ RenderSceneBuffersRD::~RenderSceneBuffersRD() {
void RenderSceneBuffersRD::_bind_methods() {
ClassDB::bind_method(D_METHOD("has_texture", "context", "name"), &RenderSceneBuffersRD::has_texture);
- ClassDB::bind_method(D_METHOD("create_texture", "context", "name", "data_format", "usage_bits", "texture_samples", "size", "layers", "mipmaps", "unique"), &RenderSceneBuffersRD::create_texture);
+ ClassDB::bind_method(D_METHOD("create_texture", "context", "name", "data_format", "usage_bits", "texture_samples", "size", "layers", "mipmaps", "unique", "discardable"), &RenderSceneBuffersRD::create_texture);
ClassDB::bind_method(D_METHOD("create_texture_from_format", "context", "name", "format", "view", "unique"), &RenderSceneBuffersRD::_create_texture_from_format);
ClassDB::bind_method(D_METHOD("create_texture_view", "context", "name", "view_name", "view"), &RenderSceneBuffersRD::_create_texture_view);
ClassDB::bind_method(D_METHOD("get_texture", "context", "name"), &RenderSceneBuffersRD::get_texture);
@@ -181,8 +181,8 @@ void RenderSceneBuffersRD::configure(const RenderSceneBuffersConfiguration *p_co
texture_samples = RD::TEXTURE_SAMPLES_1;
} else {
texture_samples = msaa_to_samples(msaa_3d);
- create_texture(RB_SCOPE_BUFFERS, RB_TEX_COLOR_MSAA, base_data_format, get_color_usage_bits(false, true, can_be_storage), texture_samples);
- create_texture(RB_SCOPE_BUFFERS, RB_TEX_DEPTH_MSAA, get_depth_format(false, true, can_be_storage), get_depth_usage_bits(false, true, can_be_storage), texture_samples);
+ create_texture(RB_SCOPE_BUFFERS, RB_TEX_COLOR_MSAA, base_data_format, get_color_usage_bits(false, true, can_be_storage), texture_samples, Size2i(), 0, 1, true, true);
+ create_texture(RB_SCOPE_BUFFERS, RB_TEX_DEPTH_MSAA, get_depth_format(false, true, can_be_storage), get_depth_usage_bits(false, true, can_be_storage), texture_samples, Size2i(), 0, 1, true, true);
}
// VRS (note, our vrs object will only be set if VRS is supported)
@@ -244,7 +244,7 @@ bool RenderSceneBuffersRD::has_texture(const StringName &p_context, const String
return named_textures.has(key);
}
-RID RenderSceneBuffersRD::create_texture(const StringName &p_context, const StringName &p_texture_name, const RD::DataFormat p_data_format, const uint32_t p_usage_bits, const RD::TextureSamples p_texture_samples, const Size2i p_size, const uint32_t p_layers, const uint32_t p_mipmaps, bool p_unique) {
+RID RenderSceneBuffersRD::create_texture(const StringName &p_context, const StringName &p_texture_name, const RD::DataFormat p_data_format, const uint32_t p_usage_bits, const RD::TextureSamples p_texture_samples, const Size2i p_size, const uint32_t p_layers, const uint32_t p_mipmaps, bool p_unique, bool p_discardable) {
// Keep some useful data, we use default values when these are 0.
Size2i size = p_size == Size2i(0, 0) ? internal_size : p_size;
uint32_t layers = p_layers == 0 ? view_count : p_layers;
@@ -264,6 +264,7 @@ RID RenderSceneBuffersRD::create_texture(const StringName &p_context, const Stri
tf.mipmaps = mipmaps;
tf.usage_bits = p_usage_bits;
tf.samples = p_texture_samples;
+ tf.is_discardable = p_discardable;
return create_texture_from_format(p_context, p_texture_name, tf, RD::TextureView(), p_unique);
}