70 for (
size_t i = 0; i <
passes.size(); i++)
88 for (
size_t i = 0; i <
passes.size(); i++)
89 offset +=
passes[i].components;
135 map_neighbor_copied(false),
170 int type,
float exposure,
int sample,
int components,
float *pixels)
177 float alpha_scale = 1.0f /
sample;
183 scale *= exposure * exposure * (
sample - 1);
221 if (components == 1) {
222 for (
int i = 0; i <
size; i++, in += pass_stride, pixels++) {
223 pixels[0] = in[0] * scale;
226 else if (components == 3) {
227 for (
int i = 0; i <
size; i++, in += pass_stride, pixels += 3) {
228 pixels[0] = in[0] * scale;
229 pixels[1] = in[1] * scale;
230 pixels[2] = in[2] * scale;
233 else if (components == 4) {
238 for (
int i = 0; i <
size; i++, in += pass_stride, in_combined += pass_stride, pixels += 4) {
244 pixels[0] = val.
x * scale;
245 pixels[1] = val.
y * scale;
246 pixels[2] = val.
z * scale;
247 pixels[3] =
saturate(in_combined[3] * alpha_scale);
258 const string &name,
float exposure,
int sample,
int components,
float *pixels)
264 float *sample_count =
NULL;
265 if (name ==
"Combined") {
266 int sample_offset = 0;
287 if (pass.
name != name) {
297 float scale = (pass.
filter) ? 1.0f / (
float)
sample : 1.0f;
298 float scale_exposure = (pass.
exposure) ? scale * exposure : scale;
305 for (
int i = 0; i <
size; i++, pixels++) {
309 else if (components == 1) {
314 for (
int i = 0; i <
size; i++, in += pass_stride, pixels++) {
316 pixels[0] = (f == 0.0f) ? 1e10f : f * scale_exposure;
320 for (
int i = 0; i <
size; i++, in += pass_stride, pixels++) {
322 pixels[0] =
saturate(f * scale_exposure);
325 #ifdef WITH_CYCLES_DEBUG
326 else if (
type == PASS_BVH_TRAVERSED_NODES ||
type == PASS_BVH_TRAVERSED_INSTANCES ||
327 type == PASS_BVH_INTERSECTIONS ||
type == PASS_RAY_BOUNCES) {
328 for (
int i = 0; i <
size; i++, in += pass_stride, pixels++) {
330 pixels[0] = f * scale;
335 for (
int i = 0; i <
size; i++, in += pass_stride, pixels++) {
337 pixels[0] = f * scale_exposure;
341 else if (components == 3) {
346 for (
int i = 0; i <
size; i++, in += pass_stride, pixels += 3) {
347 float4 f =
make_float4(in[0], in[1], in[2], in[3]);
348 float invw = (f.w > 0.0f) ? 1.0f / f.w : 1.0f;
350 pixels[0] = f.x * invw;
351 pixels[1] = f.y * invw;
352 pixels[2] = f.z * invw;
365 float *in_divide =
buffer.
data() + pass_offset;
367 for (
int i = 0; i <
size; i++, in += pass_stride, in_divide += pass_stride, pixels += 3) {
380 for (
int i = 0; i <
size; i++, in += pass_stride, pixels += 3) {
383 pixels[0] = f.
x * scale_exposure;
384 pixels[1] = f.
y * scale_exposure;
385 pixels[2] = f.
z * scale_exposure;
389 else if (components == 4) {
394 for (
int i = 0; i <
size; i++, in += pass_stride, pixels += 4) {
395 float4 f =
make_float4(in[0], in[1], in[2], in[3]);
396 float invw = (f.w > 0.0f) ? 1.0f / f.w : 1.0f;
398 pixels[0] = f.x * invw;
399 pixels[1] = f.y * invw;
400 pixels[2] = f.z * invw;
414 float *in_weight =
buffer.
data() + pass_offset;
416 for (
int i = 0; i <
size; i++, in += pass_stride, in_weight += pass_stride, pixels += 4) {
417 float4 f =
make_float4(in[0], in[1], in[2], in[3]);
418 float w = in_weight[0];
419 float invw = (
w > 0.0f) ? 1.0f /
w : 0.0f;
421 pixels[0] = f.x * invw;
422 pixels[1] = f.y * invw;
423 pixels[2] = f.z * invw;
424 pixels[3] = f.w * invw;
428 for (
int i = 0; i <
size; i++, in += pass_stride, pixels += 4) {
429 float4 f =
make_float4(in[0], in[1], in[2], in[3]);
433 pixels[1] = f.y * scale;
435 pixels[3] = f.w * scale;
439 for (
int i = 0; i <
size; i++, in += pass_stride, pixels += 4) {
440 if (sample_count && sample_count[i * pass_stride] < 0.0f) {
441 scale = (pass.
filter) ? -1.0f / (sample_count[i * pass_stride]) : 1.0f;
442 scale_exposure = (pass.
exposure) ? scale * exposure : scale;
445 float4 f =
make_float4(in[0], in[1], in[2], in[3]);
447 pixels[0] = f.x * scale_exposure;
448 pixels[1] = f.y * scale_exposure;
449 pixels[2] = f.z * scale_exposure;
485 for (
int i = 0; i <
size; i++, out += pass_stride, pixels += components) {
490 for (
int j = 0; j < components; j++) {
491 out[j] = pixels[j] * samples;
496 memcpy(out, pixels,
sizeof(
float) * components);
513 rgba_byte(device,
"display buffer byte"),
514 rgba_half(device,
"display buffer half")
typedef float(TangentPoint)[2]
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei stride
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
bool modified(const BufferParams ¶ms)
int get_denoising_prefiltered_offset()
void get_offset_stride(int &offset, int &stride)
int get_denoising_offset()
bool denoising_prefiltered_pass
bool denoising_clean_pass
virtual void draw_pixels(device_memory &mem, int y, int w, int h, int width, int height, int dx, int dy, int dw, int dh, bool transparent, const DeviceDrawParams &draw_params)
device_pixels< uchar4 > rgba_byte
DisplayBuffer(Device *device, bool linear=false)
void draw_set(int width, int height)
void reset(BufferParams ¶ms)
void draw(Device *device, const DeviceDrawParams &draw_params)
device_pixels< half4 > rgba_half
static bool equals(const vector< Pass > &A, const vector< Pass > &B)
static void add(PassType type, vector< Pass > &passes, const char *name=NULL)
bool get_pass_rect(const string &name, float exposure, int sample, int components, float *pixels)
bool set_pass_rect(PassType type, int components, float *pixels, int samples)
bool get_denoising_pass_rect(int offset, float exposure, int sample, int components, float *pixels)
device_vector< float > buffer
void reset(BufferParams ¶ms)
RenderBuffers(Device *device)
StealingState stealing_state
device_ptr device_pointer
void alloc_to_device(size_t width, size_t height, size_t depth=0)
T * alloc(size_t width, size_t height=0, size_t depth=0)
#define CCL_NAMESPACE_END
#define make_float4(x, y, z, w)
#define make_float3(x, y, z)
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
@ DENOISING_PASS_PREFILTERED_VARIANCE
@ DENOISING_PASS_PREFILTERED_NORMAL
@ DENOISING_PASS_SIZE_CLEAN
@ DENOISING_PASS_SIZE_BASE
@ DENOISING_PASS_PREFILTERED_DEPTH
@ DENOISING_PASS_SIZE_PREFILTERED
@ DENOISING_PASS_PREFILTERED_ALBEDO
@ DENOISING_PASS_PREFILTERED_COLOR
@ DENOISING_PASS_PREFILTERED_INTENSITY
static void sample(SocketReader *reader, int x, int y, float color[4])
ccl_device float3 color_highlight_uncompress(float3 color)
ccl_device_inline float saturate(float a)
ccl_device_inline float3 safe_divide_even_color(float3 a, float3 b)
ccl_device_inline size_t align_up(size_t offset, size_t alignment)