Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2015-11-25 19:49:46 +0300
committerMike Erwin <significant.bit@gmail.com>2015-11-25 19:51:12 +0300
commit816cdf262bdab28d3485adb6a37a937936d07a88 (patch)
tree127e326273a3e7e97d87594bd6273e1588023cbd /source
parentfeb574f21c5fcb883748bff843544f1f0c6a62a2 (diff)
OpenGL: GLSL always supported
In gpu lib: - GPU_glsl_support() always returns true - internal cleanup & comments Outside gpu lib: - remove check from various code, remove the “else” path - sprinkled a few C99-isms We can remove GPU_glsl_support() when BGE stops calling it.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c4
-rw-r--r--source/blender/editors/space_view3d/drawobject.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c7
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c32
-rw-r--r--source/blender/gpu/intern/gpu_material.c3
-rw-r--r--source/blender/gpu/intern/gpu_simple_shader.c35
6 files changed, 24 insertions, 59 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 9fac4ca2265..93e9910a28b 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -1151,7 +1151,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d,
Mesh *me = ob->data;
TexMatCallback data = {scene, ob, me, dm};
bool (*set_face_cb)(void *, int);
- bool glsl, picking = (G.f & G_PICKSEL) != 0;
+ bool picking = (G.f & G_PICKSEL) != 0;
/* face hiding callback depending on mode */
if (ob == scene->obedit)
@@ -1162,7 +1162,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d,
set_face_cb = NULL;
/* test if we can use glsl */
- glsl = (v3d->drawtype == OB_MATERIAL) && GPU_glsl_support() && !picking;
+ bool glsl = (v3d->drawtype == OB_MATERIAL) && !picking;
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index c697b22d57b..78e3ff1477b 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -289,8 +289,6 @@ static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
bool draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, const char dt)
{
- if (!GPU_glsl_support())
- return false;
if (G.f & G_PICKSEL)
return false;
if (!check_object_draw_texture(scene, v3d, dt))
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 784c7bef7f7..f9101d15d04 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2969,17 +2969,16 @@ void ED_view3d_draw_offscreen_init(Scene *scene, View3D *v3d)
static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar)
{
if (scene->world && (v3d->flag3 & V3D_SHOW_WORLD)) {
- bool glsl = GPU_glsl_support() && BKE_scene_use_new_shading_nodes(scene) && scene->world->nodetree && scene->world->use_nodes;
+ bool glsl = BKE_scene_use_new_shading_nodes(scene) && scene->world->nodetree && scene->world->use_nodes;
if (glsl) {
RegionView3D *rv3d = ar->regiondata;
GPUMaterial *gpumat = GPU_material_world(scene, scene->world);
- bool material_not_bound;
/* calculate full shader for background */
GPU_material_bind(gpumat, 1, 1, 1.0, false, rv3d->viewmat, rv3d->viewinv, rv3d->viewcamtexcofac, (v3d->scenelock != 0));
- material_not_bound = !GPU_material_bound(gpumat);
+ bool material_not_bound = !GPU_material_bound(gpumat);
if (material_not_bound) {
glMatrixMode(GL_PROJECTION);
@@ -3023,7 +3022,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar)
#define VIEWGRAD_RES_Y 16
GLubyte grid_col[VIEWGRAD_RES_X][VIEWGRAD_RES_Y][4];
- static float grid_pos[VIEWGRAD_RES_X][VIEWGRAD_RES_Y][3];
+ static float grid_pos[VIEWGRAD_RES_X][VIEWGRAD_RES_Y][3];
static GLushort indices[VIEWGRAD_RES_X - 1][VIEWGRAD_RES_X - 1][4];
static bool buf_calculated = false;
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 3ff8ab5b4c8..cb7b192b0d9 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -109,12 +109,9 @@ static struct GPUGlobal {
GLint maxtexsize;
GLint maxtextures;
GLuint currentfb;
- int glslsupport;
- int extdisabled;
+ bool extdisabled;
int colordepth;
int samples_color_texture_max;
- int npotdisabled; /* ATI 3xx-5xx (and more) chipsets support NPoT partially (== not enough) */
- int dlistsdisabled; /* Legacy ATI driver does not support display lists well */
GPUDeviceType device;
GPUOSType os;
GPUDriverType driver;
@@ -148,7 +145,7 @@ bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
void GPU_extensions_disable(void)
{
- GG.extdisabled = 1;
+ GG.extdisabled = true;
}
int GPU_max_texture_size(void)
@@ -163,9 +160,6 @@ void GPU_get_dfdy_factors(float fac[2])
void gpu_extensions_init(void)
{
- GLint r, g, b;
- const char *vendor, *renderer, *version;
-
/* BLI_assert(GLEW_VERSION_2_1); */
/* ^-- maybe a bit extreme? */
@@ -173,8 +167,7 @@ void gpu_extensions_init(void)
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &GG.maxtexsize);
- GG.glslsupport = 1;
-
+ GLint r, g, b;
glGetIntegerv(GL_RED_BITS, &r);
glGetIntegerv(GL_GREEN_BITS, &g);
glGetIntegerv(GL_BLUE_BITS, &b);
@@ -184,9 +177,9 @@ void gpu_extensions_init(void)
glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES , &GG.samples_color_texture_max);
}
- vendor = (const char *)glGetString(GL_VENDOR);
- renderer = (const char *)glGetString(GL_RENDERER);
- version = (const char *)glGetString(GL_VERSION);
+ const char *vendor = (const char *)glGetString(GL_VENDOR);
+ const char *renderer = (const char *)glGetString(GL_RENDERER);
+ const char *version = (const char *)glGetString(GL_VERSION);
if (strstr(vendor, "ATI")) {
GG.device = GPU_DEVICE_ATI;
@@ -274,18 +267,23 @@ void gpu_extensions_exit(void)
bool GPU_glsl_support(void)
{
- return GG.glslsupport;
+ /* always supported, still queried by game engine */
+ return true;
}
bool GPU_non_power_of_two_support(void)
{
- /* still relevant for OpenGL ES */
- return !GG.npotdisabled;
+ /* always supported on full GL but still relevant for OpenGL ES */
+ return true;
}
bool GPU_display_list_support(void)
{
- return !GG.dlistsdisabled;
+ /* deprecated in GL 3
+ * supported on older GL and compatibility profile
+ * still queried by game engine
+ */
+ return true;
}
bool GPU_bicubic_bump_support(void)
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 82902f8d69c..85dc968602e 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -2278,9 +2278,6 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
GLint lastbindcode;
int i, liblen, fraglen;
- if (!GPU_glsl_support())
- return NULL;
-
/* TODO(sergey): How to detemine whether we need OSD or not here? */
mat = GPU_material_from_blender(scene, ma, false);
pass = (mat)? mat->pass: NULL;
diff --git a/source/blender/gpu/intern/gpu_simple_shader.c b/source/blender/gpu/intern/gpu_simple_shader.c
index 89d3c0f59df..bd7746648c8 100644
--- a/source/blender/gpu/intern/gpu_simple_shader.c
+++ b/source/blender/gpu/intern/gpu_simple_shader.c
@@ -173,29 +173,10 @@ static GPUShader *gpu_simple_shader(int options)
void GPU_simple_shader_bind(int options)
{
- if (GPU_glsl_support()) {
- GPUShader *shader = gpu_simple_shader(options);
+ GPUShader *shader = gpu_simple_shader(options);
- if (shader)
- GPU_shader_bind(shader);
- }
- else {
- // XXX where does this fit, depends on ortho/persp?
-
- if (options & GPU_SHADER_LIGHTING)
- glEnable(GL_LIGHTING);
-
- if (options & GPU_SHADER_TWO_SIDED)
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
-
- if (options & GPU_SHADER_OVERRIDE_DIFFUSE) {
- glEnable(GL_COLOR_MATERIAL);
- glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
- }
-
- if (options & GPU_SHADER_TEXTURE_2D)
- glEnable(GL_TEXTURE_2D);
- }
+ if (shader)
+ GPU_shader_bind(shader);
/* temporary hack, should be solved outside of this file */
GPU_MATERIAL_STATE.need_normals = (options & GPU_SHADER_LIGHTING);
@@ -203,15 +184,7 @@ void GPU_simple_shader_bind(int options)
void GPU_simple_shader_unbind(void)
{
- if (GPU_glsl_support()) {
- GPU_shader_unbind();
- }
- else {
- glDisable(GL_LIGHTING);
- glDisable(GL_COLOR_MATERIAL);
- glDisable(GL_TEXTURE_2D);
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
- }
+ GPU_shader_unbind();
}
/* Material Colors */