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
diff options
context:
space:
mode:
authorSergej Reich <sergej.reich@googlemail.com>2013-09-21 00:25:07 +0400
committerSergej Reich <sergej.reich@googlemail.com>2013-09-21 00:25:07 +0400
commit59d22634e09b7beff57256e10755b5bc1437c544 (patch)
tree8fad9da78940829c5e1b916c15d87e0165acdafb /source/blender/gpu
parentc6f361432987804837028ede2118d83ca6a69fdb (diff)
parent50fbb6c07e6864cb5a2300858f28a0f0ce3ac1af (diff)
svn merge -r59869:60272 ^/trunk/blender
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_extensions.h1
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c10
-rw-r--r--source/blender/gpu/intern/gpu_material.c7
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl15
4 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index 8dd28601d34..1db424b514d 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -61,6 +61,7 @@ int GPU_print_error(const char *str);
int GPU_glsl_support(void);
int GPU_non_power_of_two_support(void);
+int GPU_display_list_support(void);
int GPU_color_depth(void);
void GPU_code_generate_glsl_lib(void);
int GPU_bicubic_bump_support(void);
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index ea7b169a882..1d08f1f6ea9 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -86,6 +86,7 @@ static struct GPUGlobal {
int extdisabled;
int colordepth;
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;
@@ -190,6 +191,9 @@ void GPU_extensions_init(void)
* Incomplete list http://dri.freedesktop.org/wiki/ATIRadeon
* New IDs from MESA's src/gallium/drivers/r300/r300_screen.c
*/
+ /* This list is close enough to those using the legacy driver which
+ * has a bug with display lists and glVertexAttrib
+ */
if (strstr(renderer, "R3") || strstr(renderer, "RV3") ||
strstr(renderer, "R4") || strstr(renderer, "RV4") ||
strstr(renderer, "RS4") || strstr(renderer, "RC4") ||
@@ -200,6 +204,7 @@ void GPU_extensions_init(void)
strstr(renderer, "RADEON 9"))
{
GG.npotdisabled = 1;
+ GG.dlistsdisabled = 1;
}
}
@@ -238,6 +243,11 @@ int GPU_non_power_of_two_support(void)
return GLEW_ARB_texture_non_power_of_two;
}
+int GPU_display_list_support(void)
+{
+ return !GG.dlistsdisabled;
+}
+
int GPU_color_depth(void)
{
return GG.colordepth;
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 0ca929da65d..9319ac53db6 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -1126,8 +1126,15 @@ static void do_material_tex(GPUShadeInput *shi)
else { /* otherwise use accumulated perturbations */
GPU_link(mat, "mtex_nspace_tangent", GPU_attribute(CD_TANGENT, ""), shi->vn, tnor, &newnor);
}
+ } else if (mtex->normapspace == MTEX_NSPACE_OBJECT) {
+ /* transform normal by object then view matrix */
+ GPU_link(mat, "mtex_nspace_object", GPU_builtin(GPU_VIEW_MATRIX), GPU_builtin(GPU_OBJECT_MATRIX), tnor, &newnor);
+ } else if (mtex->normapspace == MTEX_NSPACE_WORLD) {
+ /* transform normal by view matrix */
+ GPU_link(mat, "mtex_nspace_world", GPU_builtin(GPU_VIEW_MATRIX), tnor, &newnor);
}
else {
+ /* no transform, normal in camera space */
newnor = tnor;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index cd8c2db1821..bab677da842 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -1415,6 +1415,16 @@ void mtex_nspace_tangent(vec4 tangent, vec3 normal, vec3 texnormal, out vec3 out
outnormal = normalize(outnormal);
}
+void mtex_nspace_world(mat4 viewmat, vec3 texnormal, out vec3 outnormal)
+{
+ outnormal = normalize((viewmat*vec4(texnormal, 0.0)).xyz);
+}
+
+void mtex_nspace_object(mat4 viewmat, mat4 obmat, vec3 texnormal, out vec3 outnormal)
+{
+ outnormal = normalize((viewmat*(obmat*vec4(texnormal, 0.0))).xyz);
+}
+
void mtex_blend_normal(float norfac, vec3 normal, vec3 newnormal, out vec3 outnormal)
{
outnormal = (1.0 - norfac)*normal + norfac*newnormal;
@@ -2092,6 +2102,11 @@ void node_subsurface_scattering(vec4 color, float scale, vec3 radius, float shar
node_bsdf_diffuse(color, 0.0, N, result);
}
+void node_bsdf_hair(vec4 color, float roughnessu, float roughnessv, out vec4 result)
+{
+ result = color;
+}
+
/* emission */
void node_emission(vec4 color, float strength, vec3 N, out vec4 result)