Cycles: Adding native support for UINT16 textures.
Textures in 16 bit integer format are sometimes used for displacement, bump and normal maps and can be exported by tools like Substance Painter. Without this patch, Cycles would promote those textures to single precision floating point, causing them to take up twice as much memory as needed. Reviewers: #cycles, brecht, sergey Reviewed By: #cycles, brecht, sergey Subscribers: sergey, dingto, #cycles Tags: #cycles Differential Revision: https://developer.blender.org/D3523
This commit is contained in:
@@ -54,11 +54,23 @@ ccl_device_inline float4 svm_image_texture_read(KernelGlobals *kg, const ccl_glo
|
||||
float f = 1.0f/255.0f;
|
||||
return make_float4(r.x*f, r.y*f, r.z*f, r.w*f);
|
||||
}
|
||||
/* Ushort4 */
|
||||
else if(texture_type == IMAGE_DATA_TYPE_USHORT4) {
|
||||
ushort4 r = tex_fetch(ushort4, info, offset);
|
||||
float f = 1.0f/65535.f;
|
||||
return make_float4(r.x*f, r.y*f, r.z*f, r.w*f);
|
||||
}
|
||||
/* Float */
|
||||
else if(texture_type == IMAGE_DATA_TYPE_FLOAT) {
|
||||
float f = tex_fetch(float, info, offset);
|
||||
return make_float4(f, f, f, 1.0f);
|
||||
}
|
||||
/* UShort */
|
||||
else if(texture_type == IMAGE_DATA_TYPE_USHORT) {
|
||||
ushort r = tex_fetch(ushort, info, offset);
|
||||
float f = r * (1.0f / 65535.0f);
|
||||
return make_float4(f, f, f, 1.0f);
|
||||
}
|
||||
/* Byte */
|
||||
else {
|
||||
uchar r = tex_fetch(uchar, info, offset);
|
||||
|
||||
Reference in New Issue
Block a user