Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-02-10 17:09:45 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-02-12 17:27:33 +0300
commit28604c46a137c1288cc7a494b36ed72e44a0ab8b (patch)
tree3ce7de49d1604cdec2ce420a117ae1ab59df2404 /intern/cycles/kernel
parentec9977855f9264ecf6af5b4c8e6d10324a02028e (diff)
Cycles: Make Blender importer more forward compatible
Basically the idea is to make code robust against extending enum options in the future by falling back to a known safe default setting when RNA is set to something unknown. While this approach solves the issues similar to T47377, but it wouldn't really help when/if any of the RNA values gets ever deprecated and removed. There'll be no simple solution to that apart from defining explicit mapping from RNA value to Cycles one. Another part which isn't so great actually is that we now have to have some enum guards and give some explicit values to the enum items, but we can live with that perhaps. Reviewers: dingto, juicyfruit, lukasstockner97, brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D1785
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r--intern/cycles/kernel/kernel_compat_cpu.h12
-rw-r--r--intern/cycles/kernel/kernel_types.h14
2 files changed, 21 insertions, 5 deletions
diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h
index baa67f63ab3..df7d39532aa 100644
--- a/intern/cycles/kernel/kernel_compat_cpu.h
+++ b/intern/cycles/kernel/kernel_compat_cpu.h
@@ -152,6 +152,8 @@ template<typename T> struct texture_image {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
break;
+ default:
+ kernel_assert(0);
}
return read(data[ix + iy*width]);
}
@@ -179,6 +181,8 @@ template<typename T> struct texture_image {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
break;
+ default:
+ kernel_assert(0);
}
float4 r = (1.0f - ty)*(1.0f - tx)*read(data[ix + iy*width]);
@@ -225,6 +229,8 @@ template<typename T> struct texture_image {
ix = wrap_clamp(ix, width);
iy = wrap_clamp(iy, height);
break;
+ default:
+ kernel_assert(0);
}
const int xc[4] = {pix, ix, nix, nnix};
@@ -290,6 +296,8 @@ template<typename T> struct texture_image {
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
break;
+ default:
+ kernel_assert(0);
}
return read(data[ix + iy*width + iz*width*height]);
@@ -325,6 +333,8 @@ template<typename T> struct texture_image {
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
break;
+ default:
+ kernel_assert(0);
}
float4 r;
@@ -390,6 +400,8 @@ template<typename T> struct texture_image {
iy = wrap_clamp(iy, height);
iz = wrap_clamp(iz, depth);
break;
+ default:
+ kernel_assert(0);
}
const int xc[4] = {pix, ix, nix, nnix};
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 42d40e1daee..bdd17c66c0f 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -264,7 +264,9 @@ enum PathTraceDimension {
enum SamplingPattern {
SAMPLING_PATTERN_SOBOL = 0,
- SAMPLING_PATTERN_CMJ = 1
+ SAMPLING_PATTERN_CMJ = 1,
+
+ SAMPLING_NUM_PATTERNS,
};
/* these flags values correspond to raytypes in osl.cpp, so keep them in sync!
@@ -482,10 +484,12 @@ enum CameraType {
/* Panorama Type */
enum PanoramaType {
- PANORAMA_EQUIRECTANGULAR,
- PANORAMA_MIRRORBALL,
- PANORAMA_FISHEYE_EQUIDISTANT,
- PANORAMA_FISHEYE_EQUISOLID
+ PANORAMA_EQUIRECTANGULAR = 0,
+ PANORAMA_FISHEYE_EQUIDISTANT = 1,
+ PANORAMA_FISHEYE_EQUISOLID = 2,
+ PANORAMA_MIRRORBALL = 3,
+
+ PANORAMA_NUM_TYPES,
};
/* Differential */