Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Unified Diff: src/gpu/instanced/InstancedRendering.cpp

Issue 2120163002: Enable blend optimizations with instanced draws (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_ingorecov
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/instanced/InstanceProcessor.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/instanced/InstancedRendering.cpp
diff --git a/src/gpu/instanced/InstancedRendering.cpp b/src/gpu/instanced/InstancedRendering.cpp
index 165bff494b3fa0ab1f241c844ec59afb8b582da9..adb0738967cff82c429c54453b30c0946e8b70af 100644
--- a/src/gpu/instanced/InstancedRendering.cpp
+++ b/src/gpu/instanced/InstancedRendering.cpp
@@ -328,6 +328,20 @@ void InstancedRendering::Batch::appendParamsTexel(SkScalar x, SkScalar y, SkScal
fInfo.fHasParams = true;
}
+void InstancedRendering::Batch::computePipelineOptimizations(GrInitInvariantOutput* color,
+ GrInitInvariantOutput* coverage,
+ GrBatchToXPOverrides* overrides) const {
+ color->setKnownFourComponents(this->getSingleInstance().fColor);
+
+ if (AntialiasMode::kCoverage == fInfo.fAntialiasMode ||
+ (AntialiasMode::kNone == fInfo.fAntialiasMode &&
+ !fInfo.isSimpleRects() && fInfo.fCannotDiscard)) {
+ coverage->setUnknownSingleComponent();
+ } else {
+ coverage->setKnownSingleComponent(255);
+ }
+}
+
void InstancedRendering::Batch::initBatchTracker(const GrXPOverridesForBatch& overrides) {
Draw& draw = this->getSingleDraw(); // This will assert if we have > 1 command.
SkASSERT(draw.fGeometry.isEmpty());
@@ -389,22 +403,6 @@ bool InstancedRendering::Batch::onCombineIfPossible(GrBatch* other, const GrCaps
return true;
}
-void InstancedRendering::Batch::computePipelineOptimizations(GrInitInvariantOutput* color,
- GrInitInvariantOutput* coverage,
- GrBatchToXPOverrides* overrides) const {
- // We need to be careful about fInfo here and consider how it might change as batches combine.
- // e.g. We can't make an assumption based on fInfo.isSimpleRects() because the batch might
- // later combine with a non-rect.
csmartdalton 2016/07/03 17:36:43 This comment was actually just about a bug, fixed
- color->setUnknownFourComponents();
- if (fInfo.fAntialiasMode >= AntialiasMode::kMSAA) {
- coverage->setKnownSingleComponent(255);
- } else if (AntialiasMode::kNone == fInfo.fAntialiasMode && !fInfo.fCannotDiscard) {
- coverage->setKnownSingleComponent(255);
- } else {
- coverage->setUnknownSingleComponent();
- }
-}
-
void InstancedRendering::beginFlush(GrResourceProvider* rp) {
SkASSERT(State::kRecordingDraws == fState);
fState = State::kFlushing;
« no previous file with comments | « src/gpu/instanced/InstanceProcessor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698