From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Preparations

I used the Community Bonding period (22. April - 22. May), to familiarize myself with Cycles Image/Texture code and already implemented some of my deliverables.

Preparations

I started with code cleanup and refactor, to get familiar with these areas and to simplify code.

  • Move Texture definitions to /util. (9c916b01)
  • Refactor Image Texture limits. Instead of treating Fermi GPU limits as default, and overriding them for other devices, we now nicely set them for each platform. (557544f2)
  • Refactor Cycles ImageManager arrays, to reduce code duplication and make the ImageManager more easily extendable. (36d8a70b)
  • Some variable renaming to distinguish between 4 and 1 channel texture types. (3807bcb3, 9a1e1126)

Deliverables

Less memory usage - Tornado from Cosmos Laundromat

Single Channel Textures

I added support for single channel textures, both float and byte type. (4a4f043b, 3c85e1ca) These slots are used for single channel (black / white) textures, e.g. Smoke or Bumpmaps.

This cuts the memory usage for such cases by 3/4, as we only need a single channel. Smoke (density, flame and heat attributes) use this automatically, for image textures, make sure to save the texture as single channel (e.g. in Gimp via Image -> Mode -> Grayscale).

Bindless Textures

I implemented CUDA Texture Objects (also known as Bindless Textures) for newer nvidia GPUs (Geforce 6xx and above). (c9f1ed1e)

Benefits:

  • Single channel textures (float and byte) are now available on those GPUs as well. So the memory savings for single channel textures apply here too.
  • Instead of a maximum of 5 float4 and 145 byte4 image textures, we can now use an (in theory) unlimited amount of textures. The new maximum is set to 1024 (per type, so 4096 textures in total for float4, byte4, float and byte), but it can be further increased, simply by changing a variable. All the textures have to fit into VRAM though, so in practice I don't think we will reach the new limit soon.

Additional work (project related)

HDR support for OpenCL

  • Add support for float4 textures on OpenCL. This way OpenCL users can use HDR textures, without a loss of dynamic range. (76481eae)

Additional work (not project related)

CUDA Runtime compile

Some fixes and tweaks to the adaptive CUDA runtime compile feature. (734d1aec, 4422b3f9).

Benefits of this (compared to the full size kernels, that are e.g. bundled with Blender):

  • Less VRAM usage
  • Faster renders in most cases (some scenes might not see an improvement).

In order to use this, you have to:

  • Be on Linux.
  • Have the CUDA Toolkit installed.
  • Enable the feature in Blender via CTRL + ALT + D, set the Debug value inside the popup to 256. A new Debug panel appears inside of the Cycles Render Settings (Properties Editor). Check Adaptive Compile there.