﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AJwilkins%2FGSoC2012%2FViewport_FX_Development_Diary</id>
	<title>利用者:Jwilkins/GSoC2012/Viewport FX Development Diary - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AJwilkins%2FGSoC2012%2FViewport_FX_Development_Diary"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Jwilkins/GSoC2012/Viewport_FX_Development_Diary&amp;action=history"/>
	<updated>2026-07-31T16:19:15Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Jwilkins/GSoC2012/Viewport_FX_Development_Diary&amp;diff=136773&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Jwilkins/GSoC2012/Viewport_FX_Development_Diary&amp;diff=136773&amp;oldid=prev"/>
		<updated>2018-06-28T20:49:31Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 20:49時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Jwilkins/GSoC2012/Viewport_FX_Development_Diary&amp;diff=136772&amp;oldid=prev</id>
		<title>wiki&gt;Jwilkins: /* Viewport FX Development Diary */</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Jwilkins/GSoC2012/Viewport_FX_Development_Diary&amp;diff=136772&amp;oldid=prev"/>
		<updated>2012-06-11T23:20:02Z</updated>

		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Viewport FX Development Diary&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Viewport FX Development Diary =&lt;br /&gt;
&lt;br /&gt;
== Week 1 ==&lt;br /&gt;
&lt;br /&gt;
=== Monday, May 21&amp;lt;sup&amp;gt;st&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
My first target are deprecated geometry functions.  These include &amp;lt;tt&amp;gt;Begin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;Vertex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;End&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;Rect&amp;lt;/tt&amp;gt;.  I am finding and classifying each &amp;quot;&amp;lt;i&amp;gt;doodle&amp;lt;/i&amp;gt;&amp;quot;, which is what I'm calling any reasonably self contained chunk of OpenGL drawing code.&lt;br /&gt;
&lt;br /&gt;
The first major classification is to distinguish between &amp;quot;&amp;lt;i&amp;gt;heavy doodles&amp;lt;/i&amp;gt;&amp;quot; and &amp;quot;&amp;lt;i&amp;gt;light doodles&amp;lt;/i&amp;gt;&amp;quot;.  A &amp;lt;i&amp;gt;heavy doodle&amp;lt;/i&amp;gt; may potentially contain millions of vertexes while it would be very surprising to find a &amp;lt;i&amp;gt;light&amp;lt;/i&amp;gt; doodle with more than a couple hundred (and most contain only a handful).  Example of &amp;lt;i&amp;gt;heavy doodles&amp;lt;/i&amp;gt; are mesh objects and the mesh used in the UV editor.  &amp;lt;i&amp;gt;Light doodles&amp;lt;/i&amp;gt; include key frame markers on the timeline and lots of other simple jots and scribbles used indicate things in the UI.&lt;br /&gt;
&lt;br /&gt;
Some &amp;lt;i&amp;gt;light doodles&amp;lt;/i&amp;gt;, such as text rendering, may require special attention because in some situations they do generate a fairly large amount of drawing (imagine a screen full of text with drop shadows), however most &amp;lt;i&amp;gt;light doodles&amp;lt;/i&amp;gt; are never going to be a bottleneck.  For that reason in the next couple of days, for &amp;lt;i&amp;gt;light doodles&amp;lt;/i&amp;gt; only, I'm going to replace &amp;lt;tt&amp;gt;Begin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;Vertex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;End&amp;lt;/tt&amp;gt; with a limited but &amp;lt;i&amp;gt;source compatible&amp;lt;/i&amp;gt; version.  The replacements will function similarly to &amp;lt;tt&amp;gt;Begin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;Vertex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;End&amp;lt;/tt&amp;gt;, and although they will have all the functionality that Blender needs, they will not be identical to their original OpenGL counterparts.&lt;br /&gt;
&lt;br /&gt;
The justification is that much of the code for drawing even &amp;lt;i&amp;gt;light doodles&amp;lt;/i&amp;gt; is complicated and it is probably not worth it to rewrite it to use vertex arrays directly for what will be a negligible performance gain.&lt;br /&gt;
&lt;br /&gt;
Here is my summary of [[User:Jwilkins/GSoC2012/Blender Doodles]].&lt;br /&gt;
&lt;br /&gt;
=== Tuesay, May 22&amp;lt;sup&amp;gt;nd&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
From [http://www.slideshare.net/Mark_Kilgard/using-vertex-bufferobjectswell| Using Vertex Buffer Objects Well]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;b&amp;gt;The notion that an OpenGL application is “wrong” to ever use immediate&lt;br /&gt;
mode is overzealous. The OpenGL 3.0 specification has even gone so far as to mark&lt;br /&gt;
immediate mode in OpenGL for “deprecation” (whatever that means!); such extremism&lt;br /&gt;
is counter-productive and foolish.&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt; &amp;lt;i&amp;gt;Mark J. Kilgard&amp;lt;br&amp;gt;Graphics Software Engineer&amp;lt;br&amp;gt;NVIDIA Corporation&amp;lt;/i&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Committed a preliminary set of functions to replace the deprecated immediate mode functions.  These functions are for &amp;lt;i&amp;gt;light doodles&amp;lt;/i&amp;gt; where the trouble of rewriting routines to use vertex arrays would be a waste or programmer effort.  [[User:Jwilkins/GSoC2012/Immediate Mode Replacement| You can take a look at the interface here.]]&lt;br /&gt;
&lt;br /&gt;
Several things to note.  First is that it does not copy every single function.  Only &amp;lt;tt&amp;gt;GLfloat&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;GLubyte&amp;lt;/tt&amp;gt; types are supported and only 2, 3, and occasionally 4 dimensional vectors (and certainly not obscure things like edge flags!).  Even this list may be whittled down further as code is actually ported to use this interface.  These functions were chosen because they are what Blender currently actually uses (minus functions that use GLdouble or other types).  The second thing to note are functions that tell the immediate mode exactly what kind of vertex data you will be sending.  This keeps the implementation from having to be prepared for anything.&lt;br /&gt;
&lt;br /&gt;
As I have a chance to profile this code, if it turns out to actually matter, I may reduce the flexibility even further by choosing a limited set of vertex formats that are the fastest and then rewrite any code that does not quite fit.  Hopefully though this code will be &amp;lt;i&amp;gt;good enough&amp;lt;/i&amp;gt; and will just work as a replacement so I won't have to spend a great deal of time on it after this week.&lt;br /&gt;
&lt;br /&gt;
=== Wednesday, May 23&amp;lt;sup&amp;gt;rd&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
==== Towards More Efficient Font Drawing ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Swiss-cheese now renders whole strings as single batches instead of single letters.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Blender used one &amp;lt;tt&amp;gt;Begin/End&amp;lt;/tt&amp;gt; call for each letter.  Granted that sometimes a letter is anti-aliased or has a drop shadow and this adds more geometry to each letter, but still, at most about 50 quads per letter.  Now, in swiss-cheese, as long as all the letters in a string are located in a single texture map, entire strings can be sent to OpenGl at once.  In some cases, such as the Python Console or the Text Editor this could provide a significant speed up.&lt;br /&gt;
&lt;br /&gt;
There is a terrible inefficiency in the drawing of syntax highlighted text.  When in highlighting mode the text editor only sends one character at a time to blf.  The result is that even with efforts to minimize the overhead of using vertex arrays or vbo that all of that overhead will have to be paid once per character!  I cannot see a way out of rewriting that part of the text editor to send whole strings.&lt;br /&gt;
&lt;br /&gt;
==== OpenGL Usage Policy ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;I've modified how Blender handles changing the PixelStore state.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Going to start a [[User:Jwilkins/GSoC2012/Blender OpenGL Usage Policy]].  The first thing to go on the list is that PixelStore values should be restored to OpenGL defaults after you use them.  This seems like a sane policy because in most places Blender already assumes that the values that are not changed are the default values.  It is two API calls to get the original value and then restore whatever was there before.  It is only one call to restore the value to its default.  PushClientAttribs requires two calls and probably is almost certainly more heavy weight, although it could be a win if multiple values are changed (never mind all that, PushClientAttribs is &amp;lt;i&amp;gt;deprecated&amp;lt;/i&amp;gt;).  The verdict is to just change the value and then change it back.&lt;br /&gt;
&lt;br /&gt;
==== gpuImmediate ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;I tested the [[User:Jwilkins/GSoC2012/Immediate Mode Replacement]] interface, which I'm calling gpuImmediate for short.  I also made some key decisions about how gpuImmediate will work.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decided today that it should be OK to use state setting functions between &amp;lt;tt&amp;gt;gpuBegin&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;gpuEnd&amp;lt;/tt&amp;gt;.  This should be OK as long as one does not mess with any geometry rendering state of any kind from any version of OpenGL.  In OpenGL it is illegal to set state (except the &amp;quot;current&amp;quot; vertex values) between &amp;lt;tt&amp;gt;Begin&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;End&amp;lt;/tt&amp;gt;.  This is probably just to give the driver programmer one less thing to worry about.  In the case of gpuImmediate however as long as one does not change geometry state it should be OK to change other state.  The key difference is that whatever state is in effect when &amp;lt;tt&amp;gt;gpuEnd&amp;lt;/tt&amp;gt; is called will be what is used.  This means that if one wants state changes to affect geometry then &amp;lt;tt&amp;gt;gpuEnd&amp;lt;/tt&amp;gt; needs to be called first.&lt;br /&gt;
&lt;br /&gt;
To use the compatibility layer, include &amp;lt;i&amp;gt;&amp;quot;GPU_compatibility.h&amp;quot;&amp;lt;/i&amp;gt;.  This will include the [[User:Jwilkins/GSoC2012/Immediate Mode Replacement| gpuImmediate]] interface as well as define a bunch of macros to catch use of the replaced functionality.  The result of using &amp;lt;tt&amp;gt;glBegin&amp;lt;/tt&amp;gt; for example should a compiler error stating that: The symbol &amp;lt;tt&amp;gt;DO_NOT_USE_glBegin&amp;lt;/tt&amp;gt; was not found.&lt;br /&gt;
&lt;br /&gt;
To test gpuImmediate I replaced font rendering.  Now all text in swiss-cheese is rendered using the new code. This is a very visible portion of the interface so I figured it something was wrong it would reveal itself quickly.  Now, except for matrix transformations the blenfont module has no deprecated functions.&lt;br /&gt;
&lt;br /&gt;
It occurred to me that &amp;lt;tt&amp;gt;gpuBegin/gpuEnd&amp;lt;/tt&amp;gt; is doing too much work in situations where one may need to make many state changes.  To make these functions lighter I think something like &amp;lt;tt&amp;gt;gpuImmediateLock/gpuImmediateUnlock&amp;lt;/tt&amp;gt; may be needed.  These functions would setup and tear down vertex array state just once per vertex format.  Right now &amp;lt;tt&amp;gt;gpuBegin/gpuEnd&amp;lt;/tt&amp;gt; sets up and tears down vertex arrays every time they are called.  I tried to fix this by using a flag to indicate the state had changed, but that still needed some way to indicate drawing was completed.  If gpuImmediate could completely monopolize the geometry state this may not be such a bad thing, but since it cannot at this point (or ever) a function would be needed to indicate completion.  It just seems much simpler to have bookend functions that handle this task.&lt;br /&gt;
&lt;br /&gt;
So, tomorrow I'll implement &amp;lt;tt&amp;gt;gpuImmediateLock/gpuImmediateUnlock&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Bug Watch ====&lt;br /&gt;
&lt;br /&gt;
Here are some [[User:Jwilkins/GSoC2012/Bug Watch| things to watch out for]] because they could be caused by my changes to Blender.&lt;br /&gt;
&lt;br /&gt;
=== Thursday, May 24&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
==== Text Editor /facepalm ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;quot;I don't think you should spend too much time on the text editor.&amp;quot; - &amp;lt;i&amp;gt;general mood of the responses when I asked about this on IRC.&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I ended up spending way more time fiddling with the text editor than I wanted to.  The good news is that without such a &amp;quot;pathological case&amp;quot; I might not have been driven to profile and improve the performance of gpuImmediate.  However there isn't much that can be done when over half of CPU time is being spent in the kernel handling OpenGL calls, so I ended up having to rewrite some parts of the text editor to send fewer batches containing more characters.  I'll have to revisit it later because there are 3 different places I had to rework and they are all almost identical.  But as long as it works I'm going to move on.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;tt&amp;gt;gpuImmediateLock/gpuImmediateUnlock&amp;lt;/tt&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Instead of trying to be clever, let the programmer say when things are ready and when they are completed.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Calling &amp;lt;tt&amp;gt;gpuImmediatelock&amp;lt;/tt&amp;gt; means that the vertex format has been set and the buffer can be setup, while &amp;lt;tt&amp;gt;gpuImmediateUnlock&amp;lt;/tt&amp;gt; means that there is nothing left to draw and the OpenGL buffer state can be returned to defaults.  That doesn't mean to free buffers, those are allocated when &amp;lt;tt&amp;gt;gpuNewImmediate&amp;lt;/tt&amp;gt; is called and are kept until &amp;lt;tt&amp;gt;gpuDeleteImmediate&amp;lt;/tt&amp;gt; is used to destroy them.&lt;br /&gt;
&lt;br /&gt;
This is meant to improve the situation where &amp;lt;tt&amp;gt;gpuBegin&amp;lt;/tt&amp;gt; had to setup the buffer state every time it was called.  You can lock multiple times with little overhead, but you must unlock the same number of times before the state is freed.  I did this because I did not want to have to put &amp;lt;tt&amp;gt;gpuImmediateLock/gpuImmediateUnlock&amp;lt;/tt&amp;gt; around every single call to &amp;lt;tt&amp;gt;BLF_draw&amp;lt;/tt&amp;gt;, but putting it inside that function did not solve the problem of there being too much overhead in drawing a single character.  So I created &amp;lt;tt&amp;gt;BLF_draw_begin/BLF_draw_end&amp;lt;/tt&amp;gt; which can be placed around large blocks of text rendering, but if you don't have a large block you can still just use &amp;lt;tt&amp;gt;BLF_draw&amp;lt;/tt&amp;gt; and it will lock things for you.&lt;br /&gt;
&lt;br /&gt;
==== Profiling ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Turns out I cannot really improve upon memcpy.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I was not entirely convinced that &amp;lt;tt&amp;gt;memcpy&amp;lt;/tt&amp;gt; was the best way to transfer vertexes from the staging area to the vertex buffer, so I broke out &amp;lt;i&amp;gt;AMD CodeAnalyst&amp;lt;/i&amp;gt; and did some profiling.  I ended up streamlining the code quite a bit, but was not able to come up with something faster than memcpy.  The only thing I can think of to improve &amp;lt;tt&amp;gt;gpu_copy_vertex&amp;lt;/tt&amp;gt; would be to make it polymorphic and specialize it for each case that exists in Blender.  It isn't really &amp;lt;i&amp;gt;that&amp;lt;/i&amp;gt; important however at this point.  I gotta remember this is for &amp;lt;i&amp;gt;light doodles&amp;lt;/i&amp;gt; and that bad performance should only come from &amp;lt;tt&amp;gt;Begin/End&amp;lt;/tt&amp;gt; code that was badly written in the first place.&lt;br /&gt;
&lt;br /&gt;
==== Lost Time ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;My &amp;lt;i&amp;gt;AMD CodeAnalyst&amp;lt;/i&amp;gt; works but is old, while my &amp;lt;i&amp;gt;gDEBugger&amp;lt;/i&amp;gt; is completely broken but I really need it.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I had to go all the way back to the version of &amp;lt;i&amp;gt;AMD CodeAnalyst&amp;lt;/i&amp;gt; that I used when optimizing sculpt in the Summer of 2010 to find a version that did not crash.  I'm going to have to do a binary search on the versions if I want the latest version that works.  But what I have works, so I'll probably just leave it.&lt;br /&gt;
&lt;br /&gt;
I was having no problems debugging Blender OpenGL using &amp;lt;i&amp;gt;gDEBugger&amp;lt;/i&amp;gt; last week, but now that I need to use it for real it seems to cause OpenGL to fail with GL_OUT_OF_MEMORY errors on most of the drawing calls.  I had planned on using &amp;lt;i&amp;gt;gDEBugger&amp;lt;/i&amp;gt; to find deprecated &amp;lt;tt&amp;gt;GLenum&amp;lt;/tt&amp;gt; usage as well as performance problems, so I have to find a solution soon.&lt;br /&gt;
&lt;br /&gt;
=== Friday, May 25&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Did not feel very productive today.  I did get &amp;lt;i&amp;gt;gDEBugger&amp;lt;/i&amp;gt; working.  It seemed to have something to do with multi-monitor compatibility settings.  This also fixed my problem with Blender only wanting to work on my primary monitor.  I ended up using &amp;lt;i&amp;gt;gDEBugger&amp;lt;/i&amp;gt; to discover and remove some redundant state changes and fix some bugs.&lt;br /&gt;
&lt;br /&gt;
Next week I will try to completely replace all uses of the GL immediate mode with gpuImmediate and start implementation of gpuRetained to handle situations where geometry could be reused or partially modified.  If it starts to look like too much work then I'm going to shelve the porting work and move on to other interfaces.  My goal is to port enough code to test the new library, and if it works well then porting the rest of Blender to use it can be done in the Fall.  It is more important to cover all the use cases than it is to fix everything now.&lt;br /&gt;
&lt;br /&gt;
I'm so ready for the weekend.  My head hurts from all the coding.&lt;br /&gt;
&lt;br /&gt;
=== Sunday, May 27&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Not working today, but I did notice that Blender slows down a lot when displaying edge lengths in the view port.  Other's reported that slow down is noticeable with up to 10,000 edges, while 50k edges gives 1 fps or is not usable at all.  However I was running swiss-cheese and 3k edges were starting to chug pretty badly.  I took it as a lesson that even &amp;quot;light doodles&amp;quot; can become surprisingly heavy at times.  Drawing an edge label is actually more work than drawing an edge.&lt;br /&gt;
&lt;br /&gt;
Later today, had a clever idea for drawing edge lengths really fast.  Pass in the edge lengths as a VBO and have the shader figure out the texture coordinates from the digits.  It may even be possible to render them as point sprites instead of quads.  &lt;br /&gt;
&lt;br /&gt;
However, more realistically it is probably better to just limit how many edge lengths will be drawn. Who is going to get any use out of 50,000 numeric labels??&lt;br /&gt;
&lt;br /&gt;
== Week 2 ==&lt;br /&gt;
&lt;br /&gt;
=== Monday, May 28&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; - Memorial Day ===&lt;br /&gt;
&lt;br /&gt;
Tommorrow I'm going to try replacing all of Begin/End with gpuBegin/gpuEnd.  I'm not sure this is going to work very well.  If it doesn't then I'm going to just make a patch and save it for later.  Unfortunately I expect Blender to be slower after this change, but I do not &amp;lt;i&amp;gt;know&amp;lt;/i&amp;gt; this for sure so I actually just need to do it and try.  One problem may actually be all the checks and safety I've written into the gpuImmediate functions.  I may need to actually be able to turn this off separately using a WITH_GPU_SAFETY flag or something.&lt;br /&gt;
&lt;br /&gt;
There are a couple of changes I realize I need to make to gpuImmediateLock/gpuImmediateUnlock to make things easier.&lt;br /&gt;
&lt;br /&gt;
1. Instead of banning vertex format changes inside the scope of gpuImmediateLock, just assert that the format does not require more space.  This will allow for nesting of compatible drawing commands more easily.  Not sure how badly this will be needed.&lt;br /&gt;
&lt;br /&gt;
2. When the lock count falls back to zero gpuImmediateUnlock should zero out the vertex format automatically.  Otherwise the code will be littered with commands to set the vertex format back to defaults.&lt;br /&gt;
&lt;br /&gt;
=== Tuesday, May 29&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
==== Ankh SVN versus Tortoise SVN ====&lt;br /&gt;
&lt;br /&gt;
I'm using both of these tools for managing SVN.  I've made a few mistakes because I'm learning Ankh, but it provides integration with MSVC which so far has been really helpful.  The first thing I've done is accidentally committed more files than I intended because I forgot to de-select them.  The second is more serious, I did a merge and then committed it using Ankh, but Ankh only sees the files I've configured to build in MSVC using CMake, so it leaves half of the merge on the disk.  The first time I naively thought that Tortoise had gone crazy when it was telling me there were more files to commit and I just reverted them (dumb).  I paid the price this time by having to fix up the next merge which had not gone very well.  It's all good now, I just need to remember to use Tortoise for merges.&lt;br /&gt;
&lt;br /&gt;
==== Subsurface ====&lt;br /&gt;
For a lark I converted a bunch of &amp;lt;i&amp;gt;heavy doodles&amp;lt;/i&amp;gt; to use gpuImmediate.  At first it was disheartening because performance dropped drastically, but then I noticed a few mistakes I had made and after those were fixed up things ran OK unless you applied a sub-surface modifier.  There was a big difference between the performance of these three sets of steps:&lt;br /&gt;
&lt;br /&gt;
* Make a subsurf out of a high poly object:&lt;br /&gt;
** Add cube&lt;br /&gt;
** Add subsurf&lt;br /&gt;
** Set view to 5&lt;br /&gt;
** Apply&lt;br /&gt;
** Add another subsurf&lt;br /&gt;
&lt;br /&gt;
* Make a subsurf out of a low poly object:&lt;br /&gt;
** Add cube&lt;br /&gt;
** Add subsurf&lt;br /&gt;
** Set view to 6&lt;br /&gt;
&lt;br /&gt;
* Just have a plain high poly object:&lt;br /&gt;
** Add cube&lt;br /&gt;
** Add subsurf&lt;br /&gt;
** set view to 6&lt;br /&gt;
** apply&lt;br /&gt;
&lt;br /&gt;
Theoretically, these should all perform the same because they all have the same number of polygons.  However the first case had horrendous performance before I adjusted the gpuImmediate version of the rendering code to perform better.  Keep in mind I could have made these same adjustments to the glBegin/glEnd code, it just turns out that gpuImmediate is more sensitive to bad usage (trunk shows the same pattern, it is just not as pronounced).  The last two cases performed almost identically.  Unfortunately, even after my optimizations the first case still has problems on my machine (but no worse than trunk), but I cannot track it down to a problem with OpenGL, so I believe it may be a CPU bottleneck.&lt;br /&gt;
&lt;br /&gt;
To try this same test on your own computer you may need to start with a subdivided cube.  This test only makes about 150k polygons, so it may not tax your CPU or GPU at all until you go higher.&lt;br /&gt;
&lt;br /&gt;
=== Wednesday, May 30&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;tt&amp;gt;WITH_GPU_SAFETY&amp;lt;/tt&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An advanced build option that enables a bunch of checks that would ordinarily be too expensive or that should never fire in release code.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Spent the day formalizing the GPU safety option.  Right now it just checks that gpuImmediate functions are properly nested and initialized, but I can imagine it being used for more.  I really like to put paranoid checks everywhere in my code, but they can be detrimental to performance and also to aesthetics.  Hopefully the work put in today on this will pay off in letting me add as many checks as I need without a performance penalty and that it also does not obscure what the code is supposed to be doing normally by distracting the reader with a lot of apparently superfluous code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sunday, June 3&amp;lt;sup&amp;gt;rd&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
==== Design Details ====&lt;br /&gt;
&lt;br /&gt;
I wrote so much on Thursday that I didn't see much need to update this diary.  Had a discussion with Brecht that helped me refine my ideas on Friday.  [[User:Jwilkins/GSoC2012/Viewport FX Design]]&lt;br /&gt;
&lt;br /&gt;
==== Finalizing Replacement of Immediate Mode and Future Plans ====&lt;br /&gt;
&lt;br /&gt;
The past couple of days have been spent actually replacing &amp;lt;tt&amp;gt;glBegin/glEnd&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;gpuBegin/gpuEnd&amp;lt;/tt&amp;gt;.  This is a rather tedious and time consuming process!  I'm making notes of patterns and common cases so I can factor them out.  My original plan was to have all of the &amp;lt;i&amp;gt;light doodles&amp;lt;/i&amp;gt; fixed up by the end of next week and then spend 3 weeks after that on the &amp;lt;i&amp;gt;heavy doodles&amp;lt;/i&amp;gt;.  The main focus during this time will be on geometry throughput.  The second half of the summer of code will then be spent on other state (starting with deprecated state first) and raising the level of abstraction.&lt;br /&gt;
&lt;br /&gt;
== Week 3 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Monday, June 4&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
==== Utility Drawing Functions ====&lt;br /&gt;
&lt;br /&gt;
==== Bug Bonanza ====&lt;br /&gt;
&lt;br /&gt;
==== Improved Mini-Axis ====&lt;br /&gt;
[[File:new-axis.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Tuesday, June 5&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
==== Replacing GLU and Other Basic Primitives ====&lt;br /&gt;
&lt;br /&gt;
==== Transform Manipulator Ported ====&lt;br /&gt;
&lt;br /&gt;
==== MatrixMode and TexEnv Policy ====&lt;br /&gt;
&lt;br /&gt;
=== Wednesday, June 6&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
==== Tooltip Text Bug ====&lt;br /&gt;
&lt;br /&gt;
==== AlphaFunc and BlendFunc Policy ====&lt;br /&gt;
&lt;br /&gt;
=== Thursday, June 7&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
==== Stricter Locking Policy and Logging ====&lt;br /&gt;
&lt;br /&gt;
=== Sunday, June 10&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
==== DrawArrays ====&lt;br /&gt;
&lt;br /&gt;
== Week 4 ==&lt;br /&gt;
&lt;br /&gt;
=== Monday, June 11&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
==== DrawElements ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Week 5 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Week 6 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Week 7 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Week 8 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Week 9 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Week 10 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Week 11 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Week 12 ==&lt;/div&gt;</summary>
		<author><name>wiki&gt;Jwilkins</name></author>
		
	</entry>
</feed>