World Wind Forums

Go Back   World Wind Forums > Support > Bug Reports

Bug Reports If you've found a bug in World Wind, discuss it here.

Reply
 
Thread Tools Display Modes
Old 06-08-2012, 12:39 AM   #1
cliveb
Junior Member
 
Join Date: Jun 2010
Posts: 11
cliveb is on a distinguished road
Default SkyGradientLayer and incorrect use of GPU cache

I believe both the SkyGradientLayer and the GpuResource cache are both deleting the same display list when the skybox is rebuilt.

In makeSkyDome() the old display list is explictly deleted if the cache key currently exists in the GPU resource cache. This is incorrect because the GPU resource cache will also delete the display list when the cache entry is bumped, explictly removed, or replaced (using a put() operation with the same key as an existing cache entry).

Since makeSkyDome() calls put() after creating a new display list, the GPU resource cache will delete the old value associated with the cache key, thus destroying the new skydome list if the OpenGL driver re-uses IDs immediately (this is what I think I'm seeing).

makeSkyDome() should never explictly delete a display list. It should either call remove() on the cache key before re-creating the display list, or it should allow the GPU resource cache to delete the old list when the new list is put into the cache. The latter is preferable.

Something like:

GL gl = dc.getGL();

- int[] dlResource = (int[]) dc.getGpuResourceCache().get(this.displa yListCacheKey);
- if (dlResource != null)
- gl.glDeleteLists(dlResource[0], dlResource[1]); // delete the old list

-dlResource = new int[] {gl.glGenLists(1), 1}; // the resource id and the number of ids in the group
+int[] dlResource = new int[] {gl.glGenLists(1), 1}; // the resource id and the number of ids in the group
int size = (8 * 4 + 6 * 8) * (slices + stacks + 1);
dc.getGpuResourceCache().put(this.displa yListCacheKey, dlResource,GpuResourceCache.DISPLAY_LIST S, size);


and remove the call to gl.glDeleteLists in the exception catch:


catch (Exception e)
{
- gl.glDeleteLists(dlResource[0], dlResource[1]); // delete the old list
dc.getGpuResourceCache().remove(this.dis playListCacheKey);
}
cliveb is offline   Reply With Quote
Old 06-08-2012, 07:36 PM   #2
cliveb
Junior Member
 
Join Date: Jun 2010
Posts: 11
cliveb is on a distinguished road
Default

It turns out that while the current SkyGradientLayer code is not strictly correct, it is not an issue for users of the standard GPU resource cache. My application has a custom GPU resource cache which does not behave exactly the same as the standard one.
cliveb is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:13 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.