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

Unified Diff: include/gpu/GrTypesPriv.h

Issue 761563002: First step to moving vertex attributes to the geometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: adding test to ignore Created 6 years 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 | « gm/convexpolyeffect.cpp ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrTypesPriv.h
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
index 75c987f148707ab05f659a9b9938d89dc6bab663..0ff4e5709e4928a7fa69c418c114ad0665ee0c21 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -120,58 +120,24 @@ static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
}
/**
- * Semantic bindings for vertex attributes. kEffect means that the attribute is input to a
- * GrProcessor. Each binding other than kEffect may not appear more than once in the current set of
- * attributes. kPosition must be appear for exactly one attribute.
+ * converts a GrVertexAttribType to a GrSLType
*/
-enum GrVertexAttribBinding {
- kPosition_GrVertexAttribBinding, // required, must have vector count of 2
- kLocalCoord_GrVertexAttribBinding, // must have vector count of 2
- kColor_GrVertexAttribBinding, // must have vector count of 4
- kCoverage_GrVertexAttribBinding, // must have a single byte
-
- kLastFixedFunction_GrVertexAttribBinding = kCoverage_GrVertexAttribBinding,
-
- kGeometryProcessor_GrVertexAttribBinding, // vector length must agree with
- // GrProcessor::vertexAttribType() for each effect input to
- // which the attribute is mapped by GrDrawState::setEffect()
- kLast_GrVertexAttribBinding = kGeometryProcessor_GrVertexAttribBinding
-};
-
-static const int kGrVertexAttribBindingCnt = kLast_GrVertexAttribBinding + 1;
-static const int kGrFixedFunctionVertexAttribBindingCnt =
- kLastFixedFunction_GrVertexAttribBinding + 1;
-
-static inline int GrFixedFunctionVertexAttribVectorCount(GrVertexAttribBinding binding) {
- SkASSERT(binding >= 0 && binding < kGrFixedFunctionVertexAttribBindingCnt);
- static const int kVecCounts[] = { 2, 2, 4, 1 };
-
- return kVecCounts[binding];
-
- GR_STATIC_ASSERT(0 == kPosition_GrVertexAttribBinding);
- GR_STATIC_ASSERT(1 == kLocalCoord_GrVertexAttribBinding);
- GR_STATIC_ASSERT(2 == kColor_GrVertexAttribBinding);
- GR_STATIC_ASSERT(3 == kCoverage_GrVertexAttribBinding);
- GR_STATIC_ASSERT(kGrFixedFunctionVertexAttribBindingCnt == SK_ARRAY_COUNT(kVecCounts));
-}
-
-struct GrVertexAttrib {
- inline void set(GrVertexAttribType type, size_t offset, GrVertexAttribBinding binding) {
- fType = type;
- fOffset = offset;
- fBinding = binding;
+static inline GrSLType GrVertexAttribTypeToSLType(GrVertexAttribType type) {
+ switch (type) {
+ default:
+ SkFAIL("Unsupported type conversion");
+ case kUByte_GrVertexAttribType:
+ case kFloat_GrVertexAttribType:
+ return kFloat_GrSLType;
+ case kVec2f_GrVertexAttribType:
+ return kVec2f_GrSLType;
+ case kVec3f_GrVertexAttribType:
+ return kVec3f_GrSLType;
+ case kVec4ub_GrVertexAttribType:
+ case kVec4f_GrVertexAttribType:
+ return kVec4f_GrSLType;
}
- bool operator==(const GrVertexAttrib& other) const {
- return fType == other.fType && fOffset == other.fOffset && fBinding == other.fBinding;
- };
- bool operator!=(const GrVertexAttrib& other) const { return !(*this == other); }
-
- GrVertexAttribType fType;
- size_t fOffset;
- GrVertexAttribBinding fBinding;
-};
-
-template <int N> class GrVertexAttribArray : public SkSTArray<N, GrVertexAttrib, true> {};
+}
//////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « gm/convexpolyeffect.cpp ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698