Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,
leading to unnecesary copy on writes and reduced performance.
This commit is contained in:
@ -68,7 +68,7 @@ void AudioEffectChorusInstance::_process_chunk(const AudioFrame *p_src_frames, A
|
||||
|
||||
unsigned int local_rb_pos = buffer_pos;
|
||||
AudioFrame *dst_buff = p_dst_frames;
|
||||
AudioFrame *rb_buff = audio_buffer.ptr();
|
||||
AudioFrame *rb_buff = audio_buffer.ptrw();
|
||||
|
||||
double delay_msec = v.delay;
|
||||
unsigned int delay_frames = Math::fast_ftoi((delay_msec / 1000.0) * mix_rate);
|
||||
|
||||
@ -82,8 +82,8 @@ void AudioEffectDelayInstance::_process_chunk(const AudioFrame *p_src_frames, Au
|
||||
|
||||
const AudioFrame *src = p_src_frames;
|
||||
AudioFrame *dst = p_dst_frames;
|
||||
AudioFrame *rb_buf = ring_buffer.ptr();
|
||||
AudioFrame *fb_buf = feedback_buffer.ptr();
|
||||
AudioFrame *rb_buf = ring_buffer.ptrw();
|
||||
AudioFrame *fb_buf = feedback_buffer.ptrw();
|
||||
|
||||
for (int i = 0; i < p_frame_count; i++) {
|
||||
|
||||
|
||||
@ -33,9 +33,9 @@
|
||||
void AudioEffectEQInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
|
||||
|
||||
int band_count = bands[0].size();
|
||||
EQ::BandProcess *proc_l = bands[0].ptr();
|
||||
EQ::BandProcess *proc_r = bands[1].ptr();
|
||||
float *bgain = gains.ptr();
|
||||
EQ::BandProcess *proc_l = bands[0].ptrw();
|
||||
EQ::BandProcess *proc_r = bands[1].ptrw();
|
||||
float *bgain = gains.ptrw();
|
||||
for (int i = 0; i < band_count; i++) {
|
||||
bgain[i] = Math::db2linear(base->gain[i]);
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ void AudioServer::_driver_process(int p_frames, int32_t *p_buffer) {
|
||||
|
||||
if (master->channels[k].active) {
|
||||
|
||||
AudioFrame *buf = master->channels[k].buffer.ptr();
|
||||
const AudioFrame *buf = master->channels[k].buffer.ptr();
|
||||
|
||||
for (int j = 0; j < to_copy; j++) {
|
||||
|
||||
@ -296,7 +296,7 @@ void AudioServer::_mix_step() {
|
||||
|
||||
if (bus->channels[k].active && !bus->channels[k].used) {
|
||||
//buffer was not used, but it's still active, so it must be cleaned
|
||||
AudioFrame *buf = bus->channels[k].buffer.ptr();
|
||||
AudioFrame *buf = bus->channels[k].buffer.ptrw();
|
||||
|
||||
for (uint32_t j = 0; j < buffer_size; j++) {
|
||||
|
||||
@ -316,7 +316,7 @@ void AudioServer::_mix_step() {
|
||||
|
||||
if (!bus->channels[k].active)
|
||||
continue;
|
||||
bus->channels[k].effect_instances[j]->process(bus->channels[k].buffer.ptr(), temp_buffer[k].ptr(), buffer_size);
|
||||
bus->channels[k].effect_instances[j]->process(bus->channels[k].buffer.ptr(), temp_buffer[k].ptrw(), buffer_size);
|
||||
}
|
||||
|
||||
//swap buffers, so internal buffer always has the right data
|
||||
@ -350,7 +350,7 @@ void AudioServer::_mix_step() {
|
||||
if (!bus->channels[k].active)
|
||||
continue;
|
||||
|
||||
AudioFrame *buf = bus->channels[k].buffer.ptr();
|
||||
AudioFrame *buf = bus->channels[k].buffer.ptrw();
|
||||
|
||||
AudioFrame peak = AudioFrame(0, 0);
|
||||
|
||||
@ -414,7 +414,7 @@ AudioFrame *AudioServer::thread_get_channel_mix_buffer(int p_bus, int p_buffer)
|
||||
ERR_FAIL_INDEX_V(p_bus, buses.size(), NULL);
|
||||
ERR_FAIL_INDEX_V(p_buffer, buses[p_bus]->channels.size(), NULL);
|
||||
|
||||
AudioFrame *data = buses[p_bus]->channels[p_buffer].buffer.ptr();
|
||||
AudioFrame *data = buses[p_bus]->channels[p_buffer].buffer.ptrw();
|
||||
|
||||
if (!buses[p_bus]->channels[p_buffer].used) {
|
||||
buses[p_bus]->channels[p_buffer].used = true;
|
||||
|
||||
@ -239,7 +239,7 @@ Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryP
|
||||
|
||||
Vector<ShapeResult> sr;
|
||||
sr.resize(p_max_results);
|
||||
int rc = intersect_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, sr.ptr(), sr.size(), p_shape_query->exclude, p_shape_query->collision_mask);
|
||||
int rc = intersect_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, sr.ptrw(), sr.size(), p_shape_query->exclude, p_shape_query->collision_mask);
|
||||
Array ret;
|
||||
ret.resize(rc);
|
||||
for (int i = 0; i < rc; i++) {
|
||||
@ -278,7 +278,7 @@ Array Physics2DDirectSpaceState::_intersect_point(const Vector2 &p_point, int p_
|
||||
Vector<ShapeResult> ret;
|
||||
ret.resize(p_max_results);
|
||||
|
||||
int rc = intersect_point(p_point, ret.ptr(), ret.size(), exclude, p_layers);
|
||||
int rc = intersect_point(p_point, ret.ptrw(), ret.size(), exclude, p_layers);
|
||||
if (rc == 0)
|
||||
return Array();
|
||||
|
||||
@ -302,7 +302,7 @@ Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryPar
|
||||
Vector<Vector2> ret;
|
||||
ret.resize(p_max_results * 2);
|
||||
int rc = 0;
|
||||
bool res = collide_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, ret.ptr(), p_max_results, rc, p_shape_query->exclude, p_shape_query->collision_mask);
|
||||
bool res = collide_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->motion, p_shape_query->margin, ret.ptrw(), p_max_results, rc, p_shape_query->exclude, p_shape_query->collision_mask);
|
||||
if (!res)
|
||||
return Array();
|
||||
Array r;
|
||||
|
||||
@ -264,7 +264,7 @@ Array PhysicsDirectSpaceState::_intersect_shape(const Ref<PhysicsShapeQueryParam
|
||||
|
||||
Vector<ShapeResult> sr;
|
||||
sr.resize(p_max_results);
|
||||
int rc = intersect_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, sr.ptr(), sr.size(), p_shape_query->exclude, p_shape_query->collision_mask);
|
||||
int rc = intersect_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, sr.ptrw(), sr.size(), p_shape_query->exclude, p_shape_query->collision_mask);
|
||||
Array ret;
|
||||
ret.resize(rc);
|
||||
for (int i = 0; i < rc; i++) {
|
||||
@ -297,7 +297,7 @@ Array PhysicsDirectSpaceState::_collide_shape(const Ref<PhysicsShapeQueryParamet
|
||||
Vector<Vector3> ret;
|
||||
ret.resize(p_max_results * 2);
|
||||
int rc = 0;
|
||||
bool res = collide_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, ret.ptr(), p_max_results, rc, p_shape_query->exclude, p_shape_query->collision_mask);
|
||||
bool res = collide_shape(p_shape_query->shape, p_shape_query->transform, p_shape_query->margin, ret.ptrw(), p_max_results, rc, p_shape_query->exclude, p_shape_query->collision_mask);
|
||||
if (!res)
|
||||
return Array();
|
||||
Array r;
|
||||
|
||||
@ -3606,7 +3606,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
|
||||
|
||||
uniform.default_value.resize(cn->values.size());
|
||||
|
||||
if (!convert_constant(cn, uniform.type, uniform.default_value.ptr())) {
|
||||
if (!convert_constant(cn, uniform.type, uniform.default_value.ptrw())) {
|
||||
_set_error("Can't convert constant to " + get_datatype_name(uniform.type));
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ void VisualServerCanvas::render_canvas(Canvas *p_canvas, const Transform2D &p_tr
|
||||
}
|
||||
|
||||
int l = p_canvas->child_items.size();
|
||||
Canvas::ChildItem *ci = p_canvas->child_items.ptr();
|
||||
Canvas::ChildItem *ci = p_canvas->child_items.ptrw();
|
||||
|
||||
bool has_mirror = false;
|
||||
for (int i = 0; i < l; i++) {
|
||||
|
||||
@ -597,7 +597,7 @@ void VisualServerScene::instance_set_custom_aabb(RID p_instance, AABB p_aabb) {
|
||||
ERR_FAIL_COND(!instance);
|
||||
ERR_FAIL_COND(!is_geometry_instance(instance->base_type));
|
||||
|
||||
if(p_aabb != AABB()) {
|
||||
if (p_aabb != AABB()) {
|
||||
|
||||
// Set custom AABB
|
||||
if (instance->custom_aabb == NULL)
|
||||
@ -1855,7 +1855,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) {
|
||||
|
||||
probe->dynamic.level_cell_lists.resize(header->cell_subdiv);
|
||||
|
||||
_gi_probe_fill_local_data(0, 0, 0, 0, 0, cells, header, ldw.ptr(), probe->dynamic.level_cell_lists.ptr());
|
||||
_gi_probe_fill_local_data(0, 0, 0, 0, 0, cells, header, ldw.ptr(), probe->dynamic.level_cell_lists.ptrw());
|
||||
|
||||
bool compress = VSG::storage->gi_probe_is_compressed(p_instance->base);
|
||||
|
||||
|
||||
@ -728,7 +728,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
|
||||
PoolVector<int>::Read rb = bones.read();
|
||||
PoolVector<float>::Read rw = weights.read();
|
||||
|
||||
AABB *bptr = r_bone_aabb.ptr();
|
||||
AABB *bptr = r_bone_aabb.ptrw();
|
||||
|
||||
for (int i = 0; i < vs; i++) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user