Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/modes/shaders/edit_mesh_overlay_geom_tri.glsl
| Context not available. | |||||
| layout(triangles) in; | layout(triangles) in; | ||||
| /* This is not perfect. Only a subset of intel gpus are affected. | |||||
| * This fix have some performance impact. | |||||
| * TODO Refine the range to only affect GPUs. */ | |||||
| #ifndef GPU_INTEL | |||||
| # undef INTEL_FIX | |||||
| #endif | |||||
| #ifdef EDGE_FIX | #ifdef EDGE_FIX | ||||
| /* To fix the edge artifacts, we render | /* To fix the edge artifacts, we render | ||||
| * an outline strip around the screenspace | * an outline strip around the screenspace | ||||
| Context not available. | |||||
| * and does not need interpolation */ | * and does not need interpolation */ | ||||
| flat out vec3 edgesCrease; | flat out vec3 edgesCrease; | ||||
| flat out vec3 edgesBweight; | flat out vec3 edgesBweight; | ||||
| flat out ivec3 flag; | |||||
| flat out vec4 faceColor; | flat out vec4 faceColor; | ||||
| flat out int clipCase; | flat out int clipCase; | ||||
| #ifdef VERTEX_SELECTION | #ifdef VERTEX_SELECTION | ||||
| Context not available. | |||||
| /* See fragment shader */ | /* See fragment shader */ | ||||
| noperspective out vec4 eData1; | noperspective out vec4 eData1; | ||||
| flat out vec4 eData2; | flat out vec4 eData2; | ||||
| /* Some intel gpu have problems with having the vertex position packed. */ | |||||
| #ifdef INTEL_FIX | |||||
| flat out vec2 eData3; | |||||
| #endif | |||||
| /* Some intel Gpu seems to have memory alignement problems. So adding a padding int */ | |||||
| #ifdef GPU_INTEL | |||||
| flat out ivec4 flag; | |||||
| #else | |||||
| flat out ivec3 flag; | |||||
| #endif | |||||
| #define VERTEX_ACTIVE (1 << 0) | #define VERTEX_ACTIVE (1 << 0) | ||||
| #define VERTEX_SELECTED (1 << 1) | #define VERTEX_SELECTED (1 << 1) | ||||
| Context not available. | |||||
| if (clipCase == 0) { | if (clipCase == 0) { | ||||
| /* Packing screen positions and 2 distances */ | /* Packing screen positions and 2 distances */ | ||||
| #ifdef INTEL_FIX | |||||
| eData1 = vec4(0.0); | |||||
| eData3 = pos[2]; | |||||
| #else | |||||
| eData1 = vec4(0.0, 0.0, pos[2]); | eData1 = vec4(0.0, 0.0, pos[2]); | ||||
| #endif | |||||
| eData2 = vec4(pos[1], pos[0]); | eData2 = vec4(pos[1], pos[0]); | ||||
| /* Only pass the first 2 distances */ | /* Only pass the first 2 distances */ | ||||
| Context not available. | |||||
| int v = i % 3; | int v = i % 3; | ||||
| /* Position of the "hidden" third vertex */ | /* Position of the "hidden" third vertex */ | ||||
| #ifdef INTEL_FIX | |||||
| eData3 = pos[vbe]; | |||||
| #else | |||||
| eData1.zw = pos[vbe]; | eData1.zw = pos[vbe]; | ||||
| #endif | |||||
| doVertex(v, pPos[v]); | doVertex(v, pPos[v]); | ||||
| doVertex(v, pPos[v] + vec4(fixvec[v], Z_OFFSET, 0.0)); | doVertex(v, pPos[v] + vec4(fixvec[v], Z_OFFSET, 0.0)); | ||||
| Context not available. | |||||