diff options
Diffstat (limited to 'source/blender/gpu/intern/gpu_draw.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 712 |
1 files changed, 0 insertions, 712 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 5d9270223ab..6b768d4bdd6 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -72,7 +72,6 @@ #include "BKE_DerivedMesh.h" #include "GPU_basic_shader.h" -#include "GPU_buffers.h" #include "GPU_draw.h" #include "GPU_extensions.h" #include "GPU_material.h" @@ -240,38 +239,6 @@ static unsigned int *gpu_get_image_bindcode(Image *ima, GLenum textarget) return bind; } -static void gpu_set_alpha_blend(GPUBlendMode alphablend) -{ - if (alphablend == GPU_BLEND_SOLID) { - glDisable(GL_BLEND); - glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - } - else if (alphablend == GPU_BLEND_ADD) { - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE); - glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); - } - else if (ELEM(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ALPHA_SORT)) { - glEnable(GL_BLEND); - glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); - - /* for OpenGL render we use the alpha channel, this makes alpha blend correct */ - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - /* if U.glalphaclip == 1.0, some cards go bonkers... - * turn off alpha test in this case */ - - } - else if (alphablend == GPU_BLEND_CLIP) { - glDisable(GL_BLEND); - glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); - } - else if (alphablend == GPU_BLEND_ALPHA_TO_COVERAGE) { - glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE); - } -} - typedef struct VerifyThreadData { ImBuf *ibuf; float *srgb_frect; @@ -1038,9 +1005,6 @@ void GPU_free_unused_buffers(void) BLI_linklist_free(image_free_queue, NULL); image_free_queue = NULL; - /* vbo buffers */ - GPU_global_buffer_pool_free_unused(); - BLI_thread_unlock(LOCK_OPENGL); } @@ -1120,652 +1084,6 @@ void GPU_free_images_old(void) } } - -/* OpenGL Materials */ - -#define FIXEDMAT 8 - -/* OpenGL state caching for materials */ - -typedef struct GPUMaterialFixed { - float diff[3]; - float spec[3]; - int hard; - float alpha; -} GPUMaterialFixed; - -static struct GPUMaterialState { - GPUMaterialFixed (*matbuf); - GPUMaterialFixed matbuf_fixed[FIXEDMAT]; - int totmat; - - /* set when called inside GPU_begin_object_materials / GPU_end_object_materials - * otherwise calling GPU_object_material_bind returns zero */ - bool is_enabled; - - Material **gmatbuf; - Material *gmatbuf_fixed[FIXEDMAT]; - Material *gboundmat; - Object *gob; - DupliObject *dob; - Scene *gscene; - int glay; - float (*gviewmat)[4]; - float (*gviewinv)[4]; - float (*gviewcamtexcofac); - - bool backface_culling; - bool two_sided_lighting; - - GPUBlendMode *alphablend; - GPUBlendMode alphablend_fixed[FIXEDMAT]; - bool use_alpha_pass, is_alpha_pass; - bool use_matcaps; - - int lastmatnr, lastretval; - GPUBlendMode lastalphablend; - bool is_opensubdiv; -} GMS = {NULL}; - -/* fixed function material, alpha handed by caller */ -static void gpu_material_to_fixed( - GPUMaterialFixed *smat, const Material *bmat, const int gamma, const Object *ob, - const int new_shading_nodes, const bool dimdown) -{ - if (bmat->mode & MA_SHLESS) { - copy_v3_v3(smat->diff, &bmat->r); - - if (gamma) - linearrgb_to_srgb_v3_v3(smat->diff, smat->diff); - - zero_v3(smat->spec); - smat->alpha = 1.0f; - smat->hard = 0; - } - else if (new_shading_nodes) { - copy_v3_v3(smat->diff, &bmat->r); - copy_v3_v3(smat->spec, &bmat->specr); - smat->alpha = 1.0f; - smat->hard = CLAMPIS(bmat->har, 0, 128); - - if (dimdown) { - mul_v3_fl(smat->diff, 0.8f); - mul_v3_fl(smat->spec, 0.5f); - } - - if (gamma) { - linearrgb_to_srgb_v3_v3(smat->diff, smat->diff); - linearrgb_to_srgb_v3_v3(smat->spec, smat->spec); - } - } - else { - mul_v3_v3fl(smat->diff, &bmat->r, bmat->ref + bmat->emit); - - if (bmat->shade_flag & MA_OBCOLOR) - mul_v3_v3(smat->diff, ob->col); - - mul_v3_v3fl(smat->spec, &bmat->specr, bmat->spec); - smat->hard = CLAMPIS(bmat->har, 1, 128); - smat->alpha = 1.0f; - - if (gamma) { - linearrgb_to_srgb_v3_v3(smat->diff, smat->diff); - linearrgb_to_srgb_v3_v3(smat->spec, smat->spec); - } - } -} - -static Material *gpu_active_node_material(Material *ma) -{ - if (ma && ma->use_nodes && ma->nodetree) { - bNode *node = nodeGetActiveID(ma->nodetree, ID_MA); - - if (node) - return (Material *)node->id; - else - return NULL; - } - - return ma; -} - -void GPU_begin_dupli_object(DupliObject *dob) -{ - GMS.dob = dob; -} - -void GPU_end_dupli_object(void) -{ - GMS.dob = NULL; -} - -void GPU_begin_object_materials( - View3D *v3d, RegionView3D *rv3d, Scene *scene, ViewLayer *UNUSED(view_layer), Object *ob, - bool glsl, bool *do_alpha_after) -{ - Material *ma; - GPUMaterial *gpumat; - GPUBlendMode alphablend; - DupliObject *dob; - int a; - const bool gamma = BKE_scene_check_color_management_enabled(scene); - const bool new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); - const bool use_matcap = (v3d->flag2 & V3D_SHOW_SOLID_MATCAP) != 0; /* assumes v3d->defmaterial->preview is set */ - bool use_opensubdiv = false; - -#ifdef WITH_OPENSUBDIV - { - DerivedMesh *derivedFinal = NULL; - if (ob->type == OB_MESH) { - Mesh *me = ob->data; - BMEditMesh *em = me->edit_btmesh; - if (em != NULL) { - derivedFinal = em->derivedFinal; - } - else { - derivedFinal = ob->derivedFinal; - } - } - else { - derivedFinal = ob->derivedFinal; - } - - if (derivedFinal != NULL && derivedFinal->type == DM_TYPE_CCGDM) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) derivedFinal; - use_opensubdiv = ccgdm->useGpuBackend; - } - } -#endif - - /* initialize state */ - /* DupliObject must be restored */ - dob = GMS.dob; - memset(&GMS, 0, sizeof(GMS)); - GMS.is_enabled = true; - GMS.dob = dob; - GMS.lastmatnr = -1; - GMS.lastretval = -1; - GMS.lastalphablend = GPU_BLEND_SOLID; - GMS.use_matcaps = use_matcap; - - GMS.backface_culling = (v3d->flag2 & V3D_BACKFACE_CULLING) != 0; - - GMS.two_sided_lighting = false; - if (ob && ob->type == OB_MESH) - GMS.two_sided_lighting = (((Mesh *)ob->data)->flag & ME_TWOSIDED) != 0; - - GMS.gob = ob; - GMS.gscene = scene; - GMS.is_opensubdiv = use_opensubdiv; - GMS.totmat = use_matcap ? 1 : ob->totcol + 1; /* materials start from 1, default material is 0 */ - GMS.glay = (v3d->localvd) ? v3d->localvd->lay : v3d->lay; /* keep lamps visible in local view */ - GMS.gviewmat = rv3d->viewmat; - GMS.gviewinv = rv3d->viewinv; - GMS.gviewcamtexcofac = rv3d->viewcamtexcofac; - - /* alpha pass setup. there's various cases to handle here: - * - object transparency on: only solid materials draw in the first pass, - * and only transparent in the second 'alpha' pass. - * - object transparency off: for glsl we draw both in a single pass, and - * for solid we don't use transparency at all. */ - GMS.use_alpha_pass = (do_alpha_after != NULL); - GMS.is_alpha_pass = (v3d->transp != false); - if (GMS.use_alpha_pass) - *do_alpha_after = false; - - if (GMS.totmat > FIXEDMAT) { - GMS.matbuf = MEM_callocN(sizeof(GPUMaterialFixed) * GMS.totmat, "GMS.matbuf"); - GMS.gmatbuf = MEM_callocN(sizeof(*GMS.gmatbuf) * GMS.totmat, "GMS.matbuf"); - GMS.alphablend = MEM_callocN(sizeof(*GMS.alphablend) * GMS.totmat, "GMS.matbuf"); - } - else { - GMS.matbuf = GMS.matbuf_fixed; - GMS.gmatbuf = GMS.gmatbuf_fixed; - GMS.alphablend = GMS.alphablend_fixed; - } - - /* viewport material, setup in space_view3d, defaults to matcap using ma->preview now */ - if (use_matcap) { - GMS.gmatbuf[0] = v3d->defmaterial; - GPU_material_matcap(scene, v3d->defmaterial, use_opensubdiv); - - /* do material 1 too, for displists! */ - memcpy(&GMS.matbuf[1], &GMS.matbuf[0], sizeof(GPUMaterialFixed)); - - GMS.alphablend[0] = GPU_BLEND_SOLID; - } - else { - - /* no materials assigned? */ - if (ob->totcol == 0) { - gpu_material_to_fixed(&GMS.matbuf[0], &defmaterial, 0, ob, new_shading_nodes, true); - - /* do material 1 too, for displists! */ - memcpy(&GMS.matbuf[1], &GMS.matbuf[0], sizeof(GPUMaterialFixed)); - - if (glsl) { - GMS.gmatbuf[0] = &defmaterial; - GPU_material_from_blender(GMS.gscene, &defmaterial, GMS.is_opensubdiv); - } - - GMS.alphablend[0] = GPU_BLEND_SOLID; - } - - /* setup materials */ - for (a = 1; a <= ob->totcol; a++) { - /* find a suitable material */ - ma = give_current_material(ob, a); - if (!glsl && !new_shading_nodes) ma = gpu_active_node_material(ma); - if (ma == NULL) ma = &defmaterial; - - /* create glsl material if requested */ - gpumat = glsl ? GPU_material_from_blender(GMS.gscene, ma, GMS.is_opensubdiv) : NULL; - - if (gpumat) { - /* do glsl only if creating it succeed, else fallback */ - GMS.gmatbuf[a] = ma; - alphablend = GPU_material_alpha_blend(gpumat, ob->col); - } - else { - /* fixed function opengl materials */ - gpu_material_to_fixed(&GMS.matbuf[a], ma, gamma, ob, new_shading_nodes, false); - - if (GMS.use_alpha_pass && ((ma->mode & MA_TRANSP) || (new_shading_nodes && ma->alpha != 1.0f))) { - GMS.matbuf[a].alpha = ma->alpha; - alphablend = (ma->alpha == 1.0f) ? GPU_BLEND_SOLID: GPU_BLEND_ALPHA; - } - else { - GMS.matbuf[a].alpha = 1.0f; - alphablend = GPU_BLEND_SOLID; - } - } - - /* setting 'do_alpha_after = true' indicates this object needs to be - * drawn in a second alpha pass for improved blending */ - if (do_alpha_after && !GMS.is_alpha_pass) - if (ELEM(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ADD, GPU_BLEND_ALPHA_SORT)) - *do_alpha_after = true; - - GMS.alphablend[a] = alphablend; - } - } - - /* let's start with a clean state */ - GPU_object_material_unbind(); -} - -static int gpu_get_particle_info(GPUParticleInfo *pi) -{ - DupliObject *dob = GMS.dob; - if (dob->particle_system) { - int ind; - if (dob->persistent_id[0] < dob->particle_system->totpart) - ind = dob->persistent_id[0]; - else { - ind = dob->particle_system->child[dob->persistent_id[0] - dob->particle_system->totpart].parent; - } - if (ind >= 0) { - ParticleData *p = &dob->particle_system->particles[ind]; - - pi->scalprops[0] = ind; - pi->scalprops[1] = GMS.gscene->r.cfra - p->time; - pi->scalprops[2] = p->lifetime; - pi->scalprops[3] = p->size; - - copy_v3_v3(pi->location, p->state.co); - pi->location[3] = BLI_hash_int_01(ind); - - copy_v3_v3(pi->velocity, p->state.vel); - copy_v3_v3(pi->angular_velocity, p->state.ave); - return 1; - } - else return 0; - } - else - return 0; -} - -static void GPU_get_object_info(float oi[3], Material *mat) -{ - Object *ob = GMS.gob; - oi[0] = ob->index; - oi[1] = mat->index; - unsigned int random; - if (GMS.dob) { - random = GMS.dob->random_id; - } - else { - random = BLI_hash_int_2d(BLI_hash_string(GMS.gob->id.name + 2), 0); - } - oi[2] = random * (1.0f / (float)0xFFFFFFFF); -} - -int GPU_object_material_bind(int nr, void *attribs) -{ - GPUVertexAttribs *gattribs = attribs; - - /* no GPU_begin_object_materials, use default material */ - if (!GMS.matbuf) { - memset(&GMS, 0, sizeof(GMS)); - - float diffuse[3], specular[3]; - mul_v3_v3fl(diffuse, &defmaterial.r, defmaterial.ref + defmaterial.emit); - mul_v3_v3fl(specular, &defmaterial.specr, defmaterial.spec); - GPU_basic_shader_colors(diffuse, specular, 35, 1.0f); - - if (GMS.two_sided_lighting) - GPU_basic_shader_bind(GPU_SHADER_LIGHTING | GPU_SHADER_TWO_SIDED); - else - GPU_basic_shader_bind(GPU_SHADER_LIGHTING); - - return 0; - } - - /* prevent index to use un-initialized array items */ - if (nr >= GMS.totmat) - nr = 0; - - if (gattribs) - memset(gattribs, 0, sizeof(*gattribs)); - - /* keep current material */ - if (nr == GMS.lastmatnr) - return GMS.lastretval; - - /* unbind glsl material */ - if (GMS.gboundmat) { - if (GMS.is_alpha_pass) glDepthMask(0); - GPU_material_unbind(GPU_material_from_blender(GMS.gscene, GMS.gboundmat, GMS.is_opensubdiv)); - GMS.gboundmat = NULL; - } - - /* draw materials with alpha in alpha pass */ - GMS.lastmatnr = nr; - GMS.lastretval = 1; - - if (GMS.use_alpha_pass) { - GMS.lastretval = ELEM(GMS.alphablend[nr], GPU_BLEND_SOLID, GPU_BLEND_CLIP); - if (GMS.is_alpha_pass) - GMS.lastretval = !GMS.lastretval; - } - else - GMS.lastretval = !GMS.is_alpha_pass; - - if (GMS.lastretval) { - /* for alpha pass, use alpha blend */ - GPUBlendMode alphablend = GMS.alphablend[nr]; - - if (gattribs && GMS.gmatbuf[nr]) { - /* bind glsl material and get attributes */ - Material *mat = GMS.gmatbuf[nr]; - GPUParticleInfo partile_info; - float object_info[3] = {0}; - - float auto_bump_scale; - - GPUMaterial *gpumat = GPU_material_from_blender(GMS.gscene, mat, GMS.is_opensubdiv); - GPU_material_vertex_attributes(gpumat, gattribs); - - if (GMS.dob) { - gpu_get_particle_info(&partile_info); - } - - if ((GPU_get_material_builtins(gpumat) & GPU_OBJECT_INFO) != 0) { - GPU_get_object_info(object_info, mat); - } - - GPU_material_bind( - gpumat, GMS.gob->lay, GMS.glay, 1.0, !(GMS.gob->mode & OB_MODE_TEXTURE_PAINT), - GMS.gviewmat, GMS.gviewinv, GMS.gviewcamtexcofac); - - auto_bump_scale = GMS.gob->derivedFinal != NULL ? GMS.gob->derivedFinal->auto_bump_scale : 1.0f; - GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gob->col, auto_bump_scale, &partile_info, object_info); - GMS.gboundmat = mat; - - if (GMS.is_alpha_pass) glDepthMask(1); - - if (GMS.backface_culling) { - glDisable(GL_CULL_FACE); - } - - if (GMS.use_matcaps) - glColor3f(1.0f, 1.0f, 1.0f); - } - else { - /* or do fixed function opengl material */ - GPU_basic_shader_colors( - GMS.matbuf[nr].diff, - GMS.matbuf[nr].spec, GMS.matbuf[nr].hard, GMS.matbuf[nr].alpha); - - if (GMS.two_sided_lighting) - GPU_basic_shader_bind(GPU_SHADER_LIGHTING | GPU_SHADER_TWO_SIDED); - else - GPU_basic_shader_bind(GPU_SHADER_LIGHTING); - } - - /* set (alpha) blending mode */ - GPU_set_material_alpha_blend(alphablend); - } - - return GMS.lastretval; -} - -int GPU_object_material_visible(int nr, void *attribs) -{ - GPUVertexAttribs *gattribs = attribs; - int visible; - - if (!GMS.matbuf) - return 0; - - if (gattribs) - memset(gattribs, 0, sizeof(*gattribs)); - - if (nr >= GMS.totmat) - nr = 0; - - if (GMS.use_alpha_pass) { - visible = ELEM(GMS.alphablend[nr], GPU_BLEND_SOLID, GPU_BLEND_CLIP); - if (GMS.is_alpha_pass) - visible = !visible; - } - else - visible = !GMS.is_alpha_pass; - - return visible; -} - -void GPU_set_material_alpha_blend(int alphablend) -{ - if (GMS.lastalphablend == alphablend) - return; - - gpu_set_alpha_blend(alphablend); - GMS.lastalphablend = alphablend; -} - -int GPU_get_material_alpha_blend(void) -{ - return GMS.lastalphablend; -} - -void GPU_object_material_unbind(void) -{ - GMS.lastmatnr = -1; - GMS.lastretval = 1; - - if (GMS.gboundmat) { - if (GMS.backface_culling) - glDisable(GL_CULL_FACE); - - if (GMS.is_alpha_pass) glDepthMask(0); - GPU_material_unbind(GPU_material_from_blender(GMS.gscene, GMS.gboundmat, GMS.is_opensubdiv)); - GMS.gboundmat = NULL; - } - else - GPU_basic_shader_bind(GPU_SHADER_USE_COLOR); - - GPU_set_material_alpha_blend(GPU_BLEND_SOLID); -} - -void GPU_material_diffuse_get(int nr, float diff[4]) -{ - /* prevent index to use un-initialized array items */ - if (nr >= GMS.totmat) - nr = 0; - - /* no GPU_begin_object_materials, use default material */ - if (!GMS.matbuf) { - mul_v3_v3fl(diff, &defmaterial.r, defmaterial.ref + defmaterial.emit); - } - else { - copy_v3_v3(diff, GMS.matbuf[nr].diff); - diff[3] = GMS.matbuf[nr].alpha; - } -} - -bool GPU_material_use_matcaps_get(void) -{ - return GMS.use_matcaps; -} - -bool GPU_object_materials_check(void) -{ - return GMS.is_enabled; -} - -void GPU_end_object_materials(void) -{ - GPU_object_material_unbind(); - - GMS.is_enabled = false; - - if (GMS.matbuf && GMS.matbuf != GMS.matbuf_fixed) { - MEM_freeN(GMS.matbuf); - MEM_freeN(GMS.gmatbuf); - MEM_freeN(GMS.alphablend); - } - - GMS.matbuf = NULL; - GMS.gmatbuf = NULL; - GMS.alphablend = NULL; - GMS.two_sided_lighting = false; -} - -/* Lights */ - -int GPU_default_lights(void) -{ - /* initialize */ - if (U.light[0].flag == 0 && U.light[1].flag == 0 && U.light[2].flag == 0) { - U.light[0].flag = 1; - U.light[0].vec[0] = -0.3; U.light[0].vec[1] = 0.3; U.light[0].vec[2] = 0.9; - U.light[0].col[0] = 0.8; U.light[0].col[1] = 0.8; U.light[0].col[2] = 0.8; - U.light[0].spec[0] = 0.5; U.light[0].spec[1] = 0.5; U.light[0].spec[2] = 0.5; - U.light[0].spec[3] = 1.0; - - U.light[1].flag = 0; - U.light[1].vec[0] = 0.5; U.light[1].vec[1] = 0.5; U.light[1].vec[2] = 0.1; - U.light[1].col[0] = 0.4; U.light[1].col[1] = 0.4; U.light[1].col[2] = 0.8; - U.light[1].spec[0] = 0.3; U.light[1].spec[1] = 0.3; U.light[1].spec[2] = 0.5; - U.light[1].spec[3] = 1.0; - - U.light[2].flag = 0; - U.light[2].vec[0] = 0.3; U.light[2].vec[1] = -0.3; U.light[2].vec[2] = -0.2; - U.light[2].col[0] = 0.8; U.light[2].col[1] = 0.5; U.light[2].col[2] = 0.4; - U.light[2].spec[0] = 0.5; U.light[2].spec[1] = 0.4; U.light[2].spec[2] = 0.3; - U.light[2].spec[3] = 1.0; - } - - GPU_basic_shader_light_set_viewer(false); - - int count = 0; - - for (int a = 0; a < 8; a++) { - if (a < 3 && U.light[a].flag) { - GPULightData light = {0}; - - light.type = GPU_LIGHT_SUN; - - normalize_v3_v3(light.direction, U.light[a].vec); - copy_v3_v3(light.diffuse, U.light[a].col); - copy_v3_v3(light.specular, U.light[a].spec); - - GPU_basic_shader_light_set(a, &light); - - count++; - } - else - GPU_basic_shader_light_set(a, NULL); - } - - return count; -} - -int GPU_scene_object_lights(ViewLayer *view_layer, float viewmat[4][4], int ortho) -{ - /* disable all lights */ - for (int count = 0; count < 8; count++) - GPU_basic_shader_light_set(count, NULL); - - /* view direction for specular is not computed correct by default in - * opengl, so we set the settings ourselves */ - GPU_basic_shader_light_set_viewer(!ortho); - - int count = 0; - - for (Base *base = FIRSTBASE(view_layer); base; base = base->next) { - if (base->object->type != OB_LAMP) - continue; - - Lamp *la = base->object->data; - - /* setup lamp transform */ - gpuPushMatrix(); - gpuLoadMatrix(viewmat); - - /* setup light */ - GPULightData light = {0}; - - mul_v3_v3fl(light.diffuse, &la->r, la->energy); - mul_v3_v3fl(light.specular, &la->r, la->energy); - - if (la->type == LA_SUN) { - /* directional sun light */ - light.type = GPU_LIGHT_SUN; - normalize_v3_v3(light.direction, base->object->obmat[2]); - } - else { - /* other lamps with position attenuation */ - copy_v3_v3(light.position, base->object->obmat[3]); - - light.constant_attenuation = 1.0f; - light.linear_attenuation = la->att1 / la->dist; - light.quadratic_attenuation = la->att2 / (la->dist * la->dist); - - if (la->type == LA_SPOT) { - light.type = GPU_LIGHT_SPOT; - negate_v3_v3(light.direction, base->object->obmat[2]); - normalize_v3(light.direction); - light.spot_cutoff = RAD2DEGF(la->spotsize * 0.5f); - light.spot_exponent = 128.0f * la->spotblend; - } - else - light.type = GPU_LIGHT_POINT; - } - - GPU_basic_shader_light_set(count, &light); - - gpuPopMatrix(); - - count++; - if (count == 8) - break; - } - - return count; -} - static void gpu_disable_multisample(void) { #ifdef __linux__ @@ -1798,8 +1116,6 @@ static void gpu_disable_multisample(void) void GPU_state_init(void) { - GPU_default_lights(); - GPU_disable_program_point_size(); glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); @@ -1830,34 +1146,6 @@ void GPU_disable_program_point_size(void) glDisable(GL_PROGRAM_POINT_SIZE); } -#ifdef WITH_OPENSUBDIV -/* Update face-varying variables offset which might be - * different from mesh to mesh sharing the same material. - */ -void GPU_draw_update_fvar_offset(DerivedMesh *dm) -{ - /* Sanity check to be sure we only do this for OpenSubdiv draw. */ - BLI_assert(dm->type == DM_TYPE_CCGDM); - BLI_assert(GMS.is_opensubdiv); - - for (int i = 0; i < GMS.totmat; ++i) { - Material *material = GMS.gmatbuf[i]; - GPUMaterial *gpu_material; - - if (material == NULL) { - continue; - } - - gpu_material = GPU_material_from_blender(GMS.gscene, - material, - GMS.is_opensubdiv); - - GPU_material_update_fvar_offset(gpu_material, dm); - } -} -#endif - - /** \name Framebuffer color depth, for selection codes * \{ */ |