diff options
Diffstat (limited to 'drivers/gles3/rasterizer_canvas_gles3.h')
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h index 916e12057c..1c14d0b466 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.h +++ b/drivers/gles3/rasterizer_canvas_gles3.h @@ -247,7 +247,6 @@ public: uint32_t max_lights_per_render = 256; uint32_t max_lights_per_item = 16; - uint32_t max_instances_per_batch = 512; uint32_t max_instances_per_buffer = 16384; uint32_t max_instance_buffer_size = 16384 * 128; } data; @@ -256,6 +255,7 @@ public: // Position in the UBO measured in bytes uint32_t start = 0; uint32_t instance_count = 0; + uint32_t instance_buffer_index = 0; RID tex; RS::CanvasItemTextureFilter filter = RS::CANVAS_ITEM_TEXTURE_FILTER_MAX; @@ -281,7 +281,7 @@ public: // We track them and ensure that they don't get reused until at least 2 frames have passed // to avoid the GPU stalling to wait for a resource to become available. struct DataBuffer { - GLuint buffer = 0; + Vector<GLuint> instance_buffers; GLuint light_ubo = 0; GLuint state_ubo = 0; uint64_t last_frame_used = -3; @@ -291,9 +291,10 @@ public: struct State { LocalVector<DataBuffer> canvas_instance_data_buffers; LocalVector<Batch> canvas_instance_batches; - uint32_t current_buffer = 0; - uint32_t current_buffer_index = 0; + uint32_t current_data_buffer_index = 0; + uint32_t current_instance_buffer_index = 0; uint32_t current_batch_index = 0; + uint32_t last_item_index = 0; InstanceData *instance_data_array = nullptr; @@ -354,14 +355,14 @@ public: void _prepare_canvas_texture(RID p_texture, RS::CanvasItemTextureFilter p_base_filter, RS::CanvasItemTextureRepeat p_base_repeat, uint32_t &r_index, Size2 &r_texpixel_size); void canvas_render_items(RID p_to_render_target, Item *p_item_list, const Color &p_modulate, Light *p_light_list, Light *p_directional_list, const Transform2D &p_canvas_transform, RS::CanvasItemTextureFilter p_default_filter, RS::CanvasItemTextureRepeat p_default_repeat, bool p_snap_2d_vertices_to_pixel, bool &r_sdf_used) override; - void _render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, uint32_t &r_last_index, bool &r_sdf_used, bool p_to_backbuffer = false); + void _render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, bool &r_sdf_used, bool p_to_backbuffer = false); void _record_item_commands(const Item *p_item, RID p_render_target, const Transform2D &p_canvas_transform_inverse, Item *¤t_clip, GLES3::CanvasShaderData::BlendMode p_blend_mode, Light *p_lights, uint32_t &r_index, bool &r_break_batch, bool &r_sdf_used); void _render_batch(Light *p_lights, uint32_t p_index); bool _bind_material(GLES3::CanvasMaterialData *p_material_data, CanvasShaderGLES3::ShaderVariant p_variant, uint64_t p_specialization); - void _new_batch(bool &r_batch_broken, uint32_t &r_index); + void _new_batch(bool &r_batch_broken); void _add_to_batch(uint32_t &r_index, bool &r_batch_broken); void _allocate_instance_data_buffer(); - void _align_instance_data_buffer(uint32_t &r_index); + void _allocate_instance_buffer(); void _enable_attributes(uint32_t p_start, bool p_primitive, uint32_t p_rate = 1); void set_time(double p_time); |