Fix T64762: incorrect textures for non-color images with an alpha channel
This commit is contained in:
@@ -61,6 +61,7 @@ const char *IMB_colormanagement_get_rect_colorspace(struct ImBuf *ibuf);
|
||||
bool IMB_colormanagement_space_is_data(struct ColorSpace *colorspace);
|
||||
bool IMB_colormanagement_space_is_scene_linear(struct ColorSpace *colorspace);
|
||||
bool IMB_colormanagement_space_is_srgb(struct ColorSpace *colorspace);
|
||||
bool IMB_colormanagement_space_name_is_data(const char *name);
|
||||
|
||||
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3]);
|
||||
BLI_INLINE unsigned char IMB_colormanagement_get_luminance_byte(const unsigned char[3]);
|
||||
|
||||
@@ -1381,6 +1381,12 @@ bool IMB_colormanagement_space_is_srgb(ColorSpace *colorspace)
|
||||
return (colorspace && colorspace->info.is_srgb);
|
||||
}
|
||||
|
||||
bool IMB_colormanagement_space_name_is_data(const char *name)
|
||||
{
|
||||
ColorSpace *colorspace = colormanage_colorspace_get_named(name);
|
||||
return (colorspace && colorspace->is_data);
|
||||
}
|
||||
|
||||
/*********************** Threaded display buffer transform routines *************************/
|
||||
|
||||
typedef struct DisplayBufferThread {
|
||||
|
||||
@@ -60,8 +60,7 @@
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "IMB_imbuf_types.h"
|
||||
#include "IMB_imbuf.h"
|
||||
#include "IMB_colormanagement.h"
|
||||
|
||||
#include "RE_pipeline.h"
|
||||
#include "RE_shader_ext.h"
|
||||
|
||||
@@ -180,7 +180,8 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
if (out[0].hasoutput) {
|
||||
if (out[1].hasoutput) {
|
||||
if (out[1].hasoutput &&
|
||||
!IMB_colormanagement_space_name_is_data(ima->colorspace_settings.name)) {
|
||||
GPU_link(mat, "tex_color_alpha_unpremultiply", out[0].link, &out[0].link);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user