summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/alsa/SCsub3
-rw-r--r--drivers/alsa/audio_driver_alsa.cpp5
-rw-r--r--drivers/alsa/audio_driver_alsa.h4
-rw-r--r--drivers/alsamidi/midi_driver_alsamidi.h5
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp38
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp19
-rw-r--r--drivers/gles3/rasterizer_gles3.h4
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp10
-rw-r--r--drivers/gles3/shaders/sky.glsl10
-rw-r--r--drivers/gles3/shaders/stdlib_inc.glsl6
-rw-r--r--drivers/gles3/storage/material_storage.cpp54
-rw-r--r--drivers/gles3/storage/mesh_storage.cpp19
-rw-r--r--drivers/gles3/storage/texture_storage.cpp5
-rw-r--r--drivers/gles3/storage/texture_storage.h2
-rw-r--r--drivers/pulseaudio/SCsub3
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp7
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.h4
-rw-r--r--drivers/unix/file_access_unix.cpp4
-rw-r--r--drivers/unix/file_access_unix.h2
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp5
-rw-r--r--drivers/vulkan/vulkan_context.cpp12
-rw-r--r--drivers/windows/file_access_windows.cpp5
-rw-r--r--drivers/windows/file_access_windows.h2
23 files changed, 172 insertions, 56 deletions
diff --git a/drivers/alsa/SCsub b/drivers/alsa/SCsub
index 1d76bb18c4..f17acb0f91 100644
--- a/drivers/alsa/SCsub
+++ b/drivers/alsa/SCsub
@@ -3,6 +3,7 @@
Import("env")
if "alsa" in env and env["alsa"]:
- env.add_source_files(env.drivers_sources, "asound-so_wrap.c")
+ if env["use_sowrap"]:
+ env.add_source_files(env.drivers_sources, "asound-so_wrap.c")
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp
index 20cd8dd26c..689f76389b 100644
--- a/drivers/alsa/audio_driver_alsa.cpp
+++ b/drivers/alsa/audio_driver_alsa.cpp
@@ -37,7 +37,7 @@
#include <errno.h>
-#ifdef PULSEAUDIO_ENABLED
+#if defined(PULSEAUDIO_ENABLED) && defined(SOWRAP_ENABLED)
extern "C" {
extern int initialize_pulse(int verbose);
}
@@ -153,6 +153,7 @@ Error AudioDriverALSA::init_output_device() {
}
Error AudioDriverALSA::init() {
+#ifdef SOWRAP_ENABLED
#ifdef DEBUG_ENABLED
int dylibloader_verbose = 1;
#else
@@ -167,7 +168,7 @@ Error AudioDriverALSA::init() {
if (initialize_asound(dylibloader_verbose)) {
return ERR_CANT_OPEN;
}
-
+#endif
active.clear();
exit_thread.clear();
diff --git a/drivers/alsa/audio_driver_alsa.h b/drivers/alsa/audio_driver_alsa.h
index 821ba1d145..b62d7188dd 100644
--- a/drivers/alsa/audio_driver_alsa.h
+++ b/drivers/alsa/audio_driver_alsa.h
@@ -38,7 +38,11 @@
#include "core/templates/safe_refcount.h"
#include "servers/audio_server.h"
+#ifdef SOWRAP_ENABLED
#include "asound-so_wrap.h"
+#else
+#include <alsa/asoundlib.h>
+#endif
class AudioDriverALSA : public AudioDriver {
Thread thread;
diff --git a/drivers/alsamidi/midi_driver_alsamidi.h b/drivers/alsamidi/midi_driver_alsamidi.h
index 3c6300411c..80cc96310f 100644
--- a/drivers/alsamidi/midi_driver_alsamidi.h
+++ b/drivers/alsamidi/midi_driver_alsamidi.h
@@ -39,7 +39,12 @@
#include "core/templates/safe_refcount.h"
#include "core/templates/vector.h"
+#ifdef SOWRAP_ENABLED
#include "../alsa/asound-so_wrap.h"
+#else
+#include <alsa/asoundlib.h>
+#endif
+
#include <stdio.h>
class MIDIDriverALSAMidi : public MIDIDriver {
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 3c5441f3c4..522685bf87 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -115,7 +115,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
if (state.canvas_instance_data_buffers[state.current_data_buffer_index].fence != GLsync()) {
GLint syncStatus;
- glGetSynciv(state.canvas_instance_data_buffers[state.current_data_buffer_index].fence, GL_SYNC_STATUS, sizeof(GLint), nullptr, &syncStatus);
+ glGetSynciv(state.canvas_instance_data_buffers[state.current_data_buffer_index].fence, GL_SYNC_STATUS, 1, nullptr, &syncStatus);
if (syncStatus == GL_UNSIGNALED) {
// If older than 2 frames, wait for sync OpenGL can have up to 3 frames in flight, any more and we need to sync anyway.
if (state.canvas_instance_data_buffers[state.current_data_buffer_index].last_frame_used < RSG::rasterizer->get_frame_number() - 2) {
@@ -224,13 +224,12 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
l = l->next_ptr;
ERR_CONTINUE(!clight);
}
- Transform2D to_light_xform = (p_canvas_transform * l->light_shader_xform).affine_inverse();
Vector2 canvas_light_pos = p_canvas_transform.xform(l->xform.get_origin()); //convert light position to canvas coordinates, as all computation is done in canvas coords to avoid precision loss
state.light_uniforms[index].position[0] = canvas_light_pos.x;
state.light_uniforms[index].position[1] = canvas_light_pos.y;
- _update_transform_2d_to_mat2x4(to_light_xform, state.light_uniforms[index].matrix);
+ _update_transform_2d_to_mat2x4(l->light_shader_xform.affine_inverse(), state.light_uniforms[index].matrix);
_update_transform_2d_to_mat2x4(l->xform_cache.affine_inverse(), state.light_uniforms[index].shadow_matrix);
state.light_uniforms[index].height = l->height * (p_canvas_transform.columns[0].length() + p_canvas_transform.columns[1].length()) * 0.5; //approximate height conversion to the canvas size, since all calculations are done in canvas coords to avoid precision loss
@@ -397,6 +396,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
Item *ci = p_item_list;
Item *canvas_group_owner = nullptr;
+ bool skip_item = false;
state.last_item_index = 0;
@@ -465,6 +465,7 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
Rect2i group_rect = ci->canvas_group_owner->global_rect_cache;
texture_storage->render_target_copy_to_back_buffer(p_to_render_target, group_rect, false);
if (ci->canvas_group_owner->canvas_group->mode == RS::CANVAS_GROUP_MODE_CLIP_AND_DRAW) {
+ ci->canvas_group_owner->use_canvas_group = false;
items[item_count++] = ci->canvas_group_owner;
}
} else if (!backbuffer_cleared) {
@@ -479,9 +480,8 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
ci->canvas_group_owner = nullptr; //must be cleared
}
- if (!backbuffer_cleared && canvas_group_owner == nullptr && ci->canvas_group != nullptr && !backbuffer_copy) {
- texture_storage->render_target_clear_back_buffer(p_to_render_target, Rect2i(), Color(0, 0, 0, 0));
- backbuffer_cleared = true;
+ if (canvas_group_owner == nullptr && ci->canvas_group != nullptr && ci->canvas_group->mode != RS::CANVAS_GROUP_MODE_CLIP_AND_DRAW) {
+ skip_item = true;
}
if (ci == canvas_group_owner) {
@@ -499,6 +499,11 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
canvas_group_owner = nullptr;
// Backbuffer is dirty now and needs to be re-cleared if another CanvasGroup needs it.
backbuffer_cleared = false;
+
+ // Tell the renderer to paint this as a canvas group
+ ci->use_canvas_group = true;
+ } else {
+ ci->use_canvas_group = false;
}
if (backbuffer_copy) {
@@ -514,9 +519,9 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
texture_storage->render_target_copy_to_back_buffer(p_to_render_target, back_buffer_rect, backbuffer_gen_mipmaps);
backbuffer_copy = false;
- backbuffer_gen_mipmaps = false;
material_screen_texture_cached = true; // After a backbuffer copy, screen texture makes no further copies.
material_screen_texture_mipmaps_cached = backbuffer_gen_mipmaps;
+ backbuffer_gen_mipmaps = false;
}
if (backbuffer_gen_mipmaps) {
@@ -527,14 +532,18 @@ void RasterizerCanvasGLES3::canvas_render_items(RID p_to_render_target, Item *p_
}
// just add all items for now
- items[item_count++] = ci;
+ if (skip_item) {
+ skip_item = false;
+ } else {
+ items[item_count++] = ci;
+ }
if (!ci->next || item_count == MAX_RENDER_ITEMS - 1) {
if (update_skeletons) {
mesh_storage->update_mesh_instances();
update_skeletons = false;
}
- _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, r_sdf_used);
+ _render_items(p_to_render_target, item_count, canvas_transform_inverse, p_light_list, r_sdf_used, canvas_group_owner != nullptr);
//then reset
item_count = 0;
}
@@ -566,6 +575,7 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou
uint32_t index = 0;
Item *current_clip = nullptr;
+ GLES3::CanvasShaderData *shader_data_cache = nullptr;
// Record Batches.
// First item always forms its own batch.
@@ -586,11 +596,9 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou
}
RID material = ci->material_owner == nullptr ? ci->material : ci->material_owner->material;
- if (ci->canvas_group != nullptr) {
+ if (ci->use_canvas_group) {
if (ci->canvas_group->mode == RS::CANVAS_GROUP_MODE_CLIP_AND_DRAW) {
- if (!p_to_backbuffer) {
- material = default_clip_children_material;
- }
+ material = default_clip_children_material;
} else {
if (material.is_null()) {
if (ci->canvas_group->mode == RS::CANVAS_GROUP_MODE_CLIP_ONLY) {
@@ -602,7 +610,6 @@ void RasterizerCanvasGLES3::_render_items(RID p_to_render_target, int p_item_cou
}
}
- GLES3::CanvasShaderData *shader_data_cache = nullptr;
if (material != state.canvas_instance_batches[state.current_batch_index].material) {
_new_batch(batch_broken);
@@ -1951,11 +1958,12 @@ void RasterizerCanvasGLES3::occluder_polygon_set_shape(RID p_occluder, const Vec
glBufferData(GL_ELEMENT_ARRAY_BUFFER, 3 * lc * sizeof(uint16_t), indices.ptr(), GL_STATIC_DRAW);
glBindVertexArray(0);
} else {
- glBindVertexArray(oc->vertex_array);
glBindBuffer(GL_ARRAY_BUFFER, oc->vertex_buffer);
glBufferData(GL_ARRAY_BUFFER, lc * 6 * sizeof(float), geometry.ptr(), GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, oc->index_buffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, 3 * lc * sizeof(uint16_t), indices.ptr(), GL_STATIC_DRAW);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
}
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index 2e3e6263ed..7cbce428cb 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -198,7 +198,11 @@ void RasterizerGLES3::finalize() {
memdelete(config);
}
+RasterizerGLES3 *RasterizerGLES3::singleton = nullptr;
+
RasterizerGLES3::RasterizerGLES3() {
+ singleton = this;
+
#ifdef GLAD_ENABLED
if (!gladLoaderLoadGL()) {
ERR_PRINT("Error initializing GLAD");
@@ -281,7 +285,7 @@ void RasterizerGLES3::prepare_for_blitting_render_targets() {
utils->capture_timestamps_end();
}
-void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, DisplayServer::WindowID p_screen, const Rect2 &p_screen_rect, uint32_t p_layer) {
+void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, DisplayServer::WindowID p_screen, const Rect2 &p_screen_rect, uint32_t p_layer, bool p_first) {
GLES3::RenderTarget *rt = GLES3::TextureStorage::get_singleton()->get_render_target(p_render_target);
ERR_FAIL_COND(!rt);
@@ -306,6 +310,17 @@ void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, Display
glReadBuffer(GL_COLOR_ATTACHMENT0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, GLES3::TextureStorage::system_fbo);
+
+ if (p_first) {
+ Size2i win_size = DisplayServer::get_singleton()->window_get_size();
+ if (p_screen_rect.position != Vector2() || p_screen_rect.size != rt->size) {
+ // Viewport doesn't cover entire window so clear window to black before blitting.
+ glViewport(0, 0, win_size.width, win_size.height);
+ glClearColor(0.0, 0.0, 0.0, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+ }
+
Vector2i screen_rect_end = p_screen_rect.get_end();
glBlitFramebuffer(0, 0, rt->size.x, rt->size.y,
p_screen_rect.position.x, flip_y ? screen_rect_end.y : p_screen_rect.position.y, screen_rect_end.x, flip_y ? p_screen_rect.position.y : screen_rect_end.y,
@@ -325,7 +340,7 @@ void RasterizerGLES3::blit_render_targets_to_screen(DisplayServer::WindowID p_sc
RID rid_rt = blit.render_target;
Rect2 dst_rect = blit.dst_rect;
- _blit_render_target_to_screen(rid_rt, p_screen, dst_rect, blit.multi_view.use_layer ? blit.multi_view.layer : 0);
+ _blit_render_target_to_screen(rid_rt, p_screen, dst_rect, blit.multi_view.use_layer ? blit.multi_view.layer : 0, i == 0);
}
}
diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h
index 446c6af338..e29ccefdbd 100644
--- a/drivers/gles3/rasterizer_gles3.h
+++ b/drivers/gles3/rasterizer_gles3.h
@@ -67,8 +67,9 @@ protected:
GLES3::CopyEffects *copy_effects = nullptr;
RasterizerCanvasGLES3 *canvas = nullptr;
RasterizerSceneGLES3 *scene = nullptr;
+ static RasterizerGLES3 *singleton;
- void _blit_render_target_to_screen(RID p_render_target, DisplayServer::WindowID p_screen, const Rect2 &p_screen_rect, uint32_t p_layer);
+ void _blit_render_target_to_screen(RID p_render_target, DisplayServer::WindowID p_screen, const Rect2 &p_screen_rect, uint32_t p_layer, bool p_first = true);
public:
RendererUtilities *get_utilities() { return utilities; }
@@ -107,6 +108,7 @@ public:
_ALWAYS_INLINE_ double get_frame_delta_time() const { return delta; }
_ALWAYS_INLINE_ double get_total_time() const { return time_total; }
+ static RasterizerGLES3 *get_singleton() { return singleton; }
RasterizerGLES3();
~RasterizerGLES3();
};
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 1a18f35e64..9a4deefdc8 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -1895,6 +1895,10 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
glBindFramebuffer(GL_FRAMEBUFFER, rt->fbo);
glViewport(0, 0, rb->width, rb->height);
+ glCullFace(GL_BACK);
+ glEnable(GL_CULL_FACE);
+ scene_state.cull_mode = GLES3::SceneShaderData::CULL_BACK;
+
// Do depth prepass if it's explicitly enabled
bool use_depth_prepass = config->use_depth_prepass;
@@ -1910,9 +1914,6 @@ void RasterizerSceneGLES3::render_scene(const Ref<RenderSceneBuffers> &p_render_
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glDisable(GL_SCISSOR_TEST);
- glCullFace(GL_BACK);
- glEnable(GL_CULL_FACE);
- scene_state.cull_mode = GLES3::SceneShaderData::CULL_BACK;
glColorMask(0, 0, 0, 0);
glClearDepth(1.0f);
@@ -2205,6 +2206,9 @@ void RasterizerSceneGLES3::_render_list_template(RenderListParameters *p_params,
}
RS::PrimitiveType primitive = surf->primitive;
+ if (shader->uses_point_size) {
+ primitive = RS::PRIMITIVE_POINTS;
+ }
static const GLenum prim[5] = { GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_TRIANGLES, GL_TRIANGLE_STRIP };
GLenum primitive_gl = prim[int(primitive)];
diff --git a/drivers/gles3/shaders/sky.glsl b/drivers/gles3/shaders/sky.glsl
index e59bca8b07..2455ffb8e2 100644
--- a/drivers/gles3/shaders/sky.glsl
+++ b/drivers/gles3/shaders/sky.glsl
@@ -21,12 +21,13 @@ out vec2 uv_interp;
/* clang-format on */
void main() {
- uv_interp = vertex_attrib;
#ifdef USE_INVERTED_Y
- gl_Position = vec4(uv_interp, 1.0, 1.0);
+ uv_interp = vertex_attrib;
#else
- gl_Position = vec4(uv_interp.x, uv_interp.y * -1.0, 1.0, 1.0);
+ // We're doing clockwise culling so flip the order
+ uv_interp = vec2(vertex_attrib.x, vertex_attrib.y * -1.0);
#endif
+ gl_Position = vec4(uv_interp, 1.0, 1.0);
}
/* clang-format off */
@@ -145,9 +146,6 @@ void main() {
cube_normal.x = (uv_interp.x + projection.x) / projection.y;
cube_normal.y = (-uv_interp.y - projection.z) / projection.w;
#endif
-#ifndef USE_INVERTED_Y
- cube_normal.y *= -1.0;
-#endif
cube_normal = mat3(orientation) * cube_normal;
cube_normal = normalize(cube_normal);
diff --git a/drivers/gles3/shaders/stdlib_inc.glsl b/drivers/gles3/shaders/stdlib_inc.glsl
index 0b76c4334a..92bf2d87e4 100644
--- a/drivers/gles3/shaders/stdlib_inc.glsl
+++ b/drivers/gles3/shaders/stdlib_inc.glsl
@@ -14,11 +14,7 @@ uint float2half(uint f) {
uint half2float(uint h) {
uint h_e = h & uint(0x7c00);
- if (h_e == uint(0x0000)) {
- return uint(0);
- } else {
- return ((h & uint(0x8000)) << uint(16)) | ((h_e + uint(0x1c000)) << uint(13)) | ((h & uint(0x03ff)) << uint(13));
- }
+ return ((h & uint(0x8000)) << uint(16)) | uint((h_e >> uint(10)) != uint(0)) * (((h_e + uint(0x1c000)) << uint(13)) | ((h & uint(0x03ff)) << uint(13)));
}
uint packHalf2x16(vec2 v) {
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp
index aa8df606cf..1736ad1d42 100644
--- a/drivers/gles3/storage/material_storage.cpp
+++ b/drivers/gles3/storage/material_storage.cpp
@@ -38,6 +38,7 @@
#include "texture_storage.h"
#include "drivers/gles3/rasterizer_canvas_gles3.h"
+#include "drivers/gles3/rasterizer_gles3.h"
using namespace GLES3;
@@ -1065,6 +1066,12 @@ static const RS::CanvasItemTextureRepeat repeat_from_uniform[ShaderLanguage::REP
RS::CanvasItemTextureRepeat::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED, // ShaderLanguage::TextureRepeat::REPEAT_DEFAULT,
};
+static const RS::CanvasItemTextureRepeat repeat_from_uniform_canvas[ShaderLanguage::REPEAT_DEFAULT + 1] = {
+ RS::CanvasItemTextureRepeat::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED, // ShaderLanguage::TextureRepeat::REPEAT_DISABLE,
+ RS::CanvasItemTextureRepeat::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED, // ShaderLanguage::TextureRepeat::REPEAT_ENABLE,
+ RS::CanvasItemTextureRepeat::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED, // ShaderLanguage::TextureRepeat::REPEAT_DEFAULT,
+};
+
static const RS::CanvasItemTextureFilter filter_from_uniform[ShaderLanguage::FILTER_DEFAULT + 1] = {
RS::CanvasItemTextureFilter::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, // ShaderLanguage::TextureFilter::FILTER_NEAREST,
RS::CanvasItemTextureFilter::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, // ShaderLanguage::TextureFilter::FILTER_LINEAR,
@@ -1075,6 +1082,16 @@ static const RS::CanvasItemTextureFilter filter_from_uniform[ShaderLanguage::FIL
RS::CanvasItemTextureFilter::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, // ShaderLanguage::TextureFilter::FILTER_DEFAULT,
};
+static const RS::CanvasItemTextureFilter filter_from_uniform_canvas[ShaderLanguage::FILTER_DEFAULT + 1] = {
+ RS::CanvasItemTextureFilter::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, // ShaderLanguage::TextureFilter::FILTER_NEAREST,
+ RS::CanvasItemTextureFilter::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, // ShaderLanguage::TextureFilter::FILTER_LINEAR,
+ RS::CanvasItemTextureFilter::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, // ShaderLanguage::TextureFilter::FILTER_NEAREST_MIPMAP,
+ RS::CanvasItemTextureFilter::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, // ShaderLanguage::TextureFilter::FILTER_LINEAR_MIPMAP,
+ RS::CanvasItemTextureFilter::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC, // ShaderLanguage::TextureFilter::FILTER_NEAREST_MIPMAP_ANISOTROPIC,
+ RS::CanvasItemTextureFilter::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC, // ShaderLanguage::TextureFilter::FILTER_LINEAR_MIPMAP_ANISOTROPIC,
+ RS::CanvasItemTextureFilter::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, // ShaderLanguage::TextureFilter::FILTER_DEFAULT,
+};
+
void MaterialData::update_uniform_buffer(const HashMap<StringName, ShaderLanguage::ShaderNode::Uniform> &p_uniforms, const uint32_t *p_uniform_offsets, const HashMap<StringName, Variant> &p_parameters, uint8_t *p_buffer, uint32_t p_buffer_size, bool p_use_linear_color) {
MaterialStorage *material_storage = MaterialStorage::get_singleton();
bool uses_global_buffer = false;
@@ -1493,7 +1510,7 @@ MaterialStorage::MaterialStorage() {
actions.renames["LIGHT_VERTEX"] = "light_vertex";
actions.renames["SHADOW_VERTEX"] = "shadow_vertex";
actions.renames["UV"] = "uv";
- actions.renames["POINT_SIZE"] = "gl_PointSize";
+ actions.renames["POINT_SIZE"] = "point_size";
actions.renames["MODEL_MATRIX"] = "model_matrix";
actions.renames["CANVAS_MATRIX"] = "canvas_transform";
@@ -1574,7 +1591,7 @@ MaterialStorage::MaterialStorage() {
actions.renames["UV"] = "uv_interp";
actions.renames["UV2"] = "uv2_interp";
actions.renames["COLOR"] = "color_interp";
- actions.renames["POINT_SIZE"] = "gl_PointSize";
+ actions.renames["POINT_SIZE"] = "point_size";
actions.renames["INSTANCE_ID"] = "gl_InstanceID";
actions.renames["VERTEX_ID"] = "gl_VertexID";
@@ -1721,7 +1738,7 @@ MaterialStorage::MaterialStorage() {
actions.default_filter = ShaderLanguage::FILTER_LINEAR_MIPMAP;
actions.default_repeat = ShaderLanguage::REPEAT_ENABLE;
- actions.check_multiview_samplers = true;
+ actions.check_multiview_samplers = RasterizerGLES3::get_singleton()->is_xr_enabled();
actions.global_buffer_array_variable = "global_shader_uniforms";
shaders.compiler_scene.initialize(actions);
@@ -2881,6 +2898,7 @@ void MaterialStorage::material_set_render_priority(RID p_material, int priority)
if (material->data) {
material->data->set_render_priority(priority);
}
+ material->dependency.changed_notify(Dependency::DEPENDENCY_CHANGED_MATERIAL);
}
bool MaterialStorage::material_is_animated(RID p_material) {
@@ -3059,8 +3077,8 @@ void CanvasMaterialData::bind_uniforms() {
texture->render_target->used_in_frame = true;
}
- texture->gl_set_filter(filter_from_uniform[int(texture_uniforms[ti].filter)]);
- texture->gl_set_repeat(repeat_from_uniform[int(texture_uniforms[ti].repeat)]);
+ texture->gl_set_filter(filter_from_uniform_canvas[int(texture_uniforms[ti].filter)]);
+ texture->gl_set_repeat(repeat_from_uniform_canvas[int(texture_uniforms[ti].repeat)]);
}
}
@@ -3371,6 +3389,32 @@ void SceneShaderData::set_code(const String &p_code) {
uses_vertex_time = gen_code.uses_vertex_time;
uses_fragment_time = gen_code.uses_fragment_time;
+#ifdef DEBUG_ENABLED
+ if (uses_particle_trails) {
+ WARN_PRINT_ONCE_ED("Particle trails are only available when using the Forward+ or Mobile rendering backends.");
+ }
+
+ if (uses_sss) {
+ WARN_PRINT_ONCE_ED("Sub-surface scattering is only available when using the Forward+ rendering backend.");
+ }
+
+ if (uses_transmittance) {
+ WARN_PRINT_ONCE_ED("Transmittance is only available when using the Forward+ rendering backend.");
+ }
+
+ if (uses_screen_texture) {
+ WARN_PRINT_ONCE_ED("Reading from the screen texture is not supported when using the GL Compatibility backend yet. Support will be added in a future release.");
+ }
+
+ if (uses_depth_texture) {
+ WARN_PRINT_ONCE_ED("Reading from the depth texture is not supported when using the GL Compatibility backend yet. Support will be added in a future release.");
+ }
+
+ if (uses_normal_texture) {
+ WARN_PRINT_ONCE_ED("Reading from the normal-roughness texture is only available when using the Forward+ or Mobile rendering backends.");
+ }
+#endif
+
#if 0
print_line("**compiling shader:");
print_line("**defines:\n");
diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp
index 36b34dd8a2..44c9dc714c 100644
--- a/drivers/gles3/storage/mesh_storage.cpp
+++ b/drivers/gles3/storage/mesh_storage.cpp
@@ -327,6 +327,7 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
} else {
mesh->aabb.merge_with(p_surface.aabb);
}
+ mesh->skeleton_aabb_version = 0;
s->material = p_surface.material;
@@ -541,12 +542,12 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
Transform3D mtx;
- mtx.basis.rows[0].x = dataptr[0];
- mtx.basis.rows[1].x = dataptr[1];
+ mtx.basis.rows[0][0] = dataptr[0];
+ mtx.basis.rows[0][1] = dataptr[1];
mtx.origin.x = dataptr[3];
- mtx.basis.rows[0].y = dataptr[4];
- mtx.basis.rows[1].y = dataptr[5];
+ mtx.basis.rows[1][0] = dataptr[4];
+ mtx.basis.rows[1][1] = dataptr[5];
mtx.origin.y = dataptr[7];
AABB baabb = mtx.xform(skbones[j]);
@@ -1438,12 +1439,12 @@ void MeshStorage::_multimesh_re_create_aabb(MultiMesh *multimesh, const float *p
t.origin.z = data[11];
} else {
- t.basis.rows[0].x = data[0];
- t.basis.rows[1].x = data[1];
+ t.basis.rows[0][0] = data[0];
+ t.basis.rows[0][1] = data[1];
t.origin.x = data[3];
- t.basis.rows[0].y = data[4];
- t.basis.rows[1].y = data[5];
+ t.basis.rows[1][0] = data[4];
+ t.basis.rows[1][1] = data[5];
t.origin.y = data[7];
}
@@ -1686,6 +1687,8 @@ void MeshStorage::multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_b
uint32_t old_stride = multimesh->xform_format == RS::MULTIMESH_TRANSFORM_2D ? 8 : 12;
old_stride += multimesh->uses_colors ? 4 : 0;
old_stride += multimesh->uses_custom_data ? 4 : 0;
+ ERR_FAIL_COND(p_buffer.size() != (multimesh->instances * (int)old_stride));
+
for (int i = 0; i < multimesh->instances; i++) {
{
float *dataptr = w + i * old_stride;
diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp
index 9c9c39cc0e..b4dea0dfe2 100644
--- a/drivers/gles3/storage/texture_storage.cpp
+++ b/drivers/gles3/storage/texture_storage.cpp
@@ -806,6 +806,7 @@ void TextureStorage::texture_2d_update(RID p_texture, const Ref<Image> &p_image,
texture_set_data(p_texture, p_image, p_layer);
#ifdef TOOLS_ENABLED
Texture *tex = texture_owner.get_or_null(p_texture);
+ ERR_FAIL_COND(!tex);
tex->image_cache_2d.unref();
#endif
@@ -831,6 +832,8 @@ void TextureStorage::texture_proxy_update(RID p_texture, RID p_proxy_to) {
tex->is_render_target = false;
tex->is_proxy = true;
tex->proxies.clear();
+ tex->canvas_texture = nullptr;
+ tex->tex_id = 0;
proxy_to->proxies.push_back(p_texture);
}
@@ -1133,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();
}
diff --git a/drivers/gles3/storage/texture_storage.h b/drivers/gles3/storage/texture_storage.h
index fedda6b260..c702904648 100644
--- a/drivers/gles3/storage/texture_storage.h
+++ b/drivers/gles3/storage/texture_storage.h
@@ -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);
diff --git a/drivers/pulseaudio/SCsub b/drivers/pulseaudio/SCsub
index 467d1448dc..f48489d787 100644
--- a/drivers/pulseaudio/SCsub
+++ b/drivers/pulseaudio/SCsub
@@ -3,6 +3,7 @@
Import("env")
if "pulseaudio" in env and env["pulseaudio"]:
- env.add_source_files(env.drivers_sources, "pulse-so_wrap.c")
+ if env["use_sowrap"]:
+ env.add_source_files(env.drivers_sources, "pulse-so_wrap.c")
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index 0246af4fea..797ffd67fe 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -37,7 +37,11 @@
#include "core/version.h"
#ifdef ALSAMIDI_ENABLED
+#ifdef SOWRAP_ENABLED
#include "drivers/alsa/asound-so_wrap.h"
+#else
+#include <alsa/asoundlib.h>
+#endif
#endif
void AudioDriverPulseAudio::pa_state_cb(pa_context *c, void *userdata) {
@@ -272,6 +276,7 @@ Error AudioDriverPulseAudio::init_output_device() {
}
Error AudioDriverPulseAudio::init() {
+#ifdef SOWRAP_ENABLED
#ifdef DEBUG_ENABLED
int dylibloader_verbose = 1;
#else
@@ -284,7 +289,7 @@ Error AudioDriverPulseAudio::init() {
if (initialize_pulse(dylibloader_verbose)) {
return ERR_CANT_OPEN;
}
-
+#endif
active.clear();
exit_thread.clear();
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.h b/drivers/pulseaudio/audio_driver_pulseaudio.h
index f4ff44d361..585e882059 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.h
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.h
@@ -38,7 +38,11 @@
#include "core/templates/safe_refcount.h"
#include "servers/audio_server.h"
+#ifdef SOWRAP_ENABLED
#include "pulse-so_wrap.h"
+#else
+#include <pulse/pulseaudio.h>
+#endif
class AudioDriverPulseAudio : public AudioDriver {
Thread thread;
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 43d3f53904..ee3cb876cf 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -318,6 +318,10 @@ Error FileAccessUnix::_set_unix_permissions(const String &p_file, uint32_t p_per
return FAILED;
}
+void FileAccessUnix::close() {
+ _close();
+}
+
CloseNotificationFunc FileAccessUnix::close_notification_func = nullptr;
FileAccessUnix::~FileAccessUnix() {
diff --git a/drivers/unix/file_access_unix.h b/drivers/unix/file_access_unix.h
index 884fb9567f..79c4e73636 100644
--- a/drivers/unix/file_access_unix.h
+++ b/drivers/unix/file_access_unix.h
@@ -82,6 +82,8 @@ public:
virtual uint32_t _get_unix_permissions(const String &p_file) override;
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) override;
+ virtual void close() override;
+
FileAccessUnix() {}
virtual ~FileAccessUnix();
};
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index 327f067e65..2166d12d31 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -2530,7 +2530,7 @@ Error RenderingDeviceVulkan::_texture_update(RID p_texture, uint32_t p_layer, co
for (uint32_t z = 0; z < depth; z++) { // For 3D textures, depth may be > 0.
- const uint8_t *read_ptr = read_ptr_mipmap + image_size * z / depth;
+ const uint8_t *read_ptr = read_ptr_mipmap + (image_size / depth) * z;
for (uint32_t y = 0; y < height; y += region_size) {
for (uint32_t x = 0; x < width; x += region_size) {
@@ -8462,14 +8462,17 @@ void RenderingDeviceVulkan::set_resource_name(RID p_id, const String p_name) {
}
void RenderingDeviceVulkan::draw_command_begin_label(String p_label_name, const Color p_color) {
+ _THREAD_SAFE_METHOD_
context->command_begin_label(frames[frame].draw_command_buffer, p_label_name, p_color);
}
void RenderingDeviceVulkan::draw_command_insert_label(String p_label_name, const Color p_color) {
+ _THREAD_SAFE_METHOD_
context->command_insert_label(frames[frame].draw_command_buffer, p_label_name, p_color);
}
void RenderingDeviceVulkan::draw_command_end_label() {
+ _THREAD_SAFE_METHOD_
context->command_end_label(frames[frame].draw_command_buffer);
}
diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index 179de8227a..f185a5cb88 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -101,6 +101,7 @@ VkResult VulkanContext::vkCreateRenderPass2KHR(VkDevice p_device, const VkRender
attachments.push_back(att);
}
+ Vector<Vector<VkAttachmentReference>> attachment_references;
Vector<VkSubpassDescription> subpasses;
for (uint32_t i = 0; i < p_create_info->subpassCount; i++) {
// Here we need to do more, again it's just stripping out type and next
@@ -124,6 +125,10 @@ VkResult VulkanContext::vkCreateRenderPass2KHR(VkDevice p_device, const VkRender
p_create_info->pSubpasses[i].preserveAttachmentCount, /* preserveAttachmentCount */
p_create_info->pSubpasses[i].pPreserveAttachments /* pPreserveAttachments */
};
+ attachment_references.push_back(input_attachments);
+ attachment_references.push_back(color_attachments);
+ attachment_references.push_back(resolve_attachments);
+ attachment_references.push_back(depth_attachments);
subpasses.push_back(subpass);
}
@@ -1871,7 +1876,10 @@ Error VulkanContext::_update_swap_chain(Window *window) {
// Set the windows present mode if it is available, otherwise FIFO is used (guaranteed supported).
if (present_mode_available) {
- window->presentMode = requested_present_mode;
+ if (window->presentMode != requested_present_mode) {
+ window->presentMode = requested_present_mode;
+ print_verbose("Using present mode: " + String(string_VkPresentModeKHR(window->presentMode)));
+ }
} else {
String present_mode_string;
switch (window->vsync_mode) {
@@ -1892,8 +1900,6 @@ Error VulkanContext::_update_swap_chain(Window *window) {
window->vsync_mode = DisplayServer::VSYNC_ENABLED; // Set to default.
}
- print_verbose("Using present mode: " + String(string_VkPresentModeKHR(window->presentMode)));
-
free(presentModes);
// Determine the number of VkImages to use in the swap chain.
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index ea40622afc..0e51586b5a 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -375,6 +375,10 @@ Error FileAccessWindows::_set_unix_permissions(const String &p_file, uint32_t p_
return ERR_UNAVAILABLE;
}
+void FileAccessWindows::close() {
+ _close();
+}
+
FileAccessWindows::~FileAccessWindows() {
_close();
}
@@ -391,6 +395,7 @@ void FileAccessWindows::initialize() {
reserved_file_index++;
}
}
+
void FileAccessWindows::finalize() {
invalid_files.clear();
}
diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h
index 2b9960d494..453f8d3b5f 100644
--- a/drivers/windows/file_access_windows.h
+++ b/drivers/windows/file_access_windows.h
@@ -82,6 +82,8 @@ public:
virtual uint32_t _get_unix_permissions(const String &p_file) override;
virtual Error _set_unix_permissions(const String &p_file, uint32_t p_permissions) override;
+ virtual void close() override;
+
static void initialize();
static void finalize();