Differential D16826 Diff 59819 source/blender/draw/engines/workbench/shaders/workbench_image_lib.glsl
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/workbench/shaders/workbench_image_lib.glsl
| Show All 21 Lines | bool node_tex_tile_lookup(inout vec3 co, sampler2DArray ima, sampler1DArray map) | ||||
| vec4 tile_info = texelFetch(map, ivec2(tile, 1), 0); | vec4 tile_info = texelFetch(map, ivec2(tile, 1), 0); | ||||
| co = vec3(((co.xy - tile_pos) * tile_info.zw) + tile_info.xy, tile_layer); | co = vec3(((co.xy - tile_pos) * tile_info.zw) + tile_info.xy, tile_layer); | ||||
| return true; | return true; | ||||
| } | } | ||||
| vec3 workbench_image_color(vec2 uvs) | vec3 workbench_image_color(vec2 uvs) | ||||
| { | { | ||||
| #ifdef V3D_SHADING_TEXTURE_COLOR | #ifdef WORKBENCH_COLOR_TEXTURE | ||||
| vec4 color; | vec4 color; | ||||
| # ifdef TEXTURE_IMAGE_ARRAY | # ifdef WORKBENCH_NEXT | ||||
| vec3 co = vec3(uvs, 0.0); | |||||
| if (isImageTile) { | |||||
| if (node_tex_tile_lookup(co, imageTileArray, imageTileData)) { | |||||
| color = texture(imageTileArray, co); | |||||
| } | |||||
| else { | |||||
| color = vec4(1.0, 0.0, 1.0, 1.0); | |||||
| } | |||||
| } | |||||
| else { | |||||
| color = texture(imageTexture, uvs); | |||||
| } | |||||
| # else // WORKBENCH_NEXT | |||||
| # ifdef WORKBENCH_TEXTURE_IMAGE_ARRAY | |||||
| vec3 co = vec3(uvs, 0.0); | vec3 co = vec3(uvs, 0.0); | ||||
| if (node_tex_tile_lookup(co, imageTileArray, imageTileData)) { | if (node_tex_tile_lookup(co, imageTileArray, imageTileData)) { | ||||
| color = texture(imageTileArray, co); | color = texture(imageTileArray, co); | ||||
| } | } | ||||
| else { | else { | ||||
| color = vec4(1.0, 0.0, 1.0, 1.0); | color = vec4(1.0, 0.0, 1.0, 1.0); | ||||
| } | } | ||||
| # else | # else | ||||
| color = texture(imageTexture, uvs); | color = texture(imageTexture, uvs); | ||||
| # endif | # endif | ||||
| # endif // WORKBENCH_NEXT | |||||
| /* Unpremultiply if stored multiplied, since straight alpha is expected by shaders. */ | /* Unpremultiply if stored multiplied, since straight alpha is expected by shaders. */ | ||||
| if (imagePremult && !(color.a == 0.0 || color.a == 1.0)) { | if (imagePremult && !(color.a == 0.0 || color.a == 1.0)) { | ||||
| color.rgb /= color.a; | color.rgb /= color.a; | ||||
| } | } | ||||
| # ifdef GPU_FRAGMENT_SHADER | # ifdef GPU_FRAGMENT_SHADER | ||||
| if (color.a < imageTransparencyCutoff) { | if (color.a < imageTransparencyCutoff) { | ||||
| discard; | discard; | ||||
| Show All 9 Lines | |||||