Fix #111532: Partial Update Byte Data Texture with Scaling Broken
When texture painting on a Non-color byte texture with Texture limit active (or the texture didn't fit on the GPU) the data for partial updating of a GPU texture was incorrect. `gpu_texture_update_scaled` expects an input buffer clipped to the bounds of the input area that needs to be updated. In case for Byte textures with Non Color colorspace it received the unmodified input buffer, resulting in incorrect data to be uploaded to the GPU texture. This PR fixes this by selecting the non-optimized branch when the texture is a Byte buffer with Data color space and scaling should happen. Pull Request: https://projects.blender.org/blender/blender/pulls/112834
This commit is contained in:
parent
eefeb3ee22
commit
a6d6251b6e
|
@ -769,13 +769,15 @@ static void gpu_texture_update_from_ibuf(
|
|||
}
|
||||
else {
|
||||
/* Byte image is in original colorspace from the file, and may need conversion. */
|
||||
if (IMB_colormanagement_space_is_data(ibuf->byte_buffer.colorspace)) {
|
||||
/* Non-color data, just store buffer as is. */
|
||||
if (IMB_colormanagement_space_is_data(ibuf->byte_buffer.colorspace) && !scaled) {
|
||||
/* Not scaled Non-color data, just store buffer as is. */
|
||||
}
|
||||
else if (IMB_colormanagement_space_is_srgb(ibuf->byte_buffer.colorspace) ||
|
||||
IMB_colormanagement_space_is_scene_linear(ibuf->byte_buffer.colorspace))
|
||||
IMB_colormanagement_space_is_scene_linear(ibuf->byte_buffer.colorspace) ||
|
||||
IMB_colormanagement_space_is_data(ibuf->byte_buffer.colorspace))
|
||||
{
|
||||
/* sRGB or scene linear, store as byte texture that the GPU can decode directly. */
|
||||
/* sRGB or scene linear or scaled down non-color data , store as byte texture that the GPU
|
||||
* can decode directly. */
|
||||
rect = (uchar *)MEM_mallocN(sizeof(uchar[4]) * w * h, __func__);
|
||||
if (rect == nullptr) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue