diff options
Diffstat (limited to 'intern/cycles/kernel/geom/subd_triangle.h')
-rw-r--r-- | intern/cycles/kernel/geom/subd_triangle.h | 119 |
1 files changed, 58 insertions, 61 deletions
diff --git a/intern/cycles/kernel/geom/subd_triangle.h b/intern/cycles/kernel/geom/subd_triangle.h index 24e1e454b8c..8b73b342e16 100644 --- a/intern/cycles/kernel/geom/subd_triangle.h +++ b/intern/cycles/kernel/geom/subd_triangle.h @@ -13,11 +13,11 @@ ccl_device_inline void subd_triangle_patch_uv(KernelGlobals kg, ccl_private const ShaderData *sd, float2 uv[3]) { - uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, sd->prim); + uint4 tri_vindex = kernel_data_fetch(tri_vindex, sd->prim); - uv[0] = kernel_tex_fetch(__tri_patch_uv, tri_vindex.x); - uv[1] = kernel_tex_fetch(__tri_patch_uv, tri_vindex.y); - uv[2] = kernel_tex_fetch(__tri_patch_uv, tri_vindex.z); + uv[0] = kernel_data_fetch(tri_patch_uv, tri_vindex.x); + uv[1] = kernel_data_fetch(tri_patch_uv, tri_vindex.y); + uv[2] = kernel_data_fetch(tri_patch_uv, tri_vindex.z); } /* Vertex indices of patch */ @@ -26,10 +26,10 @@ ccl_device_inline uint4 subd_triangle_patch_indices(KernelGlobals kg, int patch) { uint4 indices; - indices.x = kernel_tex_fetch(__patches, patch + 0); - indices.y = kernel_tex_fetch(__patches, patch + 1); - indices.z = kernel_tex_fetch(__patches, patch + 2); - indices.w = kernel_tex_fetch(__patches, patch + 3); + indices.x = kernel_data_fetch(patches, patch + 0); + indices.y = kernel_data_fetch(patches, patch + 1); + indices.z = kernel_data_fetch(patches, patch + 2); + indices.w = kernel_data_fetch(patches, patch + 3); return indices; } @@ -38,14 +38,14 @@ ccl_device_inline uint4 subd_triangle_patch_indices(KernelGlobals kg, int patch) ccl_device_inline uint subd_triangle_patch_face(KernelGlobals kg, int patch) { - return kernel_tex_fetch(__patches, patch + 4); + return kernel_data_fetch(patches, patch + 4); } /* Number of corners on originating face */ ccl_device_inline uint subd_triangle_patch_num_corners(KernelGlobals kg, int patch) { - return kernel_tex_fetch(__patches, patch + 5) & 0xffff; + return kernel_data_fetch(patches, patch + 5) & 0xffff; } /* Indices of the four corners that are used by the patch */ @@ -54,10 +54,10 @@ ccl_device_inline void subd_triangle_patch_corners(KernelGlobals kg, int patch, { uint4 data; - data.x = kernel_tex_fetch(__patches, patch + 4); - data.y = kernel_tex_fetch(__patches, patch + 5); - data.z = kernel_tex_fetch(__patches, patch + 6); - data.w = kernel_tex_fetch(__patches, patch + 7); + data.x = kernel_data_fetch(patches, patch + 4); + data.y = kernel_data_fetch(patches, patch + 5); + data.z = kernel_data_fetch(patches, patch + 6); + data.w = kernel_data_fetch(patches, patch + 7); int num_corners = data.y & 0xffff; @@ -141,7 +141,7 @@ ccl_device_noinline float subd_triangle_attribute_float(KernelGlobals kg, if (dy) *dy = 0.0f; - return kernel_tex_fetch(__attributes_float, desc.offset + subd_triangle_patch_face(kg, patch)); + return kernel_data_fetch(attributes_float, desc.offset + subd_triangle_patch_face(kg, patch)); } else if (desc.element == ATTR_ELEMENT_VERTEX || desc.element == ATTR_ELEMENT_VERTEX_MOTION) { float2 uv[3]; @@ -149,10 +149,10 @@ ccl_device_noinline float subd_triangle_attribute_float(KernelGlobals kg, uint4 v = subd_triangle_patch_indices(kg, patch); - float f0 = kernel_tex_fetch(__attributes_float, desc.offset + v.x); - float f1 = kernel_tex_fetch(__attributes_float, desc.offset + v.y); - float f2 = kernel_tex_fetch(__attributes_float, desc.offset + v.z); - float f3 = kernel_tex_fetch(__attributes_float, desc.offset + v.w); + float f0 = kernel_data_fetch(attributes_float, desc.offset + v.x); + float f1 = kernel_data_fetch(attributes_float, desc.offset + v.y); + float f2 = kernel_data_fetch(attributes_float, desc.offset + v.z); + float f3 = kernel_data_fetch(attributes_float, desc.offset + v.w); if (subd_triangle_patch_num_corners(kg, patch) != 4) { f1 = (f1 + f0) * 0.5f; @@ -179,10 +179,10 @@ ccl_device_noinline float subd_triangle_attribute_float(KernelGlobals kg, int corners[4]; subd_triangle_patch_corners(kg, patch, corners); - float f0 = kernel_tex_fetch(__attributes_float, corners[0] + desc.offset); - float f1 = kernel_tex_fetch(__attributes_float, corners[1] + desc.offset); - float f2 = kernel_tex_fetch(__attributes_float, corners[2] + desc.offset); - float f3 = kernel_tex_fetch(__attributes_float, corners[3] + desc.offset); + float f0 = kernel_data_fetch(attributes_float, corners[0] + desc.offset); + float f1 = kernel_data_fetch(attributes_float, corners[1] + desc.offset); + float f2 = kernel_data_fetch(attributes_float, corners[2] + desc.offset); + float f3 = kernel_data_fetch(attributes_float, corners[3] + desc.offset); if (subd_triangle_patch_num_corners(kg, patch) != 4) { f1 = (f1 + f0) * 0.5f; @@ -208,7 +208,7 @@ ccl_device_noinline float subd_triangle_attribute_float(KernelGlobals kg, if (dy) *dy = 0.0f; - return kernel_tex_fetch(__attributes_float, desc.offset); + return kernel_data_fetch(attributes_float, desc.offset); } else { if (dx) @@ -281,8 +281,7 @@ ccl_device_noinline float2 subd_triangle_attribute_float2(KernelGlobals kg, if (dy) *dy = make_float2(0.0f, 0.0f); - return kernel_tex_fetch(__attributes_float2, - desc.offset + subd_triangle_patch_face(kg, patch)); + return kernel_data_fetch(attributes_float2, desc.offset + subd_triangle_patch_face(kg, patch)); } else if (desc.element == ATTR_ELEMENT_VERTEX || desc.element == ATTR_ELEMENT_VERTEX_MOTION) { float2 uv[3]; @@ -290,10 +289,10 @@ ccl_device_noinline float2 subd_triangle_attribute_float2(KernelGlobals kg, uint4 v = subd_triangle_patch_indices(kg, patch); - float2 f0 = kernel_tex_fetch(__attributes_float2, desc.offset + v.x); - float2 f1 = kernel_tex_fetch(__attributes_float2, desc.offset + v.y); - float2 f2 = kernel_tex_fetch(__attributes_float2, desc.offset + v.z); - float2 f3 = kernel_tex_fetch(__attributes_float2, desc.offset + v.w); + float2 f0 = kernel_data_fetch(attributes_float2, desc.offset + v.x); + float2 f1 = kernel_data_fetch(attributes_float2, desc.offset + v.y); + float2 f2 = kernel_data_fetch(attributes_float2, desc.offset + v.z); + float2 f3 = kernel_data_fetch(attributes_float2, desc.offset + v.w); if (subd_triangle_patch_num_corners(kg, patch) != 4) { f1 = (f1 + f0) * 0.5f; @@ -322,10 +321,10 @@ ccl_device_noinline float2 subd_triangle_attribute_float2(KernelGlobals kg, float2 f0, f1, f2, f3; - f0 = kernel_tex_fetch(__attributes_float2, corners[0] + desc.offset); - f1 = kernel_tex_fetch(__attributes_float2, corners[1] + desc.offset); - f2 = kernel_tex_fetch(__attributes_float2, corners[2] + desc.offset); - f3 = kernel_tex_fetch(__attributes_float2, corners[3] + desc.offset); + f0 = kernel_data_fetch(attributes_float2, corners[0] + desc.offset); + f1 = kernel_data_fetch(attributes_float2, corners[1] + desc.offset); + f2 = kernel_data_fetch(attributes_float2, corners[2] + desc.offset); + f3 = kernel_data_fetch(attributes_float2, corners[3] + desc.offset); if (subd_triangle_patch_num_corners(kg, patch) != 4) { f1 = (f1 + f0) * 0.5f; @@ -351,7 +350,7 @@ ccl_device_noinline float2 subd_triangle_attribute_float2(KernelGlobals kg, if (dy) *dy = make_float2(0.0f, 0.0f); - return kernel_tex_fetch(__attributes_float2, desc.offset); + return kernel_data_fetch(attributes_float2, desc.offset); } else { if (dx) @@ -423,8 +422,7 @@ ccl_device_noinline float3 subd_triangle_attribute_float3(KernelGlobals kg, if (dy) *dy = make_float3(0.0f, 0.0f, 0.0f); - return kernel_tex_fetch(__attributes_float3, - desc.offset + subd_triangle_patch_face(kg, patch)); + return kernel_data_fetch(attributes_float3, desc.offset + subd_triangle_patch_face(kg, patch)); } else if (desc.element == ATTR_ELEMENT_VERTEX || desc.element == ATTR_ELEMENT_VERTEX_MOTION) { float2 uv[3]; @@ -432,10 +430,10 @@ ccl_device_noinline float3 subd_triangle_attribute_float3(KernelGlobals kg, uint4 v = subd_triangle_patch_indices(kg, patch); - float3 f0 = kernel_tex_fetch(__attributes_float3, desc.offset + v.x); - float3 f1 = kernel_tex_fetch(__attributes_float3, desc.offset + v.y); - float3 f2 = kernel_tex_fetch(__attributes_float3, desc.offset + v.z); - float3 f3 = kernel_tex_fetch(__attributes_float3, desc.offset + v.w); + float3 f0 = kernel_data_fetch(attributes_float3, desc.offset + v.x); + float3 f1 = kernel_data_fetch(attributes_float3, desc.offset + v.y); + float3 f2 = kernel_data_fetch(attributes_float3, desc.offset + v.z); + float3 f3 = kernel_data_fetch(attributes_float3, desc.offset + v.w); if (subd_triangle_patch_num_corners(kg, patch) != 4) { f1 = (f1 + f0) * 0.5f; @@ -464,10 +462,10 @@ ccl_device_noinline float3 subd_triangle_attribute_float3(KernelGlobals kg, float3 f0, f1, f2, f3; - f0 = kernel_tex_fetch(__attributes_float3, corners[0] + desc.offset); - f1 = kernel_tex_fetch(__attributes_float3, corners[1] + desc.offset); - f2 = kernel_tex_fetch(__attributes_float3, corners[2] + desc.offset); - f3 = kernel_tex_fetch(__attributes_float3, corners[3] + desc.offset); + f0 = kernel_data_fetch(attributes_float3, corners[0] + desc.offset); + f1 = kernel_data_fetch(attributes_float3, corners[1] + desc.offset); + f2 = kernel_data_fetch(attributes_float3, corners[2] + desc.offset); + f3 = kernel_data_fetch(attributes_float3, corners[3] + desc.offset); if (subd_triangle_patch_num_corners(kg, patch) != 4) { f1 = (f1 + f0) * 0.5f; @@ -493,7 +491,7 @@ ccl_device_noinline float3 subd_triangle_attribute_float3(KernelGlobals kg, if (dy) *dy = make_float3(0.0f, 0.0f, 0.0f); - return kernel_tex_fetch(__attributes_float3, desc.offset); + return kernel_data_fetch(attributes_float3, desc.offset); } else { if (dx) @@ -570,8 +568,7 @@ ccl_device_noinline float4 subd_triangle_attribute_float4(KernelGlobals kg, if (dy) *dy = zero_float4(); - return kernel_tex_fetch(__attributes_float4, - desc.offset + subd_triangle_patch_face(kg, patch)); + return kernel_data_fetch(attributes_float4, desc.offset + subd_triangle_patch_face(kg, patch)); } else if (desc.element == ATTR_ELEMENT_VERTEX || desc.element == ATTR_ELEMENT_VERTEX_MOTION) { float2 uv[3]; @@ -579,10 +576,10 @@ ccl_device_noinline float4 subd_triangle_attribute_float4(KernelGlobals kg, uint4 v = subd_triangle_patch_indices(kg, patch); - float4 f0 = kernel_tex_fetch(__attributes_float4, desc.offset + v.x); - float4 f1 = kernel_tex_fetch(__attributes_float4, desc.offset + v.y); - float4 f2 = kernel_tex_fetch(__attributes_float4, desc.offset + v.z); - float4 f3 = kernel_tex_fetch(__attributes_float4, desc.offset + v.w); + float4 f0 = kernel_data_fetch(attributes_float4, desc.offset + v.x); + float4 f1 = kernel_data_fetch(attributes_float4, desc.offset + v.y); + float4 f2 = kernel_data_fetch(attributes_float4, desc.offset + v.z); + float4 f3 = kernel_data_fetch(attributes_float4, desc.offset + v.w); if (subd_triangle_patch_num_corners(kg, patch) != 4) { f1 = (f1 + f0) * 0.5f; @@ -613,19 +610,19 @@ ccl_device_noinline float4 subd_triangle_attribute_float4(KernelGlobals kg, if (desc.element == ATTR_ELEMENT_CORNER_BYTE) { f0 = color_srgb_to_linear_v4( - color_uchar4_to_float4(kernel_tex_fetch(__attributes_uchar4, corners[0] + desc.offset))); + color_uchar4_to_float4(kernel_data_fetch(attributes_uchar4, corners[0] + desc.offset))); f1 = color_srgb_to_linear_v4( - color_uchar4_to_float4(kernel_tex_fetch(__attributes_uchar4, corners[1] + desc.offset))); + color_uchar4_to_float4(kernel_data_fetch(attributes_uchar4, corners[1] + desc.offset))); f2 = color_srgb_to_linear_v4( - color_uchar4_to_float4(kernel_tex_fetch(__attributes_uchar4, corners[2] + desc.offset))); + color_uchar4_to_float4(kernel_data_fetch(attributes_uchar4, corners[2] + desc.offset))); f3 = color_srgb_to_linear_v4( - color_uchar4_to_float4(kernel_tex_fetch(__attributes_uchar4, corners[3] + desc.offset))); + color_uchar4_to_float4(kernel_data_fetch(attributes_uchar4, corners[3] + desc.offset))); } else { - f0 = kernel_tex_fetch(__attributes_float4, corners[0] + desc.offset); - f1 = kernel_tex_fetch(__attributes_float4, corners[1] + desc.offset); - f2 = kernel_tex_fetch(__attributes_float4, corners[2] + desc.offset); - f3 = kernel_tex_fetch(__attributes_float4, corners[3] + desc.offset); + f0 = kernel_data_fetch(attributes_float4, corners[0] + desc.offset); + f1 = kernel_data_fetch(attributes_float4, corners[1] + desc.offset); + f2 = kernel_data_fetch(attributes_float4, corners[2] + desc.offset); + f3 = kernel_data_fetch(attributes_float4, corners[3] + desc.offset); } if (subd_triangle_patch_num_corners(kg, patch) != 4) { @@ -652,7 +649,7 @@ ccl_device_noinline float4 subd_triangle_attribute_float4(KernelGlobals kg, if (dy) *dy = zero_float4(); - return kernel_tex_fetch(__attributes_float4, desc.offset); + return kernel_data_fetch(attributes_float4, desc.offset); } else { if (dx) |