mirror of
https://github.com/godotengine/godot
synced 2024-09-05 05:58:29 +00:00
Merge duplicate rd_texture functions
This commit is contained in:
parent
c1128e911c
commit
70dca9ff55
|
@ -1136,7 +1136,7 @@ Size2 TextureStorage::texture_size_with_proxy(RID p_texture) {
|
|||
}
|
||||
}
|
||||
|
||||
RID TextureStorage::texture_get_rd_texture_rid(RID p_texture, bool p_srgb) const {
|
||||
RID TextureStorage::texture_get_rd_texture(RID p_texture, bool p_srgb) const {
|
||||
return RID();
|
||||
}
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ public:
|
|||
|
||||
virtual Size2 texture_size_with_proxy(RID p_proxy) override;
|
||||
|
||||
virtual RID texture_get_rd_texture_rid(RID p_texture, bool p_srgb = false) const override;
|
||||
virtual RID texture_get_rd_texture(RID p_texture, bool p_srgb = false) const override;
|
||||
|
||||
void texture_set_data(RID p_texture, const Ref<Image> &p_image, int p_layer = 0);
|
||||
void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, int p_layer = 0);
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
|
||||
virtual Size2 texture_size_with_proxy(RID p_proxy) override { return Size2(); };
|
||||
|
||||
virtual RID texture_get_rd_texture_rid(RID p_texture, bool p_srgb = false) const override { return RID(); };
|
||||
virtual RID texture_get_rd_texture(RID p_texture, bool p_srgb = false) const override { return RID(); };
|
||||
|
||||
/* DECAL API */
|
||||
virtual RID decal_allocate() override { return RID(); }
|
||||
|
|
|
@ -1429,9 +1429,15 @@ Size2 TextureStorage::texture_size_with_proxy(RID p_proxy) {
|
|||
return texture_2d_get_size(p_proxy);
|
||||
}
|
||||
|
||||
RID TextureStorage::texture_get_rd_texture_rid(RID p_texture, bool p_srgb) const {
|
||||
RID TextureStorage::texture_get_rd_texture(RID p_texture, bool p_srgb) const {
|
||||
if (p_texture.is_null()) {
|
||||
return RID();
|
||||
}
|
||||
|
||||
Texture *tex = texture_owner.get_or_null(p_texture);
|
||||
ERR_FAIL_COND_V(!tex, RID());
|
||||
if (!tex) {
|
||||
return RID();
|
||||
}
|
||||
|
||||
return (p_srgb && tex->rd_texture_srgb.is_valid()) ? tex->rd_texture_srgb : tex->rd_texture;
|
||||
}
|
||||
|
|
|
@ -498,7 +498,7 @@ public:
|
|||
|
||||
virtual Size2 texture_size_with_proxy(RID p_proxy) override;
|
||||
|
||||
virtual RID texture_get_rd_texture_rid(RID p_texture, bool p_srgb = false) const override;
|
||||
virtual RID texture_get_rd_texture(RID p_texture, bool p_srgb = false) const override;
|
||||
|
||||
//internal usage
|
||||
_FORCE_INLINE_ TextureType texture_get_type(RID p_texture) {
|
||||
|
@ -519,18 +519,6 @@ public:
|
|||
return tex->layers;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ RID texture_get_rd_texture(RID p_texture, bool p_srgb = false) {
|
||||
if (p_texture.is_null()) {
|
||||
return RID();
|
||||
}
|
||||
RendererRD::TextureStorage::Texture *tex = texture_owner.get_or_null(p_texture);
|
||||
|
||||
if (!tex) {
|
||||
return RID();
|
||||
}
|
||||
return (p_srgb && tex->rd_texture_srgb.is_valid()) ? tex->rd_texture_srgb : tex->rd_texture;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Size2i texture_2d_get_size(RID p_texture) {
|
||||
if (p_texture.is_null()) {
|
||||
return Size2i();
|
||||
|
|
|
@ -213,7 +213,7 @@ public:
|
|||
FUNC1(texture_debug_usage, List<TextureInfo> *)
|
||||
|
||||
FUNC2(texture_set_force_redraw_if_visible, RID, bool)
|
||||
FUNC2RC(RID, texture_get_rd_texture_rid, RID, bool)
|
||||
FUNC2RC(RID, texture_get_rd_texture, RID, bool)
|
||||
|
||||
/* SHADER API */
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
|
||||
virtual Size2 texture_size_with_proxy(RID p_proxy) = 0;
|
||||
|
||||
virtual RID texture_get_rd_texture_rid(RID p_texture, bool p_srgb = false) const = 0;
|
||||
virtual RID texture_get_rd_texture(RID p_texture, bool p_srgb = false) const = 0;
|
||||
|
||||
/* Decal API */
|
||||
virtual RID decal_allocate() = 0;
|
||||
|
|
|
@ -1697,7 +1697,7 @@ void RenderingServer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("texture_get_path", "texture"), &RenderingServer::texture_get_path);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("texture_set_force_redraw_if_visible", "texture", "enable"), &RenderingServer::texture_set_force_redraw_if_visible);
|
||||
ClassDB::bind_method(D_METHOD("texture_get_rd_texture", "texture", "srgb"), &RenderingServer::texture_get_rd_texture_rid, DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("texture_get_rd_texture", "texture", "srgb"), &RenderingServer::texture_get_rd_texture, DEFVAL(false));
|
||||
|
||||
BIND_ENUM_CONSTANT(TEXTURE_LAYERED_2D_ARRAY);
|
||||
BIND_ENUM_CONSTANT(TEXTURE_LAYERED_CUBEMAP);
|
||||
|
|
|
@ -156,7 +156,7 @@ public:
|
|||
|
||||
virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) = 0;
|
||||
|
||||
virtual RID texture_get_rd_texture_rid(RID p_texture, bool p_srgb = false) const = 0;
|
||||
virtual RID texture_get_rd_texture(RID p_texture, bool p_srgb = false) const = 0;
|
||||
|
||||
/* SHADER API */
|
||||
|
||||
|
|
Loading…
Reference in a new issue