From 60fc04fb9b4f112998ac42395a17b56cc6edec5c Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 19 May 2017 11:47:55 +0200 Subject: Remove reference to WITH_GL_PROFILE_CORE There is no more point of keep those around. ES20 may need special case when/if we dabble with it again. Meanwhile no point on polluting the code with this. (ghost still has reference for the PROFILE, but that's reasonable) --- source/blender/blenkernel/intern/cdderivedmesh.c | 49 +----------- source/blender/gpu/GPU_matrix.h | 6 +- source/blender/gpu/intern/gpu_basic_shader.c | 99 +----------------------- source/blender/gpu/intern/gpu_draw.c | 7 -- source/blender/gpu/intern/gpu_extensions.c | 10 --- source/blender/modifiers/intern/MOD_subsurf.c | 5 +- 6 files changed, 9 insertions(+), 167 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 76cf7966181..54ccad64c90 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -58,13 +58,10 @@ #include "GPU_buffers.h" #include "GPU_draw.h" #include "GPU_glew.h" +#include "GPU_immediate.h" #include "GPU_shader.h" #include "GPU_basic_shader.h" -#ifdef WITH_GL_PROFILE_CORE -# include "GPU_immediate.h" -#endif - #include #include #include @@ -376,7 +373,7 @@ static void cdDM_drawVerts(DerivedMesh *dm) GPU_buffers_unbind(); } -static void cdDM_drawEdges(DerivedMesh *dm, bool drawLooseEdges, bool drawAllEdges) +static void cdDM_drawEdges(DerivedMesh *dm, bool UNUSED(drawLooseEdges), bool UNUSED(drawAllEdges)) { CDDerivedMesh *cddm = (CDDerivedMesh *) dm; @@ -388,28 +385,6 @@ static void cdDM_drawEdges(DerivedMesh *dm, bool drawLooseEdges, bool drawAllEdg return; } -#ifndef WITH_GL_PROFILE_CORE - GPUDrawObject *gdo; - - GPU_edge_setup(dm); - gdo = dm->drawObject; - if (gdo->edges && gdo->points) { - if (drawAllEdges && drawLooseEdges) { - GPU_buffer_draw_elements(gdo->edges, GL_LINES, 0, gdo->totedge * 2); - } - else if (drawAllEdges) { - GPU_buffer_draw_elements(gdo->edges, GL_LINES, 0, gdo->loose_edge_offset * 2); - } - else { - GPU_buffer_draw_elements(gdo->edges, GL_LINES, 0, gdo->tot_edge_drawn * 2); - GPU_buffer_draw_elements(gdo->edges, GL_LINES, gdo->loose_edge_offset * 2, dm->drawObject->tot_loose_edge_drawn * 2); - } - } - GPU_buffers_unbind(); -#else - (void) drawLooseEdges; - (void) drawAllEdges; - MVert *vert = cddm->mvert; MEdge *edge = cddm->medge; @@ -440,7 +415,6 @@ static void cdDM_drawEdges(DerivedMesh *dm, bool drawLooseEdges, bool drawAllEdg } immUnbindProgram(); -#endif } static void cdDM_drawLooseEdges(DerivedMesh *dm) @@ -463,8 +437,9 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm) static void cdDM_drawFacesSolid( DerivedMesh *dm, float (*partial_redraw_planes)[4], - bool UNUSED(fast), DMSetMaterial setMaterial) + bool fast, DMSetMaterial setMaterial) { + UNUSED_VARS(partial_redraw_planes, fast, setMaterial); CDDerivedMesh *cddm = (CDDerivedMesh *) dm; int a; @@ -478,21 +453,6 @@ static void cdDM_drawFacesSolid( } } -#ifndef WITH_GL_PROFILE_CORE - GPU_vertex_setup(dm); - GPU_normal_setup(dm); - GPU_triangle_setup(dm); - for (a = 0; a < dm->drawObject->totmaterial; a++) { - if (!setMaterial || setMaterial(dm->drawObject->materials[a].mat_nr + 1, NULL)) { - GPU_buffer_draw_elements( - dm->drawObject->triangles, GL_TRIANGLES, - dm->drawObject->materials[a].start, dm->drawObject->materials[a].totelements); - } - } -#else - (void) partial_redraw_planes; - (void) setMaterial; - const MVert *mvert = cddm->mvert; const MLoop *mloop = cddm->mloop; const MPoly *mpoly = cddm->mpoly; @@ -565,7 +525,6 @@ static void cdDM_drawFacesSolid( } immUnbindProgram(); -#endif } static void cdDM_drawFacesTex_common( diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h index 2d43d1ad573..9512587c754 100644 --- a/source/blender/gpu/GPU_matrix.h +++ b/source/blender/gpu/GPU_matrix.h @@ -43,11 +43,7 @@ extern "C" { /* For now we support the legacy matrix stack in gpuGetMatrix functions. * Will remove this after switching to core profile, which can happen after * we convert all code to use the API in this file. */ -#ifdef WITH_GL_PROFILE_CORE -# define SUPPORT_LEGACY_MATRIX 0 -#else -# define SUPPORT_LEGACY_MATRIX 1 -#endif +#define SUPPORT_LEGACY_MATRIX 0 void gpuMatrixReset(void); /* to Identity transform & empty stack */ diff --git a/source/blender/gpu/intern/gpu_basic_shader.c b/source/blender/gpu/intern/gpu_basic_shader.c index 42fb39a6eb0..620a06ae606 100644 --- a/source/blender/gpu/intern/gpu_basic_shader.c +++ b/source/blender/gpu/intern/gpu_basic_shader.c @@ -307,113 +307,20 @@ void GPU_basic_shader_colors( const float diffuse[3], const float specular[3], int shininess, float alpha) { -#ifdef WITH_GL_PROFILE_CORE + UNUSED_VARS(diffuse, specular, shininess, alpha); return; -#endif - - float gl_diffuse[4], gl_specular[4]; - - if (diffuse) - copy_v3_v3(gl_diffuse, diffuse); - else - zero_v3(gl_diffuse); - gl_diffuse[3] = alpha; - - if (specular) - copy_v3_v3(gl_specular, specular); - else - zero_v3(gl_specular); - gl_specular[3] = 1.0f; - - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, gl_diffuse); - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, gl_specular); - glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, CLAMPIS(shininess, 1, 128)); } void GPU_basic_shader_light_set(int light_num, GPULightData *light) { -#ifdef WITH_GL_PROFILE_CORE + UNUSED_VARS(light_num, light); return; -#endif - - int light_bit = (1 << light_num); - - /* note that light position is affected by the current modelview matrix! */ - - GPU_MATERIAL_STATE.lights_enabled &= ~light_bit; - GPU_MATERIAL_STATE.lights_directional &= ~light_bit; - - if (light) { - float position[4], diffuse[4], specular[4]; - - glEnable(GL_LIGHT0 + light_num); - - /* position */ - if (light->type == GPU_LIGHT_SUN) { - copy_v3_v3(position, light->direction); - position[3] = 0.0f; - } - else { - copy_v3_v3(position, light->position); - position[3] = 1.0f; - } - glLightfv(GL_LIGHT0 + light_num, GL_POSITION, position); - - /* energy */ - copy_v3_v3(diffuse, light->diffuse); - copy_v3_v3(specular, light->specular); - diffuse[3] = 1.0f; - specular[3] = 1.0f; - glLightfv(GL_LIGHT0 + light_num, GL_DIFFUSE, diffuse); - glLightfv(GL_LIGHT0 + light_num, GL_SPECULAR, specular); - - /* attenuation */ - if (light->type == GPU_LIGHT_SUN) { - glLightf(GL_LIGHT0 + light_num, GL_CONSTANT_ATTENUATION, 1.0f); - glLightf(GL_LIGHT0 + light_num, GL_LINEAR_ATTENUATION, 0.0f); - glLightf(GL_LIGHT0 + light_num, GL_QUADRATIC_ATTENUATION, 0.0f); - } - else { - glLightf(GL_LIGHT0 + light_num, GL_CONSTANT_ATTENUATION, light->constant_attenuation); - glLightf(GL_LIGHT0 + light_num, GL_LINEAR_ATTENUATION, light->linear_attenuation); - glLightf(GL_LIGHT0 + light_num, GL_QUADRATIC_ATTENUATION, light->quadratic_attenuation); - } - - /* spot */ - glLightfv(GL_LIGHT0 + light_num, GL_SPOT_DIRECTION, light->direction); - if (light->type == GPU_LIGHT_SPOT) { - glLightf(GL_LIGHT0 + light_num, GL_SPOT_CUTOFF, light->spot_cutoff); - glLightf(GL_LIGHT0 + light_num, GL_SPOT_EXPONENT, light->spot_exponent); - } - else { - glLightf(GL_LIGHT0 + light_num, GL_SPOT_CUTOFF, 180.0f); - glLightf(GL_LIGHT0 + light_num, GL_SPOT_EXPONENT, 0.0f); - } - - GPU_MATERIAL_STATE.lights_enabled |= light_bit; - if (position[3] == 0.0f) - GPU_MATERIAL_STATE.lights_directional |= light_bit; - } - else { - /* TODO(sergey): Needs revisit. */ - /* glsl shader needs these zero to skip them */ - const float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - - glLightfv(GL_LIGHT0 + light_num, GL_POSITION, zero); - glLightfv(GL_LIGHT0 + light_num, GL_DIFFUSE, zero); - glLightfv(GL_LIGHT0 + light_num, GL_SPECULAR, zero); - - glDisable(GL_LIGHT0 + light_num); - } } void GPU_basic_shader_light_set_viewer(bool local) { -#ifdef WITH_GL_PROFILE_CORE + UNUSED_VARS(local); return; -#endif - - glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, (local) ? GL_TRUE: GL_FALSE); } void GPU_basic_shader_stipple(GPUBasicShaderStipple stipple_id) diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 0f4b105731d..d2a86dbcfa4 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -2271,13 +2271,6 @@ void GPU_state_init(void) GPU_disable_program_point_size(); -#ifndef WITH_GL_PROFILE_CORE - /* TODO: remove this when we switch to core profile */ - { - glEnable(GL_POINT_SPRITE); - } -#endif - glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); glDepthFunc(GL_LEQUAL); diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index b1876e93876..502cfeb6f02 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -137,17 +137,7 @@ void gpu_extensions_init(void) * final 2.8 release will be unified on OpenGL 3.3 core profile, no required extensions * see developer.blender.org/T49012 for details */ -#if defined(WITH_GL_PROFILE_CORE) || defined(_WIN32) BLI_assert(GLEW_VERSION_3_3); -#elif defined(__APPLE__) - BLI_assert(GLEW_VERSION_2_1 && GLEW_EXT_gpu_shader4 - && GLEW_ARB_framebuffer_object - && GLEW_ARB_draw_elements_base_vertex - && GLEW_APPLE_flush_buffer_range); -#else - BLI_assert(GLEW_VERSION_3_3 || (GLEW_VERSION_3_0 && GLEW_ARB_draw_elements_base_vertex)); - /* vendor driver || Mesa compatibility profile */ -#endif glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &GG.maxtextures); diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index e444fb85162..407fd63d5c3 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -148,16 +148,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, result = subsurf_make_derived_from_derived(derivedData, smd, NULL, subsurf_flags); result->cd_flag = derivedData->cd_flag; -#ifndef WITH_GL_PROFILE_CORE - if (do_cddm_convert) -#endif { DerivedMesh *cddm = CDDM_copy(result); result->release(result); result = cddm; } -#if defined(WITH_GL_PROFILE_CORE) && !defined(WITH_OPESUBDIV) +#ifndef WITH_OPESUBDIV (void) do_cddm_convert; #endif -- cgit v1.2.3