Reland "Add tooling support for dmsaa"
Reland 188443be8d
without the DMSAA bots
to ensure nothing else changes.
Original change's description:
> Add tooling support for dmsaa
>
> Adds a "fAlwaysAntiAlias" flag to GrContextOptions that can be set from
> tooling code. When dmsaa is set, SkGpuDevice draws everything
> antialiased. Adds new "gldmsaa" and "glesdmsaa" configs and creates bots
> to run them.
>
> Bug: skia:11396
> Change-Id: I165e89434b733f7b02312cea0e6649812528083b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384936
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com
Bug: skia:11396
Change-Id: Icb45097e0a34543dc577fa32f19a692e90643a35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386338
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
parent
1c22e62b71
commit
fd708655ae
@ -247,6 +247,7 @@ struct GPUTarget : public Target {
|
||||
}
|
||||
bool init(SkImageInfo info, Benchmark* bench) override {
|
||||
GrContextOptions options = grContextOpts;
|
||||
options.fAlwaysAntialias = config.useDMSAA;
|
||||
bench->modifyGrContextOptions(&options);
|
||||
this->factory = std::make_unique<GrContextFactory>(options);
|
||||
SkSurfaceProps props(this->config.surfaceFlags, kRGB_H_SkPixelGeometry);
|
||||
@ -469,6 +470,7 @@ static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
|
||||
const auto ctxType = gpuConfig->getContextType();
|
||||
const auto ctxOverrides = gpuConfig->getContextOverrides();
|
||||
const auto sampleCount = gpuConfig->getSamples();
|
||||
const auto useDMSAA = gpuConfig->getUseDMSAA();
|
||||
const auto colorType = gpuConfig->getColorType();
|
||||
auto colorSpace = gpuConfig->getColorSpace();
|
||||
if (gpuConfig->getSurfType() != SkCommandLineConfigGpu::SurfType::kDefault) {
|
||||
@ -499,6 +501,7 @@ static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
|
||||
kPremul_SkAlphaType,
|
||||
sk_ref_sp(colorSpace),
|
||||
sampleCount,
|
||||
useDMSAA,
|
||||
ctxType,
|
||||
ctxOverrides,
|
||||
gpuConfig->getSurfaceFlags()
|
||||
@ -517,7 +520,7 @@ static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c
|
||||
} \
|
||||
Config config = { \
|
||||
SkString(#name), Benchmark::backend, color, alpha, colorSpace, \
|
||||
0, kBogusContextType, kBogusContextOverrides, 0 \
|
||||
0, false, kBogusContextType, kBogusContextOverrides, 0 \
|
||||
}; \
|
||||
configs->push_back(config); \
|
||||
return; \
|
||||
|
@ -25,6 +25,7 @@ struct Config {
|
||||
SkAlphaType alpha;
|
||||
sk_sp<SkColorSpace> colorSpace;
|
||||
int samples;
|
||||
bool useDMSAA;
|
||||
sk_gpu_test::GrContextFactory::ContextType ctxType;
|
||||
sk_gpu_test::GrContextFactory::ContextOverrides ctxOverrides;
|
||||
uint32_t surfaceFlags;
|
||||
|
@ -1479,6 +1479,7 @@ GPUSink::GPUSink(const SkCommandLineConfigGpu* config,
|
||||
, fAlphaType(config->getAlphaType())
|
||||
, fColorSpace(sk_ref_sp(config->getColorSpace()))
|
||||
, fBaseContextOptions(grCtxOptions) {
|
||||
fBaseContextOptions.fAlwaysAntialias = config->getUseDMSAA();
|
||||
if (FLAGS_programBinaryCache) {
|
||||
fBaseContextOptions.fPersistentCache = &fMemoryCache;
|
||||
}
|
||||
|
@ -313,6 +313,12 @@ struct SK_API GrContextOptions {
|
||||
*/
|
||||
bool fDisallowWritePixelRowBytes = false;
|
||||
|
||||
/**
|
||||
* Forces all draws to use antialiasing. This allows Ganesh to use internal multisampling
|
||||
* as well as certain clip optimizations.
|
||||
*/
|
||||
bool fAlwaysAntialias = false;
|
||||
|
||||
/**
|
||||
* Include or exclude specific GPU path renderers.
|
||||
*/
|
||||
|
@ -570,8 +570,7 @@ void GrBlurUtils::drawShapeWithMaskFilter(GrRecordingContext* context,
|
||||
draw_shape_with_mask_filter(context, surfaceDrawContext, clip, std::move(grPaint),
|
||||
viewMatrix, mf, shape);
|
||||
} else {
|
||||
GrAA aa = GrAA(paint.isAntiAlias());
|
||||
surfaceDrawContext->drawShape(clip, std::move(grPaint), aa, viewMatrix,
|
||||
GrStyledShape(shape));
|
||||
surfaceDrawContext->drawShape(clip, std::move(grPaint), context->priv().chooseAA(paint),
|
||||
viewMatrix, GrStyledShape(shape));
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#ifndef GrRecordingContextPriv_DEFINED
|
||||
#define GrRecordingContextPriv_DEFINED
|
||||
|
||||
#include "include/core/SkPaint.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/gpu/text/GrSDFTControl.h"
|
||||
|
||||
@ -25,6 +26,16 @@ public:
|
||||
|
||||
const GrContextOptions& options() const { return fContext->options(); }
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
bool alwaysAntialias() const { return fContext->options().fAlwaysAntialias; }
|
||||
GrAA chooseAA(const SkPaint& paint) const {
|
||||
return GrAA(paint.isAntiAlias() || this->alwaysAntialias());
|
||||
}
|
||||
#else
|
||||
bool alwaysAntialias() const { return false; }
|
||||
GrAA chooseAA(const SkPaint& paint) const { return GrAA(paint.isAntiAlias()); }
|
||||
#endif
|
||||
|
||||
const GrCaps* caps() const { return fContext->caps(); }
|
||||
sk_sp<const GrCaps> refCaps() const;
|
||||
|
||||
|
@ -119,8 +119,9 @@ static SkImageInfo make_info(GrSurfaceDrawContext* context, bool opaque) {
|
||||
}
|
||||
|
||||
#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
|
||||
static bool force_aa_clip(const GrSurfaceDrawContext* sdc) {
|
||||
return sdc->numSamples() > 1 && !sdc->caps()->multisampleDisableSupport();
|
||||
static bool force_aa_clip(const GrRecordingContext* context, const GrSurfaceDrawContext* sdc) {
|
||||
return (sdc->numSamples() > 1 && !sdc->caps()->multisampleDisableSupport()) ||
|
||||
context->priv().alwaysAntialias();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -134,7 +135,7 @@ SkGpuDevice::SkGpuDevice(GrRecordingContext* context,
|
||||
#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
|
||||
, fClip(SkIRect::MakeSize(fSurfaceDrawContext->dimensions()),
|
||||
&this->asMatrixProvider(),
|
||||
force_aa_clip(fSurfaceDrawContext.get())) {
|
||||
force_aa_clip(fContext.get(), fSurfaceDrawContext.get())) {
|
||||
#else
|
||||
, fClip(fSurfaceDrawContext->dimensions(), &this->cs(), &this->asMatrixProvider()) {
|
||||
#endif
|
||||
@ -264,14 +265,17 @@ void SkGpuDevice::onClipPath(const SkPath& path, SkClipOp op, bool aa) {
|
||||
void SkGpuDevice::onClipRegion(const SkRegion& globalRgn, SkClipOp op) {
|
||||
SkASSERT(op == SkClipOp::kIntersect || op == SkClipOp::kDifference);
|
||||
|
||||
// Regions don't actually need AA, but in DMSAA mode every clip element is antialiased.
|
||||
GrAA aa = GrAA(fContext->priv().alwaysAntialias());
|
||||
|
||||
if (globalRgn.isEmpty()) {
|
||||
fClip.clipRect(SkMatrix::I(), SkRect::MakeEmpty(), GrAA::kNo, op);
|
||||
fClip.clipRect(SkMatrix::I(), SkRect::MakeEmpty(), aa, op);
|
||||
} else if (globalRgn.isRect()) {
|
||||
fClip.clipRect(this->globalToDevice(), SkRect::Make(globalRgn.getBounds()), GrAA::kNo, op);
|
||||
fClip.clipRect(this->globalToDevice(), SkRect::Make(globalRgn.getBounds()), aa, op);
|
||||
} else {
|
||||
SkPath path;
|
||||
globalRgn.getBoundaryPath(&path);
|
||||
fClip.clipPath(this->globalToDevice(), path, GrAA::kNo, op);
|
||||
fClip.clipPath(this->globalToDevice(), path, aa, op);
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,6 +301,7 @@ bool SkGpuDevice::onClipIsAA() const {
|
||||
if (e.fAA == GrAA::kYes) {
|
||||
return true;
|
||||
}
|
||||
SkASSERT(!fContext->priv().alwaysAntialias());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -351,6 +356,8 @@ void SkGpuDevice::drawPoints(SkCanvas::PointMode mode,
|
||||
return;
|
||||
}
|
||||
|
||||
GrAA aa = fContext->priv().chooseAA(paint);
|
||||
|
||||
if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mode) {
|
||||
GrStyle style(paint, SkPaint::kStroke_Style);
|
||||
GrPaint grPaint;
|
||||
@ -362,8 +369,8 @@ void SkGpuDevice::drawPoints(SkCanvas::PointMode mode,
|
||||
path.setIsVolatile(true);
|
||||
path.moveTo(pts[0]);
|
||||
path.lineTo(pts[1]);
|
||||
fSurfaceDrawContext->drawPath(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
|
||||
this->localToDevice(), path, style);
|
||||
fSurfaceDrawContext->drawPath(this->clip(), std::move(grPaint), aa, this->localToDevice(),
|
||||
path, style);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -373,7 +380,7 @@ void SkGpuDevice::drawPoints(SkCanvas::PointMode mode,
|
||||
SkScalarNearlyEqual(scales[0], 1.f) && SkScalarNearlyEqual(scales[1], 1.f));
|
||||
// we only handle non-antialiased hairlines and paints without path effects or mask filters,
|
||||
// else we let the SkDraw call our drawPath()
|
||||
if (!isHairline || paint.getPathEffect() || paint.getMaskFilter() || paint.isAntiAlias()) {
|
||||
if (!isHairline || paint.getPathEffect() || paint.getMaskFilter() || aa == GrAA::kYes) {
|
||||
SkRasterClip rc(this->devClipBounds());
|
||||
SkDraw draw;
|
||||
draw.fDst = SkPixmap(SkImageInfo::MakeUnknown(this->width(), this->height()), nullptr, 0);
|
||||
@ -433,8 +440,9 @@ void SkGpuDevice::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
return;
|
||||
}
|
||||
|
||||
fSurfaceDrawContext->drawRect(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
|
||||
this->localToDevice(), rect, &style);
|
||||
fSurfaceDrawContext->drawRect(this->clip(), std::move(grPaint),
|
||||
fContext->priv().chooseAA(paint), this->localToDevice(), rect,
|
||||
&style);
|
||||
}
|
||||
|
||||
void SkGpuDevice::drawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||
@ -496,16 +504,18 @@ void SkGpuDevice::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
return;
|
||||
}
|
||||
|
||||
fSurfaceDrawContext->drawRRect(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
|
||||
this->localToDevice(), rrect, style);
|
||||
fSurfaceDrawContext->drawRRect(this->clip(), std::move(grPaint),
|
||||
fContext->priv().chooseAA(paint), this->localToDevice(), rrect,
|
||||
style);
|
||||
}
|
||||
|
||||
static std::unique_ptr<GrFragmentProcessor> make_inverse_rrect_fp(const SkMatrix& viewMatrix,
|
||||
const SkRRect& rrect, bool aa,
|
||||
const SkRRect& rrect, GrAA aa,
|
||||
const GrShaderCaps& shaderCaps) {
|
||||
SkTCopyOnFirstWrite<SkRRect> devRRect(rrect);
|
||||
if (viewMatrix.isIdentity() || rrect.transform(viewMatrix, devRRect.writable())) {
|
||||
auto edgeType = (aa) ? GrClipEdgeType::kInverseFillAA : GrClipEdgeType::kInverseFillBW;
|
||||
auto edgeType = (aa == GrAA::kYes) ? GrClipEdgeType::kInverseFillAA
|
||||
: GrClipEdgeType::kInverseFillBW;
|
||||
auto [success, fp] = GrRRectEffect::Make(/*inputFP=*/nullptr, edgeType, *devRRect,
|
||||
shaderCaps);
|
||||
return (success) ? std::move(fp) : nullptr;
|
||||
@ -529,7 +539,8 @@ void SkGpuDevice::drawDRRect(const SkRRect& outer, const SkRRect& inner, const S
|
||||
if (stroke.isFillStyle() && !paint.getMaskFilter() && !paint.getPathEffect()) {
|
||||
// For axis-aligned filled DRRects, just draw a regular rrect with inner clipped out using a
|
||||
// coverage FP instead of using path rendering.
|
||||
if (auto fp = make_inverse_rrect_fp(this->localToDevice(), inner, paint.isAntiAlias(),
|
||||
if (auto fp = make_inverse_rrect_fp(this->localToDevice(), inner,
|
||||
fContext->priv().chooseAA(paint),
|
||||
*fSurfaceDrawContext->caps()->shaderCaps())) {
|
||||
GrPaint grPaint;
|
||||
if (!SkPaintToGrPaint(this->recordingContext(), fSurfaceDrawContext->colorInfo(), paint,
|
||||
@ -539,8 +550,8 @@ void SkGpuDevice::drawDRRect(const SkRRect& outer, const SkRRect& inner, const S
|
||||
SkASSERT(!grPaint.hasCoverageFragmentProcessor());
|
||||
grPaint.setCoverageFragmentProcessor(std::move(fp));
|
||||
fSurfaceDrawContext->drawRRect(this->clip(), std::move(grPaint),
|
||||
GrAA(paint.isAntiAlias()), this->localToDevice(), outer,
|
||||
GrStyle());
|
||||
fContext->priv().chooseAA(paint), this->localToDevice(),
|
||||
outer, GrStyle());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -575,8 +586,9 @@ void SkGpuDevice::drawRegion(const SkRegion& region, const SkPaint& paint) {
|
||||
return;
|
||||
}
|
||||
|
||||
fSurfaceDrawContext->drawRegion(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
|
||||
this->localToDevice(), region, GrStyle(paint));
|
||||
fSurfaceDrawContext->drawRegion(this->clip(), std::move(grPaint),
|
||||
fContext->priv().chooseAA(paint), this->localToDevice(), region,
|
||||
GrStyle(paint));
|
||||
}
|
||||
|
||||
void SkGpuDevice::drawOval(const SkRect& oval, const SkPaint& paint) {
|
||||
@ -595,8 +607,9 @@ void SkGpuDevice::drawOval(const SkRect& oval, const SkPaint& paint) {
|
||||
return;
|
||||
}
|
||||
|
||||
fSurfaceDrawContext->drawOval(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
|
||||
this->localToDevice(), oval, GrStyle(paint));
|
||||
fSurfaceDrawContext->drawOval(this->clip(), std::move(grPaint),
|
||||
fContext->priv().chooseAA(paint), this->localToDevice(), oval,
|
||||
GrStyle(paint));
|
||||
}
|
||||
|
||||
void SkGpuDevice::drawArc(const SkRect& oval, SkScalar startAngle,
|
||||
@ -613,7 +626,7 @@ void SkGpuDevice::drawArc(const SkRect& oval, SkScalar startAngle,
|
||||
return;
|
||||
}
|
||||
|
||||
fSurfaceDrawContext->drawArc(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
|
||||
fSurfaceDrawContext->drawArc(this->clip(), std::move(grPaint), fContext->priv().chooseAA(paint),
|
||||
this->localToDevice(), oval, startAngle, sweepAngle, useCenter,
|
||||
GrStyle(paint));
|
||||
}
|
||||
@ -637,8 +650,9 @@ void SkGpuDevice::drawPath(const SkPath& origSrcPath, const SkPaint& paint, bool
|
||||
this->asMatrixProvider(), &grPaint)) {
|
||||
return;
|
||||
}
|
||||
fSurfaceDrawContext->drawPath(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
|
||||
this->localToDevice(), origSrcPath, GrStyle(paint));
|
||||
fSurfaceDrawContext->drawPath(this->clip(), std::move(grPaint),
|
||||
fContext->priv().chooseAA(paint), this->localToDevice(),
|
||||
origSrcPath, GrStyle(paint));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -748,9 +762,10 @@ void SkGpuDevice::drawImageRect(const SkImage* image, const SkRect* src, const S
|
||||
const SkSamplingOptions& sampling, const SkPaint& paint,
|
||||
SkCanvas::SrcRectConstraint constraint) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
GrQuadAAFlags aaFlags = paint.isAntiAlias() ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone;
|
||||
this->drawImageQuad(image, src, &dst, nullptr, GrAA(paint.isAntiAlias()), aaFlags, nullptr,
|
||||
sampling, paint, constraint);
|
||||
GrAA aa = fContext->priv().chooseAA(paint);
|
||||
GrQuadAAFlags aaFlags = (aa == GrAA::kYes) ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone;
|
||||
this->drawImageQuad(image, src, &dst, nullptr, aa, aaFlags, nullptr, sampling, paint,
|
||||
constraint);
|
||||
}
|
||||
|
||||
void SkGpuDevice::drawViewLattice(GrSurfaceProxyView view,
|
||||
@ -1023,7 +1038,9 @@ bool SkGpuDevice::android_utils_clipWithStencil() {
|
||||
GrUserStencilOp::kReplace,
|
||||
0x1>()
|
||||
);
|
||||
sdc->drawRegion(nullptr, std::move(grPaint), GrAA::kNo, SkMatrix::I(), clipRegion,
|
||||
// Regions don't actually need AA, but in DMSAA mode everything is antialiased.
|
||||
GrAA aa = GrAA(fContext->priv().alwaysAntialias());
|
||||
sdc->drawRegion(nullptr, std::move(grPaint), aa, SkMatrix::I(), clipRegion,
|
||||
GrStyle::SimpleFill(), &kDrawToStencil);
|
||||
return true;
|
||||
}
|
||||
|
@ -673,8 +673,8 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special, const SkMatrix& localToDe
|
||||
SkMatrix srcToDst = SkMatrix::RectToRect(src, dst);
|
||||
|
||||
GrSamplerState sampler(GrSamplerState::WrapMode::kClamp, downgrade_to_filter(sampling));
|
||||
GrAA aa = paint.isAntiAlias() ? GrAA::kYes : GrAA::kNo;
|
||||
GrQuadAAFlags aaFlags = paint.isAntiAlias() ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone;
|
||||
GrAA aa = fContext->priv().chooseAA(paint);
|
||||
GrQuadAAFlags aaFlags = (aa == GrAA::kYes) ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone;
|
||||
|
||||
GrColorInfo colorInfo(SkColorTypeToGrColorType(special->colorType()),
|
||||
special->alphaType(), sk_ref_sp(special->getColorSpace()));
|
||||
|
@ -39,8 +39,8 @@ float4x3 unpack_rational_cubic(float2 p0, float2 p1, float2 p2, float2 p3) {
|
||||
if (isinf(P[3].y)) {
|
||||
// This patch is actually a conic. Convert to a rational cubic.
|
||||
float w = P[3].x;
|
||||
float3 c = P[1] * (2/3.0 * w);
|
||||
P = float4x3(P[0], fma(P[0], float3(1/3.0), c), fma(P[2], float3(1/3.0), c), P[2]);
|
||||
float3 c = P[1] * ((2.0/3.0) * w);
|
||||
P = float4x3(P[0], fma(P[0], float3(1.0/3.0), c), fma(P[2], float3(1.0/3.0), c), P[2]);
|
||||
}
|
||||
return P;
|
||||
})";
|
||||
@ -53,7 +53,7 @@ float3 safe_mix(float3 a, float3 b, float T, float one_minus_T) {
|
||||
return a*one_minus_T + b*T;
|
||||
}
|
||||
float2 eval_rational_cubic(float4x3 P, float T) {
|
||||
float one_minus_T = 1 - T;
|
||||
float one_minus_T = 1.0 - T;
|
||||
float3 ab = safe_mix(P[0], P[1], T, one_minus_T);
|
||||
float3 bc = safe_mix(P[1], P[2], T, one_minus_T);
|
||||
float3 cd = safe_mix(P[2], P[3], T, one_minus_T);
|
||||
|
@ -29,7 +29,7 @@ static const char* kCosineBetweenVectorsFn = R"(
|
||||
float cosine_between_vectors(float2 a, float2 b) {
|
||||
float ab_cosTheta = dot(a,b);
|
||||
float ab_pow2 = dot(a,a) * dot(b,b);
|
||||
return (ab_pow2 == 0) ? 1 : clamp(ab_cosTheta * inversesqrt(ab_pow2), -1, 1);
|
||||
return (ab_pow2 == 0.0) ? 1.0 : clamp(ab_cosTheta * inversesqrt(ab_pow2), -1.0, 1.0);
|
||||
})";
|
||||
|
||||
// Extends the middle radius to either the miter point, or the bevel edge if we surpassed the miter
|
||||
@ -77,7 +77,7 @@ static void append_wangs_formula_fn(SkString* code, bool hasConics) {
|
||||
if (hasConics) {
|
||||
code->appendf(R"(
|
||||
const float QUAD_TERM_POW2 = %f;
|
||||
m = (w > 0) ? QUAD_TERM_POW2 * l0 : m;)", GrWangsFormula::length_term_pow2<2>(1));
|
||||
m = (w > 0.0) ? QUAD_TERM_POW2 * l0 : m;)", GrWangsFormula::length_term_pow2<2>(1));
|
||||
}
|
||||
code->append(R"(
|
||||
return max(ceil(sqrt(parametricIntolerance * sqrt(m))), 1.0);
|
||||
@ -688,7 +688,7 @@ static void append_eval_stroke_edge_fn(SkString* code, bool hasConics) {
|
||||
// that we use to find a tangent.
|
||||
C *= w;
|
||||
B = .5*D - C;
|
||||
A = (w - 1) * D;
|
||||
A = (w - 1.0) * D;
|
||||
P[1] *= w;
|
||||
} else {)");
|
||||
} else {
|
||||
|
@ -38,6 +38,8 @@ static const struct {
|
||||
{ "gl", "gpu", "api=gl" },
|
||||
{ "gles", "gpu", "api=gles" },
|
||||
{ "glesfakev2", "gpu", "api=glesfakev2" },
|
||||
{ "gldmsaa", "gpu", "api=gl,dmsaa=true" },
|
||||
{ "glesdmsaa", "gpu", "api=gles,dmsaa=true" },
|
||||
{ "glmsaa4", "gpu", "api=gl,samples=4" },
|
||||
{ "glmsaa8" , "gpu", "api=gl,samples=8" },
|
||||
{ "glesmsaa4", "gpu", "api=gles,samples=4" },
|
||||
@ -143,7 +145,7 @@ static const char configExtendedHelp[] =
|
||||
"Extended form: 'backend(option=value,...)'\n\n"
|
||||
"Possible backends and options:\n"
|
||||
"\n"
|
||||
"gpu[api=string,color=string,dit=bool,samples=int]\n"
|
||||
"gpu[api=string,color=string,dit=bool,dmsaa=bool,samples=int]\n"
|
||||
"\tapi\ttype: string\trequired\n"
|
||||
"\t Select graphics API to use with gpu backend.\n"
|
||||
"\t Options:\n"
|
||||
@ -179,6 +181,8 @@ static const char configExtendedHelp[] =
|
||||
"\t\tf16\t\t\tLinearly blended 16-bit floating point.\n"
|
||||
"\tdit\ttype: bool\tdefault: false.\n"
|
||||
"\t Use device independent text.\n"
|
||||
"\tdmsaa\ttype: bool\tdefault: false.\n"
|
||||
"\t Use internal MSAA to render to non-MSAA surfaces.\n"
|
||||
"\tsamples\ttype: int\tdefault: 0.\n"
|
||||
"\t Use multisampling with N samples.\n"
|
||||
"\tstencils\ttype: bool\tdefault: true.\n"
|
||||
@ -470,6 +474,7 @@ SkCommandLineConfigGpu::SkCommandLineConfigGpu(const SkString& tag,
|
||||
bool fakeGLESVersion2,
|
||||
uint32_t surfaceFlags,
|
||||
int samples,
|
||||
bool useDMSAA,
|
||||
SkColorType colorType,
|
||||
SkAlphaType alphaType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
@ -485,6 +490,7 @@ SkCommandLineConfigGpu::SkCommandLineConfigGpu(const SkString& tag,
|
||||
, fContextOverrides(ContextOverrides::kNone)
|
||||
, fSurfaceFlags(surfaceFlags)
|
||||
, fSamples(samples)
|
||||
, fUseDMSAA(useDMSAA)
|
||||
, fColorType(colorType)
|
||||
, fAlphaType(alphaType)
|
||||
, fColorSpace(std::move(colorSpace))
|
||||
@ -508,6 +514,7 @@ SkCommandLineConfigGpu* parse_command_line_config_gpu(const SkString&
|
||||
// Defaults for GPU backend.
|
||||
SkCommandLineConfigGpu::ContextType contextType = GrContextFactory::kGL_ContextType;
|
||||
bool useDIText = false;
|
||||
bool useDMSAA = false;
|
||||
int samples = 1;
|
||||
SkColorType colorType = kRGBA_8888_SkColorType;
|
||||
SkAlphaType alphaType = kPremul_SkAlphaType;
|
||||
@ -531,6 +538,7 @@ SkCommandLineConfigGpu* parse_command_line_config_gpu(const SkString&
|
||||
extendedOptions.get_option_gpu_api("api", &contextType, &fakeGLESVersion2, false) &&
|
||||
extendedOptions.get_option_bool("dit", &useDIText) &&
|
||||
extendedOptions.get_option_int("samples", &samples) &&
|
||||
extendedOptions.get_option_bool("dmsaa", &useDMSAA) &&
|
||||
extendedOptions.get_option_gpu_color("color", &colorType, &alphaType, &colorSpace) &&
|
||||
extendedOptions.get_option_bool("stencils", &useStencils) &&
|
||||
extendedOptions.get_option_bool("testThreading", &testThreading) &&
|
||||
@ -556,6 +564,7 @@ SkCommandLineConfigGpu* parse_command_line_config_gpu(const SkString&
|
||||
fakeGLESVersion2,
|
||||
surfaceFlags,
|
||||
samples,
|
||||
useDMSAA,
|
||||
colorType,
|
||||
alphaType,
|
||||
colorSpace,
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
bool fakeGLESVer2,
|
||||
uint32_t surfaceFlags,
|
||||
int samples,
|
||||
bool useDMSAA,
|
||||
SkColorType colorType,
|
||||
SkAlphaType alphaType,
|
||||
sk_sp<SkColorSpace> colorSpace,
|
||||
@ -73,6 +74,7 @@ public:
|
||||
ContextOverrides getContextOverrides() const { return fContextOverrides; }
|
||||
uint32_t getSurfaceFlags() const { return fSurfaceFlags; }
|
||||
int getSamples() const { return fSamples; }
|
||||
bool getUseDMSAA() const { return fUseDMSAA; }
|
||||
SkColorType getColorType() const { return fColorType; }
|
||||
SkAlphaType getAlphaType() const { return fAlphaType; }
|
||||
SkColorSpace* getColorSpace() const { return fColorSpace.get(); }
|
||||
@ -88,6 +90,7 @@ private:
|
||||
ContextOverrides fContextOverrides;
|
||||
uint32_t fSurfaceFlags;
|
||||
int fSamples;
|
||||
bool fUseDMSAA;
|
||||
SkColorType fColorType;
|
||||
SkAlphaType fAlphaType;
|
||||
sk_sp<SkColorSpace> fColorSpace;
|
||||
|
@ -566,6 +566,7 @@ int main(int argc, char** argv) {
|
||||
// Create a context.
|
||||
GrContextOptions ctxOptions;
|
||||
SetCtxOptionsFromCommonFlags(&ctxOptions);
|
||||
ctxOptions.fAlwaysAntialias = config->getUseDMSAA();
|
||||
sk_gpu_test::GrContextFactory factory(ctxOptions);
|
||||
sk_gpu_test::ContextInfo ctxInfo =
|
||||
factory.getContextInfo(config->getContextType(), config->getContextOverrides());
|
||||
|
@ -133,6 +133,7 @@ static DEFINE_bool(list, false, "List samples?");
|
||||
static DEFINE_string2(backend, b, "sw", "Backend to use. Allowed values are " BACKENDS_STR ".");
|
||||
|
||||
static DEFINE_int(msaa, 1, "Number of subpixel samples. 0 for no HW antialiasing.");
|
||||
static DEFINE_bool(dmsaa, false, "Use internal MSAA to render to non-MSAA surfaces?");
|
||||
|
||||
static DEFINE_string(bisect, "", "Path to a .skp or .svg file to bisect.");
|
||||
|
||||
@ -378,6 +379,7 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
|
||||
GrContextOptions::ShaderCacheStrategy::kBackendSource;
|
||||
displayParams.fGrContextOptions.fShaderErrorHandler = &gShaderErrorHandler;
|
||||
displayParams.fGrContextOptions.fSuppressPrints = true;
|
||||
displayParams.fGrContextOptions.fAlwaysAntialias = FLAGS_dmsaa;
|
||||
fWindow->setRequestedDisplayParams(displayParams);
|
||||
fDisplay = fWindow->getRequestedDisplayParams();
|
||||
fRefresh = FLAGS_redraw;
|
||||
|
Loading…
Reference in New Issue
Block a user