Cycles: Remove incorrect dead code for CUDA 32bit textures #117818

Merged
Nikita Sirgienko merged 2 commits from Sirgienko/blender:removal_cuda_32bit_texture_dead_code into main 2024-02-05 13:53:59 +01:00
1 changed files with 11 additions and 6 deletions

View File

@ -733,6 +733,15 @@ void CUDADevice::tex_alloc(device_texture &mem)
}
/* Image Texture Storage */
/* Cycles expects to read all texture data as normalized float values in
* kernel/device/gpu/image.h. But storing all data as floats would be very inefficient due to the
* huge size of float textures. So in the code below, we define different texture types including
* integer types, with the aim of using CUDA's default promotion behavior of integer data to
* floating point data in the range [0, 1], as noted in the CUDA documentation on
* cuTexObjectCreate API Call.
* Note that 32-bit integers are not supported by this promotion behavior and cannot be used
* with Cycles's current implementation in kernel/device/gpu/image.h.
Sirgienko marked this conversation as resolved Outdated

There are some grammatical errors/typos, here's another suggestion:

Cycles expects to read all texture data as normalized float values in kernel/device/gpu/image.h.
Storing all data as floats would be very inefficient due to the huge size of float textures.
In the code below, we define different texture types including integer types, with the aim of using CUDA's default promotion behavior of integer data to floating point data in the range [0, 1], as noted in the CUDA documentation on cuTexObjectCreate API Call.
32-bit integers are not supported by this promotion behavior and cannot be used with Cycles's current implementation in kernel/device/gpu/image.h.

There are some grammatical errors/typos, here's another suggestion: > Cycles expects to read all texture data as normalized float values in kernel/device/gpu/image.h. Storing all data as floats would be very inefficient due to the huge size of float textures. In the code below, we define different texture types including integer types, with the aim of using CUDA's default promotion behavior of integer data to floating point data in the range [0, 1], as noted in the CUDA documentation on cuTexObjectCreate API Call. 32-bit integers are not supported by this promotion behavior and cannot be used with Cycles's current implementation in kernel/device/gpu/image.h.
*/
CUarray_format_enum format;
switch (mem.data_type) {
case TYPE_UCHAR:
@ -741,12 +750,6 @@ void CUDADevice::tex_alloc(device_texture &mem)
case TYPE_UINT16:
format = CU_AD_FORMAT_UNSIGNED_INT16;
break;
case TYPE_UINT:
format = CU_AD_FORMAT_UNSIGNED_INT32;
break;
case TYPE_INT:
format = CU_AD_FORMAT_SIGNED_INT32;
break;
case TYPE_FLOAT:
format = CU_AD_FORMAT_FLOAT;
break;
@ -900,6 +903,8 @@ void CUDADevice::tex_alloc(device_texture &mem)
texDesc.addressMode[1] = address_mode;
texDesc.addressMode[2] = address_mode;
texDesc.filterMode = filter_mode;
/* CUDA's flag CU_TRSF_READ_AS_INTEGER is intentionally not used and it is
* significant, see above an explanation about how Blender treat textures. */
texDesc.flags = CU_TRSF_NORMALIZED_COORDINATES;
thread_scoped_lock lock(device_mem_map_mutex);