Bug 1594128 - Don't rely on high bits to store the brush_kind varying. r=gw

In GLES the default precision for ints is only 16 bits in the fragment shader.

Differential Revision: https://phabricator.services.mozilla.com/D54000

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Silva 2019-11-27 13:22:50 +00:00
Родитель 3ea62468fc
Коммит 109faa3808
3 изменённых файлов: 20 добавлений и 20 удалений

Просмотреть файл

@ -13,14 +13,14 @@
#define WR_FEATURE_MULTI_BRUSH
// These constants must match the BrushShaderKind enum in gpu_types.rs.
#define BRUSH_KIND_SOLID 0x1000000
#define BRUSH_KIND_IMAGE 0x2000000
#define BRUSH_KIND_TEXT 0x3000000
#define BRUSH_KIND_LINEAR_GRADIENT 0x4000000
#define BRUSH_KIND_RADIAL_GRADIENT 0x5000000
#define BRUSH_KIND_BLEND 0x6000000
#define BRUSH_KIND_MIX_BLEND 0x7000000
#define BRUSH_KIND_YV 0x8000000
#define BRUSH_KIND_SOLID 1
#define BRUSH_KIND_IMAGE 2
#define BRUSH_KIND_TEXT 3
#define BRUSH_KIND_LINEAR_GRADIENT 4
#define BRUSH_KIND_RADIAL_GRADIENT 5
#define BRUSH_KIND_BLEND 6
#define BRUSH_KIND_MIX_BLEND 7
#define BRUSH_KIND_YV 8
int vecs_per_brush(int brush_kind);

Просмотреть файл

@ -70,7 +70,7 @@ Instance decode_instance_attributes() {
instance.segment_index = aData.z & 0xffff;
instance.flags = aData.z & 0xffff0000;
instance.resource_address = aData.w & 0xffffff;
instance.brush_kind = aData.w & 0xff000000;
instance.brush_kind = aData.w >> 24;
return instance;
}

Просмотреть файл

@ -72,15 +72,15 @@ impl ZBufferIdGenerator {
#[repr(i32)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum BrushShaderKind {
None = 0,
Solid = 0x1000000,
Image = 0x2000000,
Text = 0x3000000,
LinearGradient = 0x4000000,
RadialGradient = 0x5000000,
Blend = 0x6000000,
MixBlend = 0x7000000,
Yuv = 0x8000000,
None = 0,
Solid = 1,
Image = 2,
Text = 3,
LinearGradient = 4,
RadialGradient = 5,
Blend = 6,
MixBlend = 7,
Yuv = 8,
}
#[derive(Debug, Copy, Clone)]
@ -368,7 +368,7 @@ impl GlyphInstance {
self.prim_header_index.0 as i32,
data0,
data1,
resource_address | BrushShaderKind::Text as i32,
resource_address | ((BrushShaderKind::Text as i32) << 24),
],
}
}
@ -438,7 +438,7 @@ impl From<BrushInstance> for PrimitiveInstanceData {
| ((instance.edge_flags.bits() as i32) << 16)
| ((instance.brush_flags.bits() as i32) << 24),
instance.resource_address
| instance.brush_kind as i32,
| ((instance.brush_kind as i32) << 24),
]
}
}