summaryrefslogtreecommitdiff
path: root/drivers/gles3/rasterizer_storage_gles3.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles3/rasterizer_storage_gles3.h')
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h268
1 files changed, 141 insertions, 127 deletions
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 398ffdeb82..badb656e96 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -46,7 +46,6 @@
// WebGL 2.0 has no MapBufferRange/UnmapBuffer, but offers a non-ES style BufferSubData API instead.
#ifdef __EMSCRIPTEN__
void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
-void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
#endif
class RasterizerCanvasGLES3;
@@ -83,10 +82,12 @@ public:
bool etc2_supported;
bool pvrtc_supported;
- bool hdr_supported;
-
bool srgb_decode_supported;
+ bool texture_float_linear_supported;
+ bool framebuffer_float_supported;
+ bool framebuffer_half_float_supported;
+
bool use_rgba_2d_shadows;
float anisotropic_level;
@@ -102,7 +103,7 @@ public:
bool keep_original_textures;
- bool no_depth_prepass;
+ bool use_depth_prepass;
bool force_vertex_shading;
} config;
@@ -131,6 +132,7 @@ public:
GLuint aniso_tex;
GLuint white_tex_3d;
+ GLuint white_tex_array;
GLuint quadie;
GLuint quadie_array;
@@ -285,29 +287,32 @@ public:
VisualServer::TextureDetectCallback detect_normal;
void *detect_normal_ud;
- Texture() {
-
- using_srgb = false;
- stored_cube_sides = 0;
- ignore_mipmaps = false;
- render_target = NULL;
- flags = width = height = 0;
- tex_id = 0;
- data_size = 0;
- format = Image::FORMAT_L8;
- active = false;
- compressed = false;
- total_data_size = 0;
- target = GL_TEXTURE_2D;
- mipmaps = 0;
- detect_3d = NULL;
- detect_3d_ud = NULL;
- detect_srgb = NULL;
- detect_srgb_ud = NULL;
- detect_normal = NULL;
- detect_normal_ud = NULL;
- proxy = NULL;
- redraw_if_visible = false;
+ Texture() :
+ proxy(NULL),
+ flags(0),
+ width(0),
+ height(0),
+ format(Image::FORMAT_L8),
+ type(VS::TEXTURE_TYPE_2D),
+ target(GL_TEXTURE_2D),
+ data_size(0),
+ compressed(false),
+ srgb(false),
+ total_data_size(0),
+ ignore_mipmaps(false),
+ mipmaps(0),
+ active(false),
+ tex_id(0),
+ using_srgb(false),
+ redraw_if_visible(false),
+ stored_cube_sides(0),
+ render_target(NULL),
+ detect_3d(NULL),
+ detect_3d_ud(NULL),
+ detect_srgb(NULL),
+ detect_srgb_ud(NULL),
+ detect_normal(NULL),
+ detect_normal_ud(NULL) {
}
_ALWAYS_INLINE_ Texture *get_ptr() {
@@ -353,6 +358,7 @@ public:
virtual uint32_t texture_get_height(RID p_texture) const;
virtual uint32_t texture_get_depth(RID p_texture) const;
virtual void texture_set_size_override(RID p_texture, int p_width, int p_height, int p_depth);
+ virtual void texture_bind(RID p_texture, uint32_t p_texture_no);
virtual void texture_set_path(RID p_texture, const String &p_path);
virtual String texture_get_path(RID p_texture) const;
@@ -370,6 +376,8 @@ public:
virtual void texture_set_detect_normal_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata);
virtual void texture_set_proxy(RID p_texture, RID p_proxy);
+ virtual Size2 texture_size_with_proxy(RID p_texture) const;
+
virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable);
/* SKY API */
@@ -553,16 +561,16 @@ public:
bool is_animated_cache;
Material() :
+ shader(NULL),
+ ubo_id(0),
+ ubo_size(0),
list(this),
- dirty_list(this) {
- can_cast_shadow_cache = false;
- is_animated_cache = false;
- shader = NULL;
- line_width = 1.0;
- ubo_id = 0;
- ubo_size = 0;
- last_pass = 0;
- render_priority = 0;
+ dirty_list(this),
+ line_width(1.0),
+ render_priority(0),
+ last_pass(0),
+ can_cast_shadow_cache(false),
+ is_animated_cache(false) {
}
};
@@ -661,27 +669,24 @@ public:
int total_data_size;
- Surface() {
-
- array_byte_size = 0;
- index_array_byte_size = 0;
- mesh = NULL;
- format = 0;
- array_id = 0;
- vertex_id = 0;
- index_id = 0;
- array_len = 0;
+ Surface() :
+ mesh(NULL),
+ format(0),
+ array_id(0),
+ vertex_id(0),
+ index_id(0),
+ index_wireframe_id(0),
+ array_wireframe_id(0),
+ instancing_array_wireframe_id(0),
+ index_wireframe_len(0),
+ array_len(0),
+ index_array_len(0),
+ array_byte_size(0),
+ index_array_byte_size(0),
+ primitive(VS::PRIMITIVE_POINTS),
+ active(false),
+ total_data_size(0) {
type = GEOMETRY_SURFACE;
- primitive = VS::PRIMITIVE_POINTS;
- index_array_len = 0;
- active = false;
-
- total_data_size = 0;
-
- index_wireframe_id = 0;
- array_wireframe_id = 0;
- instancing_array_wireframe_id = 0;
- index_wireframe_len = 0;
}
~Surface() {
@@ -708,11 +713,11 @@ public:
}
}
- Mesh() {
- blend_shape_mode = VS::BLEND_SHAPE_MODE_NORMALIZED;
- blend_shape_count = 0;
- last_pass = 0;
- active = false;
+ Mesh() :
+ active(false),
+ blend_shape_count(0),
+ blend_shape_mode(VS::BLEND_SHAPE_MODE_NORMALIZED),
+ last_pass(0) {
}
};
@@ -780,19 +785,19 @@ public:
bool dirty_data;
MultiMesh() :
+ size(0),
+ transform_format(VS::MULTIMESH_TRANSFORM_2D),
+ color_format(VS::MULTIMESH_COLOR_NONE),
+ custom_data_format(VS::MULTIMESH_CUSTOM_DATA_NONE),
update_list(this),
- mesh_list(this) {
- dirty_aabb = true;
- dirty_data = true;
- xform_floats = 0;
- color_floats = 0;
- custom_data_floats = 0;
- visible_instances = -1;
- size = 0;
- buffer = 0;
- transform_format = VS::MULTIMESH_TRANSFORM_2D;
- color_format = VS::MULTIMESH_COLOR_NONE;
- custom_data_format = VS::MULTIMESH_CUSTOM_DATA_NONE;
+ mesh_list(this),
+ buffer(0),
+ visible_instances(-1),
+ xform_floats(0),
+ color_floats(0),
+ custom_data_floats(0),
+ dirty_aabb(true),
+ dirty_data(true) {
}
};
@@ -887,13 +892,15 @@ public:
SelfList<Skeleton> update_list;
Set<RasterizerScene::InstanceBase *> instances; //instances using skeleton
Transform2D base_transform_2d;
+ bool use_world_transform;
+ Transform world_transform;
Skeleton() :
- update_list(this) {
- size = 0;
-
- use_2d = false;
- texture = 0;
+ use_2d(false),
+ size(0),
+ texture(0),
+ update_list(this),
+ use_world_transform(false) {
}
};
@@ -911,6 +918,7 @@ public:
virtual void skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform);
virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const;
virtual void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform);
+ virtual void skeleton_set_world_transform(RID p_skeleton, bool p_enable, const Transform &p_world_transform);
/* Light API */
@@ -924,6 +932,7 @@ public:
bool shadow;
bool negative;
bool reverse_cull;
+ bool use_gi;
uint32_t cull_mask;
VS::LightOmniShadowMode omni_shadow_mode;
VS::LightOmniShadowDetail omni_shadow_detail;
@@ -945,6 +954,7 @@ public:
virtual void light_set_negative(RID p_light, bool p_enable);
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask);
virtual void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled);
+ virtual void light_set_use_gi(RID p_light, bool p_enabled);
virtual void light_omni_set_shadow_mode(RID p_light, VS::LightOmniShadowMode p_mode);
virtual void light_omni_set_shadow_detail(RID p_light, VS::LightOmniShadowDetail p_detail);
@@ -964,6 +974,7 @@ public:
virtual VS::LightType light_get_type(RID p_light) const;
virtual float light_get_param(RID p_light, VS::LightParam p_param);
virtual Color light_get_color(RID p_light);
+ virtual bool light_get_use_gi(RID p_light);
virtual AABB light_get_aabb(RID p_light) const;
virtual uint64_t light_get_version(RID p_light) const;
@@ -1174,37 +1185,31 @@ public:
Transform emission_transform;
Particles() :
- particle_element(this) {
- cycle_number = 0;
- emitting = false;
- one_shot = false;
- amount = 0;
- lifetime = 1.0;
- pre_process_time = 0.0;
- explosiveness = 0.0;
- randomness = 0.0;
- use_local_coords = true;
- fixed_fps = 0;
- fractional_delta = false;
- frame_remainder = 0;
- histories_enabled = false;
- speed_scale = 1.0;
- random_seed = 0;
-
- restart_request = false;
-
- custom_aabb = AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8));
-
- draw_order = VS::PARTICLES_DRAW_ORDER_INDEX;
+ inactive(true),
+ inactive_time(0.0),
+ emitting(false),
+ one_shot(false),
+ amount(0),
+ lifetime(1.0),
+ pre_process_time(0.0),
+ explosiveness(0.0),
+ randomness(0.0),
+ restart_request(false),
+ custom_aabb(AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8))),
+ use_local_coords(true),
+ draw_order(VS::PARTICLES_DRAW_ORDER_INDEX),
+ histories_enabled(false),
+ particle_element(this),
+ prev_ticks(0),
+ random_seed(0),
+ cycle_number(0),
+ speed_scale(1.0),
+ fixed_fps(0),
+ fractional_delta(false),
+ frame_remainder(0),
+ clear(true) {
particle_buffers[0] = 0;
particle_buffers[1] = 0;
-
- prev_ticks = 0;
-
- clear = true;
- inactive = true;
- inactive_time = 0.0;
-
glGenBuffers(2, particle_buffers);
glGenVertexArrays(2, particle_vaos);
}
@@ -1309,9 +1314,9 @@ public:
GLuint color;
int levels;
- MipMaps() {
- color = 0;
- levels = 0;
+ MipMaps() :
+ color(0),
+ levels(0) {
}
};
@@ -1326,10 +1331,10 @@ public:
Vector<GLuint> depth_mipmap_fbos; //fbos for depth mipmapsla ver
- SSAO() {
+ SSAO() :
+ linear_depth(0) {
blur_fbo[0] = 0;
blur_fbo[1] = 0;
- linear_depth = 0;
}
} ssao;
@@ -1341,9 +1346,19 @@ public:
GLuint fbo;
GLuint color;
- Exposure() { fbo = 0; }
+ Exposure() :
+ fbo(0) {}
} exposure;
+ // External FBO to render our final result to (mostly used for ARVR)
+ struct External {
+ GLuint fbo;
+ RID texture;
+
+ External() :
+ fbo(0) {}
+ } external;
+
uint64_t last_exposure_tick;
int width, height;
@@ -1355,26 +1370,23 @@ public:
RID texture;
- RenderTarget() {
-
- msaa = VS::VIEWPORT_MSAA_DISABLED;
- width = 0;
- height = 0;
- depth = 0;
- fbo = 0;
+ RenderTarget() :
+ fbo(0),
+ depth(0),
+ last_exposure_tick(0),
+ width(0),
+ height(0),
+ used_in_frame(false),
+ msaa(VS::VIEWPORT_MSAA_DISABLED) {
exposure.fbo = 0;
buffers.fbo = 0;
- used_in_frame = false;
-
+ external.fbo = 0;
for (int i = 0; i < RENDER_TARGET_FLAG_MAX; i++) {
flags[i] = false;
}
flags[RENDER_TARGET_HDR] = true;
-
buffers.active = false;
buffers.effects_active = false;
-
- last_exposure_tick = 0;
}
};
@@ -1384,8 +1396,10 @@ public:
void _render_target_allocate(RenderTarget *rt);
virtual RID render_target_create();
+ virtual void render_target_set_position(RID p_render_target, int p_x, int p_y);
virtual void render_target_set_size(RID p_render_target, int p_width, int p_height);
virtual RID render_target_get_texture(RID p_render_target) const;
+ virtual void render_target_set_external_texture(RID p_render_target, unsigned int p_texture_id);
virtual void render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value);
virtual bool render_target_was_used(RID p_render_target);