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:
Juan Linietsky 2017-11-25 00:07:54 -03:00
parent 7dfba3cda9
commit bc2e8d99e5
62 changed files with 148 additions and 147 deletions

View file

@ -261,7 +261,7 @@ Array &Array::sort_custom(Object *p_obj, const StringName &p_function) {
SortArray<Variant, _ArrayVariantSortCustom> avs;
avs.compare.obj = p_obj;
avs.compare.func = p_function;
avs.sort(_p->array.ptr(), _p->array.size());
avs.sort(_p->array.ptrw(), _p->array.size());
return *this;
}

View file

@ -288,7 +288,7 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const {
CharString uncomp;
uncomp.resize(bucket.elem[idx].uncomp_size + 1);
smaz_decompress(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].comp_size, uncomp.ptr(), bucket.elem[idx].uncomp_size);
smaz_decompress(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].comp_size, uncomp.ptrw(), bucket.elem[idx].uncomp_size);
String rstr;
rstr.parse_utf8(uncomp.get_data());
//print_line("Compressed, size: "+itos(bucket.elem[idx].comp_size));

View file

@ -51,7 +51,7 @@ void FileAccessCompressed::configure(const String &p_magic, Compression::Mode p_
if (write_max > write_buffer_size) { \
write_buffer_size = next_power_of_2(write_max); \
buffer.resize(write_buffer_size); \
write_ptr = buffer.ptr(); \
write_ptr = buffer.ptrw(); \
} \
}
@ -76,14 +76,14 @@ Error FileAccessCompressed::open_after_magic(FileAccess *p_base) {
comp_buffer.resize(max_bs);
buffer.resize(block_size);
read_ptr = buffer.ptr();
f->get_buffer(comp_buffer.ptr(), read_blocks[0].csize);
read_ptr = buffer.ptrw();
f->get_buffer(comp_buffer.ptrw(), read_blocks[0].csize);
at_end = false;
read_eof = false;
read_block_count = bc;
read_block_size = read_blocks.size() == 1 ? read_total : block_size;
Compression::decompress(buffer.ptr(), read_block_size, comp_buffer.ptr(), read_blocks[0].csize, cmode);
Compression::decompress(buffer.ptrw(), read_block_size, comp_buffer.ptr(), read_blocks[0].csize, cmode);
read_block = 0;
read_pos = 0;
@ -114,7 +114,7 @@ Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) {
write_buffer_size = 256;
buffer.resize(256);
write_max = 0;
write_ptr = buffer.ptr();
write_ptr = buffer.ptrw();
//don't store anything else unless it's done saving!
} else {
@ -160,7 +160,7 @@ void FileAccessCompressed::close() {
Vector<uint8_t> cblock;
cblock.resize(Compression::get_max_compressed_buffer_size(bl, cmode));
int s = Compression::compress(cblock.ptr(), bp, bl, cmode);
int s = Compression::compress(cblock.ptrw(), bp, bl, cmode);
f->store_buffer(cblock.ptr(), s);
block_sizes.push_back(s);
@ -211,8 +211,8 @@ void FileAccessCompressed::seek(size_t p_position) {
read_block = block_idx;
f->seek(read_blocks[read_block].offset);
f->get_buffer(comp_buffer.ptr(), read_blocks[read_block].csize);
Compression::decompress(buffer.ptr(), read_blocks.size() == 1 ? read_total : block_size, comp_buffer.ptr(), read_blocks[read_block].csize, cmode);
f->get_buffer(comp_buffer.ptrw(), read_blocks[read_block].csize);
Compression::decompress(buffer.ptrw(), read_blocks.size() == 1 ? read_total : block_size, comp_buffer.ptr(), read_blocks[read_block].csize, cmode);
read_block_size = read_block == read_block_count - 1 ? read_total % block_size : block_size;
}
@ -282,8 +282,8 @@ uint8_t FileAccessCompressed::get_8() const {
if (read_block < read_block_count) {
//read another block of compressed data
f->get_buffer(comp_buffer.ptr(), read_blocks[read_block].csize);
Compression::decompress(buffer.ptr(), read_blocks.size() == 1 ? read_total : block_size, comp_buffer.ptr(), read_blocks[read_block].csize, cmode);
f->get_buffer(comp_buffer.ptrw(), read_blocks[read_block].csize);
Compression::decompress(buffer.ptrw(), read_blocks.size() == 1 ? read_total : block_size, comp_buffer.ptr(), read_blocks[read_block].csize, cmode);
read_block_size = read_block == read_block_count - 1 ? read_total % block_size : block_size;
read_pos = 0;
@ -315,8 +315,8 @@ int FileAccessCompressed::get_buffer(uint8_t *p_dst, int p_length) const {
if (read_block < read_block_count) {
//read another block of compressed data
f->get_buffer(comp_buffer.ptr(), read_blocks[read_block].csize);
Compression::decompress(buffer.ptr(), read_blocks.size() == 1 ? read_total : block_size, comp_buffer.ptr(), read_blocks[read_block].csize, cmode);
f->get_buffer(comp_buffer.ptrw(), read_blocks[read_block].csize);
Compression::decompress(buffer.ptrw(), read_blocks.size() == 1 ? read_total : block_size, comp_buffer.ptr(), read_blocks[read_block].csize, cmode);
read_block_size = read_block == read_block_count - 1 ? read_total % block_size : block_size;
read_pos = 0;

View file

@ -80,11 +80,11 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8
data.resize(ds);
uint32_t blen = p_base->get_buffer(data.ptr(), ds);
uint32_t blen = p_base->get_buffer(data.ptrw(), ds);
ERR_FAIL_COND_V(blen != ds, ERR_FILE_CORRUPT);
aes256_context ctx;
aes256_init(&ctx, key.ptr());
aes256_init(&ctx, key.ptrw());
for (size_t i = 0; i < ds; i += 16) {
@ -97,7 +97,7 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8
MD5_CTX md5;
MD5Init(&md5);
MD5Update(&md5, data.ptr(), data.size());
MD5Update(&md5, (uint8_t *)data.ptr(), data.size());
MD5Final(&md5);
ERR_FAIL_COND_V(String::md5(md5.digest) != String::md5(md5d), ERR_FILE_CORRUPT);
@ -141,17 +141,17 @@ void FileAccessEncrypted::close() {
MD5_CTX md5;
MD5Init(&md5);
MD5Update(&md5, data.ptr(), data.size());
MD5Update(&md5, (uint8_t *)data.ptr(), data.size());
MD5Final(&md5);
compressed.resize(len);
zeromem(compressed.ptr(), len);
zeromem(compressed.ptrw(), len);
for (int i = 0; i < data.size(); i++) {
compressed[i] = data[i];
}
aes256_context ctx;
aes256_init(&ctx, key.ptr());
aes256_init(&ctx, key.ptrw());
for (size_t i = 0; i < len; i += 16) {

View file

@ -147,7 +147,7 @@ void FileAccessNetworkClient::_thread_func() {
Vector<uint8_t> block;
block.resize(len);
client->get_data(block.ptr(), len);
client->get_data(block.ptrw(), len);
if (fa) //may have been queued
fa->_set_block(offset, block);
@ -434,12 +434,12 @@ int FileAccessNetwork::get_buffer(uint8_t *p_dst, int p_length) const {
_queue_page(page + j);
}
buff = pages[page].buffer.ptr();
buff = pages[page].buffer.ptrw();
//queue pages
buffer_mutex->unlock();
}
buff = pages[page].buffer.ptr();
buff = pages[page].buffer.ptrw();
last_page_buff = buff;
last_page = page;
}

View file

@ -220,7 +220,7 @@ void StreamPeer::put_var(const Variant &p_variant) {
encode_variant(p_variant, NULL, len);
buf.resize(len);
put_32(len);
encode_variant(p_variant, buf.ptr(), len);
encode_variant(p_variant, buf.ptrw(), len);
put_data(buf.ptr(), buf.size());
}
@ -340,7 +340,7 @@ String StreamPeer::get_utf8_string(int p_bytes) {
Vector<uint8_t> buf;
Error err = buf.resize(p_bytes);
ERR_FAIL_COND_V(err != OK, String());
err = get_data(buf.ptr(), p_bytes);
err = get_data(buf.ptrw(), p_bytes);
ERR_FAIL_COND_V(err != OK, String());
String ret;
@ -353,7 +353,7 @@ Variant StreamPeer::get_var() {
Vector<uint8_t> var;
Error err = var.resize(len);
ERR_FAIL_COND_V(err != OK, Variant());
err = get_data(var.ptr(), len);
err = get_data(var.ptrw(), len);
ERR_FAIL_COND_V(err != OK, Variant());
Variant ret;

View file

@ -818,7 +818,7 @@ Variant Object::callv(const StringName &p_method, const Array &p_args) {
}
Variant::CallError ce;
return call(p_method, argptrs.ptr(), p_args.size(), ce);
return call(p_method, (const Variant **)argptrs.ptr(), p_args.size(), ce);
}
Variant Object::call(const StringName &p_name, VARIANT_ARG_DECLARE) {
@ -1183,7 +1183,7 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int
bind_mem[p_argcount + j] = &c.binds[j];
}
args = bind_mem.ptr();
args = (const Variant **)bind_mem.ptr();
argc = bind_mem.size();
}

View file

@ -481,7 +481,7 @@ Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path) {
ERR_FAIL_COND_V(!f, Vector<uint8_t>());
Vector<uint8_t> data;
data.resize(f->get_len());
f->get_buffer(data.ptr(), data.size());
f->get_buffer(data.ptrw(), data.size());
memdelete(f);
return data;
}

View file

@ -429,7 +429,7 @@ Error ProjectSettings::_load_settings_binary(const String p_path) {
uint32_t vlen = f->get_32();
Vector<uint8_t> d;
d.resize(vlen);
f->get_buffer(d.ptr(), vlen);
f->get_buffer(d.ptrw(), vlen);
Variant value;
Error err = decode_variant(value, d.ptr(), d.size());
ERR_EXPLAIN("Error decoding property: " + key);

View file

@ -212,7 +212,7 @@ void ScriptDebuggerLocal::idle_poll() {
}
SortArray<ScriptLanguage::ProfilingInfo, _ScriptDebuggerLocalProfileInfoSort> sort;
sort.sort(pinfo.ptr(), ofs);
sort.sort(pinfo.ptrw(), ofs);
//falta el frame time
@ -264,7 +264,7 @@ void ScriptDebuggerLocal::profiling_end() {
}
SortArray<ScriptLanguage::ProfilingInfo, _ScriptDebuggerLocalProfileInfoSort> sort;
sort.sort(pinfo.ptr(), ofs);
sort.sort(pinfo.ptrw(), ofs);
uint64_t total_us = 0;
for (int i = 0; i < ofs; i++) {

View file

@ -749,7 +749,7 @@ void ScriptDebuggerRemote::_send_profiling_data(bool p_for_frame) {
}
SortArray<ScriptLanguage::ProfilingInfo *, ProfileInfoSort> sa;
sa.sort(profile_info_ptrs.ptr(), ofs);
sa.sort(profile_info_ptrs.ptrw(), ofs);
int to_send = MIN(ofs, max_frame_functions);

View file

@ -71,7 +71,7 @@ StringBuffer &StringBuffer::reserve(int p_size) {
bool need_copy = string_length > 0 && buffer.empty();
buffer.resize(next_power_of_2(p_size));
if (need_copy) {
memcpy(buffer.ptr(), short_buffer, string_length * sizeof(CharType));
memcpy(buffer.ptrw(), short_buffer, string_length * sizeof(CharType));
}
return *this;

View file

@ -40,7 +40,7 @@ class StringBuffer {
int string_length = 0;
_FORCE_INLINE_ CharType *current_buffer_ptr() {
return static_cast<Vector<CharType> &>(buffer).empty() ? short_buffer : buffer.ptr();
return static_cast<Vector<CharType> &>(buffer).empty() ? short_buffer : buffer.ptrw();
}
public:

View file

@ -115,7 +115,7 @@ void String::copy_from(const char *p_cstr) {
resize(len + 1); // include 0
CharType *dst = this->ptr();
CharType *dst = this->ptrw();
for (int i = 0; i < len + 1; i++) {
@ -1119,7 +1119,7 @@ String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
chars++;
String s;
s.resize(chars + 1);
CharType *c = s.ptr();
CharType *c = s.ptrw();
c[chars] = 0;
n = num;
do {

View file

@ -499,7 +499,7 @@ struct _VariantCall {
PoolByteArray::Read r = ba->read();
CharString cs;
cs.resize(ba->size() + 1);
copymem(cs.ptr(), r.ptr(), ba->size());
copymem(cs.ptrw(), r.ptr(), ba->size());
cs[ba->size()] = 0;
s = cs.get_data();

View file

@ -96,7 +96,7 @@ class Vector {
void _copy_on_write();
public:
_FORCE_INLINE_ T *ptr() {
_FORCE_INLINE_ T *ptrw() {
if (!_ptr) return NULL;
_copy_on_write();
return (T *)_get_data();
@ -361,7 +361,7 @@ template <class T>
void Vector<T>::remove(int p_index) {
ERR_FAIL_INDEX(p_index, size());
T *p = ptr();
T *p = ptrw();
int len = size();
for (int i = p_index; i < len - 1; i++) {

View file

@ -449,7 +449,7 @@ void RasterizerCanvasGLES3::_draw_gui_primitive(int p_points, const Vector2 *p_v
void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *current_clip, bool &reclip) {
int cc = p_item->commands.size();
Item::Command **commands = p_item->commands.ptr();
Item::Command **commands = p_item->commands.ptrw();
for (int i = 0; i < cc; i++) {
@ -1084,8 +1084,8 @@ void RasterizerCanvasGLES3::canvas_render_items(Item *p_item_list, int p_z, cons
}
int tc = material_ptr->textures.size();
RID *textures = material_ptr->textures.ptr();
ShaderLanguage::ShaderNode::Uniform::Hint *texture_hints = shader_ptr->texture_hints.ptr();
RID *textures = material_ptr->textures.ptrw();
ShaderLanguage::ShaderNode::Uniform::Hint *texture_hints = shader_ptr->texture_hints.ptrw();
for (int i = 0; i < tc; i++) {

View file

@ -254,7 +254,7 @@ bool RasterizerSceneGLES3::_shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas,
//look for an empty space
int sc = shadow_atlas->quadrants[qidx].shadows.size();
ShadowAtlas::Quadrant::Shadow *sarr = shadow_atlas->quadrants[qidx].shadows.ptr();
ShadowAtlas::Quadrant::Shadow *sarr = shadow_atlas->quadrants[qidx].shadows.ptrw();
int found_free_idx = -1; //found a free one
int found_used_idx = -1; //found existing one, must steal it
@ -1198,8 +1198,8 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material *p_m
}
int tc = p_material->textures.size();
RID *textures = p_material->textures.ptr();
ShaderLanguage::ShaderNode::Uniform::Hint *texture_hints = p_material->shader->texture_hints.ptr();
RID *textures = p_material->textures.ptrw();
ShaderLanguage::ShaderNode::Uniform::Hint *texture_hints = p_material->shader->texture_hints.ptrw();
state.current_main_tex = 0;

View file

@ -3477,7 +3477,7 @@ void RasterizerStorageGLES3::mesh_clear(RID p_mesh) {
}
}
void RasterizerStorageGLES3::mesh_render_blend_shapes(Surface *s, float *p_weights) {
void RasterizerStorageGLES3::mesh_render_blend_shapes(Surface *s, const float *p_weights) {
glBindVertexArray(s->array_id);
@ -4063,7 +4063,7 @@ void RasterizerStorageGLES3::update_dirty_multimeshes() {
int stride = multimesh->color_floats + multimesh->xform_floats;
int count = multimesh->data.size();
float *data = multimesh->data.ptr();
float *data = multimesh->data.ptrw();
AABB aabb;
@ -4327,7 +4327,7 @@ void RasterizerStorageGLES3::skeleton_bone_set_transform(RID p_skeleton, int p_b
ERR_FAIL_INDEX(p_bone, skeleton->size);
ERR_FAIL_COND(skeleton->use_2d);
float *texture = skeleton->skel_texture.ptr();
float *texture = skeleton->skel_texture.ptrw();
int base_ofs = ((p_bone / 256) * 256) * 3 * 4 + (p_bone % 256) * 4;
@ -4390,7 +4390,7 @@ void RasterizerStorageGLES3::skeleton_bone_set_transform_2d(RID p_skeleton, int
ERR_FAIL_INDEX(p_bone, skeleton->size);
ERR_FAIL_COND(!skeleton->use_2d);
float *texture = skeleton->skel_texture.ptr();
float *texture = skeleton->skel_texture.ptrw();
int base_ofs = ((p_bone / 256) * 256) * 2 * 4 + (p_bone % 256) * 4;
@ -5632,8 +5632,8 @@ void RasterizerStorageGLES3::update_particles() {
}
int tc = material->textures.size();
RID *textures = material->textures.ptr();
ShaderLanguage::ShaderNode::Uniform::Hint *texture_hints = material->shader->texture_hints.ptr();
RID *textures = material->textures.ptrw();
ShaderLanguage::ShaderNode::Uniform::Hint *texture_hints = material->shader->texture_hints.ptrw();
for (int i = 0; i < tc; i++) {

View file

@ -719,7 +719,7 @@ public:
virtual AABB mesh_get_aabb(RID p_mesh, RID p_skeleton) const;
virtual void mesh_clear(RID p_mesh);
void mesh_render_blend_shapes(Surface *s, float *p_weights);
void mesh_render_blend_shapes(Surface *s, const float *p_weights);
/* MULTIMESH API */

View file

@ -241,7 +241,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
} else {
ad->lock();
ad->audio_server_process(ad->buffer_frames, ad->samples_in.ptr());
ad->audio_server_process(ad->buffer_frames, ad->samples_in.ptrw());
ad->unlock();

View file

@ -1115,7 +1115,7 @@ Error DocData::load_compressed(const uint8_t *p_data, int p_compressed_size, int
Vector<uint8_t> data;
data.resize(p_uncompressed_size);
Compression::decompress(data.ptr(), p_uncompressed_size, p_data, p_compressed_size, Compression::MODE_DEFLATE);
Compression::decompress(data.ptrw(), p_uncompressed_size, p_data, p_compressed_size, Compression::MODE_DEFLATE);
class_list.clear();
Ref<XMLParser> parser = memnew(XMLParser);

View file

@ -268,7 +268,7 @@ void EditorAssetInstaller::ok_pressed() {
//read
unzOpenCurrentFile(pkg);
unzReadCurrentFile(pkg, data.ptr(), data.size());
unzReadCurrentFile(pkg, data.ptrw(), data.size());
unzCloseCurrentFile(pkg);
FileAccess *f = FileAccess::open(path, FileAccess::WRITE);

View file

@ -221,7 +221,7 @@ void EditorProfiler::_update_plot() {
Vector<int> columnv;
columnv.resize(h * 4);
int *column = columnv.ptr();
int *column = columnv.ptrw();
Map<StringName, int> plot_prev;
//Map<StringName,int> plot_max;

View file

@ -1388,7 +1388,7 @@ EditorSettings::EditorSettings() {
Vector<uint8_t> data;
data.resize(etl->uncomp_size);
Compression::decompress(data.ptr(), etl->uncomp_size, etl->data, etl->comp_size, Compression::MODE_DEFLATE);
Compression::decompress(data.ptrw(), etl->uncomp_size, etl->data, etl->comp_size, Compression::MODE_DEFLATE);
FileAccessMemory *fa = memnew(FileAccessMemory);
fa->open_custom(data.ptr(), data.size());

View file

@ -207,7 +207,7 @@ void ExportTemplateManager::_install_from_file(const String &p_file) {
//read
unzOpenCurrentFile(pkg);
ret = unzReadCurrentFile(pkg, data.ptr(), data.size());
ret = unzReadCurrentFile(pkg, data.ptrw(), data.size());
unzCloseCurrentFile(pkg);
String data_str;
@ -277,7 +277,7 @@ void ExportTemplateManager::_install_from_file(const String &p_file) {
//read
unzOpenCurrentFile(pkg);
unzReadCurrentFile(pkg, data.ptr(), data.size());
unzReadCurrentFile(pkg, data.ptrw(), data.size());
unzCloseCurrentFile(pkg);
print_line(fname);

View file

@ -31,7 +31,6 @@
#include "../editor_settings.h"
#include "io/marshalls.h"
#include "io/marshalls.h"
//#define DEBUG_PRINT(m_p) print_line(m_p)
#define DEBUG_TIME(m_what) printf("MS: %s - %lu\n", m_what, OS::get_singleton()->get_ticks_usec());
@ -240,7 +239,7 @@ void EditorFileServer::_subthread_start(void *s) {
cd->files[id]->seek(offset);
Vector<uint8_t> buf;
buf.resize(blocklen);
int read = cd->files[id]->get_buffer(buf.ptr(), blocklen);
int read = cd->files[id]->get_buffer(buf.ptrw(), blocklen);
ERR_CONTINUE(read < 0);
print_line("GET BLOCK - offset: " + itos(offset) + ", blocklen: " + itos(blocklen));

View file

@ -29,7 +29,7 @@ Error EditorSceneImporterGLTF::_parse_json(const String &p_path, GLTFState &stat
Vector<uint8_t> array;
array.resize(f->get_len());
f->get_buffer(array.ptr(), array.size());
f->get_buffer(array.ptrw(), array.size());
String text;
text.parse_utf8((const char *)array.ptr(), array.size());
@ -65,7 +65,7 @@ Error EditorSceneImporterGLTF::_parse_glb(const String &p_path, GLTFState &state
ERR_FAIL_COND_V(chunk_type != 0x4E4F534A, ERR_PARSE_ERROR); //JSON
Vector<uint8_t> json_data;
json_data.resize(chunk_length);
uint32_t len = f->get_buffer(json_data.ptr(), chunk_length);
uint32_t len = f->get_buffer(json_data.ptrw(), chunk_length);
ERR_FAIL_COND_V(len != chunk_length, ERR_FILE_CORRUPT);
String text;
@ -94,7 +94,7 @@ Error EditorSceneImporterGLTF::_parse_glb(const String &p_path, GLTFState &state
ERR_FAIL_COND_V(chunk_type != 0x004E4942, ERR_PARSE_ERROR); //BIN
state.glb_data.resize(chunk_length);
len = f->get_buffer(state.glb_data.ptr(), chunk_length);
len = f->get_buffer(state.glb_data.ptrw(), chunk_length);
ERR_FAIL_COND_V(len != chunk_length, ERR_FILE_CORRUPT);
return OK;
@ -467,9 +467,10 @@ Error EditorSceneImporterGLTF::_decode_buffer_view(GLTFState &state, int p_buffe
uint32_t offset = bv.byte_offset + byte_offset;
Vector<uint8_t> buffer = state.buffers[bv.buffer]; //copy on write, so no performance hit
const uint8_t *bufptr = buffer.ptr();
//use to debug
print_line("type " + _get_type_name(type) + " component type: " + _get_component_type_name(component_type) + " stride: " + itos(stride) + " amount " + itos(count));
//print_line("type " + _get_type_name(type) + " component type: " + _get_component_type_name(component_type) + " stride: " + itos(stride) + " amount " + itos(count));
print_line("accessor offset" + itos(byte_offset) + " view offset: " + itos(bv.byte_offset) + " total buffer len: " + itos(buffer.size()) + " view len " + itos(bv.byte_length));
int buffer_end = (stride * (count - 1)) + element_size;
@ -481,7 +482,7 @@ Error EditorSceneImporterGLTF::_decode_buffer_view(GLTFState &state, int p_buffe
for (int i = 0; i < count; i++) {
const uint8_t *src = &buffer[offset + i * stride];
const uint8_t *src = &bufptr[offset + i * stride];
for (int j = 0; j < component_count; j++) {
@ -605,7 +606,7 @@ Vector<double> EditorSceneImporterGLTF::_decode_accessor(GLTFState &state, int p
Vector<double> dst_buffer;
dst_buffer.resize(component_count * a.count);
double *dst = dst_buffer.ptr();
double *dst = dst_buffer.ptrw();
if (a.buffer_view >= 0) {
@ -628,13 +629,13 @@ Vector<double> EditorSceneImporterGLTF::_decode_accessor(GLTFState &state, int p
indices.resize(a.sparse_count);
int indices_component_size = _get_component_type_size(a.sparse_indices_component_type);
Error err = _decode_buffer_view(state, a.sparse_indices_buffer_view, indices.ptr(), 0, 0, indices_component_size, a.sparse_count, TYPE_SCALAR, 1, a.sparse_indices_component_type, indices_component_size, false, a.sparse_indices_byte_offset, false);
Error err = _decode_buffer_view(state, a.sparse_indices_buffer_view, indices.ptrw(), 0, 0, indices_component_size, a.sparse_count, TYPE_SCALAR, 1, a.sparse_indices_component_type, indices_component_size, false, a.sparse_indices_byte_offset, false);
if (err != OK)
return Vector<double>();
Vector<double> data;
data.resize(component_count * a.sparse_count);
err = _decode_buffer_view(state, a.sparse_values_buffer_view, data.ptr(), skip_every, skip_bytes, element_size, a.sparse_count, a.type, component_count, a.component_type, component_size, a.normalized, a.sparse_values_byte_offset, p_for_vertex);
err = _decode_buffer_view(state, a.sparse_values_buffer_view, data.ptrw(), skip_every, skip_bytes, element_size, a.sparse_count, a.type, component_count, a.component_type, component_size, a.normalized, a.sparse_values_byte_offset, p_for_vertex);
if (err != OK)
return Vector<double>();
@ -813,6 +814,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
Array meshes = state.json["meshes"];
for (int i = 0; i < meshes.size(); i++) {
print_line("on mesh: " + itos(i));
Dictionary d = meshes[i];
GLTFMesh mesh;

View file

@ -189,8 +189,8 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh(Ref<NavigationMesh>
ERR_FAIL_COND(tri_areas.size() == 0);
memset(tri_areas.ptr(), 0, ntris * sizeof(unsigned char));
rcMarkWalkableTriangles(&ctx, cfg.walkableSlopeAngle, verts, nverts, tris, ntris, tri_areas.ptr());
memset(tri_areas.ptrw(), 0, ntris * sizeof(unsigned char));
rcMarkWalkableTriangles(&ctx, cfg.walkableSlopeAngle, verts, nverts, tris, ntris, tri_areas.ptrw());
ERR_FAIL_COND(!rcRasterizeTriangles(&ctx, verts, nverts, tris, tri_areas.ptr(), ntris, *hf, cfg.walkableClimb));
}

View file

@ -383,7 +383,7 @@ private:
//read
unzOpenCurrentFile(pkg);
unzReadCurrentFile(pkg, data.ptr(), data.size());
unzReadCurrentFile(pkg, data.ptrw(), data.size());
unzCloseCurrentFile(pkg);
FileAccess *f = FileAccess::open(dir.plus_file(path), FileAccess::WRITE);

View file

@ -585,7 +585,7 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer *
if (enet->dst_compressor_mem.size() < req_size) {
enet->dst_compressor_mem.resize(req_size);
}
int ret = Compression::compress(enet->dst_compressor_mem.ptr(), enet->src_compressor_mem.ptr(), ofs, mode);
int ret = Compression::compress(enet->dst_compressor_mem.ptrw(), enet->src_compressor_mem.ptr(), ofs, mode);
if (ret < 0)
return 0;

View file

@ -100,7 +100,7 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
#endif
instance->owner->set_script_instance(instance);
/* STEP 2, INITIALIZE AND CONSRTUCT */
/* STEP 2, INITIALIZE AND CONSRTUCT */
#ifndef NO_THREADS
GDScriptLanguage::singleton->lock->lock();
@ -738,7 +738,7 @@ Error GDScript::load_byte_code(const String &p_path) {
Error err = fae->open_and_parse(fa, key, FileAccessEncrypted::MODE_READ);
ERR_FAIL_COND_V(err, err);
bytecode.resize(fae->get_len());
fae->get_buffer(bytecode.ptr(), bytecode.size());
fae->get_buffer(bytecode.ptrw(), bytecode.size());
memdelete(fae);
} else {
@ -1324,7 +1324,7 @@ void GDScriptLanguage::_add_global(const StringName &p_name, const Variant &p_va
}
globals[p_name] = global_array.size();
global_array.push_back(p_value);
_global_array = global_array.ptr();
_global_array = global_array.ptrw();
}
void GDScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) {

View file

@ -29,11 +29,11 @@
/*************************************************************************/
#include "gdscript.h"
#include "core/engine.h"
#include "editor/editor_settings.h"
#include "gdscript_compiler.h"
#include "global_constants.h"
#include "os/file_access.h"
#include "core/engine.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_file_system.h"
@ -791,7 +791,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &context, const GDS
}
Variant::CallError ce;
Variant ret = mb->call(baseptr, argptr.ptr(), argptr.size(), ce);
Variant ret = mb->call(baseptr, (const Variant **)argptr.ptr(), argptr.size(), ce);
if (ce.error == Variant::CallError::CALL_OK && ret.get_type() != Variant::NIL) {
@ -1795,7 +1795,7 @@ static void _find_type_arguments(GDScriptCompletionContext &context, const GDScr
}
} else {
//regular method
//regular method
#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED)
if (p_argidx < m->get_argument_count()) {

View file

@ -1434,7 +1434,7 @@ void VisualScriptInstance::_dependency_step(VisualScriptNodeInstance *node, int
if (!node->dependencies.empty()) {
int dc = node->dependencies.size();
VisualScriptNodeInstance **deps = node->dependencies.ptr();
VisualScriptNodeInstance **deps = node->dependencies.ptrw();
for (int i = 0; i < dc; i++) {
@ -1526,7 +1526,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
if (!node->dependencies.empty()) {
int dc = node->dependencies.size();
VisualScriptNodeInstance **deps = node->dependencies.ptr();
VisualScriptNodeInstance **deps = node->dependencies.ptrw();
for (int i = 0; i < dc; i++) {
@ -1626,7 +1626,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
state->flow_stack_pos = flow_stack_pos;
state->stack.resize(p_stack_size);
state->pass = p_pass;
copymem(state->stack.ptr(), p_stack, p_stack_size);
copymem(state->stack.ptrw(), p_stack, p_stack_size);
//step 2, run away, return directly
r_error.error = Variant::CallError::CALL_OK;
@ -2277,7 +2277,7 @@ Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int
*working_mem = args; //arguments go to working mem.
Variant ret = instance->_call_internal(function, stack.ptr(), stack.size(), node, flow_stack_pos, pass, true, r_error);
Variant ret = instance->_call_internal(function, stack.ptrw(), stack.size(), node, flow_stack_pos, pass, true, r_error);
function = StringName(); //invalidate
return ret;
}
@ -2319,7 +2319,7 @@ Variant VisualScriptFunctionState::resume(Array p_args) {
*working_mem = p_args; //arguments go to working mem.
Variant ret = instance->_call_internal(function, stack.ptr(), stack.size(), node, flow_stack_pos, pass, true, r_error);
Variant ret = instance->_call_internal(function, stack.ptrw(), stack.size(), node, flow_stack_pos, pass, true, r_error);
function = StringName(); //invalidate
return ret;
}

View file

@ -2466,7 +2466,7 @@ VisualScriptNode::TypeGuess VisualScriptEditor::_guess_output_type(int p_port_ac
in_guesses.push_back(g);
}
return node->guess_output_type(in_guesses.ptr(), p_port_action_output);
return node->guess_output_type(in_guesses.ptrw(), p_port_action_output);
}
void VisualScriptEditor::_port_action_menu(int p_option) {

View file

@ -1378,7 +1378,7 @@ public:
argp[i] = &arr[i];
}
r_ret = Variant::construct(constructor->data_type, argp.ptr(), argp.size(), ce);
r_ret = Variant::construct(constructor->data_type, (const Variant **)argp.ptr(), argp.size(), ce);
if (ce.error != Variant::CallError::CALL_OK) {
r_error_str = "Invalid arguments to construct '" + Variant::get_type_name(constructor->data_type) + "'.";
@ -1405,7 +1405,7 @@ public:
argp[i] = &arr[i];
}
VisualScriptBuiltinFunc::exec_func(bifunc->func, argp.ptr(), &r_ret, ce, r_error_str);
VisualScriptBuiltinFunc::exec_func(bifunc->func, (const Variant **)argp.ptr(), &r_ret, ce, r_error_str);
if (ce.error != Variant::CallError::CALL_OK) {
r_error_str = "Builtin Call Failed. " + r_error_str;
@ -1437,7 +1437,7 @@ public:
argp[i] = &arr[i];
}
r_ret = base.call(call->method, argp.ptr(), argp.size(), ce);
r_ret = base.call(call->method, (const Variant **)argp.ptr(), argp.size(), ce);
if (ce.error != Variant::CallError::CALL_OK) {
r_error_str = "On call to '" + String(call->method) + "':";

View file

@ -1391,7 +1391,7 @@ public:
//read
unzOpenCurrentFile(pkg);
unzReadCurrentFile(pkg, data.ptr(), data.size());
unzReadCurrentFile(pkg, data.ptrw(), data.size());
unzCloseCurrentFile(pkg);
//write
@ -1414,7 +1414,7 @@ public:
FileAccess *f = FileAccess::open(icon_path, FileAccess::READ);
if (f) {
data.resize(f->get_len());
f->get_buffer(data.ptr(), data.size());
f->get_buffer(data.ptrw(), data.size());
memdelete(f);
found = true;
break;
@ -1428,7 +1428,7 @@ public:
FileAccess *f = FileAccess::open(appicon, FileAccess::READ);
if (f) {
data.resize(f->get_len());
f->get_buffer(data.ptr(), data.size());
f->get_buffer(data.ptrw(), data.size());
memdelete(f);
}
}
@ -1703,7 +1703,7 @@ public:
int method, level;
unzOpenCurrentFile2(tmp_unaligned, &method, &level, 1); // raw read
long file_offset = unzGetCurrentFileZStreamPos64(tmp_unaligned);
unzReadCurrentFile(tmp_unaligned, data.ptr(), data.size());
unzReadCurrentFile(tmp_unaligned, data.ptrw(), data.size());
unzCloseCurrentFile(tmp_unaligned);
// align

View file

@ -793,7 +793,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
//read
unzOpenCurrentFile(src_pkg_zip);
unzReadCurrentFile(src_pkg_zip, data.ptr(), data.size());
unzReadCurrentFile(src_pkg_zip, data.ptrw(), data.size());
unzCloseCurrentFile(src_pkg_zip);
//write

View file

@ -214,7 +214,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
//read
unzOpenCurrentFile(pkg);
unzReadCurrentFile(pkg, data.ptr(), data.size());
unzReadCurrentFile(pkg, data.ptrw(), data.size());
unzCloseCurrentFile(pkg);
//write
@ -257,7 +257,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
}
Vector<uint8_t> buf;
buf.resize(f->get_len());
f->get_buffer(buf.ptr(), buf.size());
f->get_buffer(buf.ptrw(), buf.size());
memdelete(f);
_fix_html(buf, p_preset, p_path.get_file().get_basename(), p_debug);

View file

@ -390,7 +390,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
//read
unzOpenCurrentFile(src_pkg_zip);
unzReadCurrentFile(src_pkg_zip, data.ptr(), data.size());
unzReadCurrentFile(src_pkg_zip, data.ptrw(), data.size());
unzCloseCurrentFile(src_pkg_zip);
//write

View file

@ -137,7 +137,7 @@ class AppxPackager {
ZPOS64_T end_of_central_dir_offset;
Vector<uint8_t> central_dir_data;
String hash_block(uint8_t *p_block_data, size_t p_block_len);
String hash_block(const uint8_t *p_block_data, size_t p_block_len);
void make_block_map();
void make_content_types();
@ -188,14 +188,14 @@ public:
///////////////////////////////////////////////////////////////////////////
String AppxPackager::hash_block(uint8_t *p_block_data, size_t p_block_len) {
String AppxPackager::hash_block(const uint8_t *p_block_data, size_t p_block_len) {
char hash[32];
char base64[45];
sha256_context ctx;
sha256_init(&ctx);
sha256_hash(&ctx, p_block_data, p_block_len);
sha256_hash(&ctx, (uint8_t *)p_block_data, p_block_len);
sha256_done(&ctx, (uint8_t *)hash);
base64_encode(base64, hash, 32);
@ -510,8 +510,8 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
strm.avail_in = block_size;
strm.avail_out = strm_out.size();
strm.next_in = strm_in.ptr();
strm.next_out = strm_out.ptr();
strm.next_in = (uint8_t *)strm_in.ptr();
strm.next_out = strm_out.ptrw();
int total_out_before = strm.total_out;
@ -541,8 +541,8 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
strm.avail_in = 0;
strm.avail_out = strm_out.size();
strm.next_in = strm_in.ptr();
strm.next_out = strm_out.ptr();
strm.next_in = (uint8_t *)strm_in.ptr();
strm.next_out = strm_out.ptrw();
int total_out_before = strm.total_out;
@ -588,7 +588,7 @@ void AppxPackager::finish() {
Vector<uint8_t> blockmap_buffer;
blockmap_buffer.resize(blockmap_file->get_len());
blockmap_file->get_buffer(blockmap_buffer.ptr(), blockmap_buffer.size());
blockmap_file->get_buffer(blockmap_buffer.ptrw(), blockmap_buffer.size());
add_file("AppxBlockMap.xml", blockmap_buffer.ptr(), blockmap_buffer.size(), -1, -1, true);
@ -604,7 +604,7 @@ void AppxPackager::finish() {
Vector<uint8_t> types_buffer;
types_buffer.resize(types_file->get_len());
types_file->get_buffer(types_buffer.ptr(), types_buffer.size());
types_file->get_buffer(types_buffer.ptrw(), types_buffer.size());
add_file("[Content_Types].xml", types_buffer.ptr(), types_buffer.size(), -1, -1, true);
@ -911,7 +911,7 @@ class EditorExportUWP : public EditorExportPlatform {
}
data.resize(f->get_len());
f->get_buffer(data.ptr(), data.size());
f->get_buffer(data.ptrw(), data.size());
f->close();
memdelete(f);
@ -1301,7 +1301,7 @@ public:
if (do_read) {
data.resize(info.uncompressed_size);
unzOpenCurrentFile(pkg);
unzReadCurrentFile(pkg, data.ptr(), data.size());
unzReadCurrentFile(pkg, data.ptrw(), data.size());
unzCloseCurrentFile(pkg);
}
@ -1341,7 +1341,7 @@ public:
// Argc
clf.resize(4);
encode_uint32(cl.size(), clf.ptr());
encode_uint32(cl.size(), clf.ptrw());
for (int i = 0; i < cl.size(); i++) {

View file

@ -21,7 +21,7 @@ void AudioStreamPlayer2D::_mix_audio() {
}
//get data
AudioFrame *buffer = mix_buffer.ptr();
AudioFrame *buffer = mix_buffer.ptrw();
int buffer_size = mix_buffer.size();
//mix

View file

@ -150,7 +150,7 @@ void Navigation2D::_navpoly_unlink(int p_id) {
Polygon &p = E->get();
int ec = p.edges.size();
Polygon::Edge *edges = p.edges.ptr();
Polygon::Edge *edges = p.edges.ptrw();
for (int i = 0; i < ec; i++) {
int next = (i + 1) % ec;

View file

@ -21,7 +21,7 @@ void AudioStreamPlayer3D::_mix_audio() {
}
//get data
AudioFrame *buffer = mix_buffer.ptr();
AudioFrame *buffer = mix_buffer.ptrw();
int buffer_size = mix_buffer.size();
//mix

View file

@ -147,7 +147,7 @@ void Navigation::_navmesh_unlink(int p_id) {
Polygon &p = E->get();
int ec = p.edges.size();
Polygon::Edge *edges = p.edges.ptr();
Polygon::Edge *edges = p.edges.ptrw();
for (int i = 0; i < ec; i++) {
int next = (i + 1) % ec;

View file

@ -36,7 +36,7 @@ void AudioStreamPlayer::_mix_internal(bool p_fadeout) {
int bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus);
//get data
AudioFrame *buffer = mix_buffer.ptr();
AudioFrame *buffer = mix_buffer.ptrw();
int buffer_size = mix_buffer.size();
if (p_fadeout) {

View file

@ -84,7 +84,7 @@ void VideoPlayer::_mix_audio() {
return;
}
AudioFrame *buffer = mix_buffer.ptr();
AudioFrame *buffer = mix_buffer.ptrw();
int buffer_size = mix_buffer.size();
// Resample

View file

@ -1198,7 +1198,7 @@ void Node::_validate_child_name(Node *p_child, bool p_force_human_readable) {
unique = false;
} else {
//check if exists
Node **childs = data.children.ptr();
Node **childs = data.children.ptrw();
int cc = data.children.size();
for (int i = 0; i < cc; i++) {

View file

@ -1001,7 +1001,7 @@ Array SceneTree::_get_nodes_in_group(const StringName &p_group) {
ret.resize(nc);
Node **ptr = E->get().nodes.ptr();
Node **ptr = E->get().nodes.ptrw();
for (int i = 0; i < nc; i++) {
ret[i] = ptr[i];
@ -1024,7 +1024,7 @@ void SceneTree::get_nodes_in_group(const StringName &p_group, List<Node *> *p_li
int nc = E->get().nodes.size();
if (nc == 0)
return;
Node **ptr = E->get().nodes.ptr();
Node **ptr = E->get().nodes.ptrw();
for (int i = 0; i < nc; i++) {
p_list->push_back(ptr[i]);
@ -1997,9 +1997,9 @@ void SceneTree::_network_process_packet(int p_from, const uint8_t *p_packet, int
Variant::CallError ce;
node->call(name, argp.ptr(), argc, ce);
node->call(name, (const Variant **)argp.ptr(), argc, ce);
if (ce.error != Variant::CallError::CALL_OK) {
String error = Variant::get_call_error_text(node, name, argp.ptr(), argc, ce);
String error = Variant::get_call_error_text(node, name, (const Variant **)argp.ptr(), argc, ce);
error = "RPC - " + error;
ERR_PRINTS(error);
}

View file

@ -38,7 +38,7 @@ void BitMap::create(const Size2 &p_size) {
width = p_size.width;
height = p_size.height;
bitmask.resize(((width * height) / 8) + 1);
zeromem(bitmask.ptr(), bitmask.size());
zeromem(bitmask.ptrw(), bitmask.size());
}
void BitMap::create_from_image_alpha(const Ref<Image> &p_image) {
@ -51,7 +51,7 @@ void BitMap::create_from_image_alpha(const Ref<Image> &p_image) {
create(Size2(img->get_width(), img->get_height()));
PoolVector<uint8_t>::Read r = img->get_data().read();
uint8_t *w = bitmask.ptr();
uint8_t *w = bitmask.ptrw();
for (int i = 0; i < width * height; i++) {
@ -65,7 +65,7 @@ void BitMap::create_from_image_alpha(const Ref<Image> &p_image) {
void BitMap::set_bit_rect(const Rect2 &p_rect, bool p_value) {
Rect2i current = Rect2i(0, 0, width, height).clip(p_rect);
uint8_t *data = bitmask.ptr();
uint8_t *data = bitmask.ptrw();
for (int i = current.position.x; i < current.position.x + current.size.x; i++) {

View file

@ -125,7 +125,7 @@ Error DynamicFontAtSize::_load() {
_fontdata[font->font_path] = Vector<uint8_t>();
Vector<uint8_t> &fontdata = _fontdata[font->font_path];
fontdata.resize(len);
f->get_buffer(fontdata.ptr(), len);
f->get_buffer(fontdata.ptrw(), len);
font->set_font_ptr(fontdata.ptr(), len);
f->close();
}

View file

@ -159,9 +159,9 @@ struct SpatialIndexer {
Vector<Plane> planes = c->get_frustum();
int culled = octree.cull_convex(planes, cull.ptr(), cull.size());
int culled = octree.cull_convex(planes, cull.ptrw(), cull.size());
VisibilityNotifier **ptr = cull.ptr();
VisibilityNotifier **ptr = cull.ptrw();
List<VisibilityNotifier *> added;
List<VisibilityNotifier *> removed;

View file

@ -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);

View file

@ -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++) {

View file

@ -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]);
}

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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++) {

View file

@ -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);

View file

@ -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++) {