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

Unified Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 23537028: Enable vertexless shading when path rendering is supported (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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
Index: src/gpu/gl/GrGLShaderBuilder.cpp
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index f73520c363f268a7666689d2a4b26404afbcaea0..0d09606ddcfbbb7d9bdc351ecd4a817c1a71a2e4 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -102,12 +102,21 @@ GrGLShaderBuilder::GrGLShaderBuilder(const GrGLContextInfo& ctxInfo,
, fFSInputs(kVarsPerBlock)
, fFSOutputs(kMaxFSOutputs)
, fSetupFragPosition(false)
- , fTopLeftFragPosRead(kTopLeftFragPosRead_FragPosKey == desc.getHeader().fFragPosKey) {
+ , fTopLeftFragPosRead(kTopLeftFragPosRead_FragPosKey == desc.getHeader().fFragPosKey)
+ , fNumTexGenUnits(0) {
const GrGLProgramDesc::KeyHeader& header = desc.getHeader();
- // TODO: go vertexless when possible.
- fVertexBuilder.reset(SkNEW_ARGS(VertexBuilder, (this, desc)));
+ // We only go without a vertex shader if every effect supports vertexless mode, the context
+ // has fixed function/path rendering support, and position is the only vertex attribute.
+ if (hasVertexShaderEffects ||
+ !ctxInfo.caps()->fixedFunctionSupport() ||
+ !ctxInfo.caps()->pathStencilingSupport() ||
+ -1 != header.fLocalCoordAttributeIndex ||
+ -1 != header.fColorAttributeIndex ||
+ -1 != header.fCoverageAttributeIndex) {
+ fVertexBuilder.reset(SkNEW_ARGS(VertexBuilder, (this, desc)));
+ }
// Emit code to read the dst copy textue if necessary.
if (kNoDstRead_DstReadKey != header.fDstReadKey &&
@@ -434,6 +443,23 @@ void GrGLShaderBuilder::fsEmitFunction(GrSLType returnType,
fFSFunctions.append("}\n\n");
}
+void GrGLShaderBuilder::addTexGenUnit(GrSLType type,
+ SkString* fsInName,
+ int* unitIdx,
+ int* numComponents)
+{
bsalomon 2013/09/10 13:51:06 style nit: { up on prev line
+ const int index = fNumTexGenUnits++;
+ if (fsInName) {
+ fsInName->printf("%s(gl_TexCoord[%u])", GrGLSLTypeString(type), index);
+ }
+ if (unitIdx) {
+ *unitIdx = index;
+ }
+ if (numComponents) {
+ *numComponents = GrSLTypeToVecLength(type);
+ }
+}
+
namespace {
inline void append_default_precision_qualifier(GrGLShaderVar::Precision p,

Powered by Google App Engine
This is Rietveld 408576698