summaryrefslogtreecommitdiff
path: root/servers/visual
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-05-04 12:36:51 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-05-04 12:37:07 -0300
commit89d87294dbc84df8dd7740cd04cc4842b8738e96 (patch)
tree62d1015ed08cb12c6e57e6391d4f8cc9f32c355e /servers/visual
parent0fa5154c0af7895b0a5e11ff4899e12cc0cbbdd2 (diff)
ability to shrink all images x2 on load
this is for extreme cases when running on devices with very low video memory, so you can still retain compatibility.
Diffstat (limited to 'servers/visual')
-rw-r--r--servers/visual/rasterizer.h2
-rw-r--r--servers/visual/rasterizer_dummy.h2
-rw-r--r--servers/visual/visual_server_raster.cpp5
-rw-r--r--servers/visual/visual_server_raster.h4
-rw-r--r--servers/visual/visual_server_wrap_mt.h2
5 files changed, 14 insertions, 1 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index e2de20785a..e3d1b14835 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -196,6 +196,8 @@ public:
virtual String texture_get_path(RID p_texture) const=0;
virtual void texture_debug_usage(List<VS::TextureInfo> *r_info)=0;
+ virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable)=0;
+
/* SHADER API */
virtual RID shader_create(VS::ShaderMode p_mode=VS::SHADER_MATERIAL)=0;
diff --git a/servers/visual/rasterizer_dummy.h b/servers/visual/rasterizer_dummy.h
index efa843839a..674c165966 100644
--- a/servers/visual/rasterizer_dummy.h
+++ b/servers/visual/rasterizer_dummy.h
@@ -415,6 +415,8 @@ public:
virtual String texture_get_path(RID p_texture) const { return String(); }
virtual void texture_debug_usage(List<VS::TextureInfo> *r_info) {}
+ virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable) {}
+
/* SHADER API */
virtual RID shader_create(VS::ShaderMode p_mode=VS::SHADER_MATERIAL);
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 1db7971d3b..ad85ecc7c0 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -127,6 +127,11 @@ void VisualServerRaster::texture_debug_usage(List<TextureInfo> *r_info){
rasterizer->texture_debug_usage(r_info);
}
+void VisualServerRaster::texture_set_shrink_all_x2_on_set_data(bool p_enable) {
+
+ rasterizer->texture_set_shrink_all_x2_on_set_data(p_enable);
+}
+
/* SHADER API */
RID VisualServerRaster::shader_create(ShaderMode p_mode) {
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 2b72b0b900..cb9e96e284 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -657,7 +657,7 @@ public:
virtual RID texture_create();
virtual void texture_allocate(RID p_texture,int p_width, int p_height,Image::Format p_format,uint32_t p_flags=TEXTURE_FLAGS_DEFAULT);
- virtual void texture_set_data(RID p_texture,const Image& p_image,CubeMapSide p_cube_side=CUBEMAP_LEFT);
+ virtual void texture_set_data(RID p_texture,const Image& p_image,CubeMapSide p_cube_side=CUBEMAP_LEFT);
virtual Image texture_get_data(RID p_texture,CubeMapSide p_cube_side=CUBEMAP_LEFT) const;
virtual void texture_set_flags(RID p_texture,uint32_t p_flags) ;
virtual uint32_t texture_get_flags(RID p_texture) const;
@@ -673,6 +673,8 @@ public:
virtual void texture_debug_usage(List<TextureInfo> *r_info);
+ virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable);
+
/* SHADER API */
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index b6018f1c25..6a42fcc8a6 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -101,6 +101,8 @@ public:
FUNC2(texture_set_path,RID,const String&);
FUNC1RC(String,texture_get_path,RID);
+ FUNC1(texture_set_shrink_all_x2_on_set_data,bool);
+
virtual void texture_debug_usage(List<TextureInfo> *r_info) {
//pass directly, should lock the server anyway
visual_server->texture_debug_usage(r_info);