[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58919] branches/soc-2013-viewport_fx/ source/blender: runs without crashing, the shaders compile, but nothing draws...

Jason Wilkins Jason.A.Wilkins at gmail.com
Mon Aug 5 06:25:17 CEST 2013


Revision: 58919
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58919
Author:   jwilkins
Date:     2013-08-05 04:25:17 +0000 (Mon, 05 Aug 2013)
Log Message:
-----------
runs without crashing, the shaders compile, but nothing draws...

Modified Paths:
--------------
    branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/cdderivedmesh.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_file/file_draw.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_file/file_ops.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawmesh.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/view3d_view.c
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_matrix.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_basic_shader.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_buffers.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_common.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_common.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_draw.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_font_shader.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate_gl.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_lighting.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_lighting.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_matrix.c
    branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
    branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_basic_vert.glsl
    branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_common_attribs.glsl
    branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_common_constants.glsl
    branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_common_uniforms.glsl
    branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_font_vert.glsl
    branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_init_exit.c

Modified: branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/cdderivedmesh.c	2013-08-05 04:19:34 UTC (rev 58918)
+++ branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/cdderivedmesh.c	2013-08-05 04:25:17 UTC (rev 58919)
@@ -350,7 +350,10 @@
 	}
 	else {  /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
 		GPU_vertex_setup(dm);
-		GPU_commit_matrixes();
+
+		gpu_commit_aspect(); // XXX jwilkins: internal interface
+		gpu_commit_matrixes(); // XXX jwilkins: internal interface
+
 		if (!GPU_buffer_legacy(dm)) {
 			if (dm->drawObject->tot_triangle_point)
 				glDrawArrays(GL_POINTS, 0, dm->drawObject->tot_triangle_point);
@@ -402,7 +405,8 @@
 
 			GPU_uvedge_setup(dm);
 
-			GPU_commit_matrixes(); // XXX jwilkins: internal interface
+			gpu_commit_aspect(); // XXX jwilkins: internal interface
+			gpu_commit_matrixes(); // XXX jwilkins: internal interface
 
 			if (!GPU_buffer_legacy(dm)) {
 				for (i = 0; i < dm->numTessFaceData; i++, mf++) {
@@ -883,7 +887,10 @@
 							GPU_color_switch(1);
 						else
 							GPU_color_switch(0);
-						GPU_commit_matrixes();
+
+						gpu_commit_aspect(); // XXX jwilkins: internal interface
+						gpu_commit_matrixes(); // XXX jwilkins: internal interface
+
 						glDrawArrays(GL_TRIANGLES, first, count);
 					}
 
@@ -1085,7 +1092,10 @@
 			}
 			if (setDrawOptions == NULL) {
 				/* just draw the entire face array */
-				GPU_commit_matrixes(); // XXX jwilkins: internal function call
+
+				gpu_commit_aspect(); // XXX jwilkins: internal interface
+				gpu_commit_matrixes(); // XXX jwilkins: internal function call
+
 				glDrawArrays(GL_TRIANGLES, 0, (tottri) * 3);
 			}
 			else {
@@ -1136,7 +1146,7 @@
 
 						if (count)
 						{
-							GPU_commit_matrixes(); // XXX jwilkins: internal function call
+							gpu_commit_matrixes(); // XXX jwilkins: internal function call
 							glDrawArrays(GL_TRIANGLES, first, count);
 						}
 
@@ -1421,7 +1431,9 @@
 		GPU_normal_setup(dm);
 
 		if (!GPU_buffer_legacy(dm)) {
-			GPU_commit_matrixes(); // XXX jwilkins: internal function call
+			gpu_commit_aspect(); // XXX jwilkins: internal interface
+			gpu_commit_matrixes(); // XXX jwilkins: internal function call
+
 			for (i = 0; i < dm->drawObject->tot_triangle_point / 3; i++) {
 
 				a = dm->drawObject->triangle_to_mface[i];
@@ -1601,7 +1613,10 @@
 						GPU_buffer_unlock(buffer);
 						GPU_interleaved_attrib_setup(buffer, datatypes, numdata);
 					}
-					GPU_commit_matrixes(); // XXX jwilkins: internal function call
+
+					gpu_commit_aspect(); // XXX jwilkins: internal interface
+					gpu_commit_matrixes(); // XXX jwilkins: internal function call
+
 					glDrawArrays(GL_TRIANGLES, start * 3, (curface - start) * 3);
 				}
 			}

Modified: branches/soc-2013-viewport_fx/source/blender/editors/space_file/file_draw.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/space_file/file_draw.c	2013-08-05 04:19:34 UTC (rev 58918)
+++ branches/soc-2013-viewport_fx/source/blender/editors/space_file/file_draw.c	2013-08-05 04:25:17 UTC (rev 58919)
@@ -561,7 +561,7 @@
 		UI_ThemeColor4(TH_TEXT);
 
 		if (file->selflag & EDITING_FILE) {
-			uiBut *but = uiDefBut(block, TEX, 1, "", sx, sy - layout->tile_h - 0.15f * UI_UNIT_X,
+			uiBut *but = uiDefBut(block, TEX, 1, "", sx, (int)(sy - layout->tile_h - 0.15f * UI_UNIT_X),
 			                      textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit), 0, 0, "");
 			uiButSetRenameFunc(but, renamebutton_cb, file);
 			uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */

Modified: branches/soc-2013-viewport_fx/source/blender/editors/space_file/file_ops.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/space_file/file_ops.c	2013-08-05 04:19:34 UTC (rev 58918)
+++ branches/soc-2013-viewport_fx/source/blender/editors/space_file/file_ops.c	2013-08-05 04:25:17 UTC (rev 58919)
@@ -73,8 +73,8 @@
 	View2D *v2d = &ar->v2d;
 	rcti rect_view;
 
-	UI_view2d_region_to_view(v2d, rect->xmin, rect->ymin, &fxmin, &fymin);
-	UI_view2d_region_to_view(v2d, rect->xmax, rect->ymax, &fxmax, &fymax);
+	UI_view2d_region_to_view(v2d, (float)rect->xmin, (float)rect->ymin, &fxmin, &fymin);
+	UI_view2d_region_to_view(v2d, (float)rect->xmax, (float)rect->ymax, &fxmax, &fymax);
 
 	BLI_rcti_init(&rect_view, (int)(v2d->tot.xmin + fxmin), (int)(v2d->tot.xmin + fxmax), (int)(v2d->tot.ymax - fymin), (int)(v2d->tot.ymax - fymax));
 

Modified: branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawmesh.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawmesh.c	2013-08-05 04:19:34 UTC (rev 58918)
+++ branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawmesh.c	2013-08-05 04:25:17 UTC (rev 58919)
@@ -330,15 +330,17 @@
 			// SSS GPU_simple_shader_material(...);
 			//gpuMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
 			//gpuMateriali(GL_FRONT_AND_BACK, GL_SHININESS, CLAMPIS(ma->har, 0, 128));
+			GPU_set_basic_material_specular(spec);     // XXX jwilkins: couldn't find where specular is returned to default
+			GPU_set_basic_material_shininess(ma->har); // XXX jwilkins: couldn't find where shininess is returned to default (35?)
 
-			// SSS Update GPU_SHADER_LIGHTING
+			// SSS Enable
 			//gpuEnableLighting();
-			//gpuEnableColorMaterial();
+			GPU_aspect_enable(GPU_ASPECT_BASIC, GPU_BASIC_LIGHTING);
 		}
 		else {
-			// SSS Update
-			//gpuDisableLighting(); 
-			//gpuDisableColorMaterial();
+			// SSS Disable
+			//gpuDisableLighting();
+			GPU_aspect_disable(GPU_ASPECT_BASIC, GPU_BASIC_LIGHTING);
 		}
 
 		c_lit = lit;
@@ -910,6 +912,9 @@
 //			}
 //#endif
 
+			// SSS Enable
+			GPU_aspect_enable(GPU_ASPECT_BASIC, GPU_BASIC_TEXTURE_2D);
+
 			gpuBindTexture(GL_TEXTURE_2D, ima->bindcode);
 			gpuColor3P(CPACK_WHITE);
 
@@ -939,6 +944,9 @@
 		//glDisable(GL_TEXTURE_2D);
 		//gpuDisableColorMaterial();
 
+		// SSS Disable
+		GPU_aspect_disable(GPU_ASPECT_BASIC, GPU_BASIC_TEXTURE_2D);
+
 		/* draw single color */
 		GPU_enable_material(mat_nr, attribs);
 	}
@@ -1009,7 +1017,7 @@
 			                       set_face_cb, &data);
 		}
 		else {
-			float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+			//float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 
 			/* draw textured */
 			// SSS GPU_simple_shader_material(...);
@@ -1017,17 +1025,20 @@
 			//gpuMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, zero);
 			//gpuMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
 
-			// SSS Begin GPU_SHADER_LIGHTING
+			// SSS Enable
 			//gpuEnableLighting();
+			GPU_aspect_enable(GPU_ASPECT_BASIC, GPU_BASIC_LIGHTING|GPU_BASIC_TEXTURE_2D);
 
 			dm->drawMappedFacesMat(dm,
 			                       tex_mat_set_texture_cb,
 			                       set_face_cb, &data);
 
 			/* reset opengl state */
-			// SSS End
+
+			// SSS Disable
 			//gpuDisableColorMaterial();
 			//gpuDisableLighting();
+			GPU_aspect_disable(GPU_ASPECT_BASIC, GPU_BASIC_LIGHTING|GPU_BASIC_TEXTURE_2D);
 		}
 
 		GPU_end_object_materials();
@@ -1074,11 +1085,15 @@
 			/* but set default spec */
 			// SSS GPU_simple_shader_material(...) // only sets specular
 			//gpuMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
+			GPU_set_basic_material_specular(spec); // XXX jwilkins: couldn't find where specular is returned to default
+			                                       // XXX jwilkins: is this supposed to use the default shininess?
 
 			/* diffuse */
+
 			// SSS Begin GPU_SHADER_LIGHTING
 			//gpuEnableLighting();
 			//gpuEnableColorMaterial();
+			GPU_aspect_enable(GPU_ASPECT_BASIC, GPU_BASIC_LIGHTING);
 		}
 		else {
 			// SSS Begin
@@ -1105,6 +1120,7 @@
 			// SSS End
 			//gpuDisableColorMaterial();
 			//gpuDisableLighting();
+			GPU_aspect_disable(GPU_ASPECT_BASIC, GPU_BASIC_LIGHTING);
 
 			GPU_disable_material();
 		}

Modified: branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawobject.c	2013-08-05 04:19:34 UTC (rev 58918)
+++ branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawobject.c	2013-08-05 04:25:17 UTC (rev 58919)
@@ -3332,14 +3332,15 @@
 				GPU_enable_material(0, NULL);
 
 				/* set default spec */
-				// SSS
+				// SSS GPU_set_basic_material_specular
 				//gpuMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
-				GPU_set_basic_material_specular(spec);
+				GPU_set_basic_material_specular(spec); // XXX jwilkins: I don't see where this value is restored (or if this is already the default, why is it set here?
 
 				/* diffuse */
-				// SSS Begin GPU_SHADER_LIGHTING
+				// SSS Enable GPU_SHADER_LIGHTING
 				//gpuEnableLighting();
 				//gpuEnableColorMaterial();
+				GPU_aspect_enable(GPU_ASPECT_BASIC, GPU_BASIC_LIGHTING);
 
 				gpuImmediateFormat_C4_N3_V3();
 				dm->drawMappedFaces(
@@ -3351,9 +3352,10 @@
 					DM_DRAW_USE_COLORS|DM_DRAW_USE_NORMALS);
 				gpuImmediateUnformat();
 
-				// SSS End
+				// SSS Disable
 				//gpuDisableColorMaterial();
 				//gpuDisableLighting();
+				GPU_aspect_disable(GPU_ASPECT_BASIC, GPU_BASIC_LIGHTING);
 
 				GPU_disable_material();
 			}

Modified: branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/view3d_view.c	2013-08-05 04:19:34 UTC (rev 58918)
+++ branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/view3d_view.c	2013-08-05 04:25:17 UTC (rev 58919)
@@ -103,7 +103,9 @@
 		gpuLoadMatrix(rv3d->winmat);
 		gpuMatrixMode(GL_MODELVIEW);
 		gpuLoadMatrix(rv3d->viewmat);
-		GPU_commit_matrixes();//change // XXX jwilkins: hmm... why?
+
+		gpu_commit_aspect(); // XXX jwilkins: internal interface
+		gpu_commit_matrixes();//change // XXX jwilkins: hmm... why?
 	}
 }
 

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/GPU_matrix.h
===================================================================

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list