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

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

Issue 2182783004: Add test configs for instanced rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add test configs for instanced rendering 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.h ('k') | src/gpu/instanced/InstancedRendering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/instanced/InstanceProcessor.cpp
diff --git a/src/gpu/instanced/InstanceProcessor.cpp b/src/gpu/instanced/InstanceProcessor.cpp
index b6a3bb9a0fac1eddd0ac9f5b37fd99e5593dfe88..50bc219087dfb26d8a8a39895c56152e02641787 100644
--- a/src/gpu/instanced/InstanceProcessor.cpp
+++ b/src/gpu/instanced/InstanceProcessor.cpp
@@ -18,29 +18,26 @@
namespace gr_instanced {
-bool InstanceProcessor::IsSupported(const GrGLSLCaps& glslCaps, const GrCaps& caps,
- AntialiasMode* lastSupportedAAMode) {
+GrCaps::InstancedSupport InstanceProcessor::CheckSupport(const GrGLSLCaps& glslCaps,
+ const GrCaps& caps) {
if (!glslCaps.canUseAnyFunctionInShader() ||
!glslCaps.flatInterpolationSupport() ||
!glslCaps.integerSupport() ||
0 == glslCaps.maxVertexSamplers() ||
!caps.shaderCaps()->texelBufferSupport() ||
caps.maxVertexAttributes() < kNumAttribs) {
- return false;
- }
- if (caps.sampleLocationsSupport() &&
- glslCaps.sampleVariablesSupport() &&
- glslCaps.shaderDerivativeSupport()) {
- if (0 != caps.maxRasterSamples() &&
- glslCaps.sampleMaskOverrideCoverageSupport()) {
- *lastSupportedAAMode = AntialiasMode::kMixedSamples;
- } else {
- *lastSupportedAAMode = AntialiasMode::kMSAA;
- }
- } else {
- *lastSupportedAAMode = AntialiasMode::kCoverage;
+ return GrCaps::InstancedSupport::kNone;
+ }
+ if (!caps.sampleLocationsSupport() ||
+ !glslCaps.sampleVariablesSupport() ||
+ !glslCaps.shaderDerivativeSupport()) {
+ return GrCaps::InstancedSupport::kBasic;
}
- return true;
+ if (0 == caps.maxRasterSamples() ||
+ !glslCaps.sampleMaskOverrideCoverageSupport()) {
+ return GrCaps::InstancedSupport::kMultisampled;
+ }
+ return GrCaps::InstancedSupport::kMixedSampled;
}
InstanceProcessor::InstanceProcessor(BatchInfo batchInfo, GrBuffer* paramsBuffer)
@@ -767,8 +764,8 @@ void GLSLInstanceProcessor::BackendCoverage::onInit(GrGLSLVaryingHandler* varyin
varyingHandler->addVarying("ellipseCoords", &fEllipseCoords, kMedium_GrSLPrecision);
varyingHandler->addFlatVarying("ellipseName", &fEllipseName, kHigh_GrSLPrecision);
} else {
- varyingHandler->addVarying("circleCoords", &fEllipseCoords, kMedium_GrSLPrecision);
- varyingHandler->addFlatVarying("bloatedRadius", &fBloatedRadius, kMedium_GrSLPrecision);
+ varyingHandler->addVarying("circleCoords", &fEllipseCoords, kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("bloatedRadius", &fBloatedRadius, kHigh_GrSLPrecision);
}
}
}
@@ -1016,7 +1013,7 @@ void GLSLInstanceProcessor::BackendCoverage::emitCircle(GrGLSLPPFragmentBuilder*
const char* outCoverage) {
// TODO: circleCoords = max(circleCoords, 0) if we decide to do this optimization on rrects.
SkASSERT(!(kRRect_ShapesMask & fBatchInfo.fShapeTypes));
- f->appendPrecisionModifier(kLow_GrSLPrecision);
+ f->appendPrecisionModifier(kMedium_GrSLPrecision);
f->codeAppendf("float distanceToEdge = %s - length(%s);",
fBloatedRadius.fsIn(), fEllipseCoords.fsIn());
f->codeAppendf("%s = clamp(distanceToEdge, 0.0, 1.0);", outCoverage);
@@ -1407,9 +1404,8 @@ void GLSLInstanceProcessor::BackendMultisample::onEmitCode(GrGLSLVertexBuilder*,
}
} else {
const char* arcTest = fArcTest.fsIn();
- SkASSERT(arcTest);
- if (fBatchInfo.fHasPerspective) {
- // The non-perspective version accounts for fwith() in the vertex shader.
+ if (arcTest && fBatchInfo.fHasPerspective) {
+ // The non-perspective version accounts for fwidth() in the vertex shader.
// We make sure to take the derivative here, before a neighbor pixel may early accept.
f->enableFeature(GrGLSLPPFragmentBuilder::kStandardDerivatives_GLSLFeature);
f->appendPrecisionModifier(kHigh_GrSLPrecision);
« no previous file with comments | « src/gpu/instanced/InstanceProcessor.h ('k') | src/gpu/instanced/InstancedRendering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698