diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-01-04 17:05:37 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-01-04 17:05:37 +0300 |
commit | c6e5b3f42dfc05e911ef30df12821138e1225e91 (patch) | |
tree | 383a0851bfe57d31e4ffba8e07791dd869e03a57 /source/blender/gpu | |
parent | c716b9862aa21b920e395d5acd751dccb2472e89 (diff) |
Fix T84095: Eevee vextex color isn't working with hair
Regression introduced by {c766d9b9dc56}. When converting the vertex
buffer to a texture buffer the fetch mode wasn't checked and the short
was bitwise interpreted as a float. This change checks the fetch_mode
and select the correct texture buffer.
This could also be added to other places when needed. At this time it is
only added here to support vertex colors when used with hair particles.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_texture_private.hh | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh index efa8be2a547..4197d5c55fc 100644 --- a/source/blender/gpu/intern/gpu_texture_private.hh +++ b/source/blender/gpu/intern/gpu_texture_private.hh @@ -540,7 +540,18 @@ static inline eGPUTextureFormat to_texture_format(const GPUVertFormat *format) case GPU_COMP_I16: return GPU_RGBA16I; case GPU_COMP_U16: - return GPU_RGBA16UI; + /* Note: Checking the fetch mode to select the right GPU texture format. This can be + * added to other formats as well. */ + switch (format->attrs[0].fetch_mode) { + case GPU_FETCH_INT: + return GPU_RGBA16UI; + case GPU_FETCH_INT_TO_FLOAT_UNIT: + return GPU_RGBA16; + case GPU_FETCH_INT_TO_FLOAT: + return GPU_RGBA16F; + case GPU_FETCH_FLOAT: + return GPU_RGBA16F; + } case GPU_COMP_I32: return GPU_RGBA32I; case GPU_COMP_U32: |