mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 04:03:47 +00:00
Bug 1548339 - WR: Remove the color/alpha feature in cs_scale shader r=jrmuizel
this makes the shader simpler at no cost Differential Revision: https://phabricator.services.mozilla.com/D37114 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
a53a39a584
commit
6104350440
@ -31,12 +31,7 @@ void main(void) {
|
||||
RectWithSize src_rect = src_task.task_rect;
|
||||
RectWithSize target_rect = scale_task.common_data.task_rect;
|
||||
|
||||
#if defined WR_FEATURE_COLOR_TARGET
|
||||
vec2 texture_size = vec2(textureSize(sPrevPassColor, 0).xy);
|
||||
#else
|
||||
vec2 texture_size = vec2(textureSize(sPrevPassAlpha, 0).xy);
|
||||
#endif
|
||||
|
||||
vec2 texture_size = vec2(textureSize(sColor0, 0).xy);
|
||||
vUv.z = src_task.texture_layer_index;
|
||||
|
||||
vUvRect = vec4(src_rect.p0 + vec2(0.5),
|
||||
@ -52,17 +47,9 @@ void main(void) {
|
||||
|
||||
#ifdef WR_FRAGMENT_SHADER
|
||||
|
||||
#if defined WR_FEATURE_COLOR_TARGET
|
||||
#define SAMPLE_TYPE vec4
|
||||
#define SAMPLE_TEXTURE(uv) texture(sPrevPassColor, uv)
|
||||
#else
|
||||
#define SAMPLE_TYPE float
|
||||
#define SAMPLE_TEXTURE(uv) texture(sPrevPassAlpha, uv).r
|
||||
#endif
|
||||
|
||||
void main(void) {
|
||||
vec2 st = clamp(vUv.xy, vUvRect.xy, vUvRect.zw);
|
||||
oFragColor = vec4(SAMPLE_TEXTURE(vec3(st, vUv.z)));
|
||||
oFragColor = texture(sColor0, vec3(st, vUv.z));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -3358,24 +3358,19 @@ impl Renderer {
|
||||
|
||||
let _timer = self.gpu_profile.start_timer(GPU_TAG_SCALE);
|
||||
|
||||
match source {
|
||||
TextureSource::PrevPassColor => {
|
||||
self.shaders.borrow_mut().cs_scale_rgba8.bind(&mut self.device,
|
||||
&projection,
|
||||
&mut self.renderer_errors);
|
||||
}
|
||||
TextureSource::PrevPassAlpha => {
|
||||
self.shaders.borrow_mut().cs_scale_a8.bind(&mut self.device,
|
||||
&projection,
|
||||
&mut self.renderer_errors);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
self.shaders
|
||||
.borrow_mut()
|
||||
.cs_scale
|
||||
.bind(
|
||||
&mut self.device,
|
||||
&projection,
|
||||
&mut self.renderer_errors,
|
||||
);
|
||||
|
||||
self.draw_instanced_batch(
|
||||
&scalings,
|
||||
VertexArrayKind::Scale,
|
||||
&BatchTextures::no_texture(),
|
||||
&BatchTextures::color(source),
|
||||
stats,
|
||||
);
|
||||
}
|
||||
|
@ -508,8 +508,7 @@ pub struct Shaders {
|
||||
pub cs_blur_rgba8: LazilyCompiledShader,
|
||||
pub cs_border_segment: LazilyCompiledShader,
|
||||
pub cs_border_solid: LazilyCompiledShader,
|
||||
pub cs_scale_a8: LazilyCompiledShader,
|
||||
pub cs_scale_rgba8: LazilyCompiledShader,
|
||||
pub cs_scale: LazilyCompiledShader,
|
||||
pub cs_line_decoration: LazilyCompiledShader,
|
||||
pub cs_gradient: LazilyCompiledShader,
|
||||
|
||||
@ -688,18 +687,10 @@ impl Shaders {
|
||||
pls_precache_flags,
|
||||
)?;
|
||||
|
||||
let cs_scale_a8 = LazilyCompiledShader::new(
|
||||
let cs_scale = LazilyCompiledShader::new(
|
||||
ShaderKind::Cache(VertexArrayKind::Scale),
|
||||
"cs_scale",
|
||||
&["ALPHA_TARGET"],
|
||||
device,
|
||||
options.precache_flags,
|
||||
)?;
|
||||
|
||||
let cs_scale_rgba8 = LazilyCompiledShader::new(
|
||||
ShaderKind::Cache(VertexArrayKind::Scale),
|
||||
"cs_scale",
|
||||
&["COLOR_TARGET"],
|
||||
&[],
|
||||
device,
|
||||
options.precache_flags,
|
||||
)?;
|
||||
@ -854,8 +845,7 @@ impl Shaders {
|
||||
cs_line_decoration,
|
||||
cs_gradient,
|
||||
cs_border_solid,
|
||||
cs_scale_a8,
|
||||
cs_scale_rgba8,
|
||||
cs_scale,
|
||||
brush_solid,
|
||||
brush_image,
|
||||
brush_fast_image,
|
||||
@ -937,8 +927,7 @@ impl Shaders {
|
||||
}
|
||||
|
||||
pub fn deinit(self, device: &mut Device) {
|
||||
self.cs_scale_a8.deinit(device);
|
||||
self.cs_scale_rgba8.deinit(device);
|
||||
self.cs_scale.deinit(device);
|
||||
self.cs_blur_a8.deinit(device);
|
||||
self.cs_blur_rgba8.deinit(device);
|
||||
self.brush_solid.deinit(device);
|
||||
|
Loading…
x
Reference in New Issue
Block a user