Commit Graph

40 Commits

Author SHA1 Message Date
Campbell Barton
1f091fd234 add missing gpl headers 2013-07-02 09:47:22 +00:00
Mitchell Stokes
ef0473994b BGE: Some as of yet unmerged work I did in the Swiss branch. These changes include:
* Cleaning up the conversion code to avoid a per-face material conversion. Materials are now stored in buckets and only converted if a new material is found. This replaces some of Campbell's earlier work on the subject. His work wasn't as thorough, but it was much safer for a release.
  * Shaders are only compiled for LibLoaded materials once. Before they could be compiled twice, which could really slow things down.
  * Refactoring the rasterizer code to use a strategy design pattern to handle different geometry rendering methods such as immediate mode, vertex arrays and vertex buffer objects. VBOs are added, but they will be disabled in a following commit since they are still slower than vertex arrays with display lists. However, VBOs are still useful for mobile, so it's good to keep them around.
  * Better multi-uv support. The BGE should now be able to handle more than two UV layers, which should help it better match the viewport.
2012-12-18 20:56:25 +00:00
Sergey Sharybin
5c6f6301b0 Image thread safe improvements
This commit makes BKE_image_acquire_ibuf referencing result, which means once
some area requested for image buffer, it'll be guaranteed this buffer wouldn't
be freed by image signal.

To de-reference buffer BKE_image_release_ibuf should now always be used.

To make referencing working correct we can not rely on result of
image_get_ibuf_threadsafe called outside from thread lock. This is so because
we need to guarantee getting image buffer from list of loaded buffers and it's
referencing happens atomic. Without lock here it is possible that between call
of image_get_ibuf_threadsafe and referencing the buffer IMA_SIGNAL_FREE would
be called. Image signal handling too is blocking now to prevent such a
situation.

Threads are locking by spinlock, which are faster than mutexes. There were some
slowdown reports in the past about render slowdown when using OSX on Xeon CPU.
It shouldn't happen with spin locks, but more tests on different hardware would
be really welcome. So far can not see speed regressions on own computers.

This commit also removes BKE_image_get_ibuf, because it was not so intuitive
when get_ibuf and acquire_ibuf should be used.

Thanks to Ton and Brecht for discussion/review :)
2012-11-15 15:59:58 +00:00
Campbell Barton
ddc2dbc2a4 style cleanup 2012-10-22 08:15:51 +00:00
Campbell Barton
d599b643b7 style cleanup: bge, switch statements mostly.
also left bmesh decimator on in previous commit.
2012-10-21 07:58:38 +00:00
Campbell Barton
2fb8292005 style cleanup 2012-09-16 04:58:18 +00:00
Campbell Barton
9ecc6fdcc7 style cleanup 2012-08-23 07:10:48 +00:00
Mitchell Stokes
a6d1b955ab Moving more duplicate code from GPU_create_gl_tex_compressed() and BL_Texture::InitGLCompressedTex() into GPU_Upload_dxt_texture(). This reduces code duplication and ensures that both paths are using the same settings. 2012-08-18 03:32:28 +00:00
Brecht Van Lommel
6d8fb7c0e7 Tweak to commit related to non-power-of-two textures, some cards claim to
support this but actually don't, so use the function that checks for that.
2012-07-31 15:05:14 +00:00
Mitchell Stokes
7755873771 Fix for [#27484] "Run-time command line options don't work in Multi-texture mode." reported by Josiah Lane (solarlune). The -g nomipmap = 1 option only changed the mipmapping option for bf_gpu, which BL_Texture wasn't checking. 2012-07-29 05:59:03 +00:00
Mitchell Stokes
831ae18622 Scaling non-power-of-two (NPOT) textures to powers of two is really time consuming and not necessary on graphics cards that can support NPOT textures. So, if the graphics card has NPOT texture support, don't bother scaling. If this patch causes issues, it can always be reverted and applied to Swiss instead. 2012-07-10 19:23:57 +00:00
Mitchell Stokes
436f02ab9c Finally committing support for compressed textures on the GPU (DDS+DXT). This patch started out as a patch by me, then cleaned up by Kupoman during his work on Cucumber.
One important thing to keep in mind when using this feature is that you'll need to flip your textures vertically (both the GIMP and Photoshop DDS tools I've seen have support for this on export). This is a quirk in using a texture format originally made for DirectX/DirectDraw, and flipping the compressed data is a real headache. Another quick fix for this issue is to change the Y value for the Size in the Mapping panel in the Texture properties to -1 (default is 1).
2012-06-30 04:34:34 +00:00
Campbell Barton
07065b27b8 style cleanup 2012-03-28 05:03:24 +00:00
Campbell Barton
b8a71efeba style cleanup: follow style guide for/with/if spacing 2012-03-24 07:52:14 +00:00
Campbell Barton
2c43f99c0a formatting edits, missed these last commit. 2011-12-30 11:49:58 +00:00
Campbell Barton
2253b63c97 static functions for getting power of 2 values were being copied about too much, add to the BLI_math api.
- is_power_of_2_i
- power_of_2_min_i
- power_of_2_max_i
2011-12-16 09:25:07 +00:00
Mitchell Stokes
a3e296fc40 Committing patch #25676 Anisotropic filtering in viewport and BGE by me.
This patch adds anisotropic filtering of textures in the viewport and the BGE. The quality of the filtering is adjustable in the user preferences under System. For more information on anisotropic filtering:
http://en.wikipedia.org/wiki/Anisotropic_filtering

One current limitation of this setup (having the option a user preference) is it makes runtimes more troublesome. Runtimes don't have user preferences set, so for now the blender player defaults to 2x AF. Options will be added later to change this value (probably a command line option).
2011-06-15 18:59:22 +00:00
Nathan Letwory
bb6e7faf72 doxygen: gameengine/Ketsji tagged. 2011-02-25 13:35:59 +00:00
Mitchell Stokes
32eba0898b Reverting revision 33120, which added vram monitoring. The method used had some problems (especially in the freeing function). I will research an alternative solution and submit it to the tracker. 2010-11-24 06:27:07 +00:00
Mitchell Stokes
1bb98b4194 Adding monitoring for (approximate) VRAM used by textures. The information is currently only used in the profiling data of the BGE.
Here is a image of it in action:
http://www.pasteall.org/pic/show.php?id=6351

What it monitors:
  * VRAM used by textures created via bf_gpu and BL_Textures

What it does not monitor:
  * VRAM used by the Blender ui
  * VRAM used by 2d filters
  * VRAM allocated by the user via KX_Scene.pre_draw and KX_Scene.pre_draw
2010-11-17 05:28:25 +00:00
Campbell Barton
8268a4be71 most unused arg warnings corrected.
- removed deprecated bitmap arg from IMB_allocImBuf (plugins will need updating).
- mostly tagged UNUSED() since some of these functions look like they may need to have the arguments used later.
2010-10-16 14:32:17 +00:00
Campbell Barton
cdec2b3d15 BGE Python API
Use 'const char *' rather then the C++ 'STR_String' type for the attribute identifier of python attributes.

Each attribute and method access from python was allocating and freeing the string.
A simple test with getting an attribute a loop shows this speeds up attribute lookups a bit over 2x.
2009-02-19 13:42:07 +00:00
Brecht Van Lommel
908337bee1 Game Engine: alpha blending and sorting
=======================================

Alpha blending + sorting was revised, to fix bugs and get it
to work more predictable.

* A new per texture face "Sort" setting defines if the face
  is alpha sorted or not, instead of abusing the "ZTransp"
  setting as it did before.
* Existing files are converted to hopefully match the old
  behavior as much as possible with a version patch.
* On new meshes the Sort flag is disabled by the default, to
  avoid unexpected and hard to find slowdowns.
* Alpha sorting for faces was incredibly slow. Sorting faces
  in a mesh with 600 faces lowered the framerate from 200 to
  70 fps in my test.. the sorting there case goes about 15x
  faster now, but it is still advised to use Clip Alpha if
  possible instead of regular Alpha.
* There still various limitations in the alpha sorting code,
  I've added some comments to the code about this.

Some docs at the bottom of the page:
http://www.blender.org/development/current-projects/changes-since-246/realtime-glsl-materials/

Merged some fixes from the apricot branch, most important
change is that  tangents are now exactly the same as the rest
of Blender, instead of being computed in the game engine with a
different algorithm.

Also, the subversion was bumped to 1.
2008-07-29 15:48:31 +00:00
Brecht Van Lommel
272a91f754 Merge of apricot branch game engine changes into trunk, excluding GLSL.
GLEW
====

Added the GLEW opengl extension library into extern/, always compiled
into Blender now. This is much nicer than doing this kind of extension
management manually, and will be used in the game engine, for GLSL, and
other opengl extensions.

* According to the GLEW website it works on Windows, Linux, Mac OS X,
  FreeBSD, Irix, and Solaris. There might still be platform specific
  issues due to this commit, so let me know and I'll look into it.
* This means also that all extensions will now always be compiled in,
  regardless of the glext.h on the platform where compilation happens.

Game Engine
===========

Refactoring of the use of opengl extensions and other drawing code
in the game engine, and cleaning up some hacks related to GLSL
integration. These changes will be merged into trunk too after this.

The game engine graphics demos & apricot level survived my tests,
but this could use some good testing of course.

For users: please test with the options "Generate Display Lists" and
"Vertex Arrays" enabled, these should be the fastest and are supposed
to be "unreliable", but if that's the case that's probably due to bugs
that can be fixed.

* The game engine now also uses GLEW for extensions, replacing the
  custom opengl extensions code that was there. Removes a lot of
  #ifdef's, but the runtime checks stay of course.
* Removed the WITHOUT_GLEXT environment variable. This was added to
  work around a specific bug and only disabled multitexturing anyway.
  It might also have caused a slowdown since it was retrieving the
  environment variable for every vertex in immediate mode (bug #13680).

* Refactored the code to allow drawing skinned meshes with vertex
  arrays too, removing some specific immediate mode drawing functions
  for this that only did extra normal calculation. Now it always splits
  vertices of flat faces instead.
* Refactored normal recalculation with some minor optimizations,
  required for the above change.
* Removed some outdated code behind the __NLA_OLDDEFORM #ifdef.
* Fixed various bugs in setting of multitexture coordinates and vertex
  attributes for vertex arrays. These were not being enabled/disabled
  correct according to the opengl spec, leading to crashes. Also tangent
  attributes used an immediate mode call for vertex arrays, which can't
  work.
* Fixed use of uninitialized variable in RAS_TexVert.
* Exporting skinned meshes was doing O(n^2) lookups for vertices and
  deform weights, now uses same trick as regular meshes.
2008-06-17 10:27:34 +00:00
Kent Mein
867e12836b This patch spawns from this game engine issue:
[#7113] GE crash pressing as soon as P on 64 bit


Note:         glext.h has been removed from the source
        If you get errors compiling with it you have 2 options
                download/install 	glext.h        (preferred method)
                or set WITH_BF_GLEXT=false
        If your a user and having problems with game engine try
                setting the env var: WITHOUT_GLEXT 1

Kent
2008-04-16 17:40:59 +00:00
Kent Mein
b73ba9c181 This commit reverts the #include <mesa/glu.h>
stuff used for peach to the standard <GL/glu.h>
the mesa stuff was needed for the machines for peach but its
not the stanard location of the headers, now that its not
needed were switching it back.

Kent
2008-04-02 15:03:03 +00:00
Kent Mein
7b2e348d4f This is a modified version of this patch:
[#7660] Solaris 10 x86 support (Makefiles)

Hopefully it will not mess up anything for anyone else.  I removed
some hardcoded static libs and made NAN_*_LIB definitions so they could be 
overridden, to allow greater flexability.

Let me know if there are any problems/questions.

Kent
2007-12-05 16:58:52 +00:00
Charlie Carley
f56fca448a Added a guard to prevent more than one texture to be generated per image. 2007-03-08 03:00:33 +00:00
Charlie Carley
3947f9b885 1). Fix for cube maps in the player.
ImBuf pointer was being overridden causing the ibuf->rect to be zero.

2). Added vertex attributes for tangents in in vertex arrays.
This, probably needs the extensions enabled (glEnableVertexAttribArrayARB, glDisableVertexAttribArrayARB), but am a little
weary about enabling them right now.
2007-02-01 02:10:38 +00:00
Charlie Carley
56a4f529fd Two errors caused by previous commit;
One related to extension handling on Linux, the other is a fix for compiling with Irix and STL
2007-01-23 13:25:20 +00:00
Charlie Carley
c4202fbd43 First commit! Small bug fix for cube map crashing in the player.
Cube maps don't display correctly in the player at the moment too.. something to do with regenerating/loading the images
2007-01-13 08:30:08 +00:00
Ton Roosendaal
5ffa4dd55a Warning fixes for previous Image commit, also fixed verse_image.c 2006-12-20 18:29:23 +00:00
Erwin Coumans
4b4029afaf patch from Charlie, bug fix (3795) , improves CubeMaps in game engine 2006-05-11 20:41:28 +00:00
Erwin Coumans
6839ec6640 applied Charlies patch for game engine graphics. display list support, and bumpmapping shader improvements. 2006-04-02 21:04:20 +00:00
Erwin Coumans
e4790aef46 Improved OpenGL Shader Language support for game engine. The python interface is much simplified. Drawback is that scripts need to be updated next release. Testfiles:
http://www.continuousphysics.com/ftp/pub/test/index.php?dir=blender/&file=demos-2.42.zip

patch by Charlie Carley (snailrose @ elysiun.com)
2006-02-13 05:45:32 +00:00
Ton Roosendaal
4270cc96bc Orange: replaced obsolete IMB_rectop() with IMB_rectcpy() in game engine. 2006-01-28 16:43:00 +00:00
Jean-Luc Peurière
77c4eef90b after much suffering, got GE build and work almost cleanly on Os X
(with make, need to confirm with scons)

after cleaning the changes are in fact minimal, but the situation
is still quite a bit hackish.

Game engine coders, there is also quite a number of warnings that
need to be fixed.

current situation is that everything seems to work, but GLSL shaders
spew a lot of errors on console and blender may crash on exit when
a GLSL shader was used. ARB stuff works fine.
2006-01-16 22:27:30 +00:00
Erwin Coumans
a9e64286a9 overlooked IMB_imbuf.h was already included inside an extern "C" section. 2006-01-12 01:37:33 +00:00
Erwin Coumans
b9d99662d2 uncommented include "IMB_imbuf.h", it is needed? 2006-01-12 01:15:09 +00:00
Erwin Coumans
c94455c14d more linux game engine work. hopefully works now! 2006-01-08 09:37:15 +00:00