medfall

A super great game engine
Log | Files | Refs

commit f4d4ad18701612f2975984a8f97001ea371d4884
parent eb6fe36ad0d6a80f245ceb3080aab457d16bdaac
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Sep  3 22:24:03 +0300

Remove the target framebuffer from RenderState since it's part of the render pass now

Diffstat:
renderer.cc | 15+++++++++------
renderer.h | 2--
shadow_map.cc | 1-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/renderer.cc b/renderer.cc @@ -76,12 +76,14 @@ static size_t uniforms_offset; static Texture blue_noise; static RenderState previous_render_state; -static u32 previous_viewport_width, previous_viewport_height; +static FramebufferObject previous_fbo; +static u32 previous_viewport_width; +static u32 previous_viewport_height; static void bind_fb( FB fb ) { - if( fb.fbo != previous_render_state.fb.fbo ) { + if( fb.fbo != previous_fbo ) { glBindFramebuffer( GL_DRAW_FRAMEBUFFER, fb.fbo ); - previous_render_state.fb = fb; + previous_fbo = fb.fbo; u32 viewport_width, viewport_height; if( fb.fbo == 0 ) { @@ -109,6 +111,10 @@ void renderer_init() { in_frame = false; in_pass = false; + previous_fbo = 0; + previous_viewport_width = 0; + previous_viewport_height = 0; + GLint alignment; glGetIntegerv( GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &alignment ); ubo_offset_alignment = checked_cast< size_t >( alignment ); @@ -874,9 +880,6 @@ static void set_render_state( const RenderState & state ) { } } - // framebuffer - bind_fb( state.fb ); - // depth writing if( state.disable_depth_writes != previous_render_state.disable_depth_writes ) { glDepthMask( state.disable_depth_writes ? GL_FALSE : GL_TRUE ); diff --git a/renderer.h b/renderer.h @@ -109,7 +109,6 @@ struct RenderState { StaticArray< UniformBinding, RENDERER_MAX_UNIFORMS > uniforms = { }; StaticArray< Texture, RENDERER_MAX_TEXTURES > textures = { }; StaticArray< TB, RENDERER_MAX_TEXTURE_BUFFERS > tbs = { }; - FB fb = { }; Shader shader = INVALID_SHADER; DepthFunc depth_func = DEPTHFUNC_LESS; CullFace cull_face = CULLFACE_BACK; @@ -216,7 +215,6 @@ void renderer_tb_data( TB tb, const void * data, u32 len, BufferUsage usage = BU void renderer_delete_tb( TB tb ); FB renderer_new_fb( TextureConfig texture_format, FramebufferAttachment attachment ); -void renderer_clear_fb( FB fb ); void renderer_delete_fb( FB fb ); Shader renderer_new_shader( ShaderConfig config ); diff --git a/shadow_map.cc b/shadow_map.cc @@ -139,7 +139,6 @@ GAME_FRAME( game_frame ) { RenderState render_state; render_state.shader = get_shader( SHADER_WRITE_SHADOW_MAP ); render_state.uniforms[ UNIFORM_LIGHT_VIEW ] = light_view_uniforms; - render_state.fb = shadow_fb; draw_scene( render_state );