mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Cleanup: Cycles, sign conversion
A series of commits which reduces the number of sign conversions (int <-> uint) in the Cycles kernel. While it is not expected that the conversion emits any instructions, it is quite confusing to follow the code and choose proper type. Additionally, from some development in !151540 it seemed that such mismatch was responsible for the performance drop in HIP-RT. Pull Request: https://projects.blender.org/blender/blender/pulls/152009
This commit is contained in:
parent
9438a3412b
commit
2c4477de04
26 changed files with 68 additions and 66 deletions
|
|
@ -60,7 +60,7 @@ ccl_device_inline
|
|||
}
|
||||
kernel_assert((local_isect == nullptr) == (max_hits == 0));
|
||||
|
||||
const int object_flag = kernel_data_fetch(object_flag, local_object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, local_object);
|
||||
if (!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) {
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, local_object, ray, &P, &dir, &idir);
|
||||
|
|
|
|||
|
|
@ -177,8 +177,8 @@ ccl_device_forceinline int intersection_get_shader(
|
|||
return intersection_get_shader_from_isect_prim(kg, isect->prim, isect->type);
|
||||
}
|
||||
|
||||
ccl_device_forceinline int intersection_get_object_flags(
|
||||
KernelGlobals kg, const ccl_private Intersection *ccl_restrict isect)
|
||||
ccl_device_forceinline uint
|
||||
intersection_get_object_flags(KernelGlobals kg, const ccl_private Intersection *ccl_restrict isect)
|
||||
{
|
||||
return kernel_data_fetch(object_flag, isect->object);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ ccl_device_inline
|
|||
else {
|
||||
/* instance push */
|
||||
object = kernel_data_fetch(prim_object, -prim_addr - 1);
|
||||
int object_flag = kernel_data_fetch(object_flag, object);
|
||||
uint object_flag = kernel_data_fetch(object_flag, object);
|
||||
if (object_flag & SD_OBJECT_HAS_VOLUME) {
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir);
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ ccl_device_inline
|
|||
else {
|
||||
/* instance push */
|
||||
object = kernel_data_fetch(prim_object, -prim_addr - 1);
|
||||
int object_flag = kernel_data_fetch(object_flag, object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object);
|
||||
if (object_flag & SD_OBJECT_HAS_VOLUME) {
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir);
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ ccl_device_inline ccl_private Bssrdf *bssrdf_alloc(ccl_private ShaderData *sd, S
|
|||
|
||||
ccl_device int bssrdf_setup(ccl_private ShaderData *sd,
|
||||
ccl_private Bssrdf *bssrdf,
|
||||
const int path_flag,
|
||||
const uint32_t path_flag,
|
||||
ClosureType type)
|
||||
{
|
||||
/* Clamps protecting against bad/extreme and non physical values. */
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ void kernel_global_memory_copy(KernelGlobalsCPU *kg,
|
|||
kg->tname.width = size; \
|
||||
}
|
||||
#include "kernel/data_arrays.h"
|
||||
|
||||
else {
|
||||
assert(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ ccl_device_intersect bool scene_intersect_local(KernelGlobals kg,
|
|||
float3 dir = bvh_clamp_direction(ray->D);
|
||||
float3 idir = bvh_inverse_direction(dir);
|
||||
|
||||
const int object_flag = kernel_data_fetch(object_flag, local_object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, local_object);
|
||||
if (!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) {
|
||||
# if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, local_object, ray, &P, &dir, &idir);
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ ccl_device_inline bool motion_triangle_custom_volume_intersect(const hiprtRay &r
|
|||
KernelGlobals kg = payload->kg;
|
||||
|
||||
const int object_id = kernel_data_fetch(user_instance_id, hit.instanceID);
|
||||
const int object_flag = kernel_data_fetch(object_flag, object_id);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object_id);
|
||||
|
||||
if (!(object_flag & SD_OBJECT_HAS_VOLUME)) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ ccl_device_inline Transform object_fetch_transform_motion(KernelGlobals kg,
|
|||
{
|
||||
const uint motion_offset = kernel_data_fetch(objects, object).motion_offset;
|
||||
const ccl_global DecomposedTransform *motion = &kernel_data_fetch(object_motion, motion_offset);
|
||||
const uint num_steps = kernel_data_fetch(objects, object).num_tfm_steps;
|
||||
const int num_steps = kernel_data_fetch(objects, object).num_tfm_steps;
|
||||
|
||||
Transform tfm;
|
||||
transform_motion_array_interpolate(&tfm, motion, num_steps, time);
|
||||
|
|
@ -74,7 +74,7 @@ ccl_device_inline Transform object_fetch_transform_motion_test(KernelGlobals kg,
|
|||
ccl_private Transform *itfm)
|
||||
{
|
||||
#ifdef __OBJECT_MOTION__
|
||||
const int object_flag = kernel_data_fetch(object_flag, object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object);
|
||||
if (object_flag & SD_OBJECT_MOTION) {
|
||||
/* if we do motion blur */
|
||||
Transform tfm = object_fetch_transform_motion(kg, object, time);
|
||||
|
|
@ -203,7 +203,7 @@ ccl_device_inline void object_normal_transform(KernelGlobals kg,
|
|||
}
|
||||
}
|
||||
|
||||
ccl_device_inline bool object_negative_scale_applied(const int object_flag)
|
||||
ccl_device_inline bool object_negative_scale_applied(const uint object_flag)
|
||||
{
|
||||
return ((object_flag & SD_OBJECT_NEGATIVE_SCALE) && (object_flag & SD_OBJECT_TRANSFORM_APPLIED));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ ccl_device_inline void triangle_point_normal(KernelGlobals kg,
|
|||
const float w = 1.0f - u - v;
|
||||
*P = (w * v0 + u * v1 + v * v2);
|
||||
/* get object flags */
|
||||
const int object_flag = kernel_data_fetch(object_flag, object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object);
|
||||
/* compute normal */
|
||||
if (object_negative_scale_applied(object_flag)) {
|
||||
*Ng = normalize(cross(v2 - v0, v1 - v0));
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ ccl_device bool integrator_init_from_bake(KernelGlobals kg,
|
|||
int shader;
|
||||
triangle_point_normal(kg, object, prim, u, v, &P, &Ng, &shader);
|
||||
|
||||
const int object_flag = kernel_data_fetch(object_flag, object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object);
|
||||
if (!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) {
|
||||
const Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM);
|
||||
P = transform_point_auto(&tfm, P);
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ ccl_device_forceinline void integrator_split_shadow_catcher(
|
|||
{
|
||||
/* Test if we hit a shadow catcher object, and potentially split the path to continue tracing two
|
||||
* paths from here. */
|
||||
const int object_flags = intersection_get_object_flags(kg, isect);
|
||||
const uint object_flags = intersection_get_object_flags(kg, isect);
|
||||
if (!kernel_shadow_catcher_is_path_split_bounce(kg, state, object_flags)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ ccl_device_forceinline void integrator_intersect_next_kernel_after_shadow_catche
|
|||
|
||||
const int shader = intersection_get_shader(kg, &isect);
|
||||
const int flags = kernel_data_fetch(shaders, shader).flags;
|
||||
const int object_flags = intersection_get_object_flags(kg, &isect);
|
||||
const uint object_flags = intersection_get_object_flags(kg, &isect);
|
||||
const bool use_caustics = kernel_data.integrator.use_caustics &&
|
||||
(object_flags & SD_OBJECT_CAUSTICS);
|
||||
const bool use_raytrace_kernel = (flags & SD_HAS_RAYTRACE);
|
||||
|
|
@ -259,7 +259,7 @@ ccl_device_forceinline void integrator_intersect_next_kernel(
|
|||
const int flags = kernel_data_fetch(shaders, shader).flags;
|
||||
|
||||
if (!integrator_intersect_terminate(kg, state, flags)) {
|
||||
const int object_flags = intersection_get_object_flags(kg, isect);
|
||||
const uint object_flags = intersection_get_object_flags(kg, isect);
|
||||
const bool use_caustics = kernel_data.integrator.use_caustics &&
|
||||
(object_flags & SD_OBJECT_CAUSTICS);
|
||||
const bool use_raytrace_kernel = (flags & SD_HAS_RAYTRACE);
|
||||
|
|
@ -318,7 +318,7 @@ ccl_device_forceinline void integrator_intersect_next_kernel_after_volume(
|
|||
/* Hit a surface, continue with surface kernel unless terminated. */
|
||||
const int shader = intersection_get_shader(kg, isect);
|
||||
const int flags = kernel_data_fetch(shaders, shader).flags;
|
||||
const int object_flags = intersection_get_object_flags(kg, isect);
|
||||
const uint object_flags = intersection_get_object_flags(kg, isect);
|
||||
const bool use_caustics = kernel_data.integrator.use_caustics &&
|
||||
(object_flags & SD_OBJECT_CAUSTICS);
|
||||
const bool use_raytrace_kernel = (flags & SD_HAS_RAYTRACE);
|
||||
|
|
@ -405,7 +405,7 @@ ccl_device void integrator_intersect_closest(KernelGlobals kg,
|
|||
bool from_caustic_caster = false;
|
||||
bool from_caustic_receiver = false;
|
||||
if (!(path_flag & PATH_RAY_CAMERA) && last_isect_object != OBJECT_NONE) {
|
||||
const int object_flags = kernel_data_fetch(object_flag, last_isect_object);
|
||||
const uint object_flags = kernel_data_fetch(object_flag, last_isect_object);
|
||||
from_caustic_receiver = (object_flags & SD_OBJECT_CAUSTICS_RECEIVER);
|
||||
from_caustic_caster = (object_flags & SD_OBJECT_CAUSTICS_CASTER);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -992,7 +992,7 @@ ccl_device_forceinline int kernel_path_mnee_sample(KernelGlobals kg,
|
|||
break;
|
||||
}
|
||||
|
||||
const int object_flags = intersection_get_object_flags(kg, &probe_isect);
|
||||
const uint object_flags = intersection_get_object_flags(kg, &probe_isect);
|
||||
if (object_flags & SD_OBJECT_CAUSTICS_CASTER) {
|
||||
|
||||
/* Do we have enough slots. */
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ ccl_device_inline void integrate_background(KernelGlobals kg,
|
|||
bool eval_background = true;
|
||||
float transparent = 0.0f;
|
||||
|
||||
const int path_flag = INTEGRATOR_STATE(state, path, flag);
|
||||
const uint32_t path_flag = INTEGRATOR_STATE(state, path, flag);
|
||||
const bool is_transparent_background_ray = kernel_data.background.transparent &&
|
||||
(path_flag & PATH_RAY_TRANSPARENT_BACKGROUND);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ CCL_NAMESPACE_BEGIN
|
|||
/* Check whether current surface bounce is where path is to be split for the shadow catcher. */
|
||||
ccl_device_inline bool kernel_shadow_catcher_is_path_split_bounce(KernelGlobals kg,
|
||||
IntegratorState state,
|
||||
const int object_flag)
|
||||
const uint object_flag)
|
||||
{
|
||||
#ifdef __SHADOW_CATCHER__
|
||||
if (!kernel_data.integrator.has_shadow_catcher) {
|
||||
|
|
|
|||
|
|
@ -472,68 +472,69 @@ ccl_device_inline IntegratorState integrator_state_shadow_catcher_split(KernelGl
|
|||
}
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
ccl_device_inline int integrator_state_bounce(ConstIntegratorState state, const int /*unused*/)
|
||||
ccl_device_inline int integrator_state_bounce(ConstIntegratorState state,
|
||||
const uint32_t /*path_flag*/)
|
||||
{
|
||||
return INTEGRATOR_STATE(state, path, bounce);
|
||||
}
|
||||
|
||||
ccl_device_inline int integrator_state_bounce(ConstIntegratorShadowState state,
|
||||
const int /*unused*/)
|
||||
const uint32_t /*path_flag*/)
|
||||
{
|
||||
return INTEGRATOR_STATE(state, shadow_path, bounce);
|
||||
}
|
||||
|
||||
ccl_device_inline int integrator_state_diffuse_bounce(ConstIntegratorState state,
|
||||
const int /*unused*/)
|
||||
const uint32_t /*path_flag*/)
|
||||
{
|
||||
return INTEGRATOR_STATE(state, path, diffuse_bounce);
|
||||
}
|
||||
|
||||
ccl_device_inline int integrator_state_diffuse_bounce(ConstIntegratorShadowState state,
|
||||
const int /*unused*/)
|
||||
const uint32_t /*path_flag*/)
|
||||
{
|
||||
return INTEGRATOR_STATE(state, shadow_path, diffuse_bounce);
|
||||
}
|
||||
|
||||
ccl_device_inline int integrator_state_glossy_bounce(ConstIntegratorState state,
|
||||
const int /*unused*/)
|
||||
const uint32_t /*path_flag*/)
|
||||
{
|
||||
return INTEGRATOR_STATE(state, path, glossy_bounce);
|
||||
}
|
||||
|
||||
ccl_device_inline int integrator_state_glossy_bounce(ConstIntegratorShadowState state,
|
||||
const int /*unused*/)
|
||||
const uint32_t /*path_flag*/)
|
||||
{
|
||||
return INTEGRATOR_STATE(state, shadow_path, glossy_bounce);
|
||||
}
|
||||
|
||||
ccl_device_inline int integrator_state_transmission_bounce(ConstIntegratorState state,
|
||||
const int /*unused*/)
|
||||
const uint32_t /*path_flag*/)
|
||||
{
|
||||
return INTEGRATOR_STATE(state, path, transmission_bounce);
|
||||
}
|
||||
|
||||
ccl_device_inline int integrator_state_transmission_bounce(ConstIntegratorShadowState state,
|
||||
const int /*unused*/)
|
||||
const uint32_t /*path_flag*/)
|
||||
{
|
||||
return INTEGRATOR_STATE(state, shadow_path, transmission_bounce);
|
||||
}
|
||||
|
||||
ccl_device_inline int integrator_state_transparent_bounce(ConstIntegratorState state,
|
||||
const int /*unused*/)
|
||||
const uint32_t /*path_flag*/)
|
||||
{
|
||||
return INTEGRATOR_STATE(state, path, transparent_bounce);
|
||||
}
|
||||
|
||||
ccl_device_inline int integrator_state_transparent_bounce(ConstIntegratorShadowState state,
|
||||
const int /*unused*/)
|
||||
const uint32_t /*path_flag*/)
|
||||
{
|
||||
return INTEGRATOR_STATE(state, shadow_path, transparent_bounce);
|
||||
}
|
||||
|
||||
ccl_device_inline int integrator_state_portal_bounce(KernelGlobals kg,
|
||||
ConstIntegratorState state,
|
||||
const int /*unused*/)
|
||||
const uint32_t /*path_flag*/)
|
||||
{
|
||||
return (kernel_data.kernel_features & KERNEL_FEATURE_NODE_PORTAL) ?
|
||||
INTEGRATOR_STATE(state, path, portal_bounce) :
|
||||
|
|
@ -542,7 +543,7 @@ ccl_device_inline int integrator_state_portal_bounce(KernelGlobals kg,
|
|||
|
||||
ccl_device_inline int integrator_state_portal_bounce(KernelGlobals kg,
|
||||
ConstIntegratorShadowState state,
|
||||
const int /*unused*/)
|
||||
const uint32_t /*path_flag*/)
|
||||
{
|
||||
return (kernel_data.kernel_features & KERNEL_FEATURE_NODE_PORTAL) ?
|
||||
INTEGRATOR_STATE(state, shadow_path, portal_bounce) :
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ ccl_device_inline bool subsurface_scatter(KernelGlobals kg, IntegratorState stat
|
|||
/* Update volume stack if needed. */
|
||||
if (kernel_data.integrator.use_volumes) {
|
||||
const int object = ss_isect.hits[0].object;
|
||||
const int object_flag = kernel_data_fetch(object_flag, object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object);
|
||||
|
||||
if (object_flag & SD_OBJECT_INTERSECTS_VOLUME) {
|
||||
const float3 P = INTEGRATOR_STATE(state, ray, P);
|
||||
|
|
@ -216,7 +216,7 @@ ccl_device_inline bool subsurface_scatter(KernelGlobals kg, IntegratorState stat
|
|||
|
||||
const int shader = intersection_get_shader(kg, &ss_isect.hits[0]);
|
||||
const int shader_flags = kernel_data_fetch(shaders, shader).flags;
|
||||
const int object_flags = intersection_get_object_flags(kg, &ss_isect.hits[0]);
|
||||
const uint object_flags = intersection_get_object_flags(kg, &ss_isect.hits[0]);
|
||||
const bool use_caustics = kernel_data.integrator.use_caustics &&
|
||||
(object_flags & SD_OBJECT_CAUSTICS);
|
||||
const bool use_raytrace_kernel = (shader_flags & SD_HAS_RAYTRACE);
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ ccl_device_inline bool subsurface_disk(KernelGlobals kg,
|
|||
for (int hit = 0; hit < num_eval_hits; hit++) {
|
||||
/* Get geometric normal. */
|
||||
const int object = ss_isect.hits[hit].object;
|
||||
const int object_flag = kernel_data_fetch(object_flag, object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object);
|
||||
float3 hit_Ng = ss_isect.Ng[hit];
|
||||
if (path_flag & PATH_RAY_SUBSURFACE_BACKFACING) {
|
||||
hit_Ng = -hit_Ng;
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ ccl_device_inline bool volume_is_homogeneous(KernelGlobals kg,
|
|||
return true;
|
||||
}
|
||||
|
||||
const int object_flag = kernel_data_fetch(object_flag, object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object);
|
||||
if (object_flag & SD_OBJECT_HAS_VOLUME_ATTRIBUTES) {
|
||||
/* If both the shader and the object needs volume attributes, the volume is heterogeneous. */
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ ccl_device void light_tree_to_local_space(KernelGlobals kg,
|
|||
ccl_private float3 &N_or_D,
|
||||
ccl_private float &t)
|
||||
{
|
||||
const int object_flag = kernel_data_fetch(object_flag, object_id);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object_id);
|
||||
if (!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) {
|
||||
#ifdef __OBJECT_MOTION__
|
||||
Transform itfm;
|
||||
|
|
@ -286,7 +286,7 @@ ccl_device bool compute_emitter_centroid_and_dir(KernelGlobals kg,
|
|||
if (is_back_only) {
|
||||
dir = -dir;
|
||||
}
|
||||
const int object_flag = kernel_data_fetch(object_flag, object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object);
|
||||
if ((object_flag & SD_OBJECT_TRANSFORM_APPLIED) && (object_flag & SD_OBJECT_NEGATIVE_SCALE))
|
||||
{
|
||||
dir = -dir;
|
||||
|
|
@ -815,7 +815,7 @@ ccl_device float light_tree_pdf(KernelGlobals kg,
|
|||
float3 P,
|
||||
float3 N,
|
||||
const float dt,
|
||||
const int path_flag,
|
||||
const uint32_t path_flag,
|
||||
const int object_emitter,
|
||||
const uint index_emitter,
|
||||
const int object_receiver)
|
||||
|
|
@ -931,7 +931,7 @@ ccl_device float light_tree_pdf(KernelGlobals kg,
|
|||
float3 P,
|
||||
const float3 N,
|
||||
const float dt,
|
||||
const int path_flag,
|
||||
const uint32_t path_flag,
|
||||
const int emitter_object,
|
||||
const uint emitter_id,
|
||||
const int object_receiver)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ ccl_device_inline bool triangle_world_space_vertices(
|
|||
KernelGlobals kg, const int object, const int prim, const float time, float3 V[3])
|
||||
{
|
||||
bool has_motion = false;
|
||||
const int object_flag = kernel_data_fetch(object_flag, object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object);
|
||||
|
||||
if (object_flag & SD_OBJECT_HAS_VERTEX_MOTION && time >= 0.0f) {
|
||||
motion_triangle_vertices(kg, object, prim, time, V);
|
||||
|
|
@ -146,7 +146,7 @@ ccl_device_forceinline bool triangle_light_sample(KernelGlobals kg,
|
|||
const float longest_edge_squared = max(len_squared(e0), max(len_squared(e1), len_squared(e2)));
|
||||
float3 N0 = cross(e0, e1);
|
||||
/* Flip normal if necessary. */
|
||||
const int object_flag = kernel_data_fetch(object_flag, object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object);
|
||||
if (object_flag & SD_OBJECT_NEGATIVE_SCALE) {
|
||||
N0 = -N0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ ccl_device float3 svm_bevel(
|
|||
/* Get geometric normal. */
|
||||
float3 hit_Ng = isect.Ng[hit];
|
||||
const int object = isect.hits[hit].object;
|
||||
const int object_flag = kernel_data_fetch(object_flag, object);
|
||||
const uint object_flag = kernel_data_fetch(object_flag, object);
|
||||
if (object_negative_scale_applied(object_flag)) {
|
||||
hit_Ng = -hit_Ng;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,13 +116,13 @@ ccl_device void svm_eval_nodes(KernelGlobals kg,
|
|||
SVM_CASE(NODE_SHADER_JUMP)
|
||||
{
|
||||
if (type == SHADER_TYPE_SURFACE) {
|
||||
offset = node.y;
|
||||
offset = int(node.y);
|
||||
}
|
||||
else if (type == SHADER_TYPE_VOLUME) {
|
||||
offset = node.z;
|
||||
offset = int(node.z);
|
||||
}
|
||||
else if (type == SHADER_TYPE_DISPLACEMENT) {
|
||||
offset = node.w;
|
||||
offset = int(node.w);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -898,31 +898,31 @@ enum ShaderDataFlag {
|
|||
};
|
||||
|
||||
/* Object flags. */
|
||||
enum ShaderDataObjectFlag {
|
||||
enum ShaderDataObjectFlag : uint {
|
||||
/* Holdout for camera rays. */
|
||||
SD_OBJECT_HOLDOUT_MASK = (1 << 0),
|
||||
SD_OBJECT_HOLDOUT_MASK = (1u << 0),
|
||||
/* Has object motion blur. */
|
||||
SD_OBJECT_MOTION = (1 << 1),
|
||||
SD_OBJECT_MOTION = (1u << 1),
|
||||
/* Vertices have transform applied. */
|
||||
SD_OBJECT_TRANSFORM_APPLIED = (1 << 2),
|
||||
SD_OBJECT_TRANSFORM_APPLIED = (1u << 2),
|
||||
/* The object's transform applies a negative scale. */
|
||||
SD_OBJECT_NEGATIVE_SCALE = (1 << 3),
|
||||
SD_OBJECT_NEGATIVE_SCALE = (1u << 3),
|
||||
/* Object has a volume shader. */
|
||||
SD_OBJECT_HAS_VOLUME = (1 << 4),
|
||||
SD_OBJECT_HAS_VOLUME = (1u << 4),
|
||||
/* Object intersects AABB of an object with volume shader. */
|
||||
SD_OBJECT_INTERSECTS_VOLUME = (1 << 5),
|
||||
SD_OBJECT_INTERSECTS_VOLUME = (1u << 5),
|
||||
/* Has position for motion vertices. */
|
||||
SD_OBJECT_HAS_VERTEX_MOTION = (1 << 6),
|
||||
SD_OBJECT_HAS_VERTEX_MOTION = (1u << 6),
|
||||
/* object is used to catch shadows */
|
||||
SD_OBJECT_SHADOW_CATCHER = (1 << 7),
|
||||
SD_OBJECT_SHADOW_CATCHER = (1u << 7),
|
||||
/* object has volume attributes */
|
||||
SD_OBJECT_HAS_VOLUME_ATTRIBUTES = (1 << 8),
|
||||
SD_OBJECT_HAS_VOLUME_ATTRIBUTES = (1u << 8),
|
||||
/* object is caustics caster */
|
||||
SD_OBJECT_CAUSTICS_CASTER = (1 << 9),
|
||||
SD_OBJECT_CAUSTICS_CASTER = (1u << 9),
|
||||
/* object is caustics receiver */
|
||||
SD_OBJECT_CAUSTICS_RECEIVER = (1 << 10),
|
||||
SD_OBJECT_CAUSTICS_RECEIVER = (1u << 10),
|
||||
/* object has attribute for volume motion */
|
||||
SD_OBJECT_HAS_VOLUME_MOTION = (1 << 11),
|
||||
SD_OBJECT_HAS_VOLUME_MOTION = (1u << 11),
|
||||
|
||||
/* object is using caustics */
|
||||
SD_OBJECT_CAUSTICS = (SD_OBJECT_CAUSTICS_CASTER | SD_OBJECT_CAUSTICS_RECEIVER),
|
||||
|
|
@ -952,7 +952,7 @@ struct ccl_align(16) ShaderData {
|
|||
/* booleans describing shader, see ShaderDataFlag */
|
||||
int flag;
|
||||
/* booleans describing object of the shader, see ShaderDataObjectFlag */
|
||||
int object_flag;
|
||||
uint object_flag;
|
||||
|
||||
/* Closure data, we store a fixed array of closures */
|
||||
int num_closure;
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ __forceinline uint64_t bitscan(const uint64_t v)
|
|||
/* Intrinsic functions fallback for arbitrary processor. */
|
||||
__forceinline uint32_t __bsf(const uint32_t x)
|
||||
{
|
||||
for (int i = 0; i < 32; i++) {
|
||||
for (uint32_t i = 0; i < 32; i++) {
|
||||
if (x & (1U << i)) {
|
||||
return i;
|
||||
}
|
||||
|
|
@ -406,7 +406,7 @@ __forceinline uint32_t __bsf(const uint32_t x)
|
|||
|
||||
__forceinline uint32_t __bsr(const uint32_t x)
|
||||
{
|
||||
for (int i = 0; i < 32; i++) {
|
||||
for (uint32_t i = 0; i < 32; i++) {
|
||||
if (x & (1U << (31 - i))) {
|
||||
return (31 - i);
|
||||
}
|
||||
|
|
@ -422,7 +422,7 @@ __forceinline uint32_t __btc(const uint32_t x, const uint32_t bit)
|
|||
|
||||
__forceinline uint32_t __bsf(const uint64_t x)
|
||||
{
|
||||
for (int i = 0; i < 64; i++) {
|
||||
for (uint32_t i = 0; i < 64; i++) {
|
||||
if (x & (1UL << i)) {
|
||||
return i;
|
||||
}
|
||||
|
|
@ -432,7 +432,7 @@ __forceinline uint32_t __bsf(const uint64_t x)
|
|||
|
||||
__forceinline uint32_t __bsr(const uint64_t x)
|
||||
{
|
||||
for (int i = 0; i < 64; i++) {
|
||||
for (uint32_t i = 0; i < 64; i++) {
|
||||
if (x & (1UL << (63 - i))) {
|
||||
return (63 - i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@ ccl_device_inline void transform_compose(ccl_private Transform *tfm,
|
|||
/* Interpolate from array of decomposed transforms. */
|
||||
ccl_device void transform_motion_array_interpolate(ccl_private Transform *tfm,
|
||||
const ccl_global DecomposedTransform *motion,
|
||||
const uint numsteps,
|
||||
const int numsteps,
|
||||
const float time)
|
||||
{
|
||||
/* Figure out which steps we need to interpolate. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue