| /* | |
| * Copyright 2022 Rive | |
| */ | |
| #define TESS_TEXTURE_WIDTH float(2048) | |
| #define TESS_TEXTURE_WIDTH_LOG2 11 | |
| // # of tessellation segments spanned by each patch type. Kept in sync with | |
| // gpu::kMidpointFanPatchSegmentSpan and gpu::OuterCubicPatchSegmentSpan (see | |
| // the static_asserts in gpu.cpp). | |
| #define MIDPOINT_FAN_PATCH_SEGMENT_SPAN 8u | |
| #define OUTER_CUBIC_PATCH_SEGMENT_SPAN 16u | |
| // An outer cubic's tessellation stride also covers its trailing zero-length | |
| // bowtie-join segment. (gpu::OuterCubicPatchSegmentSpanPlusBowtie.) | |
| #define OUTER_CUBIC_PATCH_SEGMENT_SPAN_PLUS_BOWTIE \ | |
| (OUTER_CUBIC_PATCH_SEGMENT_SPAN + 1u) | |
| // depthStencil draws use repeating index patterns instead of instancing. | |
| // Per-patch vertex IDs are aligned on pow2 strides, specifically so the | |
| // shader can decode gl_VertexID without divides and mods. (Using integer | |
| // division costs 10% total framerate on PowerVR and 3% on Adreno.) | |
| // NOTE: The patches don't actually have pow2 numbers of vertices; the index | |
| // buffers just never reference those vertex IDs between the end of one patch | |
| // and the beginning of another. | |
| #define DS_MIDPOINT_FAN_STRIDE_LOG2 4 | |
| #define DS_OUTER_CUBIC_STRIDE_LOG2 5 | |
| #define DS_FILL_PATCH_STRIDE_LOG2(IS_OUTER_CUBIC) \ | |
| ((IS_OUTER_CUBIC) ? DS_OUTER_CUBIC_STRIDE_LOG2 : DS_MIDPOINT_FAN_STRIDE_LOG2) | |
| #define DS_FILL_PATCH_STRIDE(IS_OUTER_CUBIC) \ | |
| (1 << DS_FILL_PATCH_STRIDE_LOG2(IS_OUTER_CUBIC)) | |
| #define DS_STROKE_STRIDE_LOG2 5 | |
| #define DS_AA_STROKE_STRIDE_LOG2 6 | |
| #define DS_STROKE_PATCH_STRIDE_LOG2(IS_AA_STROKE) \ | |
| ((IS_AA_STROKE) ? DS_AA_STROKE_STRIDE_LOG2 : DS_STROKE_STRIDE_LOG2) | |
| #define DS_STROKE_PATCH_STRIDE(IS_AA_STROKE) \ | |
| (1 << DS_STROKE_PATCH_STRIDE_LOG2(IS_AA_STROKE)) | |
| // Normal strokes are a single triangle strip with 2 lanes of vertices (top, | |
| // bottom). | |
| // AA strokes have an AA band on top and bottom, making 4 lanes of vertices and | |
| // 3 bands of triangle strips (top AA ramp, body, bottom AA ramp). | |
| #define DS_STROKE_LANES_PER_SPOKE_LOG2(IS_AA_STROKE) ((IS_AA_STROKE) ? 2 : 1) | |
| // One vertex of the midpointFan pattern is reserved for the contour's midpoint | |
| // rather than tessellation points. | |
| #define DS_MIDPOINT_VERTEX_IDX (int(MIDPOINT_FAN_PATCH_SEGMENT_SPAN) + 1) | |
| // depthStencil draws encode some attributes as flags on gl_VertexID, in order | |
| // to avoid input attribs. | |
| // NOTE: vertexIDs are 16-bit in the index buffer, but they get offset per draw | |
| // into the tessellation texture. So these flags have to live above the entire | |
| // tessellation range. Hence a shift of 28 and not 16. | |
| #define VERTEX_FLAGS_SHIFT 28 | |
| #define VERTEX_FLAG_DISABLE_COLOR_WRITE (0x1 << VERTEX_FLAGS_SHIFT) | |
| #define VERTEX_FLAG_OUTER_CUBIC_FILL (0x2 << VERTEX_FLAGS_SHIFT) | |
| // Strokes alias the outerCubic bit bc stroke vs. fill is decided by spec const. | |
| #define VERTEX_FLAG_AA_POLAR_STROKE VERTEX_FLAG_OUTER_CUBIC_FILL | |
| // depthAAstrokes render in two passes: a depth-only pass followed by color. | |
| // We select the pass by vertex flags rather than pipeline state. | |
| #define VERTEX_FLAG_STROKE_DEPTH_PASS (0x4 << VERTEX_FLAGS_SHIFT) | |
| #define GRAD_TEXTURE_WIDTH float(512) | |
| #define GRAD_TEXTURE_INVERSE_WIDTH float(0.001953125) | |
| // Number of standard deviations on either side of the middle of the feather | |
| // texture. The gaussian integral texture integrates the normal distribution | |
| // from -GAUSSIAN_INTEGRAL_TEXTURE_STDDEVS to +GAUSSIAN_INTEGRAL_TEXTURE_STDDEVS | |
| // in the domain x=0..1. | |
| #define GAUSSIAN_INTEGRAL_TEXTURE_STDDEVS float(3) | |
| // Indices of function tables in the gaussian integral texture1d array. | |
| // NOTE: This will be a texture2d if texture1d isn't supported. | |
| #define FEATHER_FUNCTION_ARRAY_INDEX 0 | |
| #define FEATHER_INVERSE_FUNCTION_ARRAY_INDEX 1 | |
| #define GAUSSIAN_INTEGRAL_TEXTURE_1D_ARRAY_LENGTH 2 | |
| // Number of additional tessellation "helper" vertices that need to be allocated | |
| // for a feather join. | |
| #define FEATHER_JOIN_HELPER_VERTEX_COUNT 3u | |
| // Amount to increase "joinSegmentCount" in a feather join so the number of | |
| // literal vertices allocated increases by FEATHER_JOIN_HELPER_VERTEX_COUNT. | |
| #define FEATHER_JOIN_HELPER_SEGMENT_COUNT \ | |
| (FEATHER_JOIN_HELPER_VERTEX_COUNT + 1u) | |
| // Feather joins are split into a backward and forward section. Both sections | |
| // need at least one segment, thus a minimum of 2 (plus helper vertices). | |
| #define FEATHER_JOIN_MIN_SEGMENT_COUNT (2u + FEATHER_JOIN_HELPER_SEGMENT_COUNT) | |
| #define MIN_FEATHER float(0.0) | |
| #define MAX_FEATHER float(1.0) | |
| // Width to use for a texture that emulates a storage buffer. | |
| // | |
| // Minimize width since the texture needs to be updated in entire rows from the | |
| // resource buffer. The paintAuxBuffer is the bottleneck here, it is large | |
| // enough that we need a width of 256 for all of the values to sit within the | |
| // minimum-required texture height of 2048. If not for that, a width of 128 | |
| // would be sufficient (as paths and contours just store 16-bit indices). | |
| #define STORAGE_TEXTURE_WIDTH 256 | |
| #define STORAGE_TEXTURE_SHIFT_Y 8 | |
| #define STORAGE_TEXTURE_MASK_X 0xffu | |
| // Flags that state whether/how we need to render solid-color borders to the | |
| // left and/or right side of a GradientSpan. (Borders of complex gradients | |
| // stretch all the way to the left/right edges of the texture, whereas borders | |
| // of simple gradients just need to stretch 1px to the left/right of the | |
| // span.) | |
| #define GRAD_SPAN_FLAG_LEFT_BORDER 0x80000000u | |
| #define GRAD_SPAN_FLAG_RIGHT_BORDER 0x40000000u | |
| #define GRAD_SPAN_FLAG_COMPLEX_BORDER 0x20000000u | |
| #define GRAD_SPAN_FLAGS_MASK \ | |
| (GRAD_SPAN_FLAG_LEFT_BORDER | GRAD_SPAN_FLAG_RIGHT_BORDER | \ | |
| GRAD_SPAN_FLAG_COMPLEX_BORDER) | |
| // Tells shaders that a cubic should actually be drawn as a non-AA triangle | |
| // strip of up to 5 points: [p0, p1, p3, p2, joinTangent]. This is used to | |
| // reduce draws and pipeline transitions by squeezing in triangles that don't | |
| // otherwise need special state or shading logic. | |
| #define RETROFIT_TRI_STRIP_CONTOUR_FLAG (1u << 31u) | |
| // Skip bit 30 in the contour flags so that it's always 0. This ensures we never | |
| // generate special NaN/Inf floating point values in contourIDWithFlags, which | |
| // may confuse the driver. | |
| #define NEVER_USED_CONTOUR_FLAG (1u << 30u) | |
| // Tells the tessellation shader to re-run Wang's formula on the given curve, | |
| // figure out how many segments it actually needs, and make any excess segments | |
| // degenerate by co-locating their vertices at T=0. (Used on the "outerCurve" | |
| // patches that are drawn with interior triangulations.) | |
| #define CULL_EXCESS_TESSELLATION_SEGMENTS_CONTOUR_FLAG (1u << 29u) | |
| // Flags for specifying the join type. | |
| #define JOIN_TYPE_MASK (7u << 26u) | |
| #define MITER_CLIP_JOIN_CONTOUR_FLAG (6u << 26u) | |
| #define MITER_REVERT_JOIN_CONTOUR_FLAG (5u << 26u) | |
| #define BEVEL_JOIN_CONTOUR_FLAG (4u << 26u) | |
| #define ROUND_JOIN_CONTOUR_FLAG (3u << 26u) | |
| #define CUSP_JOIN_CONTOUR_FLAG (2u << 26u) | |
| #define FEATHER_JOIN_CONTOUR_FLAG (1u << 26u) | |
| // When a join is being used to emulate a stroke cap, the shader emits | |
| // additional vertices at T=0 and T=1 for round joins, and changes the miter | |
| // limit to 1 for miter-clip joins. | |
| #define EMULATED_STROKE_CAP_CONTOUR_FLAG (1u << 25u) | |
| // Flip the sign on interpolated fragment coverage for fills. Ignored on | |
| // strokes. This is used when reversing the winding direction of a path. | |
| #define NEGATE_PATH_FILL_COVERAGE_FLAG (1u << 24u) | |
| // Internal contour flags. | |
| #define MIRRORED_CONTOUR_CONTOUR_FLAG (1u << 23u) | |
| #define JOIN_TANGENT_0_CONTOUR_FLAG (1u << 22u) | |
| #define JOIN_TANGENT_INNER_CONTOUR_FLAG (1u << 21u) | |
| #define LEFT_JOIN_CONTOUR_FLAG (1u << 20u) | |
| #define RIGHT_JOIN_CONTOUR_FLAG (1u << 19u) | |
| #define CONTOUR_ID_MASK 0xffffu | |
| // This is guaranteed to not collide with any path IDs being rendered. | |
| #define INVALID_PATH_ID .0 | |
| // This is guaranteed to not collide with a neighboring contour ID. | |
| #define INVALID_CONTOUR_ID_WITH_FLAGS 0u | |
| // Says which part of the patch a vertex belongs to. | |
| #define STROKE_VERTEX 0 | |
| #define FAN_VERTEX 1 | |
| #define FAN_MIDPOINT_VERTEX 2 | |
| // Says which part of the patch a vertex belongs to. | |
| #define STROKE_VERTEX 0 | |
| #define FAN_VERTEX 1 | |
| #define FAN_MIDPOINT_VERTEX 2 | |
| // Mirrors pls::PaintType. | |
| #define CLIP_UPDATE_PAINT_TYPE 0u | |
| #define SOLID_COLOR_PAINT_TYPE 1u | |
| #define LINEAR_GRADIENT_PAINT_TYPE 2u | |
| #define RADIAL_GRADIENT_PAINT_TYPE 3u | |
| #define ANGULAR_GRADIENT_PAINT_TYPE 4u | |
| // Paint flags, found in the z-component of a path record's second uint4 (the | |
| // paint's "params" word). | |
| #define PAINT_FLAG_NON_ZERO_FILL 0x100u | |
| #define PAINT_FLAG_EVEN_ODD_FILL 0x200u | |
| #define PAINT_FLAG_HAS_CLIP_RECT 0x400u | |
| #define PAINT_FLAG_HAS_IMAGE 0x800u | |
| // A layer-mask apply: the sampled image is coverage, not color, and the blend | |
| // step multiplies the destination by a factor derived from it. Bits 13-14 hold | |
| // which factor (rive::LayerMaskMode). Bits 12-15 of the params word were free; | |
| // 8-11 are the flags above and 16-31 are the clipID (or, in depthStencil, the | |
| // path's zIndex). | |
| #define PAINT_FLAG_LAYER_MASK 0x1000u | |
| #define PAINT_LAYER_MASK_MODE_SHIFT 13u | |
| #define PAINT_LAYER_MASK_MODE_MASK 0x6000u | |
| #define PAINT_FLAG_LOAD_RADIUS_AND_OUTSET_PATH_DATA 0x8000u | |
| // rive::LayerMaskMode | |
| #define LAYER_MASK_MODE_ALPHA 0u | |
| #define LAYER_MASK_MODE_INVERTED_ALPHA 1u | |
| #define LAYER_MASK_MODE_LUMINANCE 2u | |
| #define LAYER_MASK_MODE_INVERTED_LUMINANCE 3u | |
| // PLS draw resources are either updated per flush or per draw. They go into set | |
| // 0 or set 1, depending on how often they are updated. | |
| #define PER_FLUSH_BINDINGS_SET 0 | |
| #define PER_DRAW_BINDINGS_SET 1 | |
| // Index at which we access each resource. | |
| // (Enumerate buffers first because GLES allows a hard limit on buffer index | |
| // bindings as low as 7.) | |
| #define FLUSH_UNIFORM_BUFFER_IDX 0 | |
| #define PATH_BASE_INSTANCE_UNIFORM_BUFFER_IDX 1 | |
| #define PATH_BUFFER_IDX 2 | |
| #define PAINT_AUX_BUFFER_IDX 3 | |
| #define CONTOUR_BUFFER_IDX 4 | |
| // Coverage buffer used in coverageAtomic mode. | |
| #define COVERAGE_BUFFER_IDX 5 | |
| #define TESS_VERTEX_TEXTURE_IDX 6 | |
| #define GRAD_TEXTURE_IDX 7 | |
| #define GAUSSIAN_INTEGRAL_TEXTURE_IDX 8 | |
| #define FEATHER_ATLAS_TEXTURE_IDX 9 | |
| #define IMAGE_TEXTURE_IDX 10 | |
| #define DST_COLOR_TEXTURE_IDX 11 | |
| #define DEFAULT_BINDINGS_SET_SIZE 12 | |
| // WebGPU needs image sampler index as a separate value. | |
| #define WEBGPU_IMAGE_SAMPLER_IDX 12 | |
| #define WEBGPU_BINDINGS_SET_SIZE 13 | |
| // In Metal, vertex attributes just come in as buffers. Since we use up to 3 | |
| // vertex attrib buffers, offset the Rive resources by 3 so they don't alias | |
| // with vertex attribs. | |
| #define METAL_BUFFER_IDX(IDX) (3 + IDX) | |
| // PLS textures are accessed at the same index as their PLS planes, so we put | |
| // them in a separate binding set. | |
| #define PLS_TEXTURE_BINDINGS_SET 2 | |
| // In WebGPU there needs to be an additional binding set for samplers, because | |
| // there is no way to bind a texture and sampler to the same binding index in | |
| // the same binding set like there is in Vulkan. | |
| #define WEBGPU_SAMPLER_BINDINGS_SET 3 | |
| #define VULKAN_BINDINGS_SET_COUNT 3 | |
| #define WEBGPU_BINDINGS_SET_COUNT 4 | |
| // Index of each pixel local storage plane. | |
| #define COLOR_PLANE_IDX 0 | |
| #define CLIP_PLANE_IDX 1 | |
| #define SCRATCH_COLOR_PLANE_IDX 2 | |
| #define COVERAGE_PLANE_IDX 3 | |
| #define PLS_PLANE_COUNT 4 | |
| // This is the framebuffer attachment index of the final color output during the | |
| // "coalesced" atomic resolve. (Currently only used by Vulkan.) | |
| // NOTE: This attachment is still referenced as color attachment 0 by the | |
| // resolve subpass, so the shader doesn't need to know about it. | |
| // NOTE: Atomic mode does not use SCRATCH_COLOR_PLANE_IDX, which is why we chose | |
| // to alias this one. | |
| #define COALESCED_ATOMIC_RESOLVE_IDX SCRATCH_COLOR_PLANE_IDX | |
| // Index of each instanced attribute for image draws. | |
| // First, the common attributes: | |
| #define IMAGE_FIRST_ATTRIB_IDX 2 | |
| #define IMAGE_VIEW_MATRIX_ATTRIB_IDX 2 | |
| #define IMAGE_CLIP_RECT_INVERSE_MATRIX_ATTRIB_IDX 3 | |
| #define IMAGE_TRANSLATES_ATTRIB_IDX 4 | |
| #define IMAGE_MODULATED_COLOR_ATTRIB_IDX 5 | |
| #define IMAGE_CLIP_ID_ATTRIB_IDX 6 | |
| #define IMAGE_BLEND_MODE_ATTRIB_IDX 7 | |
| #define IMAGE_ZINDEX_ATTRIB_IDX 8 | |
| #define IMAGE_COMMON_LAST_ATTRIB_IDX 8 | |
| #define IMAGE_COMMON_ATTRIB_COUNT \ | |
| (IMAGE_COMMON_LAST_ATTRIB_IDX + 1 - IMAGE_FIRST_ATTRIB_IDX) | |
| #define IMAGE_RECT_IMAGE_MATRIX_ATTRIB_IDX 9 | |
| #define IMAGE_RECT_GRADIENT_MATRIX_ATTRIB_IDX 10 | |
| #define IMAGE_RECT_IMAGE_AND_GRADIENT_TRANSLATES_ATTRIB_IDX 11 | |
| #define IMAGE_RECT_PACKED_GRADIENT_DATA 12 | |
| #define IMAGE_RECT_LAST_ATTRIB_IDX IMAGE_RECT_PACKED_GRADIENT_DATA | |
| #define IMAGE_RECT_ATTRIB_COUNT \ | |
| (IMAGE_RECT_LAST_ATTRIB_IDX + 1 - IMAGE_FIRST_ATTRIB_IDX) | |
| #define IMAGE_MESH_UV_TRANSFORM_ATTRIB_IDX 9 | |
| #define IMAGE_MESH_LAST_ATTRIB_IDX IMAGE_MESH_UV_TRANSFORM_ATTRIB_IDX | |
| #define IMAGE_MESH_ATTRIB_COUNT \ | |
| (IMAGE_MESH_LAST_ATTRIB_IDX + 1 - IMAGE_FIRST_ATTRIB_IDX) | |
| // depthStencil mode attaches different resources to the framebuffer than PLS | |
| // planes. | |
| #define DEPTH_STENCIL_BUFFER_IDX 1u | |
| #define DEPTH_STENCIL_FINAL_COLOR_IDX 2u | |
| #define MSAA_COLOR_SEED_IDX 3u | |
| // Rive has a hard-coded miter limit of 4 in the editor and all runtimes. | |
| #define RIVE_MITER_LIMIT float(4) | |
| // acos(1/4), because the miter limit is 4. | |
| #define MITER_ANGLE_LIMIT float(1.318116071652817965746) | |
| // Raw bit representation of the largest denormalized fp16 value. We offset all | |
| // (1-based) path IDs by this value in order to avoid denorms, which have been | |
| // empirically unreliable on Android as ID values. | |
| #define MAX_DENORM_F16 1023u | |
| // The minimum non-denormalized fp16 value is ~6.10e-5. So steer safely within | |
| // this value (and outside of denormals, which may not be respected by GPUs), by | |
| // using using 6.2e-5. | |
| #define EPSILON_FP16_NON_DENORM 6.2e-5 | |
| // Blend modes. Mirrors rive::BlendMode, but 0-based and contiguous for tighter | |
| // packing. | |
| #define BLEND_SRC_OVER 0u | |
| #define BLEND_MODE_SCREEN 1u | |
| #define BLEND_MODE_OVERLAY 2u | |
| #define BLEND_MODE_DARKEN 3u | |
| #define BLEND_MODE_LIGHTEN 4u | |
| #define BLEND_MODE_COLORDODGE 5u | |
| #define BLEND_MODE_COLORBURN 6u | |
| #define BLEND_MODE_HARDLIGHT 7u | |
| #define BLEND_MODE_SOFTLIGHT 8u | |
| #define BLEND_MODE_DIFFERENCE 9u | |
| #define BLEND_MODE_EXCLUSION 10u | |
| #define BLEND_MODE_MULTIPLY 11u | |
| #define BLEND_MODE_HUE 12u | |
| #define BLEND_MODE_SATURATION 13u | |
| #define BLEND_MODE_COLOR 14u | |
| #define BLEND_MODE_LUMINOSITY 15u | |
| // Rive's depth buffer is a packed 23-bit integer: | |
| // | |
| // bits [22:8] : path zIndex (larger == on top, depth-tested with GREATER) | |
| // bits [7:0] : coverage | |
| // | |
| // Coverage sits below the zIndex, so the depth test resolves zIndex first and | |
| // max coverage second, for free. | |
| #define DEPTH_Z_INDEX_BIT_COUNT 15u | |
| #define DEPTH_COVERAGE_BIT_COUNT 8u | |
| // Fixed-point coverage values for atomic mode. | |
| // Atomic mode uses 6:11 fixed point, so the winding number breaks if a shape | |
| // has more than 32 levels of self overlap in either winding direction at any | |
| // point. | |
| #define FIXED_COVERAGE_PRECISION float(2048) | |
| #define FIXED_COVERAGE_INVERSE_PRECISION float(0.00048828125) | |
| #define FIXED_COVERAGE_ZERO float(1 << 16) | |
| #define FIXED_COVERAGE_ZERO_UINT (1u << 16) | |
| #define FIXED_COVERAGE_ONE (FIXED_COVERAGE_PRECISION + FIXED_COVERAGE_ZERO) | |
| #define FIXED_COVERAGE_BIT_COUNT 17u | |
| #define FIXED_COVERAGE_MASK 0x1ffffu | |
| // Fixed-point coverage values for clockwiseAtomic mode. | |
| // | |
| // The coverage buffer is laid out as: | |
| // | |
| // prefix(12) : blendColorValid(1) : coverageInt(9) : coverageFract(10) | |
| // | |
| // The prefix is a monotonically increasing token that instructs the shader to | |
| // treat coverage as "cleared to zero" when it doesn't match the expectation, | |
| // effectively allowing us to clear the coverage buffer by incrementing the | |
| // token. | |
| // | |
| // The "blendColorValid" bit is used by shaders to signal once the blend color | |
| // has become valid (and before overwriting the framebuffer), indicating that | |
| // fragments should use that value instead of reading the framebuffer. | |
| // | |
| // NOTE: Coverage uses 9:10 fixed point, so the entire coverage buffer breaks if | |
| // a shape has more than 2^8 levels of self overlap in either winding direction | |
| // at any point. This impacts future paths as well. | |
| #define CLOCKWISE_COVERAGE_PRECISION float(1024) | |
| #define CLOCKWISE_COVERAGE_INVERSE_PRECISION float(0.0009765625) | |
| #define CLOCKWISE_COVERAGE_BIT_COUNT 19u | |
| #define CLOCKWISE_FILL_ZERO_VALUE (1u << (CLOCKWISE_COVERAGE_BIT_COUNT - 1u)) | |
| #define CLOCKWISE_COVERAGE_MASK ((1u << CLOCKWISE_COVERAGE_BIT_COUNT) - 1u) | |
| #define BLEND_COLOR_VALID_BIT (1u << CLOCKWISE_COVERAGE_BIT_COUNT) | |
| #define CLOCKWISE_COVERAGE_PREFIX_ONE_VALUE (BLEND_COLOR_VALID_BIT << 1u) | |
| // Indices for SPIRV specialization constants (used in lieu of #defines in | |
| // Vulkan.) | |
| #define CLIPPING_SPECIALIZATION_IDX 0 | |
| #define CLIP_RECT_SPECIALIZATION_IDX 1 | |
| #define ADVANCED_BLEND_SPECIALIZATION_IDX 2 | |
| #define FEATHER_SPECIALIZATION_IDX 3 | |
| #define MODULATED_IMAGE_SPECIALIZATION_IDX 4 | |
| #define EVEN_ODD_SPECIALIZATION_IDX 5 | |
| #define NESTED_CLIPPING_SPECIALIZATION_IDX 6 | |
| #define HSL_BLEND_MODES_SPECIALIZATION_IDX 7 | |
| #define DITHER_SPECIALIZATION_IDX 8 | |
| #define ANGULAR_GRADIENT_SPECIALIZATION_IDX 9 | |
| #define CLOCKWISE_FILL_SPECIALIZATION_IDX 10 | |
| #define NESTED_CLIP_UPDATE_ONLY_SPECIALIZATION_IDX 11 | |
| #define BORROWED_COVERAGE_PASS_SPECIALIZATION_IDX 12 | |
| #define STORE_COLOR_CLEAR_SPECIALIZATION_IDX 13 | |
| #define LOAD_COLOR_FROM_DST_TEXTURE_SPECIALIZATION_IDX 14 | |
| #define VULKAN_VENDOR_ARM_SPECIALIZATION_IDX 15 | |
| #define DS_POLAR_STROKE_SPECIALIZATION_IDX 16 | |
| #define DS_HAIRLINE_STROKE_SPECIALIZATION_IDX 17 | |
| #define SPECIALIZATION_COUNT 18 | |
| // When rendering to an r32i feather atlas, use 16:16 fixed point. | |
| #define ATLAS_R32I_FIXED_POINT_FACTOR 65536. | |
| // When we have to fall back on an 8-bit color buffer to render the feather | |
| // atlas, sacrifice precision to lessen overflows. | |
| // Throwing away the bottom 3 bits seems to be the best tradeoff, based on our | |
| // golden image suite. | |
| #define ATLAS_UNORM8_COVERAGE_SCALE_FACTOR 8. | |
| // Buffers used to back PLS images are swizzled into square tiles for better | |
| // cache locality. | |
| // Buffer sizes must be rounded up to a multiples of BUFFER_IMAGE_TILE_SIZE in | |
| // both width and height. | |
| #define BUFFER_IMAGE_TILE_SIZE 32u | |
| #define BUFFER_IMAGE_TILE_SIZE_LOG2 5u | |
| // The paint aux data has a specific number of float32x4 elements in it | |
| #define PAINT_AUX_ENTRY_ELEMENT_COUNT 8u | |
| #ifdef __cplusplus | |
| #if __cplusplus >= 201703 | |
| static_assert(BUFFER_IMAGE_TILE_SIZE == 1u << BUFFER_IMAGE_TILE_SIZE_LOG2); | |
| #endif | |
| #endif |