1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-21 14:57:09 +00:00

Fix rendering when using WebGL2.

Fixes include using proper depth buffer format in 3D (this had previously been fixed already but the changes were lost in a rebase), Remove unused lighting and shadowing code in 2D, and update 2D UBOs using glBufferSubData so that they remain the appropriate size.
This commit is contained in:
clayjohn
2022-09-06 14:42:08 -07:00
parent 5628ab9215
commit fea48cdfc6
4 changed files with 6 additions and 308 deletions

View File

@@ -1023,8 +1023,8 @@ void RasterizerCanvasGLES3::_bind_instance_data_buffer(uint32_t p_max_index) {
glBindBufferBase(GL_UNIFORM_BUFFER, INSTANCE_UNIFORM_LOCATION, state.canvas_instance_data_buffers[state.current_buffer]);
#ifdef WEB_ENABLED
//WebGL 2.0 does not support mapping buffers, so use slow glBufferData instead
glBufferData(GL_UNIFORM_BUFFER, sizeof(InstanceData) * p_max_index, state.instance_data_array, GL_DYNAMIC_DRAW);
//WebGL 2.0 does not support mapping buffers, so use slow glBufferSubData instead
glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(InstanceData) * p_max_index, state.instance_data_array);
#else
void *ubo = glMapBufferRange(GL_UNIFORM_BUFFER, 0, sizeof(InstanceData) * p_max_index, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
memcpy(ubo, state.instance_data_array, sizeof(InstanceData) * p_max_index);