Cycles / Hair rendering:

* Enable hair rendering on the GPU.

Patch by Stuart Broadfoot, with small tweaks by me, to only enable it on sm_20 and above.
This commit is contained in:
Thomas Dinges
2013-05-08 17:33:25 +00:00
parent 9037a2d3ab
commit 872a8ed1bf
4 changed files with 16 additions and 18 deletions

View File

@@ -1032,8 +1032,7 @@ class CyclesRender_PT_CurveRendering(CyclesButtonsPanel, Panel):
scene = context.scene scene = context.scene
cscene = scene.cycles cscene = scene.cycles
psys = context.particle_system psys = context.particle_system
device_type = context.user_preferences.system.compute_device_type experimental = (cscene.feature_set == 'EXPERIMENTAL')
experimental = ((cscene.feature_set == 'EXPERIMENTAL') and (cscene.device == 'CPU' or device_type == 'NONE'))
return CyclesButtonsPanel.poll(context) and experimental and psys return CyclesButtonsPanel.poll(context) and experimental and psys
def draw_header(self, context): def draw_header(self, context):
@@ -1102,8 +1101,7 @@ class CyclesParticle_PT_CurveSettings(CyclesButtonsPanel, Panel):
cscene = scene.cycles cscene = scene.cycles
ccscene = scene.cycles_curves ccscene = scene.cycles_curves
use_curves = ccscene.use_curves and context.particle_system use_curves = ccscene.use_curves and context.particle_system
device_type = context.user_preferences.system.compute_device_type experimental = cscene.feature_set == 'EXPERIMENTAL'
experimental = cscene.feature_set == 'EXPERIMENTAL' and (cscene.device == 'CPU' or device_type == 'NONE')
return CyclesButtonsPanel.poll(context) and experimental and use_curves return CyclesButtonsPanel.poll(context) and experimental and use_curves
def draw(self, context): def draw(self, context):

View File

@@ -449,14 +449,14 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
mesh->name = ustring(b_ob_data.name().c_str()); mesh->name = ustring(b_ob_data.name().c_str());
if(b_mesh) { if(b_mesh) {
if(!(hide_tris && experimental && is_cpu)) { if(!(hide_tris && experimental)) {
if(cmesh.data && experimental && RNA_boolean_get(&cmesh, "use_subdivision")) if(cmesh.data && experimental && RNA_boolean_get(&cmesh, "use_subdivision"))
create_subd_mesh(mesh, b_mesh, &cmesh, used_shaders); create_subd_mesh(mesh, b_mesh, &cmesh, used_shaders);
else else
create_mesh(scene, mesh, b_mesh, used_shaders); create_mesh(scene, mesh, b_mesh, used_shaders);
} }
if(experimental && is_cpu) if(experimental)
sync_curves(mesh, b_mesh, b_ob, object_updated); sync_curves(mesh, b_mesh, b_ob, object_updated);
/* free derived mesh */ /* free derived mesh */

View File

@@ -51,7 +51,6 @@ CCL_NAMESPACE_BEGIN
#define __KERNEL_SHADING__ #define __KERNEL_SHADING__
#define __KERNEL_ADV_SHADING__ #define __KERNEL_ADV_SHADING__
#define __NON_PROGRESSIVE__ #define __NON_PROGRESSIVE__
#define __HAIR__
#ifdef WITH_OSL #ifdef WITH_OSL
#define __OSL__ #define __OSL__
#endif #endif
@@ -125,6 +124,7 @@ CCL_NAMESPACE_BEGIN
#define __ANISOTROPIC__ #define __ANISOTROPIC__
#define __CAMERA_MOTION__ #define __CAMERA_MOTION__
#define __OBJECT_MOTION__ #define __OBJECT_MOTION__
#define __HAIR__
#endif #endif
//#define __SOBOL_FULL_SCREEN__ //#define __SOBOL_FULL_SCREEN__

View File

@@ -97,17 +97,6 @@ __device_inline float3 transform_direction_transposed(const Transform *t, const
return make_float3(dot(x, a), dot(y, a), dot(z, a)); return make_float3(dot(x, a), dot(y, a), dot(z, a));
} }
#ifndef __KERNEL_GPU__
__device_inline void print_transform(const char *label, const Transform& t)
{
print_float4(label, t.x);
print_float4(label, t.y);
print_float4(label, t.z);
print_float4(label, t.w);
printf("\n");
}
__device_inline Transform transform_transpose(const Transform a) __device_inline Transform transform_transpose(const Transform a)
{ {
Transform t; Transform t;
@@ -148,6 +137,17 @@ __device_inline Transform make_transform(float a, float b, float c, float d,
return t; return t;
} }
#ifndef __KERNEL_GPU__
__device_inline void print_transform(const char *label, const Transform& t)
{
print_float4(label, t.x);
print_float4(label, t.y);
print_float4(label, t.z);
print_float4(label, t.w);
printf("\n");
}
__device_inline Transform transform_translate(float3 t) __device_inline Transform transform_translate(float3 t)
{ {
return make_transform( return make_transform(