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 Nov 6, 2024
1 parent 87318a2 commit db761a1
Show file tree
Hide file tree
Showing 42 changed files with 1,329 additions and 348 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
3 changes: 2 additions & 1 deletion drivers/gles3/rasterizer_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#define _EXT_DEBUG_TYPE_PORTABILITY_ARB 0x824F
#define _EXT_DEBUG_TYPE_PERFORMANCE_ARB 0x8250
#define _EXT_DEBUG_TYPE_OTHER_ARB 0x8251
#define _EXT_DEBUG_TYPE_MARKER_ARB 0x8268
#define _EXT_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143
#define _EXT_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144
#define _EXT_DEBUG_LOGGED_MESSAGES_ARB 0x9145
Expand Down Expand Up @@ -140,7 +141,7 @@ void RasterizerGLES3::clear_depth(float p_depth) {
#ifdef CAN_DEBUG
static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam) {
// These are ultimately annoying, so removing for now.
if (type == _EXT_DEBUG_TYPE_OTHER_ARB || type == _EXT_DEBUG_TYPE_PERFORMANCE_ARB) {
if (type == _EXT_DEBUG_TYPE_OTHER_ARB || type == _EXT_DEBUG_TYPE_PERFORMANCE_ARB || type == _EXT_DEBUG_TYPE_MARKER_ARB) {
return;
}

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 @@ -299,6 +300,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 @@ -452,12 +457,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 db761a1

Please sign in to comment.