This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/draw/modes/shaders/object_outline_prepass_frag.glsl
Clément Foucault 3a08153d7a DRW: Refactor to support draw call batching
Reviewers: brecht

Differential Revision: D4997
2019-09-17 15:16:43 +02:00

19 lines
435 B
GLSL

/* Should be 2 bits only [0..3]. */
uniform int outlineId;
flat in int objectId;
/* using uint because 16bit uint can contain more ids than int. */
out uint outId;
/* Replace top 2 bits (of the 16bit output) by outlineId.
* This leaves 16K different IDs to create outlines between objects.
* SHIFT = (32 - (16 - 2)) */
#define SHIFT 18u
void main()
{
outId = (uint(outlineId) << 14u) | ((uint(objectId) << SHIFT) >> SHIFT);
}