Skip to content

Commit

Permalink
Implement motion vectors in compatibility renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
devloglogan committed Oct 3, 2024
1 parent 2e14492 commit 65211d2
Show file tree
Hide file tree
Showing 28 changed files with 1,292 additions and 306 deletions.
4 changes: 2 additions & 2 deletions drivers/gles3/rasterizer_canvas_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1448,9 +1448,9 @@ void RasterizerCanvasGLES3::_render_batch(Light *p_lights, uint32_t p_index, Ren
uint64_t vertex_input_mask = state.canvas_instance_batches[p_index].vertex_input_mask;

if (mesh_instance.is_valid()) {
mesh_storage->mesh_instance_surface_get_vertex_arrays_and_format(mesh_instance, j, vertex_input_mask, vertex_array_gl);
mesh_storage->mesh_instance_surface_get_vertex_arrays_and_format(mesh_instance, j, vertex_input_mask, false, vertex_array_gl);
} else {
mesh_storage->mesh_surface_get_vertex_arrays_and_format(surface, vertex_input_mask, vertex_array_gl);
mesh_storage->mesh_surface_get_vertex_arrays_and_format(surface, vertex_input_mask, false, vertex_array_gl);
}

index_array_gl = mesh_storage->mesh_surface_get_index_buffer(surface, 0);
Expand Down
272 changes: 165 additions & 107 deletions drivers/gles3/rasterizer_scene_gles3.cpp

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions drivers/gles3/rasterizer_scene_gles3.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ enum PassMode {
PASS_MODE_SHADOW,
PASS_MODE_DEPTH,
PASS_MODE_MATERIAL,
PASS_MODE_MOTION_VECTORS,
};

// These should share as much as possible with SkyUniform Location
Expand Down Expand Up @@ -298,6 +299,10 @@ class RasterizerSceneGLES3 : public RendererSceneRender {
//used during rendering
bool store_transform_cache = true;

// Used for generating motion vectors.
Transform3D prev_transform;
bool is_prev_transform_stored = false;

int32_t instance_count = 0;

bool can_sdfgi = false;
Expand Down Expand Up @@ -451,12 +456,16 @@ class RasterizerSceneGLES3 : public RendererSceneRender {
};
static_assert(sizeof(TonemapUBO) % 16 == 0, "Tonemap UBO size must be a multiple of 16 bytes");

UBO ubo;
UBO data;
UBO prev_data;
GLuint ubo_buffer = 0;
MultiviewUBO multiview_ubo;
MultiviewUBO multiview_data;
MultiviewUBO prev_multiview_data;
GLuint multiview_buffer = 0;
GLuint tonemap_buffer = 0;

bool is_prev_data_stored = false;

bool used_depth_prepass = false;

GLES3::SceneShaderData::BlendMode current_blend_mode = GLES3::SceneShaderData::BLEND_MODE_MIX;
Expand Down
Loading

0 comments on commit 65211d2

Please sign in to comment.