Move BVHType and shadingsystem enums to top-level of Cycles namespace.

Easier access of BVHType and deduplication for ShadingSystem.

Reviewers: dingto, brecht

Differential Revision: https://developer.blender.org/D534
This commit is contained in:
Nathan Letwory
2014-05-16 16:43:28 +03:00
parent 74f77a2956
commit 9a7c4ead3f
7 changed files with 26 additions and 13 deletions

View File

@@ -35,6 +35,7 @@
#include "util_debug.h" #include "util_debug.h"
#include "util_foreach.h" #include "util_foreach.h"
#include "util_opengl.h" #include "util_opengl.h"
#include "util_types.h"
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
@@ -362,19 +363,19 @@ SceneParams BlenderSync::get_scene_params(BL::Scene b_scene, bool background)
const bool shadingsystem = RNA_boolean_get(&cscene, "shading_system"); const bool shadingsystem = RNA_boolean_get(&cscene, "shading_system");
if(shadingsystem == 0) if(shadingsystem == 0)
params.shadingsystem = SceneParams::SVM; params.shadingsystem = ShadingSystem::SVM;
else if(shadingsystem == 1) else if(shadingsystem == 1)
params.shadingsystem = SceneParams::OSL; params.shadingsystem = ShadingSystem::OSL;
if(background) if(background)
params.bvh_type = SceneParams::BVH_STATIC; params.bvh_type = BVHType::BVH_STATIC;
else else
params.bvh_type = (SceneParams::BVHType)RNA_enum_get(&cscene, "debug_bvh_type"); params.bvh_type = (BVHType)RNA_enum_get(&cscene, "debug_bvh_type");
params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits"); params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits");
params.use_bvh_cache = (background)? RNA_boolean_get(&cscene, "use_cache"): false; params.use_bvh_cache = (background)? RNA_boolean_get(&cscene, "use_cache"): false;
if(background && params.shadingsystem != SceneParams::OSL) if(background && params.shadingsystem != ShadingSystem::OSL)
params.persistent_data = r.use_persistent_data(); params.persistent_data = r.use_persistent_data();
else else
params.persistent_data = false; params.persistent_data = false;
@@ -511,9 +512,9 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
const bool shadingsystem = RNA_boolean_get(&cscene, "shading_system"); const bool shadingsystem = RNA_boolean_get(&cscene, "shading_system");
if(shadingsystem == 0) if(shadingsystem == 0)
params.shadingsystem = SessionParams::SVM; params.shadingsystem = ShadingSystem::SVM;
else if(shadingsystem == 1) else if(shadingsystem == 1)
params.shadingsystem = SessionParams::OSL; params.shadingsystem = ShadingSystem::OSL;
/* color managagement */ /* color managagement */
params.display_buffer_linear = GLEW_ARB_half_float_pixel && b_engine.support_display_space_shader(b_scene); params.display_buffer_linear = GLEW_ARB_half_float_pixel && b_engine.support_display_space_shader(b_scene);

View File

@@ -25,6 +25,7 @@
#include "util_foreach.h" #include "util_foreach.h"
#include "util_map.h" #include "util_map.h"
#include "util_progress.h" #include "util_progress.h"
#include "util_types.h"
#include "util_vector.h" #include "util_vector.h"
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
@@ -388,7 +389,7 @@ void ObjectManager::device_update(Device *device, DeviceScene *dscene, Scene *sc
/* prepare for static BVH building */ /* prepare for static BVH building */
/* todo: do before to support getting object level coords? */ /* todo: do before to support getting object level coords? */
if(scene->params.bvh_type == SceneParams::BVH_STATIC) { if(scene->params.bvh_type == BVHType::BVH_STATIC) {
progress.set_status("Updating Objects", "Applying Static Transformations"); progress.set_status("Updating Objects", "Applying Static Transformations");
apply_static_transforms(dscene, scene, object_flag, progress); apply_static_transforms(dscene, scene, object_flag, progress);
} }

View File

@@ -61,7 +61,7 @@ Scene::Scene(const SceneParams& params_, const DeviceInfo& device_info_)
if(device_info_.type == DEVICE_CPU) if(device_info_.type == DEVICE_CPU)
shader_manager = ShaderManager::create(this, params.shadingsystem); shader_manager = ShaderManager::create(this, params.shadingsystem);
else else
shader_manager = ShaderManager::create(this, SceneParams::SVM); shader_manager = ShaderManager::create(this, ShadingSystem::SVM);
/* Extended image limits for CPU and GPUs */ /* Extended image limits for CPU and GPUs */
image_manager->set_extended_image_limits(device_info_); image_manager->set_extended_image_limits(device_info_);

View File

@@ -120,8 +120,8 @@ public:
class SceneParams { class SceneParams {
public: public:
enum { OSL, SVM } shadingsystem; ShadingSystem shadingsystem;
enum BVHType { BVH_DYNAMIC, BVH_STATIC } bvh_type; BVHType bvh_type;
bool use_bvh_cache; bool use_bvh_cache;
bool use_bvh_spatial_split; bool use_bvh_spatial_split;
bool use_qbvh; bool use_qbvh;

View File

@@ -24,6 +24,7 @@
#include "util_progress.h" #include "util_progress.h"
#include "util_stats.h" #include "util_stats.h"
#include "util_thread.h" #include "util_thread.h"
#include "util_types.h"
#include "util_vector.h" #include "util_vector.h"
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
@@ -59,7 +60,7 @@ public:
double reset_timeout; double reset_timeout;
double text_timeout; double text_timeout;
enum { OSL, SVM } shadingsystem; ShadingSystem shadingsystem;
SessionParams() SessionParams()
{ {

View File

@@ -28,6 +28,7 @@
#include "tables.h" #include "tables.h"
#include "util_foreach.h" #include "util_foreach.h"
#include "util_types.h"
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
@@ -148,7 +149,7 @@ ShaderManager *ShaderManager::create(Scene *scene, int shadingsystem)
ShaderManager *manager; ShaderManager *manager;
#ifdef WITH_OSL #ifdef WITH_OSL
if(shadingsystem == SceneParams::OSL) if(shadingsystem == ShadingSystem::OSL)
manager = new OSLShaderManager(); manager = new OSLShaderManager();
else else
#endif #endif

View File

@@ -456,6 +456,15 @@ enum InterpolationType {
INTERPOLATION_SMART = 3, INTERPOLATION_SMART = 3,
}; };
enum ShadingSystem {
OSL,
SVM
};
enum BVHType {
BVH_DYNAMIC,
BVH_STATIC
};
/* macros */ /* macros */