diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gl_context/SCsub | 4 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_canvas_gles2.cpp | 49 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_scene_gles2.cpp | 48 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_storage_gles2.cpp | 15 | ||||
-rw-r--r-- | drivers/gles2/shader_compiler_gles2.cpp | 92 | ||||
-rw-r--r-- | drivers/gles2/shaders/scene.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 39 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 41 | ||||
-rw-r--r-- | drivers/gles3/shader_compiler_gles3.cpp | 82 | ||||
-rw-r--r-- | drivers/png/SCsub | 4 | ||||
-rw-r--r-- | drivers/png/resource_saver_png.cpp | 2 | ||||
-rw-r--r-- | drivers/pulseaudio/audio_driver_pulseaudio.cpp | 8 | ||||
-rw-r--r-- | drivers/unix/net_socket_posix.cpp | 2 | ||||
-rw-r--r-- | drivers/unix/net_socket_posix.h | 2 | ||||
-rw-r--r-- | drivers/unix/os_unix.cpp | 2 | ||||
-rw-r--r-- | drivers/xaudio2/SCsub | 2 |
16 files changed, 316 insertions, 80 deletions
diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub index ef5b57a0cc..b9f0ea2254 100644 --- a/drivers/gl_context/SCsub +++ b/drivers/gl_context/SCsub @@ -12,8 +12,8 @@ if (env["platform"] in ["haiku", "osx", "windows", "x11"]): env.Prepend(CPPPATH=[thirdparty_dir]) - env.Append(CPPFLAGS=['-DGLAD_ENABLED']) - env.Append(CPPFLAGS=['-DGLES_OVER_GL']) + env.Append(CPPDEFINES=['GLAD_ENABLED']) + env.Append(CPPDEFINES=['GLES_OVER_GL']) env_thirdparty = env.Clone() env_thirdparty.disable_warnings() diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp index b82186162d..8a177e32b0 100644 --- a/drivers/gles2/rasterizer_canvas_gles2.cpp +++ b/drivers/gles2/rasterizer_canvas_gles2.cpp @@ -498,7 +498,16 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur Vector2(line->to.x, line->to.y) }; +#ifdef GLES_OVER_GL + if (line->antialiased) + glEnable(GL_LINE_SMOOTH); +#endif _draw_gui_primitive(2, verts, NULL, NULL); + +#ifdef GLES_OVER_GL + if (line->antialiased) + glDisable(GL_LINE_SMOOTH); +#endif } else { Vector2 t = (line->from - line->to).normalized().tangent() * line->width * 0.5; @@ -510,6 +519,19 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur }; _draw_gui_primitive(4, verts, NULL, NULL); +#ifdef GLES_OVER_GL + if (line->antialiased) { + glEnable(GL_LINE_SMOOTH); + for (int j = 0; j < 4; j++) { + Vector2 vertsl[2] = { + verts[j], + verts[(j + 1) % 4], + }; + _draw_gui_primitive(2, vertsl, NULL, NULL); + } + glDisable(GL_LINE_SMOOTH); + } +#endif } } break; @@ -919,6 +941,13 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur } _draw_polygon(polygon->indices.ptr(), polygon->count, polygon->points.size(), polygon->points.ptr(), polygon->uvs.ptr(), polygon->colors.ptr(), polygon->colors.size() == 1, polygon->weights.ptr(), polygon->bones.ptr()); +#ifdef GLES_OVER_GL + if (polygon->antialiased) { + glEnable(GL_LINE_SMOOTH); + _draw_generic(GL_LINE_LOOP, polygon->points.size(), polygon->points.ptr(), polygon->uvs.ptr(), polygon->colors.ptr(), polygon->colors.size() == 1); + glDisable(GL_LINE_SMOOTH); + } +#endif } break; case Item::Command::TYPE_MESH: { @@ -1120,7 +1149,22 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur if (pline->triangles.size()) { _draw_generic(GL_TRIANGLE_STRIP, pline->triangles.size(), pline->triangles.ptr(), NULL, pline->triangle_colors.ptr(), pline->triangle_colors.size() == 1); +#ifdef GLES_OVER_GL + glEnable(GL_LINE_SMOOTH); + if (pline->multiline) { + //needs to be different + } else { + _draw_generic(GL_LINE_LOOP, pline->lines.size(), pline->lines.ptr(), NULL, pline->line_colors.ptr(), pline->line_colors.size() == 1); + } + glDisable(GL_LINE_SMOOTH); +#endif } else { + +#ifdef GLES_OVER_GL + if (pline->antialiased) + glEnable(GL_LINE_SMOOTH); +#endif + if (pline->multiline) { int todo = pline->lines.size() / 2; int max_per_call = data.polygon_buffer_size / (sizeof(real_t) * 4); @@ -1135,6 +1179,11 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur } else { _draw_generic(GL_LINES, pline->lines.size(), pline->lines.ptr(), NULL, pline->line_colors.ptr(), pline->line_colors.size() == 1); } + +#ifdef GLES_OVER_GL + if (pline->antialiased) + glDisable(GL_LINE_SMOOTH); +#endif } } break; diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index ea29af7d9e..23b01b4e09 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -880,7 +880,11 @@ RID RasterizerSceneGLES2::light_instance_create(RID p_light) { light_instance->light_index = 0xFFFF; - ERR_FAIL_COND_V(!light_instance->light_ptr, RID()); + if (!light_instance->light_ptr) { + memdelete(light_instance); + ERR_EXPLAIN("Condition ' !light_instance->light_ptr ' is true."); + ERR_FAIL_V(RID()); + } light_instance->self = light_instance_owner.make_rid(light_instance); @@ -1133,8 +1137,8 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G LightInstance *li = light_instance_owner.getornull(e->instance->light_instances[i]); - if (li->light_index >= render_light_instance_count) { - continue; // too many + if (li->light_index >= render_light_instance_count || render_light_instances[li->light_index] != li) { + continue; // too many or light_index did not correspond to the light instances to be rendered } if (copy) { @@ -1963,9 +1967,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado width /= 2; height /= 2; - if (k == 0) { - - } else if (k == 1) { + if (k == 1) { x += width; } else if (k == 2) { y += height; @@ -1978,9 +1980,7 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado height /= 2; - if (k == 0) { - - } else { + if (k != 0) { y += height; } } @@ -2287,19 +2287,6 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements, prev_unshaded = unshaded; } - bool depth_prepass = false; - - if (!p_alpha_pass && material->shader->spatial.depth_draw_mode == RasterizerStorageGLES2::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { - depth_prepass = true; - } - - if (depth_prepass != prev_depth_prepass) { - - state.scene_shader.set_conditional(SceneShaderGLES2::USE_DEPTH_PREPASS, depth_prepass); - prev_depth_prepass = depth_prepass; - rebind = true; - } - bool base_pass = !accum_pass && !unshaded; //conditions for a base pass if (base_pass != prev_base_pass) { @@ -2434,6 +2421,19 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements, } } + bool depth_prepass = false; + + if (!p_alpha_pass && material->shader->spatial.depth_draw_mode == RasterizerStorageGLES2::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) { + depth_prepass = true; + } + + if (depth_prepass != prev_depth_prepass) { + + state.scene_shader.set_conditional(SceneShaderGLES2::USE_DEPTH_PREPASS, depth_prepass); + prev_depth_prepass = depth_prepass; + rebind = true; + } + bool instancing = e->instance->base_type == VS::INSTANCE_MULTIMESH; if (instancing != prev_instancing) { @@ -3171,9 +3171,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_ width /= 2; height /= 2; - if (p_pass == 0) { - - } else if (p_pass == 1) { + if (p_pass == 1) { x += width; } else if (p_pass == 2) { y += height; diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index b08202ae45..a0188da4f6 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -807,7 +807,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer) } } - wb = PoolVector<uint8_t>::Write(); + wb.release(); data.resize(data_size); @@ -871,7 +871,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer) glBindFramebuffer(GL_FRAMEBUFFER, 0); glDeleteFramebuffers(1, &temp_framebuffer); - wb = PoolVector<uint8_t>::Write(); + wb.release(); data.resize(data_size); @@ -2155,8 +2155,8 @@ static PoolVector<uint8_t> _unpack_half_floats(const PoolVector<uint8_t> &array, dst_offset += dst_size[i]; } - r = PoolVector<uint8_t>::Read(); - w = PoolVector<uint8_t>::Write(); + r.release(); + w.release(); return ret; } @@ -3976,20 +3976,19 @@ AABB RasterizerStorageGLES2::light_get_aabb(RID p_light) const { float len = light->param[VS::LIGHT_PARAM_RANGE]; float size = Math::tan(Math::deg2rad(light->param[VS::LIGHT_PARAM_SPOT_ANGLE])) * len; return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len)); - } break; + }; case VS::LIGHT_OMNI: { float r = light->param[VS::LIGHT_PARAM_RANGE]; return AABB(-Vector3(r, r, r), Vector3(r, r, r) * 2); - } break; + }; case VS::LIGHT_DIRECTIONAL: { return AABB(); - } break; + }; } ERR_FAIL_V(AABB()); - return AABB(); } /* PROBE API */ diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index b48b93944c..df7eee2301 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -318,7 +318,7 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener // use highp if no precision is specified to prevent different default values in fragment and vertex shader SL::DataPrecision precision = E->get().precision; - if (precision == SL::PRECISION_DEFAULT) { + if (precision == SL::PRECISION_DEFAULT && E->get().type != SL::TYPE_BOOL) { precision = SL::PRECISION_HIGHP; } @@ -510,7 +510,97 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener } } } break; + case SL::Node::TYPE_ARRAY_DECLARATION: { + SL::ArrayDeclarationNode *var_dec_node = (SL::ArrayDeclarationNode *)p_node; + + StringBuffer<> declaration; + + declaration += _prestr(var_dec_node->precision); + declaration += _typestr(var_dec_node->datatype); + + for (int i = 0; i < var_dec_node->declarations.size(); i++) { + + if (i > 0) { + declaration += ","; + } + + declaration += " "; + + declaration += _mkid(var_dec_node->declarations[i].name); + declaration += "["; + declaration += itos(var_dec_node->declarations[i].size); + declaration += "]"; + int sz = var_dec_node->declarations[i].initializer.size(); + if (sz > 0) { + declaration += "="; + declaration += _typestr(var_dec_node->datatype); + declaration += "["; + declaration += itos(sz); + declaration += "]"; + declaration += "("; + for (int j = 0; j < sz; j++) { + declaration += _dump_node_code(var_dec_node->declarations[i].initializer[j], p_level, r_gen_code, p_actions, p_default_actions, p_assigning); + if (j != sz - 1) { + declaration += ", "; + } + } + declaration += ")"; + } + } + + code += declaration.as_string(); + } break; + case SL::Node::TYPE_ARRAY: { + SL::ArrayNode *var_node = (SL::ArrayNode *)p_node; + + if (p_assigning && p_actions.write_flag_pointers.has(var_node->name)) { + *p_actions.write_flag_pointers[var_node->name] = true; + } + + if (p_default_actions.usage_defines.has(var_node->name) && !used_name_defines.has(var_node->name)) { + String define = p_default_actions.usage_defines[var_node->name]; + + if (define.begins_with("@")) { + define = p_default_actions.usage_defines[define.substr(1, define.length())]; + } + + r_gen_code.custom_defines.push_back(define.utf8()); + used_name_defines.insert(var_node->name); + } + + if (p_actions.usage_flag_pointers.has(var_node->name) && !used_flag_pointers.has(var_node->name)) { + *p_actions.usage_flag_pointers[var_node->name] = true; + used_flag_pointers.insert(var_node->name); + } + + if (p_default_actions.renames.has(var_node->name)) { + code += p_default_actions.renames[var_node->name]; + } else { + code += _mkid(var_node->name); + } + + if (var_node->call_expression != NULL) { + code += "."; + code += _dump_node_code(var_node->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning); + } + + if (var_node->index_expression != NULL) { + code += "["; + code += _dump_node_code(var_node->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning); + code += "]"; + } + + if (var_node->name == time_name) { + if (current_func_name == vertex_name) { + r_gen_code.uses_vertex_time = true; + } + if (current_func_name == fragment_name || current_func_name == light_name) { + r_gen_code.uses_fragment_time = true; + } + } + + } break; case SL::Node::TYPE_CONSTANT: { SL::ConstantNode *const_node = (SL::ConstantNode *)p_node; diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index ca222362e7..b7f8ec3ce9 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -1549,7 +1549,7 @@ FRAGMENT_SHADER_CODE #endif // ALPHA_SCISSOR_USED #ifdef USE_DEPTH_PREPASS - if (alpha < 0.99) { + if (alpha < 0.1) { discard; } #endif // USE_DEPTH_PREPASS @@ -2112,7 +2112,7 @@ FRAGMENT_SHADER_CODE #endif // ALPHA_SCISSOR_USED #ifdef USE_DEPTH_PREPASS - if (alpha < 0.99) { + if (alpha < 0.1) { discard; } #endif // USE_DEPTH_PREPASS diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 91c0693538..f3ba29a0e7 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1008,7 +1008,8 @@ RID RasterizerSceneGLES3::light_instance_create(RID p_light) { if (!light_instance->light_ptr) { memdelete(light_instance); - ERR_FAIL_COND_V(!light_instance->light_ptr, RID()); + ERR_EXPLAIN("Condition ' !light_instance->light_ptr ' is true."); + ERR_FAIL_V(RID()); } light_instance->self = light_instance_owner.make_rid(light_instance); @@ -1459,8 +1460,8 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e, const Transfo #else PoolVector<RasterizerGLES3Particle> particle_vector; particle_vector.resize(particles->amount); - PoolVector<RasterizerGLES3Particle>::Write w = particle_vector.write(); - particle_array = w.ptr(); + PoolVector<RasterizerGLES3Particle>::Write particle_writer = particle_vector.write(); + particle_array = particle_writer.ptr(); glGetBufferSubData(GL_ARRAY_BUFFER, 0, particles->amount * sizeof(RasterizerGLES3Particle), particle_array); #endif @@ -1477,7 +1478,7 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e, const Transfo #ifndef __EMSCRIPTEN__ glUnmapBuffer(GL_ARRAY_BUFFER); #else - w = PoolVector<RasterizerGLES3Particle>::Write(); + particle_writer.release(); particle_array = NULL; { PoolVector<RasterizerGLES3Particle>::Read r = particle_vector.read(); @@ -2364,7 +2365,7 @@ void RasterizerSceneGLES3::_add_geometry_with_material(RasterizerStorageGLES3::G if (p_depth_pass) { - if (has_blend_alpha || p_material->shader->spatial.uses_depth_texture || (has_base_alpha && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) || p_material->shader->spatial.depth_draw_mode == RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_NEVER || p_material->shader->spatial.no_depth_test) + if (has_blend_alpha || p_material->shader->spatial.uses_depth_texture || (has_base_alpha && p_material->shader->spatial.depth_draw_mode != RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) || p_material->shader->spatial.depth_draw_mode == RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_NEVER || p_material->shader->spatial.no_depth_test || p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_OFF) return; //bye 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) { @@ -2763,9 +2764,7 @@ void RasterizerSceneGLES3::_setup_directional_light(int p_index, const Transform width /= 2; height /= 2; - if (j == 0) { - - } else if (j == 1) { + if (j == 1) { x += width; } else if (j == 2) { y += height; @@ -2778,9 +2777,7 @@ void RasterizerSceneGLES3::_setup_directional_light(int p_index, const Transform height /= 2; - if (j == 0) { - - } else { + if (j != 0) { y += height; } } @@ -4741,9 +4738,7 @@ void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_ width /= 2; height /= 2; - if (p_pass == 0) { - - } else if (p_pass == 1) { + if (p_pass == 1) { x += width; } else if (p_pass == 2) { y += height; @@ -4990,6 +4985,20 @@ bool RasterizerSceneGLES3::free(RID p_rid) { reflection_probe_instance_owner.free(p_rid); memdelete(reflection_instance); + } else if (environment_owner.owns(p_rid)) { + + Environment *environment = environment_owner.get(p_rid); + + environment_owner.free(p_rid); + memdelete(environment); + + } else if (gi_probe_instance_owner.owns(p_rid)) { + + GIProbeInstance *gi_probe_instance = gi_probe_instance_owner.get(p_rid); + + gi_probe_instance_owner.free(p_rid); + memdelete(gi_probe_instance); + } else { return false; } @@ -5287,7 +5296,7 @@ void RasterizerSceneGLES3::initialize() { GLOBAL_DEF("rendering/quality/subsurface_scattering/follow_surface", false); GLOBAL_DEF("rendering/quality/subsurface_scattering/weight_samples", true); - GLOBAL_DEF("rendering/quality/voxel_cone_tracing/high_quality", true); + GLOBAL_DEF("rendering/quality/voxel_cone_tracing/high_quality", false); } exposure_shrink_size = 243; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index b280898188..57b4c198eb 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1144,8 +1144,12 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer) shaders.copy.set_conditional(CopyShaderGLES3::USE_TEXTURE2DARRAY, texture->type == VS::TEXTURE_TYPE_2D_ARRAY); shaders.copy.bind(); - // calculate the normalized z coordinate for the layer - float layer = (float)p_layer / (float)texture->alloc_depth; + float layer; + if (texture->type == VS::TEXTURE_TYPE_2D_ARRAY) + layer = (float)p_layer; + else + // calculate the normalized z coordinate for the layer + layer = (float)p_layer / (float)texture->alloc_depth; shaders.copy.set_uniform(CopyShaderGLES3::LAYER, layer); @@ -1173,7 +1177,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer) glDeleteFramebuffers(1, &tmp_fbo); } - wb = PoolVector<uint8_t>::Write(); + wb.release(); data.resize(data_size); @@ -1248,7 +1252,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer) img_format = real_format; } - wb = PoolVector<uint8_t>::Write(); + wb.release(); data.resize(data_size); @@ -1316,7 +1320,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer) glBindFramebuffer(GL_FRAMEBUFFER, 0); glDeleteFramebuffers(1, &temp_framebuffer); - wb = PoolVector<uint8_t>::Write(); + wb.release(); data.resize(data_size); @@ -2526,19 +2530,19 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy int v = value; GLuint *gui = (GLuint *)data; - gui[0] = v & 1 ? GL_TRUE : GL_FALSE; - gui[1] = v & 2 ? GL_TRUE : GL_FALSE; - gui[2] = v & 4 ? GL_TRUE : GL_FALSE; + gui[0] = (v & 1) ? GL_TRUE : GL_FALSE; + gui[1] = (v & 2) ? GL_TRUE : GL_FALSE; + gui[2] = (v & 4) ? GL_TRUE : GL_FALSE; } break; case ShaderLanguage::TYPE_BVEC4: { int v = value; GLuint *gui = (GLuint *)data; - gui[0] = v & 1 ? GL_TRUE : GL_FALSE; - gui[1] = v & 2 ? GL_TRUE : GL_FALSE; - gui[2] = v & 4 ? GL_TRUE : GL_FALSE; - gui[3] = v & 8 ? GL_TRUE : GL_FALSE; + gui[0] = (v & 1) ? GL_TRUE : GL_FALSE; + gui[1] = (v & 2) ? GL_TRUE : GL_FALSE; + gui[2] = (v & 4) ? GL_TRUE : GL_FALSE; + gui[3] = (v & 8) ? GL_TRUE : GL_FALSE; } break; case ShaderLanguage::TYPE_INT: { @@ -3441,7 +3445,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh, uint32_t p_format, VS: glGenBuffers(1, &surface->vertex_id); glBindBuffer(GL_ARRAY_BUFFER, surface->vertex_id); - glBufferData(GL_ARRAY_BUFFER, array_size, vr.ptr(), p_format & VS::ARRAY_FLAG_USE_DYNAMIC_UPDATE ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, array_size, vr.ptr(), (p_format & VS::ARRAY_FLAG_USE_DYNAMIC_UPDATE) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind if (p_format & VS::ARRAY_FORMAT_INDEX) { @@ -5467,22 +5471,19 @@ AABB RasterizerStorageGLES3::light_get_aabb(RID p_light) const { float len = light->param[VS::LIGHT_PARAM_RANGE]; float size = Math::tan(Math::deg2rad(light->param[VS::LIGHT_PARAM_SPOT_ANGLE])) * len; return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len)); - } break; + }; case VS::LIGHT_OMNI: { float r = light->param[VS::LIGHT_PARAM_RANGE]; return AABB(-Vector3(r, r, r), Vector3(r, r, r) * 2); - } break; + }; case VS::LIGHT_DIRECTIONAL: { return AABB(); - } break; - default: { - } + }; } ERR_FAIL_V(AABB()); - return AABB(); } /* PROBE API */ @@ -6337,7 +6338,7 @@ AABB RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) { } #if defined(GLES_OVER_GL) || defined(__EMSCRIPTEN__) - r = PoolVector<uint8_t>::Read(); + r.release(); vector = PoolVector<uint8_t>(); #else glUnmapBuffer(GL_ARRAY_BUFFER); diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index b0f0a71d56..f826bdf5a2 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -607,6 +607,88 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener } } break; + case SL::Node::TYPE_ARRAY_DECLARATION: { + + SL::ArrayDeclarationNode *vdnode = (SL::ArrayDeclarationNode *)p_node; + + String declaration = _prestr(vdnode->precision) + _typestr(vdnode->datatype); + for (int i = 0; i < vdnode->declarations.size(); i++) { + if (i > 0) { + declaration += ","; + } else { + declaration += " "; + } + declaration += _mkid(vdnode->declarations[i].name); + declaration += "["; + declaration += itos(vdnode->declarations[i].size); + declaration += "]"; + int sz = vdnode->declarations[i].initializer.size(); + if (sz > 0) { + declaration += "="; + declaration += _typestr(vdnode->datatype); + declaration += "["; + declaration += itos(sz); + declaration += "]"; + declaration += "("; + for (int j = 0; j < sz; j++) { + declaration += _dump_node_code(vdnode->declarations[i].initializer[j], p_level, r_gen_code, p_actions, p_default_actions, p_assigning); + if (j != sz - 1) { + declaration += ", "; + } + } + declaration += ")"; + } + } + + code += declaration; + } break; + case SL::Node::TYPE_ARRAY: { + SL::ArrayNode *vnode = (SL::ArrayNode *)p_node; + + if (p_assigning && p_actions.write_flag_pointers.has(vnode->name)) { + *p_actions.write_flag_pointers[vnode->name] = true; + } + + if (p_default_actions.usage_defines.has(vnode->name) && !used_name_defines.has(vnode->name)) { + String define = p_default_actions.usage_defines[vnode->name]; + if (define.begins_with("@")) { + define = p_default_actions.usage_defines[define.substr(1, define.length())]; + } + r_gen_code.defines.push_back(define.utf8()); + used_name_defines.insert(vnode->name); + } + + if (p_actions.usage_flag_pointers.has(vnode->name) && !used_flag_pointers.has(vnode->name)) { + *p_actions.usage_flag_pointers[vnode->name] = true; + used_flag_pointers.insert(vnode->name); + } + + if (p_default_actions.renames.has(vnode->name)) + code = p_default_actions.renames[vnode->name]; + else + code = _mkid(vnode->name); + + if (vnode->call_expression != NULL) { + code += "."; + code += _dump_node_code(vnode->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning); + } + + if (vnode->index_expression != NULL) { + code += "["; + code += _dump_node_code(vnode->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning); + code += "]"; + } + + if (vnode->name == time_name) { + if (current_func_name == vertex_name) { + r_gen_code.uses_vertex_time = true; + } + if (current_func_name == fragment_name || current_func_name == light_name) { + r_gen_code.uses_fragment_time = true; + } + } + + } break; case SL::Node::TYPE_CONSTANT: { SL::ConstantNode *cnode = (SL::ConstantNode *)p_node; return get_constant_text(cnode->datatype, cnode->values); diff --git a/drivers/png/SCsub b/drivers/png/SCsub index 9dc80244ff..87b54cecaf 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -34,9 +34,9 @@ if env['builtin_libpng']: import os use_neon = "neon_enabled" in env and env["neon_enabled"] and os.name != "nt" if use_neon: - env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"]) + env_png.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 2)]) else: - env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"]) + env_png.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 0)]) env_thirdparty = env_png.Clone() env_thirdparty.disable_warnings() diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index 89e8ee32cc..43a30f055b 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -79,7 +79,7 @@ bool ResourceSaverPNG::recognize(const RES &p_resource) const { void ResourceSaverPNG::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const { - if (Object::cast_to<Texture>(*p_resource)) { + if (Object::cast_to<ImageTexture>(*p_resource)) { p_extensions->push_back("png"); } } diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index aec3d27d69..a61fa449f1 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -191,6 +191,14 @@ Error AudioDriverPulseAudio::init_device() { spec.format = PA_SAMPLE_S16LE; spec.channels = pa_map.channels; spec.rate = mix_rate; + pa_map.map[0] = PA_CHANNEL_POSITION_FRONT_LEFT; + pa_map.map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT; + pa_map.map[2] = PA_CHANNEL_POSITION_FRONT_CENTER; + pa_map.map[3] = PA_CHANNEL_POSITION_LFE; + pa_map.map[4] = PA_CHANNEL_POSITION_REAR_LEFT; + pa_map.map[5] = PA_CHANNEL_POSITION_REAR_RIGHT; + pa_map.map[6] = PA_CHANNEL_POSITION_SIDE_LEFT; + pa_map.map[7] = PA_CHANNEL_POSITION_SIDE_RIGHT; pa_str = pa_stream_new(pa_ctx, "Sound", &spec, &pa_map); if (pa_str == NULL) { diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp index f8e771aea0..6a57a2e562 100644 --- a/drivers/unix/net_socket_posix.cpp +++ b/drivers/unix/net_socket_posix.cpp @@ -212,7 +212,7 @@ NetSocketPosix::NetError NetSocketPosix::_get_socket_error() { #pragma GCC diagnostic pop #endif -bool NetSocketPosix::_can_use_ip(const IP_Address p_ip, const bool p_for_bind) const { +bool NetSocketPosix::_can_use_ip(const IP_Address &p_ip, const bool p_for_bind) const { if (p_for_bind && !(p_ip.is_valid() || p_ip.is_wildcard())) { return false; diff --git a/drivers/unix/net_socket_posix.h b/drivers/unix/net_socket_posix.h index ce6dc00d42..40406b241a 100644 --- a/drivers/unix/net_socket_posix.h +++ b/drivers/unix/net_socket_posix.h @@ -65,7 +65,7 @@ private: protected: static NetSocket *_create_func(); - bool _can_use_ip(const IP_Address p_ip, const bool p_for_bind) const; + bool _can_use_ip(const IP_Address &p_ip, const bool p_for_bind) const; public: static void make_default(); diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 4de910ee1c..aa61cf5dcc 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -256,7 +256,7 @@ OS::TimeZoneInfo OS_Unix::get_time_zone_info() const { void OS_Unix::delay_usec(uint32_t p_usec) const { - struct timespec rem = { static_cast<time_t>(p_usec / 1000000), static_cast<long>((p_usec % 1000000) * 1000) }; + struct timespec rem = { static_cast<time_t>(p_usec / 1000000), (static_cast<long>(p_usec) % 1000000) * 1000 }; while (nanosleep(&rem, &rem) == EINTR) { } } diff --git a/drivers/xaudio2/SCsub b/drivers/xaudio2/SCsub index dfc877b6f5..de750525ab 100644 --- a/drivers/xaudio2/SCsub +++ b/drivers/xaudio2/SCsub @@ -3,5 +3,5 @@ Import('env') env.add_source_files(env.drivers_sources, "*.cpp") -env.Append(CPPFLAGS=['-DXAUDIO2_ENABLED']) +env.Append(CPPDEFINES=['XAUDIO2_ENABLED']) env.Append(LINKFLAGS=['xaudio2_8.lib']) |