mirror of
https://github.com/korenkonder/ReDIVA.git
synced 2026-10-12 00:58:20 +03:00
gl_rend_state massive overhaul. Created render_data_context
This commit is contained in:
+536
-65
@@ -5,9 +5,472 @@
|
||||
|
||||
#include "gl_rend_state.hpp"
|
||||
|
||||
gl_rend_state_struct gl_rend_state;
|
||||
struct gl_rend_state {
|
||||
GLuint program;
|
||||
GLuint active_texture_index;
|
||||
GLuint texture_binding_2d[32];
|
||||
GLuint texture_binding_cube_map[32];
|
||||
GLuint sampler_binding[32];
|
||||
GLboolean blend;
|
||||
GLenum blend_src_rgb;
|
||||
GLenum blend_src_alpha;
|
||||
GLenum blend_dst_rgb;
|
||||
GLenum blend_dst_alpha;
|
||||
GLenum blend_mode_rgb;
|
||||
GLenum blend_mode_alpha;
|
||||
GLuint read_framebuffer_binding;
|
||||
GLuint draw_framebuffer_binding;
|
||||
GLuint vertex_array_binding;
|
||||
GLuint array_buffer_binding;
|
||||
GLuint element_array_buffer_binding;
|
||||
GLuint uniform_buffer_binding;
|
||||
GLuint uniform_buffer_bindings[14];
|
||||
GLintptr uniform_buffer_offsets[14];
|
||||
GLsizeiptr uniform_buffer_sizes[14];
|
||||
GLuint shader_storage_buffer_binding;
|
||||
GLuint shader_storage_buffer_bindings[14];
|
||||
GLintptr shader_storage_buffer_offsets[14];
|
||||
GLsizeiptr shader_storage_buffer_sizes[14];
|
||||
GLboolean color_mask[4];
|
||||
GLboolean cull_face;
|
||||
GLenum cull_face_mode;
|
||||
GLboolean depth_test;
|
||||
GLenum depth_func;
|
||||
GLboolean depth_mask;
|
||||
GLfloat line_width;
|
||||
GLenum polygon_mode;
|
||||
GLboolean multisample;
|
||||
GLboolean primitive_restart;
|
||||
GLuint primitive_restart_index;
|
||||
gl_rend_state_rect scissor_box;
|
||||
GLboolean scissor_test;
|
||||
GLboolean stencil_test;
|
||||
GLenum stencil_func;
|
||||
GLenum stencil_fail;
|
||||
GLenum stencil_dpfail;
|
||||
GLenum stencil_dppass;
|
||||
GLuint stencil_mask;
|
||||
GLint stencil_ref;
|
||||
GLuint stencil_value_mask;
|
||||
gl_rend_state_rect viewport;
|
||||
|
||||
void gl_rend_state_struct::active_bind_texture_2d(int32_t index, GLuint texture, bool force) {
|
||||
void active_bind_texture_2d(int32_t index, GLuint texture, bool force = false);
|
||||
void active_bind_texture_cube_map(int32_t index, GLuint texture, bool force = false);
|
||||
void active_texture(size_t index, bool force = false);
|
||||
void begin_event(const char* message, int32_t length);
|
||||
void bind_framebuffer(GLuint framebuffer, bool force = false);
|
||||
void bind_read_framebuffer(GLuint framebuffer, bool force = false);
|
||||
void bind_draw_framebuffer(GLuint framebuffer, bool force = false);
|
||||
void bind_vertex_array(GLuint array, bool force = false);
|
||||
void bind_array_buffer(GLuint buffer, bool force = false);
|
||||
void bind_element_array_buffer(GLuint buffer, bool force = false);
|
||||
void bind_uniform_buffer(GLuint buffer, bool force = false);
|
||||
void bind_uniform_buffer_base(GLuint index, GLuint buffer, bool force = false);
|
||||
void bind_uniform_buffer_range(GLuint index,
|
||||
GLuint buffer, GLintptr offset, GLsizeiptr size, bool force = false);
|
||||
void bind_shader_storage_buffer(GLuint buffer, bool force = false);
|
||||
void bind_shader_storage_buffer_base(GLuint index, GLuint buffer, bool force = false);
|
||||
void bind_shader_storage_buffer_range(GLuint index,
|
||||
GLuint buffer, GLintptr offset, GLsizeiptr size, bool force = false);
|
||||
void bind_texture_2d(GLuint texture, bool force = false);
|
||||
void bind_texture_cube_map(GLuint texture, bool force = false);
|
||||
void bind_sampler(int32_t index, GLuint sampler, bool force = false);
|
||||
bool check_uniform_buffer_binding();
|
||||
bool check_uniform_buffer_binding_base(size_t index);
|
||||
bool check_shader_storage_buffer_binding();
|
||||
bool check_shader_storage_buffer_binding_base(size_t index);
|
||||
bool check_texture_binding_2d(size_t index);
|
||||
bool check_texture_binding_cube_map(size_t index);
|
||||
bool check_sampler_binding(int32_t index, GLuint sampler);
|
||||
void disable_blend(bool force = false);
|
||||
void disable_cull_face(bool force = false);
|
||||
void disable_depth_test(bool force = false);
|
||||
void disable_multisample(bool force = false);
|
||||
void disable_primitive_restart(bool force = false);
|
||||
void disable_scissor_test(bool force = false);
|
||||
void disable_stencil_test(bool force = false);
|
||||
void enable_blend(bool force = false);
|
||||
void enable_cull_face(bool force = false);
|
||||
void enable_depth_test(bool force = false);
|
||||
void enable_multisample(bool force = false);
|
||||
void enable_primitive_restart(bool force = false);
|
||||
void enable_scissor_test(bool force = false);
|
||||
void enable_stencil_test(bool force = false);
|
||||
void end_event();
|
||||
void get();
|
||||
GLuint get_program();
|
||||
gl_rend_state_rect get_scissor();
|
||||
void get_scissor(GLint& x, GLint& y, GLsizei& width, GLsizei& height);
|
||||
gl_rend_state_rect get_viewport();
|
||||
void get_viewport(GLint& x, GLint& y, GLsizei& width, GLsizei& height);
|
||||
void set_blend_func(GLenum src, GLenum dst, bool force = false);
|
||||
void set_blend_func_separate(GLenum src_rgb, GLenum dst_rgb,
|
||||
GLenum src_alpha, GLenum dst_alpha, bool force = false);
|
||||
void set_blend_equation(GLenum mode, bool force = false);
|
||||
void set_blend_equation_separate(
|
||||
GLenum mode_rgb, GLenum mode_alpha, bool force = false);
|
||||
void set_color_mask(GLboolean red, GLboolean green,
|
||||
GLboolean blue, GLboolean alpha, bool force = false);
|
||||
void set_cull_face_mode(GLenum mode, bool force = false);
|
||||
void set_depth_func(GLenum func, bool force = false);
|
||||
void set_depth_mask(GLboolean flag, bool force = false);
|
||||
void set_line_width(GLfloat width, bool force = false);
|
||||
void set_polygon_mode(GLenum face, GLenum mode, bool force = false);
|
||||
void set_primitive_restart_index(GLuint index, bool force = false);
|
||||
void set_scissor(const gl_rend_state_rect& rect, bool force = false);
|
||||
void set_scissor(GLint x, GLint y, GLsizei width, GLsizei height, bool force = false);
|
||||
void set_stencil_func(GLenum func, GLint ref, GLuint mask, bool force = false);
|
||||
void set_stencil_mask(GLuint mask, bool force = false);
|
||||
void set_stencil_op(GLenum sfail, GLenum dpfail, GLenum dppass, bool force = false);
|
||||
void set_viewport(const gl_rend_state_rect& rect, bool force = false);
|
||||
void set_viewport(GLint x, GLint y, GLsizei width, GLsizei height, bool force = false);
|
||||
void use_program(GLuint program, bool force = false);
|
||||
};
|
||||
|
||||
gl_rend_state gl_state_data[GL_REND_STATE_COUNT];
|
||||
|
||||
p_gl_rend_state::p_gl_rend_state(int32_t index) : ptr(gl_state_data[index]) {
|
||||
|
||||
}
|
||||
|
||||
void p_gl_rend_state::active_bind_texture_2d(int32_t index, GLuint texture, bool force) {
|
||||
ptr.active_bind_texture_2d(index, texture, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::active_bind_texture_cube_map(int32_t index, GLuint texture, bool force) {
|
||||
ptr.active_bind_texture_cube_map(index, texture, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::active_texture(size_t index, bool force) {
|
||||
ptr.active_texture(index, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::begin_event(const char* message, int32_t length) {
|
||||
ptr.begin_event(message, length);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_framebuffer(GLuint framebuffer, bool force) {
|
||||
ptr.bind_framebuffer(framebuffer, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_read_framebuffer(GLuint framebuffer, bool force) {
|
||||
ptr.bind_read_framebuffer(framebuffer, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_draw_framebuffer(GLuint framebuffer, bool force) {
|
||||
ptr.bind_draw_framebuffer(framebuffer, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_vertex_array(GLuint array, bool force) {
|
||||
ptr.bind_vertex_array(array, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_array_buffer(GLuint buffer, bool force) {
|
||||
ptr.bind_array_buffer(buffer, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_element_array_buffer(GLuint buffer, bool force) {
|
||||
ptr.bind_element_array_buffer(buffer, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_uniform_buffer(GLuint buffer, bool force) {
|
||||
ptr.bind_uniform_buffer(buffer, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_uniform_buffer_base(GLuint index, GLuint buffer, bool force) {
|
||||
ptr.bind_uniform_buffer_base(index, buffer, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_uniform_buffer_range(GLuint index,
|
||||
GLuint buffer, GLintptr offset, GLsizeiptr size, bool force) {
|
||||
ptr.bind_uniform_buffer_range(index, buffer, offset, size, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_shader_storage_buffer(GLuint buffer, bool force) {
|
||||
ptr.bind_shader_storage_buffer(buffer, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_shader_storage_buffer_base(GLuint index, GLuint buffer, bool force) {
|
||||
ptr.bind_shader_storage_buffer_base(index, buffer, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_shader_storage_buffer_range(GLuint index,
|
||||
GLuint buffer, GLintptr offset, GLsizeiptr size, bool force) {
|
||||
ptr.bind_shader_storage_buffer_range(index, buffer, offset, size, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_texture_2d(GLuint texture, bool force) {
|
||||
ptr.bind_texture_2d(texture, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_texture_cube_map(GLuint texture, bool force) {
|
||||
ptr.bind_texture_cube_map(texture, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::bind_sampler(int32_t index, GLuint sampler, bool force) {
|
||||
ptr.bind_sampler(index, sampler, force);
|
||||
}
|
||||
|
||||
bool p_gl_rend_state::check_uniform_buffer_binding() {
|
||||
return ptr.check_uniform_buffer_binding();
|
||||
}
|
||||
|
||||
bool p_gl_rend_state::check_uniform_buffer_binding_base(size_t index) {
|
||||
return ptr.check_uniform_buffer_binding_base(index);
|
||||
}
|
||||
|
||||
bool p_gl_rend_state::check_shader_storage_buffer_binding() {
|
||||
return ptr.check_shader_storage_buffer_binding();
|
||||
}
|
||||
|
||||
bool p_gl_rend_state::check_shader_storage_buffer_binding_base(size_t index) {
|
||||
return ptr.check_shader_storage_buffer_binding_base(index);
|
||||
}
|
||||
|
||||
bool p_gl_rend_state::check_texture_binding_2d(size_t index) {
|
||||
return ptr.check_texture_binding_2d(index);
|
||||
}
|
||||
|
||||
bool p_gl_rend_state::check_texture_binding_cube_map(size_t index) {
|
||||
return ptr.check_texture_binding_cube_map(index);
|
||||
}
|
||||
|
||||
bool p_gl_rend_state::check_sampler_binding(int32_t index, GLuint sampler) {
|
||||
return ptr.check_sampler_binding(index, sampler);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::disable_blend(bool force) {
|
||||
ptr.disable_blend(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::disable_cull_face(bool force) {
|
||||
ptr.disable_cull_face(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::disable_depth_test(bool force) {
|
||||
ptr.disable_depth_test(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::disable_multisample(bool force) {
|
||||
ptr.disable_multisample(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::disable_primitive_restart(bool force) {
|
||||
ptr.disable_primitive_restart(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::disable_scissor_test(bool force) {
|
||||
ptr.disable_scissor_test(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::disable_stencil_test(bool force) {
|
||||
ptr.disable_stencil_test(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::draw_arrays(GLenum mode, GLint first, GLsizei count) {
|
||||
glDrawArrays(mode, first, count);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::draw_elements(GLenum mode,
|
||||
GLsizei count, GLenum type, const void* indices) {
|
||||
switch (mode) {
|
||||
case GL_TRIANGLE_STRIP:
|
||||
uint32_t index;
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
index = 0xFF;
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
index = 0xFFFF;
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
default:
|
||||
index = 0xFFFFFFFF;
|
||||
break;
|
||||
}
|
||||
|
||||
enable_primitive_restart();
|
||||
set_primitive_restart_index(index);
|
||||
break;
|
||||
}
|
||||
|
||||
glDrawElements(mode, count, type, indices);
|
||||
|
||||
switch (mode) {
|
||||
case GL_TRIANGLE_STRIP:
|
||||
disable_primitive_restart();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void p_gl_rend_state::draw_range_elements(GLenum mode,
|
||||
GLuint start, GLuint end, GLsizei count, GLenum type, const void* indices) {
|
||||
switch (mode) {
|
||||
case GL_TRIANGLE_STRIP:
|
||||
uint32_t index;
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
index = 0xFF;
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
index = 0xFFFF;
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
default:
|
||||
index = 0xFFFFFFFF;
|
||||
break;
|
||||
}
|
||||
|
||||
enable_primitive_restart();
|
||||
set_primitive_restart_index(index);
|
||||
break;
|
||||
}
|
||||
|
||||
glDrawRangeElements(mode, start, end, count, type, indices);
|
||||
|
||||
switch (mode) {
|
||||
case GL_TRIANGLE_STRIP:
|
||||
disable_primitive_restart();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void p_gl_rend_state::enable_blend(bool force) {
|
||||
ptr.enable_blend(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::enable_cull_face(bool force) {
|
||||
ptr.enable_cull_face(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::enable_depth_test(bool force) {
|
||||
ptr.enable_depth_test(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::enable_multisample(bool force) {
|
||||
ptr.enable_multisample(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::enable_primitive_restart(bool force) {
|
||||
ptr.enable_primitive_restart(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::enable_scissor_test(bool force) {
|
||||
ptr.enable_scissor_test(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::enable_stencil_test(bool force) {
|
||||
ptr.enable_stencil_test(force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::end_event() {
|
||||
ptr.end_event();
|
||||
}
|
||||
|
||||
void p_gl_rend_state::get() {
|
||||
ptr.get();
|
||||
}
|
||||
|
||||
GLuint p_gl_rend_state::get_program() {
|
||||
return ptr.get_program();
|
||||
}
|
||||
|
||||
gl_rend_state_rect p_gl_rend_state::get_scissor() {
|
||||
return ptr.get_scissor();
|
||||
}
|
||||
|
||||
void p_gl_rend_state::get_scissor(GLint& x, GLint& y, GLsizei& width, GLsizei& height) {
|
||||
ptr.get_scissor(x, y, width, height);
|
||||
}
|
||||
|
||||
gl_rend_state_rect p_gl_rend_state::get_viewport() {
|
||||
return ptr.get_viewport();
|
||||
}
|
||||
|
||||
void p_gl_rend_state::get_viewport(GLint& x, GLint& y, GLsizei& width, GLsizei& height) {
|
||||
ptr.get_viewport(x, y, width, height);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_blend_func(GLenum src, GLenum dst, bool force) {
|
||||
ptr.set_blend_func(src, dst, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_blend_func_separate(GLenum src_rgb, GLenum dst_rgb,
|
||||
GLenum src_alpha, GLenum dst_alpha, bool force) {
|
||||
ptr.set_blend_func_separate(src_rgb, dst_rgb, src_alpha, dst_alpha, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_blend_equation(GLenum mode, bool force) {
|
||||
ptr.set_blend_equation(mode, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_blend_equation_separate(
|
||||
GLenum mode_rgb, GLenum mode_alpha, bool force) {
|
||||
ptr.set_blend_equation_separate(mode_rgb, mode_alpha, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_color_mask(GLboolean red, GLboolean green,
|
||||
GLboolean blue, GLboolean alpha, bool force) {
|
||||
ptr.set_color_mask(red, green, blue, alpha, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_cull_face_mode(GLenum mode, bool force) {
|
||||
ptr.set_cull_face_mode(mode, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_depth_func(GLenum func, bool force) {
|
||||
ptr.set_depth_func(func, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_depth_mask(GLboolean flag, bool force) {
|
||||
ptr.set_depth_mask(flag, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_line_width(GLfloat width, bool force) {
|
||||
ptr.set_line_width(width, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_polygon_mode(GLenum face, GLenum mode, bool force) {
|
||||
ptr.set_polygon_mode(face, mode, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_primitive_restart_index(GLuint index, bool force) {
|
||||
ptr.set_primitive_restart_index(index, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_scissor(const gl_rend_state_rect& rect, bool force) {
|
||||
ptr.set_scissor(rect, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_scissor(GLint x, GLint y, GLsizei width, GLsizei height, bool force) {
|
||||
ptr.set_scissor(x, y, width, height, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_stencil_func(GLenum func, GLint ref, GLuint mask, bool force) {
|
||||
ptr.set_stencil_func(func, ref, mask, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_stencil_mask(GLuint mask, bool force) {
|
||||
ptr.set_stencil_mask(mask, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_stencil_op(GLenum sfail, GLenum dpfail, GLenum dppass, bool force) {
|
||||
ptr.set_stencil_op(sfail, dpfail, dppass, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_viewport(const gl_rend_state_rect& rect, bool force) {
|
||||
ptr.set_viewport(rect, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::set_viewport(GLint x, GLint y, GLsizei width, GLsizei height, bool force) {
|
||||
ptr.set_viewport(x, y, width, height, force);
|
||||
}
|
||||
|
||||
void p_gl_rend_state::use_program(GLuint program, bool force) {
|
||||
ptr.use_program(program, force);
|
||||
}
|
||||
|
||||
void gl_rend_state::active_bind_texture_2d(int32_t index, GLuint texture, bool force) {
|
||||
if (force || texture_binding_2d[index] != texture) {
|
||||
if (force || active_texture_index != index) {
|
||||
glActiveTexture((GLenum)(GL_TEXTURE0 + index));
|
||||
@@ -18,7 +481,7 @@ void gl_rend_state_struct::active_bind_texture_2d(int32_t index, GLuint texture,
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::active_bind_texture_cube_map(int32_t index, GLuint texture, bool force) {
|
||||
void gl_rend_state::active_bind_texture_cube_map(int32_t index, GLuint texture, bool force) {
|
||||
if (force || texture_binding_cube_map[index] != texture) {
|
||||
if (force || active_texture_index != index) {
|
||||
glActiveTexture((GLenum)(GL_TEXTURE0 + index));
|
||||
@@ -29,14 +492,18 @@ void gl_rend_state_struct::active_bind_texture_cube_map(int32_t index, GLuint te
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::active_texture(size_t index, bool force) {
|
||||
void gl_rend_state::active_texture(size_t index, bool force) {
|
||||
if (force || active_texture_index != index) {
|
||||
glActiveTexture((GLenum)(GL_TEXTURE0 + index));
|
||||
active_texture_index = (GLuint)index;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_framebuffer(GLuint framebuffer, bool force) {
|
||||
void gl_rend_state::begin_event(const char* message, int32_t length) {
|
||||
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, (GLsizei)length, message);
|
||||
}
|
||||
|
||||
void gl_rend_state::bind_framebuffer(GLuint framebuffer, bool force) {
|
||||
if (force || read_framebuffer_binding != framebuffer
|
||||
|| draw_framebuffer_binding != framebuffer) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
|
||||
@@ -45,49 +512,49 @@ void gl_rend_state_struct::bind_framebuffer(GLuint framebuffer, bool force) {
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_read_framebuffer(GLuint framebuffer, bool force) {
|
||||
void gl_rend_state::bind_read_framebuffer(GLuint framebuffer, bool force) {
|
||||
if (force || read_framebuffer_binding != framebuffer) {
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer);
|
||||
read_framebuffer_binding = framebuffer;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_draw_framebuffer(GLuint framebuffer, bool force) {
|
||||
void gl_rend_state::bind_draw_framebuffer(GLuint framebuffer, bool force) {
|
||||
if (force || draw_framebuffer_binding != framebuffer) {
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer);
|
||||
draw_framebuffer_binding = framebuffer;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_vertex_array(GLuint array, bool force) {
|
||||
void gl_rend_state::bind_vertex_array(GLuint array, bool force) {
|
||||
if (force || vertex_array_binding != array) {
|
||||
glBindVertexArray(array);
|
||||
vertex_array_binding = array;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_array_buffer(GLuint buffer, bool force) {
|
||||
void gl_rend_state::bind_array_buffer(GLuint buffer, bool force) {
|
||||
if (force || array_buffer_binding != buffer) {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
array_buffer_binding = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_element_array_buffer(GLuint buffer, bool force) {
|
||||
void gl_rend_state::bind_element_array_buffer(GLuint buffer, bool force) {
|
||||
if (force || element_array_buffer_binding != buffer) {
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer);
|
||||
element_array_buffer_binding = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_uniform_buffer(GLuint buffer, bool force) {
|
||||
void gl_rend_state::bind_uniform_buffer(GLuint buffer, bool force) {
|
||||
if (force || uniform_buffer_binding != buffer) {
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, buffer);
|
||||
uniform_buffer_binding = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_uniform_buffer_base(GLuint index, GLuint buffer, bool force) {
|
||||
void gl_rend_state::bind_uniform_buffer_base(GLuint index, GLuint buffer, bool force) {
|
||||
if (force || uniform_buffer_bindings[index] != buffer) {
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, index, buffer);
|
||||
uniform_buffer_binding = buffer;
|
||||
@@ -97,7 +564,7 @@ void gl_rend_state_struct::bind_uniform_buffer_base(GLuint index, GLuint buffer,
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_uniform_buffer_range(GLuint index,
|
||||
void gl_rend_state::bind_uniform_buffer_range(GLuint index,
|
||||
GLuint buffer, GLintptr offset, GLsizeiptr size, bool force) {
|
||||
if (force || uniform_buffer_bindings[index] != buffer
|
||||
|| uniform_buffer_offsets[index] != offset
|
||||
@@ -110,14 +577,14 @@ void gl_rend_state_struct::bind_uniform_buffer_range(GLuint index,
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_shader_storage_buffer(GLuint buffer, bool force) {
|
||||
void gl_rend_state::bind_shader_storage_buffer(GLuint buffer, bool force) {
|
||||
if (force || shader_storage_buffer_binding != buffer) {
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffer);
|
||||
shader_storage_buffer_binding = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_shader_storage_buffer_base(GLuint index, GLuint buffer, bool force) {
|
||||
void gl_rend_state::bind_shader_storage_buffer_base(GLuint index, GLuint buffer, bool force) {
|
||||
if (force || shader_storage_buffer_bindings[index] != buffer) {
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, index, buffer);
|
||||
shader_storage_buffer_binding = buffer;
|
||||
@@ -127,7 +594,7 @@ void gl_rend_state_struct::bind_shader_storage_buffer_base(GLuint index, GLuint
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_shader_storage_buffer_range(GLuint index,
|
||||
void gl_rend_state::bind_shader_storage_buffer_range(GLuint index,
|
||||
GLuint buffer, GLintptr offset, GLsizeiptr size, bool force) {
|
||||
if (force || shader_storage_buffer_bindings[index] != buffer
|
||||
|| shader_storage_buffer_offsets[index] != offset
|
||||
@@ -140,154 +607,154 @@ void gl_rend_state_struct::bind_shader_storage_buffer_range(GLuint index,
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_texture_2d(GLuint texture, bool force) {
|
||||
void gl_rend_state::bind_texture_2d(GLuint texture, bool force) {
|
||||
if (texture_binding_2d[active_texture_index] != texture) {
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
texture_binding_2d[active_texture_index] = texture;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_texture_cube_map(GLuint texture, bool force) {
|
||||
void gl_rend_state::bind_texture_cube_map(GLuint texture, bool force) {
|
||||
if (force || texture_binding_cube_map[active_texture_index] != texture) {
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
|
||||
texture_binding_cube_map[active_texture_index] = texture;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::bind_sampler(int32_t index, GLuint sampler, bool force) {
|
||||
void gl_rend_state::bind_sampler(int32_t index, GLuint sampler, bool force) {
|
||||
if (force || sampler_binding[index] != sampler) {
|
||||
glBindSampler(index, sampler);
|
||||
sampler_binding[index] = sampler;
|
||||
}
|
||||
}
|
||||
|
||||
bool gl_rend_state_struct::check_uniform_buffer_binding() {
|
||||
bool gl_rend_state::check_uniform_buffer_binding() {
|
||||
return uniform_buffer_binding != 0;
|
||||
}
|
||||
|
||||
bool gl_rend_state_struct::check_uniform_buffer_binding_base(size_t index) {
|
||||
bool gl_rend_state::check_uniform_buffer_binding_base(size_t index) {
|
||||
return uniform_buffer_bindings[index] != 0;
|
||||
}
|
||||
|
||||
bool gl_rend_state_struct::check_shader_storage_buffer_binding() {
|
||||
bool gl_rend_state::check_shader_storage_buffer_binding() {
|
||||
return shader_storage_buffer_binding != 0;
|
||||
}
|
||||
|
||||
bool gl_rend_state_struct::check_shader_storage_buffer_binding_base(size_t index) {
|
||||
bool gl_rend_state::check_shader_storage_buffer_binding_base(size_t index) {
|
||||
return shader_storage_buffer_bindings[index] != 0;
|
||||
}
|
||||
|
||||
bool gl_rend_state_struct::check_texture_binding_2d(size_t index) {
|
||||
bool gl_rend_state::check_texture_binding_2d(size_t index) {
|
||||
return texture_binding_2d[index] != 0;
|
||||
}
|
||||
|
||||
bool gl_rend_state_struct::check_texture_binding_cube_map(size_t index) {
|
||||
bool gl_rend_state::check_texture_binding_cube_map(size_t index) {
|
||||
return texture_binding_cube_map[index] != 0;
|
||||
}
|
||||
|
||||
bool gl_rend_state_struct::check_sampler_binding(int32_t index, GLuint sampler) {
|
||||
bool gl_rend_state::check_sampler_binding(int32_t index, GLuint sampler) {
|
||||
return sampler_binding[index] != 0;
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::disable_blend(bool force) {
|
||||
void gl_rend_state::disable_blend(bool force) {
|
||||
if (force || blend) {
|
||||
glDisable(GL_BLEND);
|
||||
blend = GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::disable_cull_face(bool force) {
|
||||
void gl_rend_state::disable_cull_face(bool force) {
|
||||
if (force || cull_face) {
|
||||
glDisable(GL_CULL_FACE);
|
||||
cull_face = GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::disable_depth_test(bool force) {
|
||||
void gl_rend_state::disable_depth_test(bool force) {
|
||||
if (force || depth_test) {
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
depth_test = GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::disable_multisample(bool force) {
|
||||
void gl_rend_state::disable_multisample(bool force) {
|
||||
if (force || multisample) {
|
||||
glDisable(GL_MULTISAMPLE);
|
||||
multisample = GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::disable_primitive_restart(bool force) {
|
||||
void gl_rend_state::disable_primitive_restart(bool force) {
|
||||
if (force || primitive_restart) {
|
||||
glDisable(GL_PRIMITIVE_RESTART);
|
||||
primitive_restart = GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::disable_scissor_test(bool force) {
|
||||
void gl_rend_state::disable_scissor_test(bool force) {
|
||||
if (force || scissor_test) {
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
scissor_test = GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::disable_stencil_test(bool force) {
|
||||
void gl_rend_state::disable_stencil_test(bool force) {
|
||||
if (force || stencil_test) {
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
stencil_test = GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::enable_blend(bool force) {
|
||||
void gl_rend_state::enable_blend(bool force) {
|
||||
if (force || !blend) {
|
||||
glEnable(GL_BLEND);
|
||||
blend = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::enable_cull_face(bool force) {
|
||||
void gl_rend_state::enable_cull_face(bool force) {
|
||||
if (force || !cull_face) {
|
||||
glEnable(GL_CULL_FACE);
|
||||
cull_face = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::enable_depth_test(bool force) {
|
||||
void gl_rend_state::enable_depth_test(bool force) {
|
||||
if (force || !depth_test) {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
depth_test = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::enable_multisample(bool force) {
|
||||
void gl_rend_state::enable_multisample(bool force) {
|
||||
if (force || !multisample) {
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
multisample = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::enable_primitive_restart(bool force) {
|
||||
void gl_rend_state::enable_primitive_restart(bool force) {
|
||||
if (force || !primitive_restart) {
|
||||
glEnable(GL_PRIMITIVE_RESTART);
|
||||
primitive_restart = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::enable_scissor_test(bool force) {
|
||||
void gl_rend_state::enable_scissor_test(bool force) {
|
||||
if (force || !scissor_test) {
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
scissor_test = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::enable_stencil_test(bool force) {
|
||||
void gl_rend_state::enable_stencil_test(bool force) {
|
||||
if (force || !stencil_test) {
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
stencil_test = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::get() {
|
||||
void gl_rend_state::get() {
|
||||
glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&program);
|
||||
GLenum active_texture = GL_TEXTURE0;
|
||||
glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&active_texture);
|
||||
@@ -364,33 +831,37 @@ void gl_rend_state_struct::get() {
|
||||
polygon_mode = GL_FILL;
|
||||
}
|
||||
|
||||
GLuint gl_rend_state_struct::get_program() {
|
||||
void gl_rend_state::end_event() {
|
||||
glPopDebugGroup();
|
||||
}
|
||||
|
||||
GLuint gl_rend_state::get_program() {
|
||||
return program;
|
||||
}
|
||||
|
||||
gl_rend_state_rect gl_rend_state_struct::get_scissor() {
|
||||
gl_rend_state_rect gl_rend_state::get_scissor() {
|
||||
return scissor_box;
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::get_scissor(GLint& x, GLint& y, GLsizei& width, GLsizei& height) {
|
||||
void gl_rend_state::get_scissor(GLint& x, GLint& y, GLsizei& width, GLsizei& height) {
|
||||
x = scissor_box.x;
|
||||
y = scissor_box.y;
|
||||
width = scissor_box.width;
|
||||
height = scissor_box.height;
|
||||
}
|
||||
|
||||
gl_rend_state_rect gl_rend_state_struct::get_viewport() {
|
||||
gl_rend_state_rect gl_rend_state::get_viewport() {
|
||||
return viewport;
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::get_viewport(GLint& x, GLint& y, GLsizei& width, GLsizei& height) {
|
||||
void gl_rend_state::get_viewport(GLint& x, GLint& y, GLsizei& width, GLsizei& height) {
|
||||
x = viewport.x;
|
||||
y = viewport.y;
|
||||
width = viewport.width;
|
||||
height = viewport.height;
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_blend_func(GLenum src, GLenum dst, bool force) {
|
||||
void gl_rend_state::set_blend_func(GLenum src, GLenum dst, bool force) {
|
||||
if (force || blend_src_rgb != src || blend_dst_rgb != dst
|
||||
|| blend_src_alpha != GL_ONE || blend_dst_alpha != GL_ONE_MINUS_SRC_ALPHA) {
|
||||
glBlendFuncSeparate(src, dst, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -401,7 +872,7 @@ void gl_rend_state_struct::set_blend_func(GLenum src, GLenum dst, bool force) {
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_blend_func_separate(GLenum src_rgb, GLenum dst_rgb,
|
||||
void gl_rend_state::set_blend_func_separate(GLenum src_rgb, GLenum dst_rgb,
|
||||
GLenum src_alpha, GLenum dst_alpha, bool force) {
|
||||
if (force || blend_src_rgb != src_rgb || blend_dst_rgb != dst_rgb
|
||||
|| blend_src_alpha != src_alpha || blend_dst_alpha != dst_alpha) {
|
||||
@@ -413,7 +884,7 @@ void gl_rend_state_struct::set_blend_func_separate(GLenum src_rgb, GLenum dst_rg
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_blend_equation(GLenum mode, bool force) {
|
||||
void gl_rend_state::set_blend_equation(GLenum mode, bool force) {
|
||||
if (force || blend_mode_rgb != mode || blend_mode_alpha != mode) {
|
||||
glBlendEquationSeparate(mode, mode);
|
||||
blend_mode_rgb = mode;
|
||||
@@ -421,7 +892,7 @@ void gl_rend_state_struct::set_blend_equation(GLenum mode, bool force) {
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_blend_equation_separate(GLenum mode_rgb, GLenum mode_alpha, bool force) {
|
||||
void gl_rend_state::set_blend_equation_separate(GLenum mode_rgb, GLenum mode_alpha, bool force) {
|
||||
if (force || blend_mode_rgb != mode_rgb || blend_mode_alpha != mode_alpha) {
|
||||
glBlendEquationSeparate(mode_rgb, mode_alpha);
|
||||
blend_mode_rgb = mode_rgb;
|
||||
@@ -429,7 +900,7 @@ void gl_rend_state_struct::set_blend_equation_separate(GLenum mode_rgb, GLenum m
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_color_mask(GLboolean red, GLboolean green,
|
||||
void gl_rend_state::set_color_mask(GLboolean red, GLboolean green,
|
||||
GLboolean blue, GLboolean alpha, bool force) {
|
||||
if (force || color_mask[0] != red || color_mask[1] != green
|
||||
|| color_mask[2] != blue || color_mask[3] != alpha) {
|
||||
@@ -441,35 +912,35 @@ void gl_rend_state_struct::set_color_mask(GLboolean red, GLboolean green,
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_cull_face_mode(GLenum mode, bool force) {
|
||||
void gl_rend_state::set_cull_face_mode(GLenum mode, bool force) {
|
||||
if (force || cull_face_mode != mode) {
|
||||
glCullFace(mode);
|
||||
cull_face_mode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_depth_func(GLenum func, bool force) {
|
||||
void gl_rend_state::set_depth_func(GLenum func, bool force) {
|
||||
if (force || depth_func != func) {
|
||||
glDepthFunc(func);
|
||||
depth_func = func;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_depth_mask(GLboolean flag, bool force) {
|
||||
void gl_rend_state::set_depth_mask(GLboolean flag, bool force) {
|
||||
if (force || depth_mask != flag) {
|
||||
glDepthMask(flag);
|
||||
depth_mask = flag;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_line_width(GLfloat width, bool force) {
|
||||
void gl_rend_state::set_line_width(GLfloat width, bool force) {
|
||||
if (force || line_width != width) {
|
||||
glLineWidth(width);
|
||||
line_width = width;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_polygon_mode(GLenum face, GLenum mode, bool force) {
|
||||
void gl_rend_state::set_polygon_mode(GLenum face, GLenum mode, bool force) {
|
||||
switch (face) {
|
||||
case GL_FRONT:
|
||||
if (force || polygon_mode != mode) {
|
||||
@@ -492,14 +963,14 @@ void gl_rend_state_struct::set_polygon_mode(GLenum face, GLenum mode, bool force
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_primitive_restart_index(GLuint index, bool force) {
|
||||
void gl_rend_state::set_primitive_restart_index(GLuint index, bool force) {
|
||||
if (force || primitive_restart_index != index) {
|
||||
glPrimitiveRestartIndex(index);
|
||||
primitive_restart_index = index;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_scissor(const gl_rend_state_rect& rect, bool force) {
|
||||
void gl_rend_state::set_scissor(const gl_rend_state_rect& rect, bool force) {
|
||||
if (force || scissor_box.x != rect.x || scissor_box.y != rect.y
|
||||
|| scissor_box.width != rect.width || scissor_box.height != rect.height) {
|
||||
glScissor(rect.x, rect.y, rect.width, rect.height);
|
||||
@@ -507,7 +978,7 @@ void gl_rend_state_struct::set_scissor(const gl_rend_state_rect& rect, bool forc
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_scissor(GLint x, GLint y, GLsizei width, GLsizei height, bool force) {
|
||||
void gl_rend_state::set_scissor(GLint x, GLint y, GLsizei width, GLsizei height, bool force) {
|
||||
if (force || scissor_box.x != x || scissor_box.y != y
|
||||
|| scissor_box.width != width || scissor_box.height != height) {
|
||||
glScissor(x, y, width, height);
|
||||
@@ -518,7 +989,7 @@ void gl_rend_state_struct::set_scissor(GLint x, GLint y, GLsizei width, GLsizei
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_stencil_func(GLenum func, GLint ref, GLuint mask, bool force) {
|
||||
void gl_rend_state::set_stencil_func(GLenum func, GLint ref, GLuint mask, bool force) {
|
||||
if (force || stencil_func != func || stencil_ref != ref || stencil_value_mask != mask) {
|
||||
glStencilFunc(func, ref, mask);
|
||||
stencil_func = func;
|
||||
@@ -527,14 +998,14 @@ void gl_rend_state_struct::set_stencil_func(GLenum func, GLint ref, GLuint mask,
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_stencil_mask(GLuint mask, bool force) {
|
||||
void gl_rend_state::set_stencil_mask(GLuint mask, bool force) {
|
||||
if (force || stencil_mask != mask) {
|
||||
glStencilMask(mask);
|
||||
stencil_mask = mask;
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_stencil_op(GLenum sfail, GLenum dpfail, GLenum dppass, bool force) {
|
||||
void gl_rend_state::set_stencil_op(GLenum sfail, GLenum dpfail, GLenum dppass, bool force) {
|
||||
if (force || stencil_fail != sfail || stencil_dpfail != dpfail || stencil_dppass != dppass) {
|
||||
glStencilOp(sfail, dpfail, dppass);
|
||||
stencil_fail = sfail;
|
||||
@@ -543,7 +1014,7 @@ void gl_rend_state_struct::set_stencil_op(GLenum sfail, GLenum dpfail, GLenum dp
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_viewport(const gl_rend_state_rect& rect, bool force) {
|
||||
void gl_rend_state::set_viewport(const gl_rend_state_rect& rect, bool force) {
|
||||
if (force || viewport.x != rect.x || viewport.y != rect.y
|
||||
|| viewport.width != rect.width || viewport.height != rect.height) {
|
||||
glViewport(rect.x, rect.y, rect.width, rect.height);
|
||||
@@ -551,7 +1022,7 @@ void gl_rend_state_struct::set_viewport(const gl_rend_state_rect& rect, bool for
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::set_viewport(GLint x, GLint y, GLsizei width, GLsizei height, bool force) {
|
||||
void gl_rend_state::set_viewport(GLint x, GLint y, GLsizei width, GLsizei height, bool force) {
|
||||
if (force || viewport.x != x || viewport.y != y
|
||||
|| viewport.width != width || viewport.height != height) {
|
||||
glViewport(x, y, width, height);
|
||||
@@ -562,7 +1033,7 @@ void gl_rend_state_struct::set_viewport(GLint x, GLint y, GLsizei width, GLsizei
|
||||
}
|
||||
}
|
||||
|
||||
void gl_rend_state_struct::use_program(GLuint program, bool force) {
|
||||
void gl_rend_state::use_program(GLuint program, bool force) {
|
||||
if (force || this->program != program) {
|
||||
glUseProgram(program);
|
||||
this->program = program;
|
||||
|
||||
Reference in New Issue
Block a user