From 291afea8ccdea57d4b2a51f134e9f53deeff964e Mon Sep 17 00:00:00 2001 From: Mike Erwin Date: Tue, 24 Nov 2015 02:20:38 -0500 Subject: OpenGL: clean up use of old extensions --- source/blender/gpu/intern/gpu_compositing.c | 20 +++++++------- source/blender/gpu/intern/gpu_debug.c | 4 +-- source/blender/gpu/intern/gpu_draw.c | 42 ++++++++++++++--------------- source/blender/gpu/intern/gpu_extensions.c | 7 +---- source/blender/gpu/intern/gpu_select.c | 24 ++++++----------- 5 files changed, 39 insertions(+), 58 deletions(-) (limited to 'source/blender/gpu/intern') diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c index e8795a0e00e..1ad35c1edae 100644 --- a/source/blender/gpu/intern/gpu_compositing.c +++ b/source/blender/gpu/intern/gpu_compositing.c @@ -179,14 +179,13 @@ GPUFX *GPU_fx_compositor_create(void) { GPUFX *fx = MEM_callocN(sizeof(GPUFX), "GPUFX compositor"); - if (GLEW_ARB_vertex_buffer_object) { - glGenBuffersARB(1, &fx->vbuffer); - glBindBuffer(GL_ARRAY_BUFFER, fx->vbuffer); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, 16 * sizeof(float), NULL, GL_STATIC_DRAW); - glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 8 * sizeof(float), fullscreencos); - glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 8 * sizeof(float), 8 * sizeof(float), fullscreenuvs); - glBindBuffer(GL_ARRAY_BUFFER, 0); - } + glGenBuffers(1, &fx->vbuffer); + glBindBuffer(GL_ARRAY_BUFFER, fx->vbuffer); + glBufferData(GL_ARRAY_BUFFER, 16 * sizeof(float), NULL, GL_STATIC_DRAW); + glBufferSubData(GL_ARRAY_BUFFER, 0, 8 * sizeof(float), fullscreencos); + glBufferSubData(GL_ARRAY_BUFFER, 8 * sizeof(float), 8 * sizeof(float), fullscreenuvs); + glBindBuffer(GL_ARRAY_BUFFER, 0); + return fx; } @@ -275,8 +274,7 @@ static void cleanup_fx_gl_data(GPUFX *fx, bool do_fbo) void GPU_fx_compositor_destroy(GPUFX *fx) { cleanup_fx_gl_data(fx, true); - if (GLEW_ARB_vertex_buffer_object) - glDeleteBuffersARB(1, &fx->vbuffer); + glDeleteBuffers(1, &fx->vbuffer); MEM_freeN(fx); } @@ -306,7 +304,7 @@ bool GPU_fx_compositor_initialize_passes( fx->effects = 0; - if (!GPU_non_power_of_two_support() || !GLEW_EXT_framebuffer_object || !GLEW_ARB_fragment_shader) + if (!GPU_non_power_of_two_support() || !GLEW_EXT_framebuffer_object) return false; if (!fx_settings) { diff --git a/source/blender/gpu/intern/gpu_debug.c b/source/blender/gpu/intern/gpu_debug.c index 29b7ff11586..ce1ddafa3e4 100644 --- a/source/blender/gpu/intern/gpu_debug.c +++ b/source/blender/gpu/intern/gpu_debug.c @@ -457,7 +457,7 @@ void GPU_state_print(void) gpu_state_print_fl(GL_FOG_INDEX); gpu_state_print_fl(GL_FOG_MODE); gpu_state_print_fl(GL_FOG_START); - gpu_state_print_fl(GL_FRAGMENT_PROGRAM_ARB); + gpu_state_print_fl(GL_FRAGMENT_PROGRAM_ARB); /* TODO: remove ARB program support */ gpu_state_print_fl(GL_FRAGMENT_SHADER_DERIVATIVE_HINT); gpu_state_print_fl(GL_FRONT_FACE); gpu_state_print_fl(GL_GENERATE_MIPMAP_HINT); @@ -560,7 +560,6 @@ void GPU_state_print(void) gpu_state_print_fl(GL_MODELVIEW_MATRIX); gpu_state_print_fl(GL_MODELVIEW_STACK_DEPTH); gpu_state_print_fl(GL_MULTISAMPLE); - gpu_state_print_fl(GL_MULTISAMPLE_ARB); gpu_state_print_fl(GL_NAME_STACK_DEPTH); gpu_state_print_fl(GL_NORMALIZE); gpu_state_print_fl(GL_NORMAL_ARRAY); @@ -686,7 +685,6 @@ void GPU_state_print(void) gpu_state_print_fl(GL_TEXTURE_COORD_ARRAY_STRIDE); gpu_state_print_fl(GL_TEXTURE_COORD_ARRAY_TYPE); gpu_state_print_fl(GL_TEXTURE_CUBE_MAP); - gpu_state_print_fl(GL_TEXTURE_CUBE_MAP_ARB); gpu_state_print_fl(GL_TEXTURE_GEN_Q); gpu_state_print_fl(GL_TEXTURE_GEN_R); gpu_state_print_fl(GL_TEXTURE_GEN_S); diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 3ad396a532c..f71733064c4 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -182,17 +182,17 @@ void GPU_render_text( uv[2][1] = (uv_quad[2][1] - centery) * sizey + transy; glBegin(GL_POLYGON); - if (glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[0]); + if (glattrib >= 0) glVertexAttrib2fv(glattrib, uv[0]); else glTexCoord2fv(uv[0]); if (col) gpu_mcol(col[0]); glVertex3f(sizex * v1[0] + movex, sizey * v1[1] + movey, v1[2]); - if (glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[1]); + if (glattrib >= 0) glVertexAttrib2fv(glattrib, uv[1]); else glTexCoord2fv(uv[1]); if (col) gpu_mcol(col[1]); glVertex3f(sizex * v2[0] + movex, sizey * v2[1] + movey, v2[2]); - if (glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[2]); + if (glattrib >= 0) glVertexAttrib2fv(glattrib, uv[2]); else glTexCoord2fv(uv[2]); if (col) gpu_mcol(col[2]); glVertex3f(sizex * v3[0] + movex, sizey * v3[1] + movey, v3[2]); @@ -201,7 +201,7 @@ void GPU_render_text( uv[3][0] = (uv_quad[3][0] - centerx) * sizex + transx; uv[3][1] = (uv_quad[3][1] - centery) * sizey + transy; - if (glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[3]); + if (glattrib >= 0) glVertexAttrib2fv(glattrib, uv[3]); else glTexCoord2fv(uv[3]); if (col) gpu_mcol(col[3]); glVertex3f(sizex * v4[0] + movex, sizey * v4[1] + movey, v4[2]); @@ -2039,33 +2039,31 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[4][ static void gpu_multisample(bool enable) { - if (GLEW_VERSION_1_3 || GLEW_ARB_multisample) { #ifdef __linux__ - /* changing multisample from the default (enabled) causes problems on some - * systems (NVIDIA/Linux) when the pixel format doesn't have a multisample buffer */ - bool toggle_ok = true; + /* changing multisample from the default (enabled) causes problems on some + * systems (NVIDIA/Linux) when the pixel format doesn't have a multisample buffer */ + bool toggle_ok = true; - if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_UNIX, GPU_DRIVER_ANY)) { - int samples = 0; - glGetIntegerv(GL_SAMPLES, &samples); + if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_UNIX, GPU_DRIVER_ANY)) { + int samples = 0; + glGetIntegerv(GL_SAMPLES, &samples); - if (samples == 0) - toggle_ok = false; - } + if (samples == 0) + toggle_ok = false; + } - if (toggle_ok) { - if (enable) - glEnable(GL_MULTISAMPLE); - else - glDisable(GL_MULTISAMPLE); - } -#else + if (toggle_ok) { if (enable) glEnable(GL_MULTISAMPLE); else glDisable(GL_MULTISAMPLE); -#endif } +#else + if (enable) + glEnable(GL_MULTISAMPLE); + else + glDisable(GL_MULTISAMPLE); +#endif } /* Default OpenGL State */ diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 270cf6c70d7..3ff8ab5b4c8 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -283,11 +283,6 @@ bool GPU_non_power_of_two_support(void) return !GG.npotdisabled; } -bool GPU_vertex_buffer_support(void) -{ - return true; -} - bool GPU_display_list_support(void) { return !GG.dlistsdisabled; @@ -1780,7 +1775,7 @@ void GPU_program_unbind(GPUProgram *program) GPUProgram *GPU_program_shader_create(GPUProgramType type, const char *code) { - /* TODO(merwin): remove ARB shader support (recode smoke shader in GLSL) */ + /* TODO(merwin): remove ARB program support (recode smoke shader in GLSL) */ GPUProgram *program; GLint error_pos, is_native; diff --git a/source/blender/gpu/intern/gpu_select.c b/source/blender/gpu/intern/gpu_select.c index 4978229a350..44847dd5a48 100644 --- a/source/blender/gpu/intern/gpu_select.c +++ b/source/blender/gpu/intern/gpu_select.c @@ -95,7 +95,7 @@ void GPU_select_begin(unsigned int *buffer, unsigned int bufsize, rctf *input, c g_query_state.queries = MEM_mallocN(g_query_state.num_of_queries * sizeof(*g_query_state.queries), "gpu selection queries"); g_query_state.id = MEM_mallocN(g_query_state.num_of_queries * sizeof(*g_query_state.id), "gpu selection ids"); - glGenQueriesARB(g_query_state.num_of_queries, g_query_state.queries); + glGenQueries(g_query_state.num_of_queries, g_query_state.queries); glPushAttrib(GL_DEPTH_BUFFER_BIT | GL_VIEWPORT_BIT); /* disable writing to the framebuffer */ @@ -144,17 +144,17 @@ bool GPU_select_load_id(unsigned int id) } else { if (g_query_state.query_issued) { - glEndQueryARB(GL_SAMPLES_PASSED_ARB); + glEndQuery(GL_SAMPLES_PASSED); } /* if required, allocate extra queries */ if (g_query_state.active_query == g_query_state.num_of_queries) { g_query_state.num_of_queries += ALLOC_QUERIES; g_query_state.queries = MEM_reallocN(g_query_state.queries, g_query_state.num_of_queries * sizeof(*g_query_state.queries)); g_query_state.id = MEM_reallocN(g_query_state.id, g_query_state.num_of_queries * sizeof(*g_query_state.id)); - glGenQueriesARB(ALLOC_QUERIES, &g_query_state.queries[g_query_state.active_query]); + glGenQueries(ALLOC_QUERIES, &g_query_state.queries[g_query_state.active_query]); } - glBeginQueryARB(GL_SAMPLES_PASSED_ARB, g_query_state.queries[g_query_state.active_query]); + glBeginQuery(GL_SAMPLES_PASSED, g_query_state.queries[g_query_state.active_query]); g_query_state.id[g_query_state.active_query] = id; g_query_state.active_query++; g_query_state.query_issued = true; @@ -184,12 +184,12 @@ unsigned int GPU_select_end(void) int i; if (g_query_state.query_issued) { - glEndQueryARB(GL_SAMPLES_PASSED_ARB); + glEndQuery(GL_SAMPLES_PASSED); } for (i = 0; i < g_query_state.active_query; i++) { unsigned int result; - glGetQueryObjectuivARB(g_query_state.queries[i], GL_QUERY_RESULT_ARB, &result); + glGetQueryObjectuiv(g_query_state.queries[i], GL_QUERY_RESULT, &result); if (result > 0) { if (g_query_state.mode != GPU_SELECT_NEAREST_SECOND_PASS) { int maxhits = g_query_state.bufsize / 4; @@ -221,7 +221,7 @@ unsigned int GPU_select_end(void) } } - glDeleteQueriesARB(g_query_state.num_of_queries, g_query_state.queries); + glDeleteQueries(g_query_state.num_of_queries, g_query_state.queries); MEM_freeN(g_query_state.queries); MEM_freeN(g_query_state.id); glPopAttrib(); @@ -233,16 +233,8 @@ unsigned int GPU_select_end(void) return hits; } - -bool GPU_select_query_check_support(void) -{ - return GLEW_ARB_occlusion_query; -} - - bool GPU_select_query_check_active(void) { - return GLEW_ARB_occlusion_query && - ((U.gpu_select_method == USER_SELECT_USE_OCCLUSION_QUERY) || + return ((U.gpu_select_method == USER_SELECT_USE_OCCLUSION_QUERY) || ((U.gpu_select_method == USER_SELECT_AUTO) && GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY))); } -- cgit v1.2.3