зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset fc222543876b (bug 1694196) for causing webrender lint failure. CLOSED TREE
This commit is contained in:
Родитель
15ff419df0
Коммит
ddcaebfbd0
|
@ -2282,16 +2282,6 @@ fn translate_expression(state: &mut State, e: &syntax::Expr) -> Expr {
|
|||
.insert((sampler, base), TexelFetchOffsets::new(x, y));
|
||||
}
|
||||
}
|
||||
} else if name == "swgl_stepInterp" {
|
||||
let mut globals = state.modified_globals.borrow_mut();
|
||||
for (i, sym) in state.syms.iter().enumerate() {
|
||||
if let SymDecl::Global(StorageClass::In, _, _, RunClass::Vector) = &sym.borrow().decl {
|
||||
let symref = SymRef(i as u32);
|
||||
if !globals.contains(&symref) {
|
||||
globals.push(symref);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let sym = match state.lookup(name) {
|
||||
Some(s) => s,
|
||||
|
|
|
@ -25,73 +25,6 @@ them from other items in the GLSL namespace.
|
|||
Inside GLSL, the `SWGL` preprocessor token is defined so that usage of SWGL
|
||||
extensions may be conditionally compiled.
|
||||
|
||||
```
|
||||
void swgl_drawSpanRGBA8();
|
||||
void swgl_drawSpanR8();
|
||||
|
||||
int swgl_SpanLength;
|
||||
int swgl_StepSize;
|
||||
|
||||
mixed swgl_interpStep(mixed varying_input);
|
||||
void swgl_stepInterp();
|
||||
```
|
||||
|
||||
SWGL's default fragment processing calls a fragment shader's `main` function
|
||||
on groups of fragments in units of `swgl_StepSize`. On return, the value of
|
||||
gl_FragColor is read, packed to an appropriate pixel format, and sent to the
|
||||
blend stage for output to the destination framebuffer. This can be inefficient
|
||||
for some types of fragment shaders, such as those that must lookup from a
|
||||
texture and immediately output it, unpacking the texels only to subsequently
|
||||
repack them at cost. Also, various per-fragment conditions in the shader might
|
||||
need to be repeatedly checked, even though they are actually constant over
|
||||
the entire primitive.
|
||||
|
||||
To work around this inefficiency, SWGL allows fragments to optionally be
|
||||
processed over entire spans. This can both side-step the packing inefficiency
|
||||
as well as more efficiently deal with conditions that remain constant over an
|
||||
entire span. SWGL also introduces various specialized intrinsics for more
|
||||
efficiently dealing with certain types of primitive spans with optimal
|
||||
fixed-function processing.
|
||||
|
||||
Inside a fragment shader, a `swgl_drawSpan` function may be defined to override
|
||||
the normal fragment processing for that fragment shader. The function must then
|
||||
call some form of `swgl_commit` intrinsic to actually output to the destination
|
||||
framebuffer via the blend stage, as normal fragment processing does not take
|
||||
place otherwise as would have happened in `main`. This function is used by the
|
||||
rasterizer to process an entire span of fragments that have passed the depth
|
||||
test (if applicable) and clipping, but have not yet been output to the blend
|
||||
stage.
|
||||
|
||||
The amount of fragments within the span to be processed is designated by
|
||||
`swgl_SpanLength` and is always aligned to units of `swgl_StepSize`.
|
||||
The size of a group of fragments in terms of which `swgl_commit` intrinsics
|
||||
process and output fragments is designated by `swgl_StepSize`. The
|
||||
`swgl_commit` intrinsics will deduct accordingly from `swgl_SpanLength` in
|
||||
units of `swgl_StepSize` to reflect the fragments actually processed, which
|
||||
may be less than the entire span or up to the entire span.
|
||||
|
||||
Fragments should be output until `swgl_SpanLength` becomes zero to process the
|
||||
entire span. If `swgl_drawSpan` returns while leaving any fragments unprocessed,
|
||||
the remaining fragments will be processed as normal by the fragment shader's
|
||||
`main` function. This can be used to conditionally handle certain fast-paths
|
||||
in a fragment shader by otherwise defaulting to the `main` function if
|
||||
`swgl_drawSpan` can't appropriately process some or all of the fragments.
|
||||
|
||||
The values of any varying inputs to the fragment shader will be set to their
|
||||
values for the start of the span, but do not automatically update over the
|
||||
the course of a span within a given call to `swgl_drawSpan`. The
|
||||
`swgl_interpStep` intrinsic may be used to get the derivative per `swgl_StepSize`
|
||||
group of fragments of a varying input so that the caller may update such
|
||||
variables manually if desired or otherwise use that information for processing.
|
||||
The `swgl_stepInterp` intrinsic forces all such varying inputs to advance by
|
||||
a single step.
|
||||
|
||||
The RGBA8 version will be used when the destination framebuffer is RGBA8 format,
|
||||
and the R8 version will be used when the destination framebuffer is R8. Various
|
||||
other intrinsics described below may have restrictions on whether they can be
|
||||
used only with a certain destination framebuffer format and are noted as such if
|
||||
so.
|
||||
|
||||
```
|
||||
void swgl_clipMask(sampler2D mask, vec2 offset, vec2 bb_origin, vec2 bb_size);
|
||||
```
|
||||
|
@ -177,13 +110,13 @@ Samples and commits an entire span of texture starting at the given uv and
|
|||
within the supplied uv bounds from the given layer. The color variations
|
||||
also accept a supplied color that modulates the result.
|
||||
|
||||
The RGBA8 versions may only be used to commit within `swgl_drawSpanRGBA8`, and
|
||||
the R8 versions may only be used to commit within `swgl_drawSpanR8`.
|
||||
The RGBA8 versions may only be used to commit within swgl_drawSpanRGBA8, and
|
||||
the R8 versions may only be used to commit within swgl_drawSpanR8.
|
||||
|
||||
The Linear variations use a linear filter that bilinearly interpolates between
|
||||
the four samples near the pixel. The Nearest variations use a nearest filter
|
||||
that chooses the closest aliased sample to the center of the pixel. If neither
|
||||
Linear nor Nearest is specified in the `swgl_commitTexture` variation name, then
|
||||
Linear nor Nearest is specified in the swgl_commitTexture variation name, then
|
||||
it will automatically select either the Linear or Nearest variation depending
|
||||
on the sampler's specified filter.
|
||||
|
||||
|
@ -197,7 +130,7 @@ always within the bounds.
|
|||
void swgl_blendDropShadow(vec4 color);
|
||||
```
|
||||
|
||||
SWGL allows overriding the blend mode per-primitive by calling `swgl_blend`
|
||||
SWGL allows overriding the blend mode per-primitive by calling swgl_blend
|
||||
intrinsics in the vertex shader. The existing blend mode set by the GL is
|
||||
replaced with the one specified by the intrinsic for the current primitive.
|
||||
The blend mode will be reset to the blend mode set by the GL for the next
|
||||
|
|
Загрузка…
Ссылка в новой задаче