forked from bartvdbraak/blender
Cycles: remove deprecated strict aliasing flag for opencl, fix missing update
modifying object layer in properties editor, and add memarena utility.
This commit is contained in:
parent
61f77fffac
commit
e9b967d05b
@ -264,7 +264,7 @@ public:
|
|||||||
string build_options = "";
|
string build_options = "";
|
||||||
|
|
||||||
build_options += "-I " + kernel_path + ""; /* todo: escape path */
|
build_options += "-I " + kernel_path + ""; /* todo: escape path */
|
||||||
build_options += " -cl-fast-relaxed-math -cl-strict-aliasing";
|
build_options += " -cl-fast-relaxed-math ";
|
||||||
|
|
||||||
ciErr = clBuildProgram(cpProgram, 0, NULL, build_options.c_str(), NULL, NULL);
|
ciErr = clBuildProgram(cpProgram, 0, NULL, build_options.c_str(), NULL, NULL);
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ set(sources
|
|||||||
util_cuda.cpp
|
util_cuda.cpp
|
||||||
util_dynlib.cpp
|
util_dynlib.cpp
|
||||||
util_md5.cpp
|
util_md5.cpp
|
||||||
|
util_memarena.cpp
|
||||||
util_opencl.c
|
util_opencl.c
|
||||||
util_path.cpp
|
util_path.cpp
|
||||||
util_string.cpp
|
util_string.cpp
|
||||||
@ -35,6 +36,7 @@ set(headers
|
|||||||
util_map.h
|
util_map.h
|
||||||
util_math.h
|
util_math.h
|
||||||
util_md5.h
|
util_md5.h
|
||||||
|
util_memarena.h
|
||||||
util_opencl.h
|
util_opencl.h
|
||||||
util_opengl.h
|
util_opengl.h
|
||||||
util_param.h
|
util_param.h
|
||||||
|
61
intern/cycles/util/util_memarena.cpp
Normal file
61
intern/cycles/util/util_memarena.cpp
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Blender Foundation.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "util_foreach.h"
|
||||||
|
#include "util_math.h"
|
||||||
|
#include "util_memarena.h"
|
||||||
|
|
||||||
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
MemArena::MemArena(bool use_calloc_, size_t buffer_size_)
|
||||||
|
{
|
||||||
|
use_calloc = use_calloc_;
|
||||||
|
buffer_size = buffer_size_;
|
||||||
|
|
||||||
|
last_left = 0;
|
||||||
|
last_buffer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
MemArena::~MemArena()
|
||||||
|
{
|
||||||
|
foreach(uint8_t *buffer, buffers)
|
||||||
|
delete [] buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *MemArena::alloc(size_t size)
|
||||||
|
{
|
||||||
|
if(size > last_left) {
|
||||||
|
last_left = (size > buffer_size)? size: buffer_size;
|
||||||
|
last_buffer = new uint8_t[last_left];
|
||||||
|
|
||||||
|
if(use_calloc)
|
||||||
|
memset(last_buffer, 0, last_left);
|
||||||
|
|
||||||
|
buffers.push_back(last_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t *mem = last_buffer;
|
||||||
|
|
||||||
|
last_buffer += size;
|
||||||
|
last_left -= size;
|
||||||
|
|
||||||
|
return (void*)mem;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCL_NAMESPACE_END
|
||||||
|
|
48
intern/cycles/util/util_memarena.h
Normal file
48
intern/cycles/util/util_memarena.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Blender Foundation.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __UTIL_MEMARENA_H__
|
||||||
|
#define __UTIL_MEMARENA_H__
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "util_list.h"
|
||||||
|
#include "util_types.h"
|
||||||
|
|
||||||
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
class MemArena {
|
||||||
|
public:
|
||||||
|
MemArena(bool use_calloc = true, size_t buffer_size = (1<<14));
|
||||||
|
~MemArena();
|
||||||
|
|
||||||
|
void *alloc(size_t size);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool use_calloc;
|
||||||
|
size_t buffer_size;
|
||||||
|
|
||||||
|
list<uint8_t*> buffers;
|
||||||
|
uint8_t *last_buffer;
|
||||||
|
size_t last_left;
|
||||||
|
};
|
||||||
|
|
||||||
|
CCL_NAMESPACE_END
|
||||||
|
|
||||||
|
#endif /* __UTIL_MEMARENA_H__ */
|
||||||
|
|
@ -30,6 +30,11 @@ CCL_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
typedef struct Transform {
|
typedef struct Transform {
|
||||||
float4 x, y, z, w; /* rows */
|
float4 x, y, z, w; /* rows */
|
||||||
|
|
||||||
|
#ifndef __KERNEL_GPU__
|
||||||
|
float4 operator[](int i) const { return *(&x + i); }
|
||||||
|
float4& operator[](int i) { return *(&x + i); }
|
||||||
|
#endif
|
||||||
} Transform;
|
} Transform;
|
||||||
|
|
||||||
__device_inline float3 transform(const Transform *t, const float3 a)
|
__device_inline float3 transform(const Transform *t, const float3 a)
|
||||||
|
@ -284,6 +284,8 @@ static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *b
|
|||||||
else {
|
else {
|
||||||
DAG_scene_sort(bmain, scene);
|
DAG_scene_sort(bmain, scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DAG_id_type_tag(bmain, ID_OB);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||||
|
Loading…
Reference in New Issue
Block a user