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

Unified Diff: include/gpu/GrTypesPriv.h

Issue 649783003: Force input coverage to be only a byte in gpu shaders. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 | « no previous file | src/gpu/GrAAHairLinePathRenderer.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 0bae612db19d68ffbf85337492114dab0ba84170..75c987f148707ab05f659a9b9938d89dc6bab663 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -70,6 +70,8 @@ enum GrVertexAttribType {
kVec2f_GrVertexAttribType,
kVec3f_GrVertexAttribType,
kVec4f_GrVertexAttribType,
+
+ kUByte_GrVertexAttribType, // unsigned byte, e.g. coverage
kVec4ub_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors
kLast_GrVertexAttribType = kVec4ub_GrVertexAttribType
@@ -81,14 +83,15 @@ static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1;
*/
static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) {
SkASSERT(type >= 0 && type < kGrVertexAttribTypeCount);
- static const int kCounts[] = { 1, 2, 3, 4, 4 };
+ static const int kCounts[] = { 1, 2, 3, 4, 1, 4 };
return kCounts[type];
GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType);
GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType);
GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType);
GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType);
- GR_STATIC_ASSERT(4 == kVec4ub_GrVertexAttribType);
+ GR_STATIC_ASSERT(4 == kUByte_GrVertexAttribType);
+ GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrVertexAttribTypeCount);
}
@@ -102,6 +105,7 @@ static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
2*sizeof(float), // kVec2f_GrVertexAttribType
3*sizeof(float), // kVec3f_GrVertexAttribType
4*sizeof(float), // kVec4f_GrVertexAttribType
+ 1*sizeof(char), // kUByte_GrVertexAttribType
4*sizeof(char) // kVec4ub_GrVertexAttribType
};
return kSizes[type];
@@ -110,7 +114,8 @@ static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType);
GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType);
GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType);
- GR_STATIC_ASSERT(4 == kVec4ub_GrVertexAttribType);
+ GR_STATIC_ASSERT(4 == kUByte_GrVertexAttribType);
+ GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount);
}
@@ -123,7 +128,7 @@ 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 vector count of 4
+ kCoverage_GrVertexAttribBinding, // must have a single byte
kLastFixedFunction_GrVertexAttribBinding = kCoverage_GrVertexAttribBinding,
@@ -139,7 +144,7 @@ static const int kGrFixedFunctionVertexAttribBindingCnt =
static inline int GrFixedFunctionVertexAttribVectorCount(GrVertexAttribBinding binding) {
SkASSERT(binding >= 0 && binding < kGrFixedFunctionVertexAttribBindingCnt);
- static const int kVecCounts[] = { 2, 2, 4, 4 };
+ static const int kVecCounts[] = { 2, 2, 4, 1 };
return kVecCounts[binding];
« no previous file with comments | « no previous file | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698