const TEXT_SHADER_V: &str = "// Cell properties.\nlayout(location = 0) in vec2 gridCoords;\n\n// Glyph properties.\nlayout(location = 1) in vec4 glyph;\n\n// uv mapping.\nlayout(location = 2) in vec4 uv;\n\n// Text foreground rgb packed together with cell flags. textColor.a\n// are the bitflags; consult RenderingGlyphFlags in renderer/mod.rs\n// for the possible values.\nlayout(location = 3) in vec4 textColor;\n\n// Background color.\nlayout(location = 4) in vec4 backgroundColor;\n\nout vec2 TexCoords;\nflat out vec4 fg;\nflat out vec4 bg;\n\n// Terminal properties\nuniform vec2 cellDim;\nuniform vec4 projection;\n\nuniform int renderingPass;\n\n#define WIDE_CHAR 2\n\nvoid main() {\n vec2 projectionOffset = projection.xy;\n vec2 projectionScale = projection.zw;\n\n // Compute vertex corner position\n vec2 position;\n position.x = (gl_VertexID == 0 || gl_VertexID == 1) ? 1. : 0.;\n position.y = (gl_VertexID == 0 || gl_VertexID == 3) ? 0. : 1.;\n\n // Position of cell from top-left\n vec2 cellPosition = cellDim * gridCoords;\n\n fg = vec4(textColor.rgb / 255.0, textColor.a);\n bg = backgroundColor / 255.0;\n\n float occupiedCells = 1;\n if ((int(fg.a) >= WIDE_CHAR)) {\n // Update wide char x dimension so it\'ll cover the following spacer.\n occupiedCells = 2;\n\n // Since we don\'t perform bitwise operations due to limitations of\n // the GLES2 renderer,we subtract wide char bits keeping only colored.\n fg.a = round(fg.a - WIDE_CHAR);\n }\n\n if (renderingPass == 0) {\n vec2 backgroundDim = cellDim;\n backgroundDim.x *= occupiedCells;\n\n vec2 finalPosition = cellPosition + backgroundDim * position;\n gl_Position =\n vec4(projectionOffset + projectionScale * finalPosition, 0.0, 1.0);\n\n TexCoords = vec2(0, 0);\n } else {\n vec2 glyphSize = glyph.zw;\n vec2 glyphOffset = glyph.xy;\n glyphOffset.y = cellDim.y - glyphOffset.y;\n\n vec2 finalPosition = cellPosition + glyphSize * position + glyphOffset;\n gl_Position =\n vec4(projectionOffset + projectionScale * finalPosition, 0.0, 1.0);\n\n vec2 uvOffset = uv.xy;\n vec2 uvSize = uv.zw;\n TexCoords = uvOffset + position * uvSize;\n }\n}\n";