[Bf-blender-cvs] [f71ac88] opensubdiv-modifier: OpenSubdiv: Fix wrong lighting data passed to the shader first time
Sergey Sharybin
noreply at git.blender.org
Wed Jul 30 13:49:26 CEST 2014
Commit: f71ac886e1976513099e12cfc264573d64060d14
Author: Sergey Sharybin
Date: Wed Jul 30 15:35:41 2014 +0600
Branches: opensubdiv-modifier
https://developer.blender.org/rBf71ac886e1976513099e12cfc264573d64060d14
OpenSubdiv: Fix wrong lighting data passed to the shader first time
The issue was caused by the memset happening after the lighting data
was read from the OpenGL state.
===================================================================
M intern/opensubdiv/opensubdiv_gpu_capi.cc
M source/blender/gpu/intern/gpu_material.c
===================================================================
diff --git a/intern/opensubdiv/opensubdiv_gpu_capi.cc b/intern/opensubdiv/opensubdiv_gpu_capi.cc
index a3e98fd..465b54a 100644
--- a/intern/opensubdiv/opensubdiv_gpu_capi.cc
+++ b/intern/opensubdiv/opensubdiv_gpu_capi.cc
@@ -84,7 +84,7 @@ typedef struct Transform {
} Transform;
static bool g_use_osd_glsl = false;
-static bool g_active_uv_index = -1;
+static int g_active_uv_index = -1;
static GLuint g_flat_fill_program = 0;
static GLuint g_smooth_fill_program = 0;
@@ -376,9 +376,6 @@ void openSubdiv_osdGLDisplayInit(void)
g_smooth_fill_program = linkProgram("#define SMOOTH_SHADING\n");
g_wireframe_program = linkProgram("#define WIREFRAME\n");
- /* We start with totally emoty lighting setup. */
- memset(&g_lighting_data, 0, sizeof(g_lighting_data));
-
glGenBuffers(1, &g_lighting_ub);
glBindBuffer(GL_UNIFORM_BUFFER, g_lighting_ub);
glBufferData(GL_UNIFORM_BUFFER,
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 44064bb..f1f67fa 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -2272,11 +2272,19 @@ void GPU_material_update_fvar_offset(GPUMaterial *gpu_material,
/* TODO(sergey): This will work for until names are
* consistent, we'll need to solve this somehow in the future.
*/
- int layer_index = CustomData_get_named_layer(&dm->loopData,
- CD_MLOOPUV,
- input->attribname);
+ int layer_index;
int location;
+ if (input->attribname[0] != '\0') {
+ layer_index = CustomData_get_named_layer(&dm->loopData,
+ CD_MLOOPUV,
+ input->attribname);
+ }
+ else {
+ layer_index = CustomData_get_active_layer(&dm->loopData,
+ CD_MLOOPUV);
+ }
+
BLI_snprintf(name, sizeof(name),
"fvar%d_offset",
input->attribid);
More information about the Bf-blender-cvs
mailing list