Commit: ccd51bb9224899b4b7d50170267d94d9b9f2567f
Author: Sergey Sharybin
Date:   Fri Jul 22 14:50:21 2016 +0200
Branches: master
https://developer.blender.org/rBccd51bb9224899b4b7d50170267d94d9b9f2567f

OpenSubdiv: Properly support active UV layer in textured view

===================================================================

M       intern/opensubdiv/opensubdiv_gpu_capi.cc
M       source/blender/blenkernel/intern/subsurf_ccg.c

===================================================================

diff --git a/intern/opensubdiv/opensubdiv_gpu_capi.cc 
b/intern/opensubdiv/opensubdiv_gpu_capi.cc
index a7c42ae..16a86f6 100644
--- a/intern/opensubdiv/opensubdiv_gpu_capi.cc
+++ b/intern/opensubdiv/opensubdiv_gpu_capi.cc
@@ -439,7 +439,10 @@ void bindProgram(OpenSubdiv_GLMesh *gl_mesh, int program)
        /* See notes below about why we use such values. */
        /* TOO(sergey): Get proper value for FVar width. */
        glUniform1i(glGetUniformLocation(program, "osd_fvar_count"), 2);
-       if (gl_mesh->fvar_data->channel_offsets.size() > 0 && g_active_uv_index 
>= 0) {
+       if (gl_mesh->fvar_data != NULL &&
+           gl_mesh->fvar_data->channel_offsets.size() > 0 &&
+           g_active_uv_index >= 0)
+       {
                glUniform1i(glGetUniformLocation(program, 
"osd_active_uv_offset"),
                            
gl_mesh->fvar_data->channel_offsets[g_active_uv_index]);
        } else {
@@ -624,7 +627,10 @@ static GLuint prepare_patchDraw(OpenSubdiv_GLMesh *gl_mesh,
 
                                location = glGetUniformLocation(program, 
"osd_active_uv_offset");
                                if (location != -1) {
-                                       if 
(gl_mesh->fvar_data->channel_offsets.size() > 0 && g_active_uv_index >= 0) {
+                                       if (gl_mesh->fvar_data != NULL &&
+                                           
gl_mesh->fvar_data->channel_offsets.size() > 0 &&
+                                           g_active_uv_index >= 0)
+                                       {
                                                glUniform1i(location,
                                                            
gl_mesh->fvar_data->channel_offsets[g_active_uv_index]);
                                        } else {
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c 
b/source/blender/blenkernel/intern/subsurf_ccg.c
index c6e20b9..7239566 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -3401,7 +3401,8 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
 
 #ifdef WITH_OPENSUBDIV
        if (ccgdm->useGpuBackend) {
-               if (UNLIKELY(ccgSubSurf_prepareGLMesh(ss, true, -1) == false)) {
+               const int active_uv_layer = 
CustomData_get_active_layer_index(&dm->loopData, CD_MLOOPUV);
+               if (UNLIKELY(ccgSubSurf_prepareGLMesh(ss, true, 
active_uv_layer) == false)) {
                        return;
                }
                if (drawParams == NULL) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to