From 28604c46a137c1288cc7a494b36ed72e44a0ab8b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 10 Feb 2016 15:09:45 +0100 Subject: 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 --- intern/cycles/kernel/kernel_compat_cpu.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'intern/cycles/kernel/kernel_compat_cpu.h') 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 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 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 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 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 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 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}; -- cgit v1.2.3