Commit Graph

166 Commits

Author SHA1 Message Date
6ec599c682 Fix T53247: mixed CPU + GPU render wrong texture limits. 2017-11-03 20:32:29 +01:00
070a668d04 Code refactor: move more memory allocation logic into device API.
* Remove tex_* and pixels_* functions, replace by mem_*.
* Add MEM_TEXTURE and MEM_PIXELS as memory types recognized by devices.
* No longer create device_memory and call mem_* directly, always go
  through device_only_memory, device_vector and device_pixels.
2017-10-24 01:25:19 +02:00
7ad9333fad Code refactor: store device/interp/extension/type in each device_memory. 2017-10-24 01:03:59 +02:00
92ec4863c2 Code refactor: simplify image device memory allocation. 2017-10-21 20:58:28 +02:00
Sergey Sharybin
33249f6987 Fix T52533: Blender shuts down when rendering duplicated smoke domain 2017-09-04 13:14:54 +02:00
Mai Lavelle
06bf34227b Revert "Cycles: Fix crash changing image after recent OpenCL changes"
This reverts commit f2809ae0a671057caa1005e2b9cc91648c33dd1f.
2017-08-09 04:24:03 -04:00
Sergey Sharybin
f2809ae0a6 Cycles: Fix crash changing image after recent OpenCL changes
Steps to reproduce:
- Create shader Image texture -> Diffuse BSDF -> Output. Do NOT select image yet!
- Start viewport render.
- Select image from the ID browser of Image Texture node.

Thing is: with the memory manager we always need to inform device that memory
was freed.
2017-08-08 17:17:04 +02:00
Mai Lavelle
ec8ae4d5e9 Cycles: Pack kernel textures into buffers for OpenCL
Image textures were being packed into a single buffer for OpenCL, which
limited the amount of memory available for images to the size of one
buffer (usually 4gb on AMD hardware). By packing textures into multiple
buffers that limit is removed, while simultaneously reducing the number
of buffers that need to be passed to each kernel.

Benchmarks were within 2%.

Fixes T51554.

Differential Revision: https://developer.blender.org/D2745
2017-08-08 07:12:04 -04:00
Sergey Sharybin
580741b317 Cycles: Cleanup, space after keyword 2017-08-07 14:47:51 +02:00
2b132fc3f7 Fix T52135: Cycles should not keep generated/packed images in memory after render. 2017-07-20 23:47:05 +02:00
Stefan Werner
4bc6faf9c8 Fix T52107: Color management difference when using multiple and different GPUs together
This commit unifies the flattened texture slot names for bindless and regular CUDA textures. Texture indices are now identical across all CUDA architectures, where before Fermi used different indices, which lead to problems when rendering on multi-GPU setups mixing Fermi with newer hardware.
2017-07-20 10:03:27 +02:00
Sergey Sharybin
49bd3d3a1a Cycles: Fix crash loading single channel texture
Was  typo in recent isfinite check.
2017-05-18 15:49:03 +02:00
Sergey Sharybin
9a910443c4 Fix compilation error in Cycles
Was caused by recent fix with finite checks.

Fixes T51536.
2017-05-17 17:23:32 +02:00
Sergey Sharybin
1d49205b1a Fix T51529: Black boxes on a denoising render when using a .exr image as a environmental texture
It is caused by NaN value in the input texture. Now we check for all the pixels
having proper finite values.

Should also help here in the studio,
2017-05-17 15:29:47 +02:00
Sergey Sharybin
a523dfd2fd Fix T51412: Instant crash with texture plugged into the Displacement output
The issue was caused by unlimited textures commit, root of the issue is that
displacement code updates some of the image slots directly, so it needs to
ensure device vectors are all proper size.
2017-05-04 16:28:22 +02:00
Mai Lavelle
8f66d6826b Cycles: Fix crashes after recent image changes
Not sure if this is a proper fix, but was getting frequent crashes, so
committing this real quick just to make master sable again. Can be
reverted later if there's a better fix. The changes to images really
need a closer look...
2017-04-28 18:54:18 -04:00
Sergey Sharybin
f8d0b27d9d Cycles: Simplify code around maximum OpenCL info size allocation 2017-04-28 15:15:15 +02:00
Sergey Sharybin
407fd66d0a Cycles: Cleanup, de-duplicate image packing of various types 2017-04-28 15:08:54 +02:00
Sergey Sharybin
0f339a748e Cycles: Quick (real) fix for broken textures on OpenCL
Previous fix did not work for mixed textures. This one will over-allocate
information array, but it's better than not being able to render at all.

Some more cleanup and improvement is coming.
2017-04-28 14:56:22 +02:00
Sergey Sharybin
1ec59c8e06 Revert "Cycles: Fix image textures were completely broken since recent unlimited textures commit"
This reverts commit 8f4166ee495531fa38b676b0a5ef4c482e89f9a5.

The fix was not correct for cases when we've got float textures.
2017-04-28 14:48:40 +02:00
Sergey Sharybin
06034b147a Cycles: Cleanup, spelling and braces 2017-04-28 14:10:21 +02:00
Sergey Sharybin
8f4166ee49 Cycles: Fix image textures were completely broken since recent unlimited textures commit
The indexing was totally wrong in both image packing code and image sampling in kernel.

Fixes T51341: Cycles OpenCL corruption in todays buildbot
2017-04-28 14:04:27 +02:00
Sergey Sharybin
e3fc945fe2 Cycles: Cleanup, always use braces for blocks 2017-04-28 13:39:14 +02:00
Sergey Sharybin
4245ed360e Cycles: Cleanup, indentaiton and trailing whitespace and wrapping 2017-04-28 13:21:17 +02:00
Thomas Dinges
a00f54332d Cleanup: Some style and code tweaks to Image Code after changes.
Whitespace and order of switch/case etc. Let's try to stick to float4/byte4/half4/float/byte/half order as defined in "ImageDataType".
2017-04-27 11:11:08 +02:00
Stefan Werner
ec25060a05 Unlimited number of textures for Cycles
This patch allows for an unlimited number of textures in Cycles where the hardware allows. It replaces a number static arrays with dynamic arrays and changes the way the flat_slot indices are calculated. Eventually, I'd like to get to a point where there are only flat slots left and textures off all kinds are stored in a single array.

Note that the arrays in DeviceScene are changed from containing device_vector<T> objects to device_vector<T>* pointers. Ideally, I'd like to store objects, but dynamic resizing of a std:vector in pre-C++11 calls the copy constructor, which for a good reason is not implemented for device_vector. Once we require C++11 for Cycles builds, we can implement a move constructor for device_vector and store objects again.

The limits for CUDA Fermi hardware still apply.

Reviewers: tod_baudais, InsigMathK, dingto, #cycles

Reviewed By: dingto, #cycles

Subscribers: dingto, smellslikedonkey

Differential Revision: https://developer.blender.org/D2650
2017-04-27 09:35:22 +02:00
Sergey Sharybin
0579eaae1f Cycles: Make all #include statements relative to cycles source directory
The idea is to make include statements more explicit and obvious where the
file is coming from, additionally reducing chance of wrong header being
picked up.

For example, it was not obvious whether bvh.h was refferring to builder
or traversal, whenter node.h is a generic graph node or a shader node
and cases like that.

Surely this might look obvious for the active developers, but after some
time of not touching the code it becomes less obvious where file is coming
from.

This was briefly mentioned in T50824 and seems @brecht is fine with such
explicitness, but need to agree with all active developers before committing
this.

Please note that this patch is lacking changes related on GPU/OpenCL
support. This will be solved if/when we all agree this is a good idea to move
forward.

Reviewers: brecht, lukasstockner97, maiself, nirved, dingto, juicyfruit, swerner

Reviewed By: lukasstockner97, maiself, nirved, dingto

Subscribers: brecht

Differential Revision: https://developer.blender.org/D2586
2017-03-29 13:41:11 +02:00
Sergey Sharybin
ea3d7a7f58 Fix T50968: Cycles crashes when image datablock points to a directory
See more details about root of the cause there:

  https://github.com/OpenImageIO/oiio/pull/1640
2017-03-17 14:47:12 +01:00
Sergey Sharybin
810d7d4694 Cycles: Fix possibly uninitialized variable
Hopefully this was a reason of randomly disappearing textures in our renders.
2017-03-03 10:10:26 +01:00
Sergey Sharybin
ced20b74e5 Fix T50032: Wrong render result when same image is used with and without alpha 2017-01-25 14:02:59 +01:00
Sergey Sharybin
7ea2dedd59 Cycles: Pass extra array size argument to builtin image pixels functions
This is a way to avoid possible memory corruption when render threads works
in parallel with UI thread.

Not guarantees complete safe, but makes things easier to check anyway.
2016-11-29 11:03:11 +01:00
Sergey Sharybin
272412f9c0 Cycles: Implement texture size limit simplify option
Main intention is to give some quick way to control scene's memory
usage by clamping textures which are too big. This is really handy
on the early production stages when you first create really nice
looking hi-res textures and only when it all works and approved
start investing time on optimizing your scene.

This is a new option in Scene Simplify panel and it acts as
following: when texture size is bigger than the given value it'll
be scaled down by half for until it fits into given limit.

There are various possible improvements, such as:

- Use threaded scaling using our own task manager.

  This is actually one of the main reasons why image resize is
  manually-implemented instead of using OIIO's resize. Other
  reason here is that API seems limited to construct 3D texture
  description easily.

- Vectorization of uchar4/float4/half4 textures.

- Use something smarter than box filter.

  Was playing with some other filters, but not sure they are
  really better: they kind of causes more fuzzy edges.

Even with such a TODOs in the code the option is already quite
useful.

Reviewers: brecht

Reviewed By: brecht

Subscribers: jtheninja, Blendify, gregzaal, venomgfx

Differential Revision: https://developer.blender.org/D2362
2016-11-22 12:00:09 +01:00
Sergey Sharybin
b047d79871 Cycles: De-duplicate image loading functions
The code was templated already, so don't see big reason to have
3 versions of templated functions. It was giving some extra code
to maintain and in fact already had divergency for support of huge
image resolution (missing size_t cast in byte image loading).

There should be no changes visible by artists.
2016-11-14 14:03:17 +01:00
Sergey Sharybin
48997d2e40 Cycles: Cleanup, style 2016-10-24 12:26:12 +02:00
Hristo Gueorguiev
8905c5c874 Cycles: OpenCL 3d textures support.
Note that volume rendering is not supported yet, this is a step towards that.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2299
2016-10-22 23:49:29 +02:00
Sergey Sharybin
d84c55f0fa Fix T49417: Cycles crash - can't use 5 Gigabyte Tile EXR texture file
Was an integer overflow issue when calculating offsets.
2016-09-22 17:30:31 +02:00
Sergey Sharybin
0de69e56b4 Cycles: Implement threaded SVM nodes compilation
The title says it all actually. From tests with barber shop scene here
gives 2-3x speedup for shader compilation on my oldie i7 machine. The
gain is mainly due to textures metadata query from jpeg files (which
seems to requite de-compression before metadata can be read). But in
theory could give nice improvements for scenes with huge node trees
as well (i'm talking about node trees of complexity of fractal which
we had reports about in the past).

Reviewers: juicyfruit, dingto, lukasstockner97, brecht

Reviewed By: brecht

Subscribers: monio, Blendify

Differential Revision: https://developer.blender.org/D2215
2016-09-13 13:46:49 +02:00
Thomas Dinges
9b0f6fa7f7 Revert "Cycles: Use half storage for 16bit files (e.g. 16bit pngs) as well."
After discussion in IRC, 16bit int should not be converted to half, too much precision loss.
2016-08-15 01:01:43 +02:00
Thomas Dinges
a18b2ba643 Cycles: Use half storage for 16bit files (e.g. 16bit pngs) as well.
Note: This only works for textures loaded from disk via OIIO, not packed textures. That's still a ToDo.
2016-08-14 22:24:29 +02:00
Thomas Dinges
5c0a67b325 Cycles: Add single channel texture support for OpenCL.
This way OpenCL devices can also benefit from a smaller memory footprint, when using e.g. bumpmaps (greyscale, 1 channel).

Additional target for my GSoC 2016.
2016-08-14 20:21:08 +02:00
Thomas Dinges
5ac7ef873b Cycles: Change code order for Image Data Types.
Now we have the 4 component ones first (float4, byte4, half4) followed by the 1 component ones (float, byte, half).
Makes code a bit more consistent and also reduces code a bit when enabling half support on GPU in next commit.

This also exposed a typo in half CPU images for 3D textures, which wasn't used yet, but good to have that one fixed anyway.
2016-08-11 22:30:03 +02:00
2c9add965b Fix use of uninitialized variable in Cycles OpenCL image textures. 2016-07-02 21:54:49 +02:00
Thomas Dinges
5c249fac9a Fix Cycles OpenCL not taking Extend and Clip extension types into account.
(See T48720).
2016-07-01 23:48:31 +02:00
Thomas Dinges
2e553f77b8 Cleanup: Remove todo comment, this is fine as is. 2016-06-19 21:09:54 +02:00
Thomas Dinges
600f7df71b Fix return type in case of single channel half. 2016-06-19 17:38:39 +02:00
Thomas Dinges
6311a9ff23 Cycles: Support half and half4 textures.
This is an initial commit for half texture support in Cycles.
It adds the basic infrastructure inside of the ImageManager and support for these textures on CPU.

Supported:
* Half Float OpenEXR images (can be used for e.g HDRs or Normalmaps) now use 1/2 the memory, when loaded via disk (OIIO).

ToDo:
Various things like support for inbuilt half textures, GPU... will come later, step by step.

Part of my GSoC 2016.
2016-06-19 17:31:16 +02:00
Thomas Dinges
dc07a5561f Cleanup: Further tweaks for consistency and simplifications.
Now I can start adding half float without adding even bigger mess to all these functions. ;)
2016-05-27 23:35:29 +02:00
Thomas Dinges
2f457b7649 Cleanup: Simplify and de-duplicate assignements in the ImageManager constructor. 2016-05-27 23:12:13 +02:00
Thomas Dinges
2ee063868d Cleanup: Shorten texture variables, tex and image was kinda redundant.
Also make prefix consistent, so it starts with either TEX_NUM or TEX_START, followed by texture type and architecture.
2016-05-27 22:58:33 +02:00
Sergey Sharybin
84c7f427f2 Cycles: Yet another fix for textures limit 2016-05-25 12:49:02 +02:00
Sergey Sharybin
18b418e8e0 Cycles: Fix wrong cuda textures limits 2016-05-24 17:02:19 +02:00
Sergey Sharybin
dc5a6a0aed Cycles: Fix wrong render results when using multiple OpenCL devices 2016-05-24 16:57:57 +02:00
Thomas Dinges
a2669b0cbf Cleanup: Deduplicate image loading functions using templates. 2016-05-22 23:24:26 +02:00
Thomas Dinges
84a9d171da Cleanup: Use short condition style. 2016-05-22 22:47:37 +02:00
Thomas Dinges
c9f1ed1e4c Cycles: Add support for bindless textures.
This adds support for CUDA Texture objects (also known as Bindless textures) for Kepler GPUs (Geforce 6xx and above).
This is used for all 2D/3D textures, data still uses arrays as before.

User benefits:
* No more limits of image textures on Kepler.
 We had 5 float4 and 145 byte4 slots there before, now we have 1024 float4 and 1024 byte4.
 This can be extended further if we need to (just change the define).

* Single channel textures slots (byte and float) are now supported on Kepler as well (1024 slots for each type).

ToDo / Issues:
* 3D textures don't work yet, at least don't show up during render. I have no idea whats wrong yet.
* Dynamically allocate bindless_mapping array?

I hope Fermi still works fine, but that should be tested on a Fermi card before pushing to master.

Part of my GSoC 2016.

Reviewers: sergey, #cycles, brecht

Subscribers: swerner, jtheninja, brecht, sergey

Differential Revision: https://developer.blender.org/D1999
2016-05-19 13:14:37 +02:00
Sergey Sharybin
22d53e558d Cycles: Cleanup after recent refactor
Wrong indentation, wrong spacing.
2016-05-16 10:55:50 +02:00
Thomas Dinges
3c85e1ca1a Cycles: Add support for single channel byte textures.
This way, we also save 3/4th of memory for single channel byte textures (e.g. Bump Maps).

Note: In order for this to work, the texture *must* have 1 channel only.
In Gimp you can e.g. do that via the menu: Image -> Mode -> Grayscale
2016-05-12 14:51:42 +02:00
Thomas Dinges
8de3303a03 Cleanup: Fix typo. 2016-05-12 02:11:36 +02:00
Thomas Dinges
16ce1b78b0 Cleanup: Remove outdated comment and add new one about slot IDs. 2016-05-11 22:25:48 +02:00
Thomas Dinges
4a4f043bc4 Cycles: Add support for single channel float textures on CPU.
Until now, single channel textures were packed into a float4, wasting 3 floats per pixel. Memory usage of such textures is now reduced by 3/4.
Voxel Attributes such as density, flame and heat benefit from this, but also Bumpmaps with one channel.
This commit also includes some cleanup and code deduplication for image loading.

Example Smoke render from Cosmos Laundromat: http://www.pasteall.org/pic/show.php?id=102972
Memory here went down from ~600MB to ~300MB.

Reviewers: #cycles, brecht

Differential Revision: https://developer.blender.org/D1981
2016-05-11 21:58:34 +02:00
Thomas Dinges
76481eaeff Cycles: Add support for float4 textures on OpenCL.
Title says it all, this adds OpenCL float4 texture support.

There is a bug in the code still, I get a "Out of ressources error" on nvidia hardware here, not sure whats wrong yet.
Will investigate further, but maybe someone else has an idea. :)

Reviewers: #cycles, brecht

Subscribers: brecht, candreacchio

Differential Revision: https://developer.blender.org/D1983
2016-05-10 02:53:50 +02:00
Thomas Dinges
9a1e11260c Cleanup: More byte -> byte4 renaming for consistency. 2016-05-09 02:22:01 +02:00
98e2135a2d Fix T48380: fix for recent image manager code cleanup. 2016-05-08 21:41:25 +02:00
dfe9aa25c3 Code cleanup: tweaks to image manager code found while looking into previous bug. 2016-05-08 20:20:53 +02:00
e362b04c43 Fix T48377: Cycles crash removing float image texture node during viewport render. 2016-05-08 19:48:22 +02:00
Thomas Dinges
3807bcb3a8 Cleanup: Rename texture slots to float4 and byte, to distinguish from future float (single channel) and half_float slots.
Should be no functional changes, tested CPU and CUDA.
2016-05-06 14:37:35 +02:00
Thomas Dinges
36d8a70b00 Code refactor: Change Cycles ImageManager arrays.
This commit simplifies the code for the image arrays. Instead of having 2 arrays for float and byte textures,
we now use an array here. This simplifies the code (avoids code duplication), and makes it possible to easily extend it
with float1 and half-float types in the future.

Only tested with CPU yet, plus some cleanup / code de-duplication is still possible here.

Reviewers: #cycles, sergey

Reviewed By: #cycles, sergey

Subscribers: jesterking, sergey

Differential Revision: https://developer.blender.org/D1969
2016-05-06 13:20:09 +02:00
Thomas Dinges
557544f2c4 Cycles: 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.

* Due to setting values for all platforms,
we don't have to offset the slot id for OpenCL anymore,
as the image manager wont add float images for OpenCL now.

* Bugfix: TEX_NUM_FLOAT_IMAGES was always 5, even for CPU,
so the code in svm_image.h clamped float textures with alpha on CPU after the 5th slot.

Reviewers: #cycles, brecht

Reviewed By: #cycles, brecht

Subscribers: brecht

Differential Revision: https://developer.blender.org/D1925
2016-04-16 20:49:59 +02:00
Thomas Dinges
9c916b0172 Cleanup: Move texture definitions to util, to avoid bad level include. 2016-04-15 23:02:44 +02:00
Sergey Sharybin
3aa74828ab Cycles: Cleanup, indentation and braces 2016-02-03 15:00:55 +01:00
Sergey Sharybin
34e7285b0a Cycles: Gracefully handle out-of-memory happening in device vector
Currently only image loading benefits of this and will give magenta color
when image manager detects it's running out of memory.

This isn't ideal solution and can't handle all cases. For example, OOM
killer might kill process before it realized it run out of memory, but
in other cases this could prevent some crashes.

Reviewers: juicyfruit, dingto

Differential Revision: https://developer.blender.org/D1502
2015-10-11 19:41:59 +05:00
Sergey Sharybin
8a1afc28db Cycles: Increase number of textures allowed for OpenCL render
Currently OpenCL devices are packing images into a single texture,
which means technically number of textures is not limited here.

Now OpenCL will use same number of textures as CPU. If we want
to bump number of textures further, this values are to be modified
in sync.

NOTE OpenCL still does not support float textures.

Original patch from a guy called bliblubli in the tracker with
some own modifications.

Reviewers: brecht, dingto, sergey

Differential Revision: https://developer.blender.org/D1530
2015-10-11 18:22:01 +05:00
Sergey Sharybin
3fba620858 Cycles: Prepare for more image extension types support
Basically just replace boolean periodic flag with extension type enum in the
device API.
2015-07-28 14:14:24 +02:00
Sergey Sharybin
f2c54df625 Cycles: Expose image image extension mapping to the image manager
Currently only two mappings are supported by API, which is Repeat (old behavior)
and new Clip behavior. Internally this extension is being converted to periodic
flag which was already supported but wasn't exposed.

There's no support for OpenCL yet because of the way how we pack images into a
single texture.

Those settings are not exposed to UI or anywhere else and there should be no
functional changes so far.
2015-07-21 21:58:19 +02:00
Sergey Sharybin
f0f481031c Fix T44616: Cycles crashes loading 42k by 21k textures
Simple integer overflow issue.

TODO(sergey): Check on CPU cubic sampling, it might also need size_t.
2015-05-12 18:48:55 +05:00
Sergey Sharybin
cd44449578 Cycles: Synchronize images after building mesh BVH
This way memory overhead caused by the BVH building is not so visible and peak
memory usage will be reduced.

Implementing this idea is not so straightforward actually, because we need to
synchronize images used for true displacement before meshes. Detecting whether
image is used for true displacement is not so striaghtforward, so for now all
all displacement types will synchronize images used for them.

Such change brings memory usage from 4.1G to 4.0G with the 01_01_01_D scene
from gooseberry. With 01_01_01_G scene it's 7.6G vs. 6.8G (before and after
the patch).

Reviewers: campbellbarton, juicyfruit, brecht

Subscribers: eyecandy

Differential Revision: https://developer.blender.org/D1217
2015-04-20 17:29:51 +05:00
Sergey Sharybin
585dd26120 Cycles: Code cleanup, prepare for strict C++ flags 2015-03-27 18:23:31 +05:00
Thomas Dinges
ee36e75b85 Cleanup: Fix Cycles Apache header.
This was already mixed a bit, but the dot belongs there.
2014-12-25 02:50:24 +01:00
Sergey Sharybin
502f6d538d Fix T41920: Changing Use Alpha settings doesn't refresh viewport properly 2014-10-03 11:27:05 +02:00
Sergey Sharybin
4ff4bfcb9c Cycles: DPX is saved in the sRGB space and need to be converted to linear
This at least applies to DPX saved from within blender, which is 1st prio
to support working reliably.
2014-08-22 23:53:29 +06:00
Sergey Sharybin
7c052a8877 Cycles: Fix wrong image update tagging, float vs. byte images 2014-08-22 17:36:00 +06:00
Sergey Sharybin
9a45c9dadf Fix T41109: Reloading image that has been modified outside Blender does not update image in Image Texture nodes 2014-07-18 19:37:32 +06:00
88d8358f91 Fix T40703: cycles viewport smoke not updating when changing frame. 2014-06-21 22:21:04 +02:00
177e1ec9b2 Fix T40714: cycles not loading CMYK jpeg files correctly. 2014-06-21 22:21:03 +02:00
30c42d7353 Fix cycles CUDA error when trying to use >= 100 image textures. 2014-06-09 12:40:13 +02:00
6271c72caf Fix T39764: cycles not rendering EXR image textures with 5 channels (RGBA + Z). 2014-05-19 16:25:17 +02:00
c6d9b11b70 Fix T40195: cycles smoke + persistent images animation render not working correct. 2014-05-19 14:45:52 +02:00
Thomas Dinges
c08c931fb6 Cycles / CUDA: Increase maximum image textures on GPU.
Instead of 95, we can use 145 images now. This only affects Kepler and above (sm30, sm_35 and sm_50).

This can be increased further if needed, but let's first test if this does not come with a performance impact.

Originally developed during my GSoC 2013.
2014-05-11 03:38:39 +02:00
Carlo Andreacchio
8b8d5a441f Cycles: add support for "Use Alpha" option on image datablocks.
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D486
2014-05-07 16:43:50 +02:00
Sergey Sharybin
a9b82244de Code cleanup: fixes for function prototypes 2014-03-31 17:35:56 +06:00
a2e4ebd36a Cycles code internals: add CPU kernel support for 3D image textures. 2014-03-29 13:03:48 +01:00
Thomas Dinges
36279afbd3 Cycles: Compile fix and some cleanup for the Image interpolation commit. 2014-03-08 00:23:45 +01:00
Martijn Berger
dd2dca2f7e Add support for multiple interpolation modes on cycles image textures
All textures are sampled bi-linear currently with the exception of OSL there texture sampling is fixed and set to smart bi-cubic.

This patch adds user control to this setting.

Added:
- bits to DNA / RNA in the form of an enum for supporting multiple interpolations types
- changes to the image texture node drawing code ( add enum)
- to ImageManager (this needs to know to allocate second texture when interpolation type is different)
- to node compiler (pass on interpolation type)
- to device tex_alloc this also needs to get the concept of multiple interpolation types
- implementation for doing non interpolated lookup for cuda and cpu
- implementation where we pass this along to osl ( this makes OSL also do linear untill I add smartcubic to the interface / DNA/ RNA)

Reviewers: brecht, dingto

Reviewed By: brecht

CC: dingto, venomgfx

Differential Revision: https://developer.blender.org/D317
2014-03-07 23:16:33 +01:00
Thomas Dinges
1bebdc9ad0 Fix T37264: cycles CPU render had limited number of float images, bumped to 1024.
GPU is still limited to 5, but there's no good reason for the CPU to be limited.
2013-12-14 15:07:46 +01:00
Brecht Van Lommel
0933c6093e Fix #36611: cycles issue loading png file with 2 channels. 2013-08-30 17:01:44 +00:00
Brecht Van Lommel
978080707c Fix part of #36594: 16 bit tiff not loading with correct color space in cycles. 2013-08-29 20:53:20 +00:00
Brecht Van Lommel
b9ce231060 Cycles: relicense GNU GPL source code to Apache version 2.0.
More information in this post:
http://code.blender.org/

Thanks to all contributes for giving their permission!
2013-08-18 14:16:15 +00:00
Brecht Van Lommel
b94993941f Fix #34252: cycles rendering 16bit PNG with too light colors. 2013-02-14 21:40:29 +00:00
Sergey Sharybin
452a52575c Cycles material preview: fix for generated/packed/movie files
Issue was caused by cycles trying to find builtin images in a main
database and in case of preview render images are not in database,
they're just referenced by shader node tree.

Now builtin images in cycles have got void* pointer to store data
needed to load builtin images.

In case ob blender session, this pointer will store pointer from
PointerRNA for image datablock and used later to construct Image
class based on this pointer.

This also saves database lookup for final render which is nice :)

Reviewed by Brecht.
2013-01-30 13:42:12 +00:00
Sergey Sharybin
7a90af7b5a Packed and generated images support for Cycles
This commit adds support of packed and generated images
for Cycles when using SVM backend. Movies are still not
supported. This changes also doesn't touch OSL which is
much less trivial to adopt for any images which are not
saved to disk.

Implementation details:

- When adding images to Image Manager is now possible
  to mark image as builtin. Builtin images will bypass
  OIIO loader and will use special loading callbacks.

- Callbacks are set by Blender Session and they're
  using C++ RNA interface to obtain needed data (pixels,
  dimensions, is_float flag).

- Image Manager assumes file path is used as reference
  to a builtin images, but in fact currently image
  datablock name is used for reference. This makes it
  easy to find an image in BlendData database.

- Added some extra properties to Image RNA:
  * channels, which denotes actual number of channels
    in ImBuf. This is needed to treat image's pixels
    correct (before it wasn't possible because API
    used internal number of channels for pixels which
    is in fact doesn't correlate with image depth)
  * is_float, which is truth if image is stored in
    float buffer of ImBuf.

- Implemented string lookup for C++ RNA collections
  for cases there's no manual lookup function.

OSL is not supported because it used own image loading
and filtering routines and there's seems to be no API
to feed pre-loaded pixels directly to the library.

Think we'll either need to add some API to support
such kind of feeding or consider OSL does not have
support of packed images at all.

Movies are not supported at this moment because of lack
of RNA API to load specified frame. It's not difficult
to solve, just need to consider what to best here:
* Either write some general python interface for ImBuf
  and use it via C++ API, or
* Write a PY API function which will return pixels for
  given frame, or
* Use bad-level BKE_* call

Anyway, small steps, further improvements later.

Reviewed by Brecht, thanks!
2013-01-12 10:59:13 +00:00