From 7b67f296114d8e4d3f345fe668ef30641db98c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Thu, 11 Apr 2024 01:13:35 +0200 Subject: [PATCH] gfx: drop viewport and scissor_box --- bind/v4k.lua | 1 - engine/joint/v4k.h | 20 +------------------- engine/split/v4k_font.c | 5 +---- engine/split/v4k_render.c | 14 -------------- engine/split/v4k_render.h | 1 - engine/v4k.c | 19 +------------------ engine/v4k.h | 1 - 7 files changed, 3 insertions(+), 58 deletions(-) diff --git a/bind/v4k.lua b/bind/v4k.lua index 9c2579b..71e28d1 100644 --- a/bind/v4k.lua +++ b/bind/v4k.lua @@ -1059,7 +1059,6 @@ typedef struct renderstate_t { unsigned polygon_mode_face; unsigned polygon_mode_mode; bool scissor_test_enabled; - int scissor_box[4]; } renderstate_t; renderstate_t renderstate(); bool renderstate_compare(const renderstate_t *stateA, const renderstate_t *stateB); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 96f731c..9d3f813 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -17082,7 +17082,6 @@ typedef struct renderstate_t { // Scissor test bool scissor_test_enabled; - int scissor_box[4]; } renderstate_t; API renderstate_t renderstate(); @@ -363545,10 +363544,7 @@ void font_draw_cmd(font_t *f, const float *glyph_data, int glyph_idx, float fact glActiveTexture(GL_TEXTURE2); glGetIntegerv(GL_TEXTURE_BINDING_1D, &last_texture2); - f->rs.scissor_box[0] = rect.x; - f->rs.scissor_box[1] = window_height() - (rect.y+rect.w); - f->rs.scissor_box[2] = rect.z; - f->rs.scissor_box[3] = rect.w; + glScissor(rect.x, window_height() - (rect.y+rect.w), rect.z, rect.w); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, f->texture_fontdata); @@ -370131,12 +370127,6 @@ void glCopyBackbufferToTexture( texture_t *tex ) { // unused renderstate_t renderstate() { renderstate_t state = {0}; - // Set default viewport parameters - state.viewport_x = 0; - state.viewport_y = 0; - state.viewport_width = window_width(); - state.viewport_height = window_height(); - // Set default clear color to black state.clear_color[0] = 0.0f; // Red state.clear_color[1] = 0.0f; // Green @@ -370183,10 +370173,6 @@ renderstate_t renderstate() { // Disable scissor test by default state.scissor_test_enabled = GL_FALSE; - state.scissor_box[0] = 0; - state.scissor_box[1] = 0; - state.scissor_box[2] = window_width(); - state.scissor_box[3] = window_height(); return state; } @@ -370197,9 +370183,6 @@ bool renderstate_compare(const renderstate_t *stateA, const renderstate_t *state void renderstate_apply(const renderstate_t *state) { if (state != NULL) { - // Apply viewport parameters @fixme - // glViewport(state->viewport_x, state->viewport_y, state->viewport_width, state->viewport_height); - // Apply clear color glClearColor(state->clear_color[0], state->clear_color[1], state->clear_color[2], state->clear_color[3]); @@ -370266,7 +370249,6 @@ void renderstate_apply(const renderstate_t *state) { // Apply scissor test if (state->scissor_test_enabled) { glEnable(GL_SCISSOR_TEST); - glScissor(state->scissor_box[0], state->scissor_box[1], state->scissor_box[2], state->scissor_box[3]); } else { glDisable(GL_SCISSOR_TEST); } diff --git a/engine/split/v4k_font.c b/engine/split/v4k_font.c index 7d61a2e..79b81c6 100644 --- a/engine/split/v4k_font.c +++ b/engine/split/v4k_font.c @@ -1935,10 +1935,7 @@ void font_draw_cmd(font_t *f, const float *glyph_data, int glyph_idx, float fact glActiveTexture(GL_TEXTURE2); glGetIntegerv(GL_TEXTURE_BINDING_1D, &last_texture2); - f->rs.scissor_box[0] = rect.x; - f->rs.scissor_box[1] = window_height() - (rect.y+rect.w); - f->rs.scissor_box[2] = rect.z; - f->rs.scissor_box[3] = rect.w; + glScissor(rect.x, window_height() - (rect.y+rect.w), rect.z, rect.w); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, f->texture_fontdata); diff --git a/engine/split/v4k_render.c b/engine/split/v4k_render.c index 0c501c0..1318a28 100644 --- a/engine/split/v4k_render.c +++ b/engine/split/v4k_render.c @@ -56,12 +56,6 @@ void glCopyBackbufferToTexture( texture_t *tex ) { // unused renderstate_t renderstate() { renderstate_t state = {0}; - // Set default viewport parameters - state.viewport_x = 0; - state.viewport_y = 0; - state.viewport_width = window_width(); - state.viewport_height = window_height(); - // Set default clear color to black state.clear_color[0] = 0.0f; // Red state.clear_color[1] = 0.0f; // Green @@ -108,10 +102,6 @@ renderstate_t renderstate() { // Disable scissor test by default state.scissor_test_enabled = GL_FALSE; - state.scissor_box[0] = 0; - state.scissor_box[1] = 0; - state.scissor_box[2] = window_width(); - state.scissor_box[3] = window_height(); return state; } @@ -122,9 +112,6 @@ bool renderstate_compare(const renderstate_t *stateA, const renderstate_t *state void renderstate_apply(const renderstate_t *state) { if (state != NULL) { - // Apply viewport parameters @fixme - // glViewport(state->viewport_x, state->viewport_y, state->viewport_width, state->viewport_height); - // Apply clear color glClearColor(state->clear_color[0], state->clear_color[1], state->clear_color[2], state->clear_color[3]); @@ -191,7 +178,6 @@ void renderstate_apply(const renderstate_t *state) { // Apply scissor test if (state->scissor_test_enabled) { glEnable(GL_SCISSOR_TEST); - glScissor(state->scissor_box[0], state->scissor_box[1], state->scissor_box[2], state->scissor_box[3]); } else { glDisable(GL_SCISSOR_TEST); } diff --git a/engine/split/v4k_render.h b/engine/split/v4k_render.h index a480c7f..ab1d645 100644 --- a/engine/split/v4k_render.h +++ b/engine/split/v4k_render.h @@ -60,7 +60,6 @@ typedef struct renderstate_t { // Scissor test bool scissor_test_enabled; - int scissor_box[4]; } renderstate_t; API renderstate_t renderstate(); diff --git a/engine/v4k.c b/engine/v4k.c index 2898710..0e6ebbb 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -10637,10 +10637,7 @@ void font_draw_cmd(font_t *f, const float *glyph_data, int glyph_idx, float fact glActiveTexture(GL_TEXTURE2); glGetIntegerv(GL_TEXTURE_BINDING_1D, &last_texture2); - f->rs.scissor_box[0] = rect.x; - f->rs.scissor_box[1] = window_height() - (rect.y+rect.w); - f->rs.scissor_box[2] = rect.z; - f->rs.scissor_box[3] = rect.w; + glScissor(rect.x, window_height() - (rect.y+rect.w), rect.z, rect.w); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, f->texture_fontdata); @@ -17223,12 +17220,6 @@ void glCopyBackbufferToTexture( texture_t *tex ) { // unused renderstate_t renderstate() { renderstate_t state = {0}; - // Set default viewport parameters - state.viewport_x = 0; - state.viewport_y = 0; - state.viewport_width = window_width(); - state.viewport_height = window_height(); - // Set default clear color to black state.clear_color[0] = 0.0f; // Red state.clear_color[1] = 0.0f; // Green @@ -17275,10 +17266,6 @@ renderstate_t renderstate() { // Disable scissor test by default state.scissor_test_enabled = GL_FALSE; - state.scissor_box[0] = 0; - state.scissor_box[1] = 0; - state.scissor_box[2] = window_width(); - state.scissor_box[3] = window_height(); return state; } @@ -17289,9 +17276,6 @@ bool renderstate_compare(const renderstate_t *stateA, const renderstate_t *state void renderstate_apply(const renderstate_t *state) { if (state != NULL) { - // Apply viewport parameters @fixme - // glViewport(state->viewport_x, state->viewport_y, state->viewport_width, state->viewport_height); - // Apply clear color glClearColor(state->clear_color[0], state->clear_color[1], state->clear_color[2], state->clear_color[3]); @@ -17358,7 +17342,6 @@ void renderstate_apply(const renderstate_t *state) { // Apply scissor test if (state->scissor_test_enabled) { glEnable(GL_SCISSOR_TEST); - glScissor(state->scissor_box[0], state->scissor_box[1], state->scissor_box[2], state->scissor_box[3]); } else { glDisable(GL_SCISSOR_TEST); } diff --git a/engine/v4k.h b/engine/v4k.h index 6de12c2..e704aa2 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -3149,7 +3149,6 @@ typedef struct renderstate_t { // Scissor test bool scissor_test_enabled; - int scissor_box[4]; } renderstate_t; API renderstate_t renderstate();