summaryrefslogtreecommitdiff
path: root/drivers/gles3
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-07 13:23:40 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-20 10:34:00 +0300
commitde4c97758af117af97fad58e4a80ffeba0154ba8 (patch)
tree2139631cc24a59900a840b9371d5043183558fbd /drivers/gles3
parentf4b0c7a1ea8d86c1dfd96478ca12ad1360903d9d (diff)
Fix more issues found by cppcheck.
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp32
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.h2
2 files changed, 17 insertions, 17 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 441b049b50..ebf538351e 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -823,24 +823,24 @@ void RasterizerCanvasGLES3::_render_batch(uint32_t &r_index) {
}
// TODO maybe dont use
-void RasterizerCanvasGLES3::_end_batch(uint32_t &r_index) {
+void RasterizerCanvasGLES3::_end_batch(uint32_t p_index) {
for (int i = 0; i < 4; i++) {
- state.instance_data_array[r_index].modulation[i] = 0.0;
- state.instance_data_array[r_index].ninepatch_margins[i] = 0.0;
- state.instance_data_array[r_index].src_rect[i] = 0.0;
- state.instance_data_array[r_index].dst_rect[i] = 0.0;
+ state.instance_data_array[p_index].modulation[i] = 0.0;
+ state.instance_data_array[p_index].ninepatch_margins[i] = 0.0;
+ state.instance_data_array[p_index].src_rect[i] = 0.0;
+ state.instance_data_array[p_index].dst_rect[i] = 0.0;
}
- state.instance_data_array[r_index].flags = uint32_t(0);
- state.instance_data_array[r_index].color_texture_pixel_size[0] = 0.0;
- state.instance_data_array[r_index].color_texture_pixel_size[1] = 0.0;
+ state.instance_data_array[p_index].flags = uint32_t(0);
+ state.instance_data_array[p_index].color_texture_pixel_size[0] = 0.0;
+ state.instance_data_array[p_index].color_texture_pixel_size[1] = 0.0;
- state.instance_data_array[r_index].pad[0] = 0.0;
- state.instance_data_array[r_index].pad[1] = 0.0;
+ state.instance_data_array[p_index].pad[0] = 0.0;
+ state.instance_data_array[p_index].pad[1] = 0.0;
- state.instance_data_array[r_index].lights[0] = uint32_t(0);
- state.instance_data_array[r_index].lights[1] = uint32_t(0);
- state.instance_data_array[r_index].lights[2] = uint32_t(0);
- state.instance_data_array[r_index].lights[3] = uint32_t(0);
+ state.instance_data_array[p_index].lights[0] = uint32_t(0);
+ state.instance_data_array[p_index].lights[1] = uint32_t(0);
+ state.instance_data_array[p_index].lights[2] = uint32_t(0);
+ state.instance_data_array[p_index].lights[3] = uint32_t(0);
}
RID RasterizerCanvasGLES3::light_create() {
@@ -1102,8 +1102,8 @@ RendererCanvasRender::PolygonID RasterizerCanvasGLES3::request_polygon(const Vec
{
glBindBuffer(GL_ARRAY_BUFFER, pb.vertex_buffer);
glBufferData(GL_ARRAY_BUFFER, stride * vertex_count * sizeof(float), nullptr, GL_STATIC_DRAW); // TODO may not be necessary
- const uint8_t *r = polygon_buffer.ptr();
- float *fptr = (float *)r;
+ uint8_t *r = polygon_buffer.ptrw();
+ float *fptr = reinterpret_cast<float *>(r);
uint32_t *uptr = (uint32_t *)r;
uint32_t base_offset = 0;
{
diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h
index a962796b2f..99b079b8bb 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.h
+++ b/drivers/gles3/rasterizer_canvas_gles3.h
@@ -270,7 +270,7 @@ public:
void _render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, bool p_to_backbuffer = false);
void _render_item(RID p_render_target, const Item *p_item, const Transform2D &p_canvas_transform_inverse, Item *&current_clip, Light *p_lights, uint32_t &r_index);
void _render_batch(uint32_t &p_max_index);
- void _end_batch(uint32_t &p_max_index);
+ void _end_batch(uint32_t p_index);
void _allocate_instance_data_buffer();
void initialize();