diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 66 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_gles2.h | 2 | ||||
-rw-r--r-- | drivers/gles2/shader_gles2.cpp | 4 | ||||
-rw-r--r-- | drivers/gles2/shader_gles2.h | 8 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.h | 2 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 28 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.h | 8 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 52 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.h | 8 | ||||
-rw-r--r-- | drivers/gles3/shader_gles3.cpp | 14 | ||||
-rw-r--r-- | drivers/gles3/shader_gles3.h | 8 | ||||
-rw-r--r-- | drivers/gles3/shaders/canvas.glsl | 4 | ||||
-rw-r--r-- | drivers/unix/dir_access_unix.h | 4 | ||||
-rw-r--r-- | drivers/unix/ip_unix.cpp | 1 | ||||
-rw-r--r-- | drivers/unix/os_unix.h | 2 | ||||
-rw-r--r-- | drivers/unix/packet_peer_udp_posix.cpp | 8 | ||||
-rw-r--r-- | drivers/unix/packet_peer_udp_posix.h | 2 | ||||
-rw-r--r-- | drivers/unix/tcp_server_posix.cpp | 2 | ||||
-rw-r--r-- | drivers/unix/tcp_server_posix.h | 2 | ||||
-rw-r--r-- | drivers/windows/dir_access_windows.h | 4 | ||||
-rw-r--r-- | drivers/windows/file_access_windows.cpp | 4 |
21 files changed, 124 insertions, 109 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 2abdbe9d0a..7ad08ed7d5 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -1600,9 +1600,9 @@ RID RasterizerGLES2::material_create() { return material; } -void RasterizerGLES2::material_set_shader(RID p_material, RID p_shader) { +void RasterizerGLES2::material_set_shader(RID p_shader_material, RID p_shader) { - Material *material = material_owner.get(p_material); + Material *material = material_owner.get(p_shader_material); ERR_FAIL_COND(!material); if (material->shader == p_shader) return; @@ -1610,9 +1610,9 @@ void RasterizerGLES2::material_set_shader(RID p_material, RID p_shader) { material->shader_version = 0; } -RID RasterizerGLES2::material_get_shader(RID p_material) const { +RID RasterizerGLES2::material_get_shader(RID p_shader_material) const { - Material *material = material_owner.get(p_material); + Material *material = material_owner.get(p_shader_material); ERR_FAIL_COND_V(!material, RID()); return material->shader; } @@ -7891,7 +7891,7 @@ void RasterizerGLES2::canvas_draw_rect(const Rect2 &p_rect, int p_flags, const R _rinfo.ci_draw_commands++; } -void RasterizerGLES2::canvas_draw_style_box(const Rect2 &p_rect, const Rect2 &p_src_region, RID p_texture, const float *p_margin, bool p_draw_center, const Color &p_modulate) { +void RasterizerGLES2::canvas_draw_style_box(const Rect2 &p_rect, const Rect2 &p_src_region, RID p_texture, const float *p_margins, bool p_draw_center, const Color &p_modulate) { Color m = p_modulate; m.a *= canvas_opacity; @@ -7907,47 +7907,47 @@ void RasterizerGLES2::canvas_draw_style_box(const Rect2 &p_rect, const Rect2 &p_ region.size.height = texture->height; /* CORNERS */ _draw_textured_quad( // top left - Rect2(p_rect.pos, Size2(p_margin[MARGIN_LEFT], p_margin[MARGIN_TOP])), - Rect2(region.pos, Size2(p_margin[MARGIN_LEFT], p_margin[MARGIN_TOP])), + Rect2(p_rect.pos, Size2(p_margins[MARGIN_LEFT], p_margins[MARGIN_TOP])), + Rect2(region.pos, Size2(p_margins[MARGIN_LEFT], p_margins[MARGIN_TOP])), Size2(texture->width, texture->height)); _draw_textured_quad( // top right - Rect2(Point2(p_rect.pos.x + p_rect.size.width - p_margin[MARGIN_RIGHT], p_rect.pos.y), Size2(p_margin[MARGIN_RIGHT], p_margin[MARGIN_TOP])), - Rect2(Point2(region.pos.x + region.size.width - p_margin[MARGIN_RIGHT], region.pos.y), Size2(p_margin[MARGIN_RIGHT], p_margin[MARGIN_TOP])), + Rect2(Point2(p_rect.pos.x + p_rect.size.width - p_margins[MARGIN_RIGHT], p_rect.pos.y), Size2(p_margins[MARGIN_RIGHT], p_margins[MARGIN_TOP])), + Rect2(Point2(region.pos.x + region.size.width - p_margins[MARGIN_RIGHT], region.pos.y), Size2(p_margins[MARGIN_RIGHT], p_margins[MARGIN_TOP])), Size2(texture->width, texture->height)); _draw_textured_quad( // bottom left - Rect2(Point2(p_rect.pos.x, p_rect.pos.y + p_rect.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_LEFT], p_margin[MARGIN_BOTTOM])), - Rect2(Point2(region.pos.x, region.pos.y + region.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_LEFT], p_margin[MARGIN_BOTTOM])), + Rect2(Point2(p_rect.pos.x, p_rect.pos.y + p_rect.size.height - p_margins[MARGIN_BOTTOM]), Size2(p_margins[MARGIN_LEFT], p_margins[MARGIN_BOTTOM])), + Rect2(Point2(region.pos.x, region.pos.y + region.size.height - p_margins[MARGIN_BOTTOM]), Size2(p_margins[MARGIN_LEFT], p_margins[MARGIN_BOTTOM])), Size2(texture->width, texture->height)); _draw_textured_quad( // bottom right - Rect2(Point2(p_rect.pos.x + p_rect.size.width - p_margin[MARGIN_RIGHT], p_rect.pos.y + p_rect.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_RIGHT], p_margin[MARGIN_BOTTOM])), - Rect2(Point2(region.pos.x + region.size.width - p_margin[MARGIN_RIGHT], region.pos.y + region.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_RIGHT], p_margin[MARGIN_BOTTOM])), + Rect2(Point2(p_rect.pos.x + p_rect.size.width - p_margins[MARGIN_RIGHT], p_rect.pos.y + p_rect.size.height - p_margins[MARGIN_BOTTOM]), Size2(p_margins[MARGIN_RIGHT], p_margins[MARGIN_BOTTOM])), + Rect2(Point2(region.pos.x + region.size.width - p_margins[MARGIN_RIGHT], region.pos.y + region.size.height - p_margins[MARGIN_BOTTOM]), Size2(p_margins[MARGIN_RIGHT], p_margins[MARGIN_BOTTOM])), Size2(texture->width, texture->height)); - Rect2 rect_center(p_rect.pos + Point2(p_margin[MARGIN_LEFT], p_margin[MARGIN_TOP]), Size2(p_rect.size.width - p_margin[MARGIN_LEFT] - p_margin[MARGIN_RIGHT], p_rect.size.height - p_margin[MARGIN_TOP] - p_margin[MARGIN_BOTTOM])); + Rect2 rect_center(p_rect.pos + Point2(p_margins[MARGIN_LEFT], p_margins[MARGIN_TOP]), Size2(p_rect.size.width - p_margins[MARGIN_LEFT] - p_margins[MARGIN_RIGHT], p_rect.size.height - p_margins[MARGIN_TOP] - p_margins[MARGIN_BOTTOM])); - Rect2 src_center(Point2(region.pos.x + p_margin[MARGIN_LEFT], region.pos.y + p_margin[MARGIN_TOP]), Size2(region.size.width - p_margin[MARGIN_LEFT] - p_margin[MARGIN_RIGHT], region.size.height - p_margin[MARGIN_TOP] - p_margin[MARGIN_BOTTOM])); + Rect2 src_center(Point2(region.pos.x + p_margins[MARGIN_LEFT], region.pos.y + p_margins[MARGIN_TOP]), Size2(region.size.width - p_margins[MARGIN_LEFT] - p_margins[MARGIN_RIGHT], region.size.height - p_margins[MARGIN_TOP] - p_margins[MARGIN_BOTTOM])); _draw_textured_quad( // top - Rect2(Point2(rect_center.pos.x, p_rect.pos.y), Size2(rect_center.size.width, p_margin[MARGIN_TOP])), - Rect2(Point2(src_center.pos.x, region.pos.y), Size2(src_center.size.width, p_margin[MARGIN_TOP])), + Rect2(Point2(rect_center.pos.x, p_rect.pos.y), Size2(rect_center.size.width, p_margins[MARGIN_TOP])), + Rect2(Point2(src_center.pos.x, region.pos.y), Size2(src_center.size.width, p_margins[MARGIN_TOP])), Size2(texture->width, texture->height)); _draw_textured_quad( // bottom - Rect2(Point2(rect_center.pos.x, rect_center.pos.y + rect_center.size.height), Size2(rect_center.size.width, p_margin[MARGIN_BOTTOM])), - Rect2(Point2(src_center.pos.x, src_center.pos.y + src_center.size.height), Size2(src_center.size.width, p_margin[MARGIN_BOTTOM])), + Rect2(Point2(rect_center.pos.x, rect_center.pos.y + rect_center.size.height), Size2(rect_center.size.width, p_margins[MARGIN_BOTTOM])), + Rect2(Point2(src_center.pos.x, src_center.pos.y + src_center.size.height), Size2(src_center.size.width, p_margins[MARGIN_BOTTOM])), Size2(texture->width, texture->height)); _draw_textured_quad( // left - Rect2(Point2(p_rect.pos.x, rect_center.pos.y), Size2(p_margin[MARGIN_LEFT], rect_center.size.height)), - Rect2(Point2(region.pos.x, region.pos.y + p_margin[MARGIN_TOP]), Size2(p_margin[MARGIN_LEFT], src_center.size.height)), + Rect2(Point2(p_rect.pos.x, rect_center.pos.y), Size2(p_margins[MARGIN_LEFT], rect_center.size.height)), + Rect2(Point2(region.pos.x, region.pos.y + p_margins[MARGIN_TOP]), Size2(p_margins[MARGIN_LEFT], src_center.size.height)), Size2(texture->width, texture->height)); _draw_textured_quad( // right - Rect2(Point2(rect_center.pos.x + rect_center.size.width, rect_center.pos.y), Size2(p_margin[MARGIN_RIGHT], rect_center.size.height)), - Rect2(Point2(src_center.pos.x + src_center.size.width, region.pos.y + p_margin[MARGIN_TOP]), Size2(p_margin[MARGIN_RIGHT], src_center.size.height)), + Rect2(Point2(rect_center.pos.x + rect_center.size.width, rect_center.pos.y), Size2(p_margins[MARGIN_RIGHT], rect_center.size.height)), + Rect2(Point2(src_center.pos.x + src_center.size.width, region.pos.y + p_margins[MARGIN_TOP]), Size2(p_margins[MARGIN_RIGHT], src_center.size.height)), Size2(texture->width, texture->height)); if (p_draw_center) { @@ -8700,17 +8700,17 @@ void RasterizerGLES2::_canvas_item_render_commands(CanvasItem *p_item, CanvasIte } } -void RasterizerGLES2::_canvas_item_setup_shader_params(ShaderMaterial *material, Shader *shader) { +void RasterizerGLES2::_canvas_item_setup_shader_params(ShaderMaterial *material, Shader *p_shader) { if (canvas_shader.bind()) rebind_texpixel_size = true; - if (material->shader_version != shader->version) { + if (material->shader_version != p_shader->version) { //todo optimize uniforms - material->shader_version = shader->version; + material->shader_version = p_shader->version; } - if (shader->has_texscreen && framebuffer.active) { + if (p_shader->has_texscreen && framebuffer.active) { int x = viewport.x; int y = window_size.height - (viewport.height + viewport.y); @@ -8742,19 +8742,19 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(ShaderMaterial *material, glActiveTexture(GL_TEXTURE0); } - if (shader->has_screen_uv) { + if (p_shader->has_screen_uv) { canvas_shader.set_uniform(CanvasShaderGLES2::SCREEN_UV_MULT, Vector2(1.0 / viewport.width, 1.0 / viewport.height)); } - uses_texpixel_size = shader->uses_texpixel_size; + uses_texpixel_size = p_shader->uses_texpixel_size; } -void RasterizerGLES2::_canvas_item_setup_shader_uniforms(ShaderMaterial *material, Shader *shader) { +void RasterizerGLES2::_canvas_item_setup_shader_uniforms(ShaderMaterial *material, Shader *p_shader) { //this can be optimized.. int tex_id = 1; int idx = 0; - for (Map<StringName, ShaderLanguage::Uniform>::Element *E = shader->uniforms.front(); E; E = E->next()) { + for (Map<StringName, ShaderLanguage::Uniform>::Element *E = p_shader->uniforms.front(); E; E = E->next()) { Map<StringName, Variant>::Element *F = material->shader_param.find(E->key()); @@ -8767,7 +8767,7 @@ void RasterizerGLES2::_canvas_item_setup_shader_uniforms(ShaderMaterial *materia if (!rid.is_valid()) { - Map<StringName, RID>::Element *DT = shader->default_textures.find(E->key()); + Map<StringName, RID>::Element *DT = p_shader->default_textures.find(E->key()); if (DT) { rid = DT->get(); } @@ -8799,7 +8799,7 @@ void RasterizerGLES2::_canvas_item_setup_shader_uniforms(ShaderMaterial *materia glActiveTexture(GL_TEXTURE0); } - if (shader->uses_time) { + if (p_shader->uses_time) { canvas_shader.set_uniform(CanvasShaderGLES2::TIME, Math::fmod(last_time, shader_time_rollback)); draw_next_frame = true; } diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h index e86d3ba298..ca6a0fce26 100644 --- a/drivers/gles2/rasterizer_gles2.h +++ b/drivers/gles2/rasterizer_gles2.h @@ -1524,7 +1524,7 @@ public: virtual void light_directional_set_shadow_param(RID p_light, VS::LightDirectionalShadowParam p_param, float p_value); virtual float light_directional_get_shadow_param(RID p_light, VS::LightDirectionalShadowParam p_param) const; - virtual AABB light_get_aabb(RID p_poly) const; + virtual AABB light_get_aabb(RID p_light) const; virtual RID light_instance_create(RID p_light); virtual void light_instance_set_transform(RID p_light_instance, const Transform &p_transform); diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp index 961bf27a72..8764ae3895 100644 --- a/drivers/gles2/shader_gles2.cpp +++ b/drivers/gles2/shader_gles2.cpp @@ -103,11 +103,11 @@ void ShaderGLES2::bind_uniforms() { uniforms_dirty = false; }; -GLint ShaderGLES2::get_uniform_location(int p_idx) const { +GLint ShaderGLES2::get_uniform_location(int p_index) const { ERR_FAIL_COND_V(!version, -1); - return version->uniform_location[p_idx]; + return version->uniform_location[p_index]; }; bool ShaderGLES2::bind() { diff --git a/drivers/gles2/shader_gles2.h b/drivers/gles2/shader_gles2.h index 69a66b8ab7..32b979807d 100644 --- a/drivers/gles2/shader_gles2.h +++ b/drivers/gles2/shader_gles2.h @@ -281,7 +281,7 @@ public: }; GLint get_uniform_location(const String &p_name) const; - GLint get_uniform_location(int p_uniform) const; + GLint get_uniform_location(int p_index) const; static _FORCE_INLINE_ ShaderGLES2 *get_active() { return active; }; bool bind(); @@ -293,9 +293,9 @@ public: void clear_caches(); uint32_t create_custom_shader(); - void set_custom_shader_code(uint32_t p_id, const String &p_vertex, const String &p_vertex_globals, const String &p_fragment, const String &p_p_light, const String &p_fragment_globals, const Vector<StringName> &p_uniforms, const Vector<const char *> &p_custom_defines); - void set_custom_shader(uint32_t p_id); - void free_custom_shader(uint32_t p_id); + void set_custom_shader_code(uint32_t p_code_id, const String &p_vertex, const String &p_vertex_globals, const String &p_fragment, const String &p_light, const String &p_fragment_globals, const Vector<StringName> &p_uniforms, const Vector<const char *> &p_custom_defines); + void set_custom_shader(uint32_t p_code_id); + void free_custom_shader(uint32_t p_code_id); void set_uniform_default(int p_idx, const Variant &p_value) { diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h index 26003f543f..29f889cc88 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.h +++ b/drivers/gles3/rasterizer_canvas_gles3.h @@ -42,6 +42,7 @@ public: float projection_matrix[16]; float time; + uint8_t padding[12]; }; RasterizerSceneGLES3 *scene_render; @@ -102,6 +103,7 @@ public: float light_height; float light_outside_alpha; float shadow_distance_mult; + uint8_t padding[4]; } ubo_data; GLuint ubo; diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 30a77c4b39..30c0d65ff3 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2180,38 +2180,38 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo } } -void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *m, bool p_shadow) { +void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_shadow) { - bool has_base_alpha = (m->shader->spatial.uses_alpha && !m->shader->spatial.uses_alpha_scissor) || m->shader->spatial.uses_screen_texture || m->shader->spatial.unshaded; - bool has_blend_alpha = m->shader->spatial.blend_mode != RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX || m->shader->spatial.ontop; + bool has_base_alpha = (p_material->shader->spatial.uses_alpha && !p_material->shader->spatial.uses_alpha_scissor) || p_material->shader->spatial.uses_screen_texture || p_material->shader->spatial.unshaded; + bool has_blend_alpha = p_material->shader->spatial.blend_mode != RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX || p_material->shader->spatial.ontop; bool has_alpha = has_base_alpha || has_blend_alpha; bool shadow = false; bool mirror = p_instance->mirror; - if (m->shader->spatial.cull_mode == RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_FRONT) { + if (p_material->shader->spatial.cull_mode == RasterizerStorageGLES3::Shader::Spatial::CULL_MODE_FRONT) { mirror = !mirror; } - if (m->shader->spatial.uses_sss) { + if (p_material->shader->spatial.uses_sss) { state.used_sss = true; } - if (m->shader->spatial.uses_screen_texture) { + if (p_material->shader->spatial.uses_screen_texture) { state.used_screen_texture = true; } if (p_shadow) { - if (has_blend_alpha || (has_base_alpha && m->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS)) + if (has_blend_alpha || (has_base_alpha && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS)) return; //bye - if (!m->shader->spatial.uses_alpha_scissor && !m->shader->spatial.writes_modelview_or_projection && !m->shader->spatial.uses_vertex && !m->shader->spatial.uses_discard && m->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { + if (!p_material->shader->spatial.uses_alpha_scissor && !p_material->shader->spatial.writes_modelview_or_projection && !p_material->shader->spatial.uses_vertex && !p_material->shader->spatial.uses_discard && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { //shader does not use discard and does not write a vertex position, use generic material if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) - m = storage->material_owner.getptr(default_material_twosided); + p_material = storage->material_owner.getptr(default_material_twosided); else - m = storage->material_owner.getptr(default_material); + p_material = storage->material_owner.getptr(default_material); } has_alpha = false; @@ -2223,7 +2223,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G return; e->geometry = p_geometry; - e->material = m; + e->material = p_material; e->instance = p_instance; e->owner = p_owner; e->sort_key = 0; @@ -2250,7 +2250,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G e->sort_key |= uint64_t(e->material->index) << RenderList::SORT_KEY_MATERIAL_INDEX_SHIFT; e->sort_key |= uint64_t(e->instance->depth_layer) << RenderList::SORT_KEY_DEPTH_LAYER_SHIFT; - if (!has_blend_alpha && has_alpha && m->shader->spatial.depth_draw_mode == RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { + if (!has_blend_alpha && has_alpha && p_material->shader->spatial.depth_draw_mode == RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { //if nothing exists, add this element as opaque too RenderList::Element *oe = render_list.add_element(); @@ -2277,12 +2277,12 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G //e->light_type=0xFF; // no lights! - if (shadow || m->shader->spatial.unshaded || state.debug_draw == VS::VIEWPORT_DEBUG_DRAW_UNSHADED) { + if (shadow || p_material->shader->spatial.unshaded || state.debug_draw == VS::VIEWPORT_DEBUG_DRAW_UNSHADED) { e->sort_key |= SORT_KEY_UNSHADED_FLAG; } - if (!shadow && (m->shader->spatial.uses_vertex_lighting || storage->config.force_vertex_shading)) { + if (!shadow && (p_material->shader->spatial.uses_vertex_lighting || storage->config.force_vertex_shading)) { e->sort_key |= SORT_KEY_VERTEX_LIT_FLAG; } diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index f6509e0041..e1d96f23dd 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -141,6 +141,7 @@ public: float fog_height_min; float fog_height_max; float fog_height_curve; + uint8_t padding[8]; } ubo_data; @@ -150,6 +151,7 @@ public: float transform[16]; float ambient_contribution; + uint8_t padding[12]; } env_radiance_data; @@ -521,8 +523,8 @@ public: virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer); virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0); - virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality); - virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, VS::EnvironmentDOFBlurQuality p_quality); + virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality); + virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality); virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, VS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, bool p_bicubic_upscale); virtual void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture); @@ -793,7 +795,7 @@ public: void _draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_scale, float p_energy); void _setup_environment(Environment *env, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform); - void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transformm, bool p_use_shadows); + void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transform, bool p_use_shadows); void _setup_lights(RID *p_light_cull_result, int p_light_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix &p_camera_projection, RID p_shadow_atlas); void _setup_reflections(RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix &p_camera_projection, RID p_reflection_atlas, Environment *p_env); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index a8e4bc0d4b..ea6ac569f0 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -5468,58 +5468,58 @@ RID RasterizerStorageGLES3::particles_get_draw_pass_mesh(RID p_particles, int p_ return particles->draw_passes[p_pass]; } -void RasterizerStorageGLES3::_particles_process(Particles *particles, float p_delta) { +void RasterizerStorageGLES3::_particles_process(Particles *p_particles, float p_delta) { - float new_phase = Math::fmod((float)particles->phase + (p_delta / particles->lifetime) * particles->speed_scale, (float)1.0); + float new_phase = Math::fmod((float)p_particles->phase + (p_delta / p_particles->lifetime) * p_particles->speed_scale, (float)1.0); - if (particles->clear) { - particles->cycle_number = 0; - particles->random_seed = Math::rand(); - } else if (new_phase < particles->phase) { - if (particles->one_shot) { - particles->emitting = false; + if (p_particles->clear) { + p_particles->cycle_number = 0; + p_particles->random_seed = Math::rand(); + } else if (new_phase < p_particles->phase) { + if (p_particles->one_shot) { + p_particles->emitting = false; shaders.particles.set_uniform(ParticlesShaderGLES3::EMITTING, false); } - particles->cycle_number++; + p_particles->cycle_number++; } shaders.particles.set_uniform(ParticlesShaderGLES3::SYSTEM_PHASE, new_phase); - shaders.particles.set_uniform(ParticlesShaderGLES3::PREV_SYSTEM_PHASE, particles->phase); - particles->phase = new_phase; + shaders.particles.set_uniform(ParticlesShaderGLES3::PREV_SYSTEM_PHASE, p_particles->phase); + p_particles->phase = new_phase; - shaders.particles.set_uniform(ParticlesShaderGLES3::DELTA, p_delta * particles->speed_scale); - shaders.particles.set_uniform(ParticlesShaderGLES3::CLEAR, particles->clear); - glUniform1ui(shaders.particles.get_uniform_location(ParticlesShaderGLES3::RANDOM_SEED), particles->random_seed); + shaders.particles.set_uniform(ParticlesShaderGLES3::DELTA, p_delta * p_particles->speed_scale); + shaders.particles.set_uniform(ParticlesShaderGLES3::CLEAR, p_particles->clear); + glUniform1ui(shaders.particles.get_uniform_location(ParticlesShaderGLES3::RANDOM_SEED), p_particles->random_seed); - if (particles->use_local_coords) + if (p_particles->use_local_coords) shaders.particles.set_uniform(ParticlesShaderGLES3::EMISSION_TRANSFORM, Transform()); else - shaders.particles.set_uniform(ParticlesShaderGLES3::EMISSION_TRANSFORM, particles->emission_transform); + shaders.particles.set_uniform(ParticlesShaderGLES3::EMISSION_TRANSFORM, p_particles->emission_transform); - glUniform1ui(shaders.particles.get_uniform(ParticlesShaderGLES3::CYCLE), particles->cycle_number); + glUniform1ui(shaders.particles.get_uniform(ParticlesShaderGLES3::CYCLE), p_particles->cycle_number); - particles->clear = false; + p_particles->clear = false; - glBindVertexArray(particles->particle_vaos[0]); + glBindVertexArray(p_particles->particle_vaos[0]); - glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, particles->particle_buffers[1]); + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, p_particles->particle_buffers[1]); // GLint size = 0; // glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size); glBeginTransformFeedback(GL_POINTS); - glDrawArrays(GL_POINTS, 0, particles->amount); + glDrawArrays(GL_POINTS, 0, p_particles->amount); glEndTransformFeedback(); - SWAP(particles->particle_buffers[0], particles->particle_buffers[1]); - SWAP(particles->particle_vaos[0], particles->particle_vaos[1]); + SWAP(p_particles->particle_buffers[0], p_particles->particle_buffers[1]); + SWAP(p_particles->particle_vaos[0], p_particles->particle_vaos[1]); glBindVertexArray(0); /* //debug particles :D - glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffers[0]); + glBindBuffer(GL_ARRAY_BUFFER, p_particles->particle_buffers[0]); - float *data = (float *)glMapBufferRange(GL_ARRAY_BUFFER, 0, particles->amount * 16 * 6, GL_MAP_READ_BIT); - for (int i = 0; i < particles->amount; i++) { + float *data = (float *)glMapBufferRange(GL_ARRAY_BUFFER, 0, p_particles->amount * 16 * 6, GL_MAP_READ_BIT); + for (int i = 0; i < p_particles->amount; i++) { int ofs = i * 24; print_line(itos(i) + ":"); print_line("\tColor: " + Color(data[ofs + 0], data[ofs + 1], data[ofs + 2], data[ofs + 3])); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 5a272f43fb..3c7ea000ba 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -314,7 +314,7 @@ public: mutable RID_Owner<Texture> texture_owner; - Ref<Image> _get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, uint32_t p_flags, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_type, bool &r_compressed, bool &srgb); + Ref<Image> _get_gl_image_and_format(const Ref<Image> &p_image, Image::Format p_format, uint32_t p_flags, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_gl_type, bool &r_compressed, bool &srgb); 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 = VS::TEXTURE_FLAGS_DEFAULT); @@ -528,8 +528,8 @@ public: mutable SelfList<Material>::List _material_dirty_list; void _material_make_dirty(Material *p_material) const; - void _material_add_geometry(RID p_material, Geometry *p_instantiable); - void _material_remove_geometry(RID p_material, Geometry *p_instantiable); + void _material_add_geometry(RID p_material, Geometry *p_geometry); + void _material_remove_geometry(RID p_material, Geometry *p_geometry); mutable RID_Owner<Material> material_owner; @@ -1168,7 +1168,7 @@ public: virtual void particles_set_draw_order(RID p_particles, VS::ParticlesDrawOrder p_order); - virtual void particles_set_draw_passes(RID p_particles, int p_count); + virtual void particles_set_draw_passes(RID p_particles, int p_passes); virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh); virtual void particles_request_process(RID p_particles); diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index f1077e2d20..20956ad644 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -102,11 +102,11 @@ void ShaderGLES3::bind_uniforms() { uniforms_dirty = false; } -GLint ShaderGLES3::get_uniform_location(int p_idx) const { +GLint ShaderGLES3::get_uniform_location(int p_index) const { ERR_FAIL_COND_V(!version, -1); - return version->uniform_location[p_idx]; + return version->uniform_location[p_index]; } bool ShaderGLES3::bind() { @@ -273,6 +273,11 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() { //vertex precision is high strings.push_back("precision highp float;\n"); strings.push_back("precision highp int;\n"); +#ifndef GLES_OVER_GL + strings.push_back("precision highp sampler2D;\n"); + strings.push_back("precision highp samplerCube;\n"); + strings.push_back("precision highp sampler2DArray;\n"); +#endif #if 0 if (cc) { @@ -371,6 +376,11 @@ ShaderGLES3::Version *ShaderGLES3::get_current_version() { //fragment precision is medium strings.push_back("precision highp float;\n"); strings.push_back("precision highp int;\n"); +#ifndef GLES_OVER_GL + strings.push_back("precision highp sampler2D;\n"); + strings.push_back("precision highp samplerCube;\n"); + strings.push_back("precision highp sampler2DArray;\n"); +#endif #if 0 if (cc) { diff --git a/drivers/gles3/shader_gles3.h b/drivers/gles3/shader_gles3.h index 5a34010a98..6a399a74cc 100644 --- a/drivers/gles3/shader_gles3.h +++ b/drivers/gles3/shader_gles3.h @@ -306,7 +306,7 @@ public: }; GLint get_uniform_location(const String &p_name) const; - GLint get_uniform_location(int p_uniform) const; + GLint get_uniform_location(int p_index) const; static _FORCE_INLINE_ ShaderGLES3 *get_active() { return active; }; bool bind(); @@ -318,9 +318,9 @@ public: void clear_caches(); uint32_t create_custom_shader(); - void set_custom_shader_code(uint32_t p_id, const String &p_vertex, const String &p_vertex_globals, const String &p_fragment, const String &p_p_light, const String &p_fragment_globals, const String &p_uniforms, const Vector<StringName> &p_texture_uniforms, const Vector<CharString> &p_custom_defines); - void set_custom_shader(uint32_t p_id); - void free_custom_shader(uint32_t p_id); + void set_custom_shader_code(uint32_t p_code_id, const String &p_vertex, const String &p_vertex_globals, const String &p_fragment, const String &p_light, const String &p_fragment_globals, const String &p_uniforms, const Vector<StringName> &p_texture_uniforms, const Vector<CharString> &p_custom_defines); + void set_custom_shader(uint32_t p_code_id); + void free_custom_shader(uint32_t p_code_id); void set_uniform_default(int p_idx, const Variant &p_value) { diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index 1c950c82d9..f0dc14c35a 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -532,11 +532,11 @@ FRAGMENT_SHADER_CODE #ifdef USE_RGBA_SHADOWS -#define SHADOW_DEPTH(m_tex,m_uv) dot(texture2D((m_tex),(m_uv)),vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1) ) +#define SHADOW_DEPTH(m_tex,m_uv) dot(texture((m_tex),(m_uv)),vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1) ) #else -#define SHADOW_DEPTH(m_tex,m_uv) (texture2D((m_tex),(m_uv)).r) +#define SHADOW_DEPTH(m_tex,m_uv) (texture((m_tex),(m_uv)).r) #endif diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h index 5a35cdf2e9..e4b294a802 100644 --- a/drivers/unix/dir_access_unix.h +++ b/drivers/unix/dir_access_unix.h @@ -75,8 +75,8 @@ public: virtual uint64_t get_modified_time(String p_file); - virtual Error rename(String p_from, String p_to); - virtual Error remove(String p_name); + virtual Error rename(String p_path, String p_new_path); + virtual Error remove(String p_path); virtual size_t get_space_left(); diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp index 30d2377a04..f55b75c1d9 100644 --- a/drivers/unix/ip_unix.cpp +++ b/drivers/unix/ip_unix.cpp @@ -100,6 +100,7 @@ IP_Address IP_Unix::_resolve_hostname(const String &p_hostname, Type p_type) { hints.ai_family = AF_UNSPEC; hints.ai_flags = AI_ADDRCONFIG; }; + hints.ai_flags &= !AI_NUMERICHOST; int s = getaddrinfo(p_hostname.utf8().get_data(), NULL, &hints, &result); if (s != 0) { diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index 6cd0016bb0..115bdc2d65 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -69,7 +69,7 @@ public: virtual void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type = ERR_ERROR); virtual void print(const char *p_format, ...); - virtual void vprint(const char *p_format, va_list p_list, bool p_stderr = false); + virtual void vprint(const char *p_format, va_list p_list, bool p_stder = false); virtual void alert(const String &p_alert, const String &p_title = "ALERT!"); virtual String get_stdin_string(bool p_block); diff --git a/drivers/unix/packet_peer_udp_posix.cpp b/drivers/unix/packet_peer_udp_posix.cpp index 74ceb3946a..b21990a866 100644 --- a/drivers/unix/packet_peer_udp_posix.cpp +++ b/drivers/unix/packet_peer_udp_posix.cpp @@ -127,7 +127,7 @@ int PacketPeerUDPPosix::get_max_packet_size() const { return 512; // uhm maybe not } -Error PacketPeerUDPPosix::listen(int p_port, IP_Address p_bind_address, int p_recv_buffer_size) { +Error PacketPeerUDPPosix::listen(int p_port, const IP_Address &p_bind_address, int p_recv_buffer_size) { ERR_FAIL_COND_V(sockfd != -1, ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER); @@ -172,13 +172,13 @@ Error PacketPeerUDPPosix::wait() { return _poll(true); } -Error PacketPeerUDPPosix::_poll(bool p_wait) { +Error PacketPeerUDPPosix::_poll(bool p_block) { if (sockfd == -1) { return FAILED; } - _set_sock_blocking(p_wait); + _set_sock_blocking(p_block); struct sockaddr_storage from = { 0 }; socklen_t len = sizeof(struct sockaddr_storage); @@ -216,7 +216,7 @@ Error PacketPeerUDPPosix::_poll(bool p_wait) { len = sizeof(struct sockaddr_storage); ++queue_count; - if (p_wait) + if (p_block) break; }; diff --git a/drivers/unix/packet_peer_udp_posix.h b/drivers/unix/packet_peer_udp_posix.h index a52b8b8e95..d8b08818b0 100644 --- a/drivers/unix/packet_peer_udp_posix.h +++ b/drivers/unix/packet_peer_udp_posix.h @@ -67,7 +67,7 @@ public: virtual int get_max_packet_size() const; - virtual Error listen(int p_port, IP_Address p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536); + virtual Error listen(int p_port, const IP_Address &p_bind_address = IP_Address("*"), int p_recv_buffer_size = 65536); virtual void close(); virtual Error wait(); virtual bool is_listening() const; diff --git a/drivers/unix/tcp_server_posix.cpp b/drivers/unix/tcp_server_posix.cpp index 865e9aa1d6..a8554d07a3 100644 --- a/drivers/unix/tcp_server_posix.cpp +++ b/drivers/unix/tcp_server_posix.cpp @@ -69,7 +69,7 @@ void TCPServerPosix::make_default() { TCP_Server::_create = TCPServerPosix::_create; }; -Error TCPServerPosix::listen(uint16_t p_port, const IP_Address p_bind_address) { +Error TCPServerPosix::listen(uint16_t p_port, const IP_Address &p_bind_address) { ERR_FAIL_COND_V(listen_sockfd != -1, ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER); diff --git a/drivers/unix/tcp_server_posix.h b/drivers/unix/tcp_server_posix.h index 659b389fe2..947050ab8a 100644 --- a/drivers/unix/tcp_server_posix.h +++ b/drivers/unix/tcp_server_posix.h @@ -41,7 +41,7 @@ class TCPServerPosix : public TCP_Server { static TCP_Server *_create(); public: - virtual Error listen(uint16_t p_port, IP_Address p_bind_address = IP_Address("*")); + virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*")); virtual bool is_connection_available() const; virtual Ref<StreamPeerTCP> take_connection(); diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h index f7553f50c2..a352415fd6 100644 --- a/drivers/windows/dir_access_windows.h +++ b/drivers/windows/dir_access_windows.h @@ -75,8 +75,8 @@ public: virtual Error make_dir(String p_dir); - virtual Error rename(String p_from, String p_to); - virtual Error remove(String p_name); + virtual Error rename(String p_path, String p_new_path); + virtual Error remove(String p_path); //virtual FileType get_file_type() const; size_t get_space_left(); diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index c66da2da29..bb133b9899 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -53,9 +53,9 @@ void FileAccessWindows::check_errors() const { } } -Error FileAccessWindows::_open(const String &p_filename, int p_mode_flags) { +Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) { - String filename = fix_path(p_filename); + String filename = fix_path(p_path); if (f) close(); |