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

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

Issue 22850006: Replace uses of GrAssert by SkASSERT. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 4 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 | « src/gpu/gl/GrGLUniformManager.h ('k') | src/gpu/gl/GrGLUtil.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLUniformManager.cpp
diff --git a/src/gpu/gl/GrGLUniformManager.cpp b/src/gpu/gl/GrGLUniformManager.cpp
index b559e10d1768cefd57ce2ab1a50ff3d1b1056350..55390d5c61770e6a460cd3ab49e1e1e221265905 100644
--- a/src/gpu/gl/GrGLUniformManager.cpp
+++ b/src/gpu/gl/GrGLUniformManager.cpp
@@ -11,13 +11,13 @@
#include "SkMatrix.h"
#define ASSERT_ARRAY_UPLOAD_IN_BOUNDS(UNI, OFFSET, COUNT) \
- GrAssert(offset + arrayCount <= uni.fArrayCount || \
+ SkASSERT(offset + arrayCount <= uni.fArrayCount || \
(0 == offset && 1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCount))
GrGLUniformManager::UniformHandle GrGLUniformManager::appendUniform(GrSLType type, int arrayCount) {
int idx = fUniforms.count();
Uniform& uni = fUniforms.push_back();
- GrAssert(GrGLShaderVar::kNonArray == arrayCount || arrayCount > 0);
+ SkASSERT(GrGLShaderVar::kNonArray == arrayCount || arrayCount > 0);
uni.fArrayCount = arrayCount;
uni.fType = type;
uni.fVSLocation = kUnusedUniform;
@@ -27,12 +27,12 @@ GrGLUniformManager::UniformHandle GrGLUniformManager::appendUniform(GrSLType typ
void GrGLUniformManager::setSampler(UniformHandle u, GrGLint texUnit) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kSampler2D_GrSLType);
- GrAssert(GrGLShaderVar::kNonArray == uni.fArrayCount);
+ SkASSERT(uni.fType == kSampler2D_GrSLType);
+ SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
// FIXME: We still insert a single sampler uniform for every stage. If the shader does not
// reference the sampler then the compiler may have optimized it out. Uncomment this assert
// once stages insert their own samplers.
- // GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(), Uniform1i(uni.fFSLocation, texUnit));
}
@@ -43,9 +43,9 @@ void GrGLUniformManager::setSampler(UniformHandle u, GrGLint texUnit) const {
void GrGLUniformManager::set1f(UniformHandle u, GrGLfloat v0) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kFloat_GrSLType);
- GrAssert(GrGLShaderVar::kNonArray == uni.fArrayCount);
- GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ SkASSERT(uni.fType == kFloat_GrSLType);
+ SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
+ SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(), Uniform1f(uni.fFSLocation, v0));
}
@@ -59,13 +59,13 @@ void GrGLUniformManager::set1fv(UniformHandle u,
int arrayCount,
const GrGLfloat v[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kFloat_GrSLType);
- GrAssert(arrayCount > 0);
+ SkASSERT(uni.fType == kFloat_GrSLType);
+ SkASSERT(arrayCount > 0);
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
// This assert fires in some instances of the two-pt gradient for its VSParams.
// Once the uniform manager is responsible for inserting the duplicate uniform
// arrays in VS and FS driver bug workaround, this can be enabled.
- //GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ //SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(), Uniform1fv(uni.fFSLocation + offset, arrayCount, v));
}
@@ -76,9 +76,9 @@ void GrGLUniformManager::set1fv(UniformHandle u,
void GrGLUniformManager::set2f(UniformHandle u, GrGLfloat v0, GrGLfloat v1) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kVec2f_GrSLType);
- GrAssert(GrGLShaderVar::kNonArray == uni.fArrayCount);
- GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ SkASSERT(uni.fType == kVec2f_GrSLType);
+ SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
+ SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(), Uniform2f(uni.fFSLocation, v0, v1));
}
@@ -92,10 +92,10 @@ void GrGLUniformManager::set2fv(UniformHandle u,
int arrayCount,
const GrGLfloat v[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kVec2f_GrSLType);
- GrAssert(arrayCount > 0);
+ SkASSERT(uni.fType == kVec2f_GrSLType);
+ SkASSERT(arrayCount > 0);
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
- GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(), Uniform2fv(uni.fFSLocation + offset, arrayCount, v));
}
@@ -106,9 +106,9 @@ void GrGLUniformManager::set2fv(UniformHandle u,
void GrGLUniformManager::set3f(UniformHandle u, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kVec3f_GrSLType);
- GrAssert(GrGLShaderVar::kNonArray == uni.fArrayCount);
- GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ SkASSERT(uni.fType == kVec3f_GrSLType);
+ SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
+ SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(), Uniform3f(uni.fFSLocation, v0, v1, v2));
}
@@ -122,10 +122,10 @@ void GrGLUniformManager::set3fv(UniformHandle u,
int arrayCount,
const GrGLfloat v[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kVec3f_GrSLType);
- GrAssert(arrayCount > 0);
+ SkASSERT(uni.fType == kVec3f_GrSLType);
+ SkASSERT(arrayCount > 0);
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
- GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(), Uniform3fv(uni.fFSLocation + offset, arrayCount, v));
}
@@ -140,9 +140,9 @@ void GrGLUniformManager::set4f(UniformHandle u,
GrGLfloat v2,
GrGLfloat v3) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kVec4f_GrSLType);
- GrAssert(GrGLShaderVar::kNonArray == uni.fArrayCount);
- GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ SkASSERT(uni.fType == kVec4f_GrSLType);
+ SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
+ SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(), Uniform4f(uni.fFSLocation, v0, v1, v2, v3));
}
@@ -156,9 +156,9 @@ void GrGLUniformManager::set4fv(UniformHandle u,
int arrayCount,
const GrGLfloat v[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kVec4f_GrSLType);
- GrAssert(arrayCount > 0);
- GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ SkASSERT(uni.fType == kVec4f_GrSLType);
+ SkASSERT(arrayCount > 0);
+ SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(), Uniform4fv(uni.fFSLocation + offset, arrayCount, v));
}
@@ -169,10 +169,10 @@ void GrGLUniformManager::set4fv(UniformHandle u,
void GrGLUniformManager::setMatrix3f(UniformHandle u, const GrGLfloat matrix[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kMat33f_GrSLType);
- GrAssert(GrGLShaderVar::kNonArray == uni.fArrayCount);
+ SkASSERT(uni.fType == kMat33f_GrSLType);
+ SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
// TODO: Re-enable this assert once texture matrices aren't forced on all effects
- // GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(), UniformMatrix3fv(uni.fFSLocation, 1, false, matrix));
}
@@ -183,9 +183,9 @@ void GrGLUniformManager::setMatrix3f(UniformHandle u, const GrGLfloat matrix[])
void GrGLUniformManager::setMatrix4f(UniformHandle u, const GrGLfloat matrix[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kMat44f_GrSLType);
- GrAssert(GrGLShaderVar::kNonArray == uni.fArrayCount);
- GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ SkASSERT(uni.fType == kMat44f_GrSLType);
+ SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
+ SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(), UniformMatrix4fv(uni.fFSLocation, 1, false, matrix));
}
@@ -199,10 +199,10 @@ void GrGLUniformManager::setMatrix3fv(UniformHandle u,
int arrayCount,
const GrGLfloat matrices[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kMat33f_GrSLType);
- GrAssert(arrayCount > 0);
+ SkASSERT(uni.fType == kMat33f_GrSLType);
+ SkASSERT(arrayCount > 0);
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
- GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(),
UniformMatrix3fv(uni.fFSLocation + offset, arrayCount, false, matrices));
@@ -218,10 +218,10 @@ void GrGLUniformManager::setMatrix4fv(UniformHandle u,
int arrayCount,
const GrGLfloat matrices[]) const {
const Uniform& uni = fUniforms[u.toUniformIndex()];
- GrAssert(uni.fType == kMat44f_GrSLType);
- GrAssert(arrayCount > 0);
+ SkASSERT(uni.fType == kMat44f_GrSLType);
+ SkASSERT(arrayCount > 0);
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, offset, arrayCount);
- GrAssert(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fContext.interface(),
UniformMatrix4fv(uni.fFSLocation + offset, arrayCount, false, matrices));
@@ -250,11 +250,11 @@ void GrGLUniformManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix) co
void GrGLUniformManager::getUniformLocations(GrGLuint programID, const BuilderUniformArray& uniforms) {
- GrAssert(uniforms.count() == fUniforms.count());
+ SkASSERT(uniforms.count() == fUniforms.count());
int count = fUniforms.count();
for (int i = 0; i < count; ++i) {
- GrAssert(uniforms[i].fVariable.getType() == fUniforms[i].fType);
- GrAssert(uniforms[i].fVariable.getArrayCount() == fUniforms[i].fArrayCount);
+ SkASSERT(uniforms[i].fVariable.getType() == fUniforms[i].fType);
+ SkASSERT(uniforms[i].fVariable.getArrayCount() == fUniforms[i].fArrayCount);
GrGLint location;
// TODO: Move the Xoom uniform array in both FS and VS bug workaround here.
GR_GL_CALL_RET(fContext.interface(), location,
« no previous file with comments | « src/gpu/gl/GrGLUniformManager.h ('k') | src/gpu/gl/GrGLUtil.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698