Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Implement motion vectors in compatibility renderer #97151

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading