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

Unified Diff: include/gpu/GrTypesPriv.h

Issue 1755483002: Add support for 2x2 matrices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: vk updates Created 4 years, 9 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/gl/GrGLProgramDataManager.h » ('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 834c185944ac6368e07c0e86881f84a9958d8888..a0451537720e66c797762e36b434c8fc6a05a8ee 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -21,6 +21,7 @@ enum GrSLType {
kVec2f_GrSLType,
kVec3f_GrSLType,
kVec4f_GrSLType,
+ kMat22f_GrSLType,
kMat33f_GrSLType,
kMat44f_GrSLType,
kSampler2D_GrSLType,
@@ -75,7 +76,7 @@ static const int kGrSLPrecisionCount = kLast_GrSLPrecision + 1;
*/
static inline int GrSLTypeVectorCount(GrSLType type) {
SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
- static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1, 1, 1, 1 };
+ static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1, -1, 1, 1, 1 };
return kCounts[type];
GR_STATIC_ASSERT(0 == kVoid_GrSLType);
@@ -83,14 +84,15 @@ static inline int GrSLTypeVectorCount(GrSLType type) {
GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
- GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
- GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
- GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
- GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
- GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
- GR_STATIC_ASSERT(10 == kBool_GrSLType);
- GR_STATIC_ASSERT(11 == kInt_GrSLType);
- GR_STATIC_ASSERT(12 == kUint_GrSLType);
+ GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
+ GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
+ GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
+ GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
+ GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
+ GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
+ GR_STATIC_ASSERT(11 == kBool_GrSLType);
+ GR_STATIC_ASSERT(12 == kInt_GrSLType);
+ GR_STATIC_ASSERT(13 == kUint_GrSLType);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount);
}
@@ -109,22 +111,23 @@ static inline GrSLType GrSLFloatVectorType(int count) {
/** Is the shading language type float (including vectors/matrices)? */
static inline bool GrSLTypeIsFloatType(GrSLType type) {
SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
- return (type >= 1 && type <= 6);
+ return type >= kFloat_GrSLType && type <= kMat44f_GrSLType;
GR_STATIC_ASSERT(0 == kVoid_GrSLType);
GR_STATIC_ASSERT(1 == kFloat_GrSLType);
GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
- GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
- GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
- GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
- GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
- GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
- GR_STATIC_ASSERT(10 == kBool_GrSLType);
- GR_STATIC_ASSERT(11 == kInt_GrSLType);
- GR_STATIC_ASSERT(12 == kUint_GrSLType);
- GR_STATIC_ASSERT(13 == kGrSLTypeCount);
+ GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
+ GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
+ GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
+ GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
+ GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
+ GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
+ GR_STATIC_ASSERT(11 == kBool_GrSLType);
+ GR_STATIC_ASSERT(12 == kInt_GrSLType);
+ GR_STATIC_ASSERT(13 == kUint_GrSLType);
+ GR_STATIC_ASSERT(14 == kGrSLTypeCount);
}
/** Is the shading language type integral (including vectors/matrices)? */
@@ -137,15 +140,16 @@ static inline bool GrSLTypeIsIntType(GrSLType type) {
GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
- GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
- GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
- GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
- GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
- GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
- GR_STATIC_ASSERT(10 == kBool_GrSLType);
- GR_STATIC_ASSERT(11 == kInt_GrSLType);
- GR_STATIC_ASSERT(12 == kUint_GrSLType);
- GR_STATIC_ASSERT(13 == kGrSLTypeCount);
+ GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
+ GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
+ GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
+ GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
+ GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
+ GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
+ GR_STATIC_ASSERT(11 == kBool_GrSLType);
+ GR_STATIC_ASSERT(12 == kInt_GrSLType);
+ GR_STATIC_ASSERT(13 == kUint_GrSLType);
+ GR_STATIC_ASSERT(14 == kGrSLTypeCount);
}
/** Is the shading language type numeric (including vectors/matrices)? */
@@ -162,8 +166,9 @@ static inline size_t GrSLTypeSize(GrSLType type) {
2 * sizeof(float), // kVec2f_GrSLType
3 * sizeof(float), // kVec3f_GrSLType
4 * sizeof(float), // kVec4f_GrSLType
- 9 * sizeof(float), // kMat33f_GrSLType
- 16 * sizeof(float), // kMat44f_GrSLType
+ 2 * 2 * sizeof(float), // kMat22f_GrSLType
+ 3 * 3 * sizeof(float), // kMat33f_GrSLType
+ 4 * 4 * sizeof(float), // kMat44f_GrSLType
0, // kSampler2D_GrSLType
0, // kSamplerExternal_GrSLType
0, // kSampler2DRect_GrSLType
@@ -178,24 +183,25 @@ static inline size_t GrSLTypeSize(GrSLType type) {
GR_STATIC_ASSERT(2 == kVec2f_GrSLType);
GR_STATIC_ASSERT(3 == kVec3f_GrSLType);
GR_STATIC_ASSERT(4 == kVec4f_GrSLType);
- GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
- GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
- GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
- GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
- GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
- GR_STATIC_ASSERT(10 == kBool_GrSLType);
- GR_STATIC_ASSERT(11 == kInt_GrSLType);
- GR_STATIC_ASSERT(12 == kUint_GrSLType);
- GR_STATIC_ASSERT(13 == kGrSLTypeCount);
+ GR_STATIC_ASSERT(5 == kMat22f_GrSLType);
+ GR_STATIC_ASSERT(6 == kMat33f_GrSLType);
+ GR_STATIC_ASSERT(7 == kMat44f_GrSLType);
+ GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
+ GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
+ GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
+ GR_STATIC_ASSERT(11 == kBool_GrSLType);
+ GR_STATIC_ASSERT(12 == kInt_GrSLType);
+ GR_STATIC_ASSERT(13 == kUint_GrSLType);
+ GR_STATIC_ASSERT(14 == kGrSLTypeCount);
}
static inline bool GrSLTypeIsSamplerType(GrSLType type) {
SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
- return type >= 7 && type <= 9;
+ return type >= kSampler2D_GrSLType && type <= kSampler2DRect_GrSLType;
- GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
- GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
- GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
+ GR_STATIC_ASSERT(8 == kSampler2D_GrSLType);
+ GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType);
+ GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType);
}
//////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « no previous file | src/gpu/gl/GrGLProgramDataManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698