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

Unified Diff: include/gpu/GrTypesPriv.h

Issue 2143143002: Add Texture2D and Sampler GrSLTypes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | src/gpu/glsl/GrGLSL.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 8c7d6bda65150b6cd055a235f136077f4897c008..b527ab1bd77c7aa8079154af1d51add8e818ff95 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -32,8 +32,10 @@ enum GrSLType {
kBool_GrSLType,
kInt_GrSLType,
kUint_GrSLType,
+ kTexture2D_GrSLType,
+ kSampler_GrSLType,
- kLast_GrSLType = kUint_GrSLType
+ kLast_GrSLType = kSampler_GrSLType
};
static const int kGrSLTypeCount = kLast_GrSLType + 1;
@@ -78,7 +80,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, 1, 1 };
+ static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1 };
return kCounts[type];
GR_STATIC_ASSERT(0 == kVoid_GrSLType);
@@ -96,6 +98,8 @@ static inline int GrSLTypeVectorCount(GrSLType type) {
GR_STATIC_ASSERT(12 == kBool_GrSLType);
GR_STATIC_ASSERT(13 == kInt_GrSLType);
GR_STATIC_ASSERT(14 == kUint_GrSLType);
+ GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+ GR_STATIC_ASSERT(16 == kSampler_GrSLType);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount);
}
@@ -131,13 +135,15 @@ static inline bool GrSLTypeIsFloatType(GrSLType type) {
GR_STATIC_ASSERT(12 == kBool_GrSLType);
GR_STATIC_ASSERT(13 == kInt_GrSLType);
GR_STATIC_ASSERT(14 == kUint_GrSLType);
- GR_STATIC_ASSERT(15 == kGrSLTypeCount);
+ GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+ GR_STATIC_ASSERT(16 == kSampler_GrSLType);
+ GR_STATIC_ASSERT(17 == kGrSLTypeCount);
}
/** Is the shading language type integral (including vectors/matrices)? */
static inline bool GrSLTypeIsIntType(GrSLType type) {
SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
- return type >= kInt_GrSLType;
+ return type >= kInt_GrSLType && type <= kUint_GrSLType;
GR_STATIC_ASSERT(0 == kVoid_GrSLType);
GR_STATIC_ASSERT(1 == kFloat_GrSLType);
@@ -154,7 +160,9 @@ static inline bool GrSLTypeIsIntType(GrSLType type) {
GR_STATIC_ASSERT(12 == kBool_GrSLType);
GR_STATIC_ASSERT(13 == kInt_GrSLType);
GR_STATIC_ASSERT(14 == kUint_GrSLType);
- GR_STATIC_ASSERT(15 == kGrSLTypeCount);
+ GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+ GR_STATIC_ASSERT(16 == kSampler_GrSLType);
+ GR_STATIC_ASSERT(17 == kGrSLTypeCount);
}
/** Is the shading language type numeric (including vectors/matrices)? */
@@ -181,6 +189,8 @@ static inline size_t GrSLTypeSize(GrSLType type) {
0, // kBool_GrSLType
0, // kInt_GrSLType
0, // kUint_GrSLType
+ 0, // kTexture2D_GrSLType
+ 0, // kSampler_GrSLType
};
return kSizes[type];
@@ -199,7 +209,9 @@ static inline size_t GrSLTypeSize(GrSLType type) {
GR_STATIC_ASSERT(12 == kBool_GrSLType);
GR_STATIC_ASSERT(13 == kInt_GrSLType);
GR_STATIC_ASSERT(14 == kUint_GrSLType);
- GR_STATIC_ASSERT(15 == kGrSLTypeCount);
+ GR_STATIC_ASSERT(15 == kTexture2D_GrSLType);
+ GR_STATIC_ASSERT(16 == kSampler_GrSLType);
+ GR_STATIC_ASSERT(17 == kGrSLTypeCount);
}
static inline bool GrSLTypeIs2DTextureType(GrSLType type) {
@@ -222,7 +234,7 @@ static inline bool GrSLTypeIsSamplerType(GrSLType type) {
}
static inline bool GrSLTypeAcceptsPrecision(GrSLType type) {
- return GrSLTypeIsNumeric(type) || GrSLTypeIsSamplerType(type);
+ return type != kVoid_GrSLType && type != kBool_GrSLType;
}
//////////////////////////////////////////////////////////////////////////////
@@ -243,7 +255,7 @@ enum GrVertexAttribType {
kInt_GrVertexAttribType,
kUint_GrVertexAttribType,
-
+
kLast_GrVertexAttribType = kUint_GrVertexAttribType
};
static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1;
« no previous file with comments | « no previous file | src/gpu/glsl/GrGLSL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698