Merge branch 'master' into blender2.8

This commit is contained in:
Julian Eisel 2017-05-25 00:43:01 +02:00
commit 45ff4a807a
7 changed files with 64 additions and 32 deletions

View File

@ -195,7 +195,7 @@ template<typename T> struct texture_image {
if(x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
ATTR_FALLTHROUGH;
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
@ -222,7 +222,7 @@ template<typename T> struct texture_image {
if(x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
ATTR_FALLTHROUGH;
case EXTENSION_EXTEND:
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
@ -265,7 +265,7 @@ template<typename T> struct texture_image {
if(x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
ATTR_FALLTHROUGH;
case EXTENSION_EXTEND:
pix = wrap_clamp(ix-1, width);
piy = wrap_clamp(iy-1, height);
@ -335,7 +335,7 @@ template<typename T> struct texture_image {
{
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
ATTR_FALLTHROUGH;
case EXTENSION_EXTEND:
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
@ -374,7 +374,7 @@ template<typename T> struct texture_image {
{
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
ATTR_FALLTHROUGH;
case EXTENSION_EXTEND:
nix = wrap_clamp(ix+1, width);
niy = wrap_clamp(iy+1, height);
@ -449,7 +449,7 @@ template<typename T> struct texture_image {
{
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
/* Fall through. */
ATTR_FALLTHROUGH;
case EXTENSION_EXTEND:
pix = wrap_clamp(ix-1, width);
piy = wrap_clamp(iy-1, height);

View File

@ -55,6 +55,8 @@
#define ccl_restrict __restrict__
#define ccl_align(n) __align__(n)
#define ATTR_FALLTHROUGH
#define CCL_MAX_LOCAL_SIZE (CUDA_THREADS_BLOCK_WIDTH*CUDA_THREADS_BLOCK_WIDTH)

View File

@ -50,6 +50,8 @@
# define ccl_addr_space
#endif
#define ATTR_FALLTHROUGH
#define ccl_local_id(d) get_local_id(d)
#define ccl_global_id(d) get_global_id(d)

View File

@ -684,6 +684,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
#ifdef __CAUSTICS_TRICKS__
if(!kernel_data.integrator.caustics_reflective && (path_flag & PATH_RAY_DIFFUSE))
break;
ATTR_FALLTHROUGH;
#endif
case CLOSURE_BSDF_DIFFUSE_TOON_ID: {
float3 weight = sd->svm_closure_weight * mix_weight;

View File

@ -68,6 +68,13 @@
# define ccl_never_inline __attribute__((noinline))
# define ccl_maybe_unused __attribute__((used))
# endif /* _WIN32 && !FREE_WINDOWS */
/* Use to suppress '-Wimplicit-fallthrough' (in place of 'break'). */
# if defined(__GNUC__) && (__GNUC__ >= 7) /* gcc7.0+ only */
# define ATTR_FALLTHROUGH __attribute__((fallthrough))
# else
# define ATTR_FALLTHROUGH ((void)0)
# endif
#endif /* __KERNEL_GPU__ */
/* Standard Integer Types */

View File

@ -1455,20 +1455,25 @@ static void *emDM_getTessFaceDataArray(DerivedMesh *dm, int type)
/* layers are store per face for editmesh, we convert to a temporary
* data layer array in the derivedmesh when these are requested */
if (type == CD_MTFACE || type == CD_MCOL) {
const int type_from = (type == CD_MTFACE) ? CD_MTEXPOLY : CD_MLOOPCOL;
int index;
const char *bmdata;
char *data;
index = CustomData_get_layer_index(&bm->pdata, type_from);
bool has_type_source = false;
if (index != -1) {
if (type == CD_MTFACE) {
has_type_source = CustomData_has_layer(&bm->pdata, CD_MTEXPOLY);
}
else {
has_type_source = CustomData_has_layer(&bm->ldata, CD_MLOOPCOL);
}
if (has_type_source) {
/* offset = bm->pdata.layers[index].offset; */ /* UNUSED */
BMLoop *(*looptris)[3] = bmdm->em->looptris;
const int size = CustomData_sizeof(type);
int i, j;
DM_add_tessface_layer(dm, type, CD_CALLOC, NULL);
index = CustomData_get_layer_index(&dm->faceData, type);
const int index = CustomData_get_layer_index(&dm->faceData, type);
dm->faceData.layers[index].flag |= CD_FLAG_TEMPORARY;
data = datalayer = DM_get_tessface_data_layer(dm, type);

View File

@ -249,6 +249,41 @@ static void do_version_hue_sat_node(bNodeTree *ntree, bNode *node)
node->storage = NULL;
}
static void do_versions_compositor_render_passes_storage(bNode *node)
{
int pass_index = 0;
const char *sockname;
for (bNodeSocket *sock = node->outputs.first; sock && pass_index < 31; sock = sock->next, pass_index++) {
if (sock->storage == NULL) {
NodeImageLayer *sockdata = MEM_callocN(sizeof(NodeImageLayer), "node image layer");
sock->storage = sockdata;
BLI_strncpy(sockdata->pass_name, node_cmp_rlayers_sock_to_pass(pass_index), sizeof(sockdata->pass_name));
if (pass_index == 0) sockname = "Image";
else if (pass_index == 1) sockname = "Alpha";
else sockname = node_cmp_rlayers_sock_to_pass(pass_index);
BLI_strncpy(sock->name, sockname, sizeof(sock->name));
}
}
}
static void do_versions_compositor_render_passes(bNodeTree *ntree)
{
for (bNode *node = ntree->nodes.first; node; node = node->next) {
if (node->type == CMP_NODE_R_LAYERS) {
/* First we make sure existing sockets have proper names.
* This is important because otherwise verification will
* drop links from sockets which were renamed.
*/
do_versions_compositor_render_passes_storage(node);
/* Make sure new sockets are properly created. */
node_verify_socket_templates(ntree, node);
/* Make sure all possibly created sockets have proper storage. */
do_versions_compositor_render_passes_storage(node);
}
}
}
void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
{
if (!MAIN_VERSION_ATLEAST(main, 270, 0)) {
@ -1612,27 +1647,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
FOREACH_NODETREE(main, ntree, id) {
if (ntree->type == NTREE_COMPOSIT) {
bNode *node;
for (node = ntree->nodes.first; node; node = node->next) {
if (node->type == CMP_NODE_R_LAYERS) {
/* Make sure new sockets are properly created. */
node_verify_socket_templates(ntree, node);
int pass_index = 0;
const char *sockname;
for (bNodeSocket *sock = node->outputs.first; sock && pass_index < 31; sock = sock->next, pass_index++) {
if (sock->storage == NULL) {
NodeImageLayer *sockdata = MEM_callocN(sizeof(NodeImageLayer), "node image layer");
sock->storage = sockdata;
BLI_strncpy(sockdata->pass_name, node_cmp_rlayers_sock_to_pass(pass_index), sizeof(sockdata->pass_name));
if (pass_index == 0) sockname = "Image";
else if (pass_index == 1) sockname = "Alpha";
else sockname = node_cmp_rlayers_sock_to_pass(pass_index);
BLI_strncpy(sock->name, sockname, sizeof(sock->name));
}
}
}
}
do_versions_compositor_render_passes(ntree);
}
} FOREACH_NODETREE_END
}