Fixed some GL inconsistencies and Lit Proj

...
This commit is contained in:
korenkonder
2025-04-13 14:19:05 +03:00
parent 6c5bb08c66
commit 0cf71e20b5
4 changed files with 16 additions and 6 deletions
+5 -1
View File
@@ -119,6 +119,7 @@ void gl_state_bind_uniform_buffer_base(GLuint index, GLuint buffer, bool force)
if (!Vulkan::use)
glBindBufferBase(GL_UNIFORM_BUFFER, index, buffer);
#endif
gl_state.uniform_buffer_binding = buffer;
gl_state.uniform_buffer_bindings[index] = buffer;
gl_state.uniform_buffer_offsets[index] = 0;
gl_state.uniform_buffer_sizes[index] = -1;
@@ -134,6 +135,7 @@ void gl_state_bind_uniform_buffer_range(GLuint index,
if (!Vulkan::use)
glBindBufferRange(GL_UNIFORM_BUFFER, index, buffer, offset, size);
#endif
gl_state.uniform_buffer_binding = buffer;
gl_state.uniform_buffer_bindings[index] = buffer;
gl_state.uniform_buffer_offsets[index] = offset;
gl_state.uniform_buffer_sizes[index] = size;
@@ -153,6 +155,7 @@ void gl_state_bind_shader_storage_buffer_base(GLuint index, GLuint buffer, bool
if (!Vulkan::use)
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, index, buffer);
#endif
gl_state.shader_storage_buffer_binding = buffer;
gl_state.shader_storage_buffer_bindings[index] = buffer;
gl_state.shader_storage_buffer_offsets[index] = 0;
gl_state.shader_storage_buffer_sizes[index] = -1;
@@ -168,6 +171,7 @@ void gl_state_bind_shader_storage_buffer_range(GLuint index,
if (!Vulkan::use)
glBindBufferRange(GL_SHADER_STORAGE_BUFFER, index, buffer, offset, size);
#endif
gl_state.shader_storage_buffer_binding = buffer;
gl_state.shader_storage_buffer_bindings[index] = buffer;
gl_state.shader_storage_buffer_offsets[index] = offset;
gl_state.shader_storage_buffer_sizes[index] = size;
@@ -378,7 +382,7 @@ void gl_state_get() {
glActiveTexture((GLenum)(GL_TEXTURE0 + i));
glGetIntegerv(GL_TEXTURE_BINDING_2D, &gl_state.texture_binding_2d[i]);
glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &gl_state.texture_binding_cube_map[i]);
glGetIntegeri_v(GL_SAMPLER_BINDING, i, &gl_state.sampler_binding[i]);
glGetIntegerv(GL_SAMPLER_BINDING, &gl_state.sampler_binding[i]);
}
glActiveTexture(gl_state.active_texture);
+3
View File
@@ -199,6 +199,9 @@ bool light_proj::set_mat(bool set_mat) {
vec3 up = { 0.0f, 1.0f, 0.0f };
mat4_look_at(&position, &interest, &up, &rctx->view_mat);
mat4_mul(&rctx->view_mat, &rctx->proj_mat, &rctx->vp_mat);
rctx->set_scene_projection_view(rctx->view_mat, rctx->proj_mat, position);
}
return true;
+5 -2
View File
@@ -316,11 +316,14 @@ namespace rndr {
rctx_ptr->disp_manager->check_vertex_arrays();
gl_state_bind_vertex_array(0);
gl_state_disable_primitive_restart();
gl_state_bind_uniform_buffer(0);
gl_state_bind_uniform_buffer_base(0, 0);
gl_state_bind_uniform_buffer_base(1, 0);
gl_state_bind_uniform_buffer_base(2, 0);
gl_state_bind_uniform_buffer_base(3, 0);
gl_state_bind_uniform_buffer_base(4, 0);
gl_state_bind_shader_storage_buffer(0);
gl_state_bind_shader_storage_buffer_base(0, 0);
}
void RenderManager::rndpass_post_proc() {
@@ -1802,8 +1805,8 @@ static int32_t draw_pass_3d_get_translucent_count(render_context* rctx) {
}
static void draw_pass_3d_shadow_reset(render_context* rctx) {
gl_state_active_bind_texture_2d(6, 0);
gl_state_active_bind_texture_2d(7, 0);
gl_state_active_bind_texture_2d(6, rctx->empty_texture_2d->glid);
gl_state_active_bind_texture_2d(7, rctx->empty_texture_2d->glid);
rctx->draw_state->self_shadow = false;
rctx->draw_state->shadow = false;
}
+3 -3
View File
@@ -216,11 +216,11 @@ static const int32_t glass_eye_fpt_unival_max[] = {
};
static const int32_t esm_gauss_vpt_unival_max[] = {
-1,
0,
};
static const int32_t esm_gauss_fpt_unival_max[] = {
-1,
1,
};
static const int32_t esm_filter_min_vpt_unival_max[] = {
@@ -2313,7 +2313,7 @@ static const uniform_name GLASEYE_uniform[] = {
};
static const uniform_name ESMGAUSS_uniform[] = {
U_INVALID,
U_LIGHT_PROJ,
};
static const uniform_name ESMFILT_uniform[] = {