forked from bartvdbraak/blender
Fix T82884: Cycles Compilation Error OpenCL/NanoVDB
Recent changes introduced `acc` parameter into the texture read functions. When nanovdb isn't enabled this leads to compilation errors as the `acc` variable wasn't defined. OpenCL only compiles needed features what made it more prominent. Reviewed By: Patrick Mours Differential Revision: https://developer.blender.org/D9629
This commit is contained in:
parent
8351760ed0
commit
b0a9081883
@ -273,6 +273,9 @@ ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals *kg, int id, float3 P
|
|||||||
y *= info->height;
|
y *= info->height;
|
||||||
z *= info->depth;
|
z *= info->depth;
|
||||||
}
|
}
|
||||||
|
# define NANOVDB_ACCESS_POINTER &acc
|
||||||
|
#else
|
||||||
|
# define NANOVDB_ACCESS_POINTER NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (interpolation == INTERPOLATION_CLOSEST) {
|
if (interpolation == INTERPOLATION_CLOSEST) {
|
||||||
@ -282,7 +285,7 @@ ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals *kg, int id, float3 P
|
|||||||
svm_image_texture_frac(y, &iy);
|
svm_image_texture_frac(y, &iy);
|
||||||
svm_image_texture_frac(z, &iz);
|
svm_image_texture_frac(z, &iz);
|
||||||
|
|
||||||
return svm_image_texture_read_3d(kg, id, &acc, ix, iy, iz);
|
return svm_image_texture_read_3d(kg, id, NANOVDB_ACCESS_POINTER, ix, iy, iz);
|
||||||
}
|
}
|
||||||
else if (interpolation == INTERPOLATION_LINEAR) {
|
else if (interpolation == INTERPOLATION_LINEAR) {
|
||||||
/* Trilinear interpolation. */
|
/* Trilinear interpolation. */
|
||||||
@ -293,15 +296,22 @@ ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals *kg, int id, float3 P
|
|||||||
|
|
||||||
float4 r;
|
float4 r;
|
||||||
r = (1.0f - tz) * (1.0f - ty) * (1.0f - tx) *
|
r = (1.0f - tz) * (1.0f - ty) * (1.0f - tx) *
|
||||||
svm_image_texture_read_3d(kg, id, &acc, ix, iy, iz);
|
svm_image_texture_read_3d(kg, id, NANOVDB_ACCESS_POINTER, ix, iy, iz);
|
||||||
r += (1.0f - tz) * (1.0f - ty) * tx * svm_image_texture_read_3d(kg, id, &acc, ix + 1, iy, iz);
|
r += (1.0f - tz) * (1.0f - ty) * tx *
|
||||||
r += (1.0f - tz) * ty * (1.0f - tx) * svm_image_texture_read_3d(kg, id, &acc, ix, iy + 1, iz);
|
svm_image_texture_read_3d(kg, id, NANOVDB_ACCESS_POINTER, ix + 1, iy, iz);
|
||||||
r += (1.0f - tz) * ty * tx * svm_image_texture_read_3d(kg, id, &acc, ix + 1, iy + 1, iz);
|
r += (1.0f - tz) * ty * (1.0f - tx) *
|
||||||
|
svm_image_texture_read_3d(kg, id, NANOVDB_ACCESS_POINTER, ix, iy + 1, iz);
|
||||||
|
r += (1.0f - tz) * ty * tx *
|
||||||
|
svm_image_texture_read_3d(kg, id, NANOVDB_ACCESS_POINTER, ix + 1, iy + 1, iz);
|
||||||
|
|
||||||
r += tz * (1.0f - ty) * (1.0f - tx) * svm_image_texture_read_3d(kg, id, &acc, ix, iy, iz + 1);
|
r += tz * (1.0f - ty) * (1.0f - tx) *
|
||||||
r += tz * (1.0f - ty) * tx * svm_image_texture_read_3d(kg, id, &acc, ix + 1, iy, iz + 1);
|
svm_image_texture_read_3d(kg, id, NANOVDB_ACCESS_POINTER, ix, iy, iz + 1);
|
||||||
r += tz * ty * (1.0f - tx) * svm_image_texture_read_3d(kg, id, &acc, ix, iy + 1, iz + 1);
|
r += tz * (1.0f - ty) * tx *
|
||||||
r += tz * ty * tx * svm_image_texture_read_3d(kg, id, &acc, ix + 1, iy + 1, iz + 1);
|
svm_image_texture_read_3d(kg, id, NANOVDB_ACCESS_POINTER, ix + 1, iy, iz + 1);
|
||||||
|
r += tz * ty * (1.0f - tx) *
|
||||||
|
svm_image_texture_read_3d(kg, id, NANOVDB_ACCESS_POINTER, ix, iy + 1, iz + 1);
|
||||||
|
r += tz * ty * tx *
|
||||||
|
svm_image_texture_read_3d(kg, id, NANOVDB_ACCESS_POINTER, ix + 1, iy + 1, iz + 1);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -322,13 +332,14 @@ ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals *kg, int id, float3 P
|
|||||||
for (int y = 0; y < 4; y++) {
|
for (int y = 0; y < 4; y++) {
|
||||||
for (int x = 0; x < 4; x++) {
|
for (int x = 0; x < 4; x++) {
|
||||||
float weight = u[x] * v[y] * w[z];
|
float weight = u[x] * v[y] * w[z];
|
||||||
r += weight *
|
r += weight * svm_image_texture_read_3d(
|
||||||
svm_image_texture_read_3d(kg, id, &acc, ix + x - 1, iy + y - 1, iz + z - 1);
|
kg, id, NANOVDB_ACCESS_POINTER, ix + x - 1, iy + y - 1, iz + z - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
#undef NANOVDB_ACCESS_POINTER
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef SET_CUBIC_SPLINE_WEIGHTS
|
#undef SET_CUBIC_SPLINE_WEIGHTS
|
||||||
|
Loading…
Reference in New Issue
Block a user