gfx: drop viewport and scissor_box

main
Dominik Madarász 2024-04-11 01:13:35 +02:00
parent 66a2d1ff6d
commit 7b67f29611
7 changed files with 3 additions and 58 deletions

View File

@ -1059,7 +1059,6 @@ typedef struct renderstate_t {
unsigned polygon_mode_face; unsigned polygon_mode_face;
unsigned polygon_mode_mode; unsigned polygon_mode_mode;
bool scissor_test_enabled; bool scissor_test_enabled;
int scissor_box[4];
} renderstate_t; } renderstate_t;
renderstate_t renderstate(); renderstate_t renderstate();
bool renderstate_compare(const renderstate_t *stateA, const renderstate_t *stateB); bool renderstate_compare(const renderstate_t *stateA, const renderstate_t *stateB);

View File

@ -17082,7 +17082,6 @@ typedef struct renderstate_t {
// Scissor test // Scissor test
bool scissor_test_enabled; bool scissor_test_enabled;
int scissor_box[4];
} renderstate_t; } renderstate_t;
API renderstate_t renderstate(); 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); glActiveTexture(GL_TEXTURE2);
glGetIntegerv(GL_TEXTURE_BINDING_1D, &last_texture2); glGetIntegerv(GL_TEXTURE_BINDING_1D, &last_texture2);
f->rs.scissor_box[0] = rect.x; glScissor(rect.x, window_height() - (rect.y+rect.w), rect.z, rect.w);
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;
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, f->texture_fontdata); glBindTexture(GL_TEXTURE_2D, f->texture_fontdata);
@ -370131,12 +370127,6 @@ void glCopyBackbufferToTexture( texture_t *tex ) { // unused
renderstate_t renderstate() { renderstate_t renderstate() {
renderstate_t state = {0}; 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 // Set default clear color to black
state.clear_color[0] = 0.0f; // Red state.clear_color[0] = 0.0f; // Red
state.clear_color[1] = 0.0f; // Green state.clear_color[1] = 0.0f; // Green
@ -370183,10 +370173,6 @@ renderstate_t renderstate() {
// Disable scissor test by default // Disable scissor test by default
state.scissor_test_enabled = GL_FALSE; 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; return state;
} }
@ -370197,9 +370183,6 @@ bool renderstate_compare(const renderstate_t *stateA, const renderstate_t *state
void renderstate_apply(const renderstate_t *state) { void renderstate_apply(const renderstate_t *state) {
if (state != NULL) { if (state != NULL) {
// Apply viewport parameters @fixme
// glViewport(state->viewport_x, state->viewport_y, state->viewport_width, state->viewport_height);
// Apply clear color // Apply clear color
glClearColor(state->clear_color[0], state->clear_color[1], state->clear_color[2], state->clear_color[3]); 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 // Apply scissor test
if (state->scissor_test_enabled) { if (state->scissor_test_enabled) {
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
glScissor(state->scissor_box[0], state->scissor_box[1], state->scissor_box[2], state->scissor_box[3]);
} else { } else {
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
} }

View File

@ -1935,10 +1935,7 @@ void font_draw_cmd(font_t *f, const float *glyph_data, int glyph_idx, float fact
glActiveTexture(GL_TEXTURE2); glActiveTexture(GL_TEXTURE2);
glGetIntegerv(GL_TEXTURE_BINDING_1D, &last_texture2); glGetIntegerv(GL_TEXTURE_BINDING_1D, &last_texture2);
f->rs.scissor_box[0] = rect.x; glScissor(rect.x, window_height() - (rect.y+rect.w), rect.z, rect.w);
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;
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, f->texture_fontdata); glBindTexture(GL_TEXTURE_2D, f->texture_fontdata);

View File

@ -56,12 +56,6 @@ void glCopyBackbufferToTexture( texture_t *tex ) { // unused
renderstate_t renderstate() { renderstate_t renderstate() {
renderstate_t state = {0}; 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 // Set default clear color to black
state.clear_color[0] = 0.0f; // Red state.clear_color[0] = 0.0f; // Red
state.clear_color[1] = 0.0f; // Green state.clear_color[1] = 0.0f; // Green
@ -108,10 +102,6 @@ renderstate_t renderstate() {
// Disable scissor test by default // Disable scissor test by default
state.scissor_test_enabled = GL_FALSE; 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; return state;
} }
@ -122,9 +112,6 @@ bool renderstate_compare(const renderstate_t *stateA, const renderstate_t *state
void renderstate_apply(const renderstate_t *state) { void renderstate_apply(const renderstate_t *state) {
if (state != NULL) { if (state != NULL) {
// Apply viewport parameters @fixme
// glViewport(state->viewport_x, state->viewport_y, state->viewport_width, state->viewport_height);
// Apply clear color // Apply clear color
glClearColor(state->clear_color[0], state->clear_color[1], state->clear_color[2], state->clear_color[3]); 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 // Apply scissor test
if (state->scissor_test_enabled) { if (state->scissor_test_enabled) {
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
glScissor(state->scissor_box[0], state->scissor_box[1], state->scissor_box[2], state->scissor_box[3]);
} else { } else {
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
} }

View File

@ -60,7 +60,6 @@ typedef struct renderstate_t {
// Scissor test // Scissor test
bool scissor_test_enabled; bool scissor_test_enabled;
int scissor_box[4];
} renderstate_t; } renderstate_t;
API renderstate_t renderstate(); API renderstate_t renderstate();

View File

@ -10637,10 +10637,7 @@ void font_draw_cmd(font_t *f, const float *glyph_data, int glyph_idx, float fact
glActiveTexture(GL_TEXTURE2); glActiveTexture(GL_TEXTURE2);
glGetIntegerv(GL_TEXTURE_BINDING_1D, &last_texture2); glGetIntegerv(GL_TEXTURE_BINDING_1D, &last_texture2);
f->rs.scissor_box[0] = rect.x; glScissor(rect.x, window_height() - (rect.y+rect.w), rect.z, rect.w);
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;
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, f->texture_fontdata); glBindTexture(GL_TEXTURE_2D, f->texture_fontdata);
@ -17223,12 +17220,6 @@ void glCopyBackbufferToTexture( texture_t *tex ) { // unused
renderstate_t renderstate() { renderstate_t renderstate() {
renderstate_t state = {0}; 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 // Set default clear color to black
state.clear_color[0] = 0.0f; // Red state.clear_color[0] = 0.0f; // Red
state.clear_color[1] = 0.0f; // Green state.clear_color[1] = 0.0f; // Green
@ -17275,10 +17266,6 @@ renderstate_t renderstate() {
// Disable scissor test by default // Disable scissor test by default
state.scissor_test_enabled = GL_FALSE; 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; return state;
} }
@ -17289,9 +17276,6 @@ bool renderstate_compare(const renderstate_t *stateA, const renderstate_t *state
void renderstate_apply(const renderstate_t *state) { void renderstate_apply(const renderstate_t *state) {
if (state != NULL) { if (state != NULL) {
// Apply viewport parameters @fixme
// glViewport(state->viewport_x, state->viewport_y, state->viewport_width, state->viewport_height);
// Apply clear color // Apply clear color
glClearColor(state->clear_color[0], state->clear_color[1], state->clear_color[2], state->clear_color[3]); 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 // Apply scissor test
if (state->scissor_test_enabled) { if (state->scissor_test_enabled) {
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
glScissor(state->scissor_box[0], state->scissor_box[1], state->scissor_box[2], state->scissor_box[3]);
} else { } else {
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
} }

View File

@ -3149,7 +3149,6 @@ typedef struct renderstate_t {
// Scissor test // Scissor test
bool scissor_test_enabled; bool scissor_test_enabled;
int scissor_box[4];
} renderstate_t; } renderstate_t;
API renderstate_t renderstate(); API renderstate_t renderstate();