aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-06 12:09:01 +0000
committerGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-06 12:09:01 +0000
commitcf6285b89b8820641ffb6871d4b3275bfe783f51 (patch)
tree6494e0064186c8b01651c45c02f0c64efa6bfc3f /src/gpu/gl
parent2a2cc2057347553f07d933b021876ba5502e55cd (diff)
fix warnings on Mac in src/gpu and include/gpu
Fix these class of warnings: - unused functions - unused locals - sign mismatch - missing function prototypes - missing newline at end of file - 64 to 32 bit truncation The changes prefer to link in dead code in the debug build with 'if (false)' than to comment it out, but trivial cases are commented out or sometimes deleted if it appears to be a copy/paste error. Review URL: https://codereview.appspot.com/6296044 git-svn-id: http://skia.googlecode.com/svn/trunk@4180 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLCaps.cpp3
-rw-r--r--src/gpu/gl/GrGLCreateNullInterface.cpp4
-rw-r--r--src/gpu/gl/GrGLProgram.cpp14
-rw-r--r--src/gpu/gl/GrGLStencilBuffer.h4
-rw-r--r--src/gpu/gl/GrGpuGL.cpp13
-rw-r--r--src/gpu/gl/GrGpuGL_program.cpp4
-rw-r--r--src/gpu/gl/GrGpuGL_unittest.cpp5
-rw-r--r--src/gpu/gl/debug/GrFrameBufferObj.cpp2
-rw-r--r--src/gpu/gl/debug/GrGLCreateDebugInterface.cpp4
-rw-r--r--src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp2
-rw-r--r--src/gpu/gl/mac/SkNativeGLContext_mac.cpp2
11 files changed, 32 insertions, 25 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index b23a1f8153..7b2bb35ead 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -98,7 +98,6 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo) {
fBGRAFormatSupport = version >= GR_GL_VER(1,2) ||
ctxInfo.hasExtension("GL_EXT_bgra");
} else {
- bool hasBGRAExt = false;
if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) {
fBGRAFormatSupport = true;
} else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) {
@@ -256,7 +255,7 @@ void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) {
gS16 = {GR_GL_STENCIL_INDEX16, 16, 16, false},
gD24S8 = {GR_GL_DEPTH24_STENCIL8, 8, 32, true },
gS4 = {GR_GL_STENCIL_INDEX4, 4, 4, false},
- gS = {GR_GL_STENCIL_INDEX, kUnknownBitCount, kUnknownBitCount, false},
+ // gS = {GR_GL_STENCIL_INDEX, kUnknownBitCount, kUnknownBitCount, false},
gDS = {GR_GL_DEPTH_STENCIL, kUnknownBitCount, kUnknownBitCount, true };
if (kDesktop_GrGLBinding == ctxInfo.binding()) {
diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp
index 57b7851722..70e9cee904 100644
--- a/src/gpu/gl/GrGLCreateNullInterface.cpp
+++ b/src/gpu/gl/GrGLCreateNullInterface.cpp
@@ -10,6 +10,8 @@
#include "GrTDArray.h"
#include "GrGLDefines.h"
+namespace { // added to suppress 'no previous prototype' warning
+
GrGLvoid GR_GL_FUNCTION_TYPE nullGLActiveTexture(GrGLenum texture) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLAttachShader(GrGLuint program, GrGLuint shader) {}
GrGLvoid GR_GL_FUNCTION_TYPE nullGLBeginQuery(GrGLenum target, GrGLuint id) {}
@@ -376,6 +378,8 @@ GrGLint GR_GL_FUNCTION_TYPE nullGLGetUniformLocation(GrGLuint program, const cha
return ++gUniLocation;
}
+} // end anonymous namespace
+
const GrGLInterface* GrGLCreateNullInterface() {
// The gl functions are not context-specific so we create one global
// interface
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 8c12ad6c7d..b1d6d4fbf5 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -1229,9 +1229,9 @@ void GrGLProgram::genStageCode(const GrGLContextInfo& gl,
GrStringBuilder samplerName;
sampler_name(stageNum, &samplerName);
- const GrGLShaderVar* sampler = &segments->addUniform(
- GrGLShaderBuilder::kFragment_VariableLifetime, kSampler2D_GrSLType,
- samplerName.c_str());
+ // const GrGLShaderVar* sampler = &
+ segments->addUniform(GrGLShaderBuilder::kFragment_VariableLifetime,
+ kSampler2D_GrSLType, samplerName.c_str());
locations->fSamplerUni = kUseUniform;
const char *varyingVSName, *varyingFSName;
@@ -1251,8 +1251,8 @@ void GrGLProgram::genStageCode(const GrGLContextInfo& gl,
vector_all_coords(segments->fVaryingDims));
}
- GrGLShaderVar* kernel = NULL;
- const char* imageIncrementName = NULL;
+ // GrGLShaderVar* kernel = NULL;
+ // const char* imageIncrementName = NULL;
if (NULL != customStage) {
segments->fVSCode.appendf("\t{ // stage %d %s\n",
stageNum, customStage->name());
@@ -1284,8 +1284,8 @@ void GrGLProgram::genStageCode(const GrGLContextInfo& gl,
if (desc.fOptFlags & StageDesc::kCustomTextureDomain_OptFlagBit) {
GrStringBuilder texDomainName;
tex_domain_name(stageNum, &texDomainName);
- const GrGLShaderVar* texDomain =
- &segments->addUniform(
+ // const GrGLShaderVar* texDomain = &
+ segments->addUniform(
GrGLShaderBuilder::kFragment_VariableLifetime,
kVec4f_GrSLType, texDomainName.c_str());
GrStringBuilder coordVar("clampCoord");
diff --git a/src/gpu/gl/GrGLStencilBuffer.h b/src/gpu/gl/GrGLStencilBuffer.h
index 87bdb4a819..7b3da4f34a 100644
--- a/src/gpu/gl/GrGLStencilBuffer.h
+++ b/src/gpu/gl/GrGLStencilBuffer.h
@@ -14,8 +14,8 @@
class GrGLStencilBuffer : public GrStencilBuffer {
public:
- static const GrGLenum kUnknownInternalFormat = ~0;
- static const GrGLuint kUnknownBitCount = ~0;
+ static const GrGLenum kUnknownInternalFormat = ~0U;
+ static const GrGLuint kUnknownBitCount = ~0U;
struct Format {
GrGLenum fInternalFormat;
GrGLuint fStencilBits;
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 3d40eb3c3f..f9d4cbb569 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -11,7 +11,7 @@
#include "GrTypes.h"
#include "SkTemplates.h"
-static const GrGLuint GR_MAX_GLUINT = ~0;
+static const GrGLuint GR_MAX_GLUINT = ~0U;
static const GrGLint GR_INVAL_GLINT = ~0;
#define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
@@ -176,6 +176,9 @@ GrGpuGL::GrGpuGL(const GrGLContextInfo& ctxInfo) : fGLContextInfo(ctxInfo) {
fLastSuccessfulStencilFmtIdx = 0;
fCanPreserveUnpremulRoundtrip = kUnknown_CanPreserveUnpremulRoundtrip;
+ if (false) { // avoid bit rot, suppress warning
+ fbo_test(this->glInterface(), 0, 0);
+ }
}
GrGpuGL::~GrGpuGL() {
@@ -526,7 +529,7 @@ void GrGpuGL::onResetContext() {
GL_CALL(PixelStorei(GR_GL_PACK_REVERSE_ROW_ORDER, GR_GL_FALSE));
}
- fHWGeometryState.fVertexOffset = ~0;
+ fHWGeometryState.fVertexOffset = ~0U;
// Third party GL code may have left vertex attributes enabled. Some GL
// implementations (osmesa) may read vetex attributes that are not required
@@ -989,7 +992,7 @@ static GrTexture* return_null_texture() {
return NULL;
}
-#if GR_DEBUG
+#if 0 && GR_DEBUG
static size_t as_size_t(int x) {
return x;
}
@@ -1443,7 +1446,7 @@ void GrGpuGL::clearStencilClip(const GrIRect& rect, bool insideClip) {
}
this->flushRenderTarget(&GrIRect::EmptyIRect());
this->enableScissoring(rect);
- GL_CALL(StencilMask(clipStencilMask));
+ GL_CALL(StencilMask((uint32_t) clipStencilMask));
GL_CALL(ClearStencil(value));
GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT));
fHWStencilSettings.invalidate();
@@ -1583,7 +1586,7 @@ bool GrGpuGL::onReadPixels(GrRenderTarget* target,
} else {
GrAssert(readDst != buffer); GrAssert(rowBytes != tightRowBytes);
// copy from readDst to buffer while flipping y
- const int halfY = height >> 1;
+ // const int halfY = height >> 1;
const char* src = reinterpret_cast<const char*>(readDst);
char* dst = reinterpret_cast<char*>(buffer);
if (!invertY) {
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index f383ffceb8..581a22a68f 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -249,7 +249,7 @@ void GrGpuGL::flushTextureMatrixAndDomain(int s) {
void GrGpuGL::flushColorMatrix() {
- const ProgramDesc& desc = fCurrentProgram.getDesc();
+ // const ProgramDesc& desc = fCurrentProgram.getDesc();
int matrixUni = fProgramData->fUniLocations.fColorMatrixUni;
int vecUni = fProgramData->fUniLocations.fColorMatrixVecUni;
if (GrGLProgram::kUnusedUniform != matrixUni
@@ -330,7 +330,7 @@ void GrGpuGL::flushColor(GrColor color) {
void GrGpuGL::flushCoverage(GrColor coverage) {
const ProgramDesc& desc = fCurrentProgram.getDesc();
- const GrDrawState& drawState = this->getDrawState();
+ // const GrDrawState& drawState = this->getDrawState();
if (this->getVertexLayout() & kCoverage_VertexLayoutBit) {
diff --git a/src/gpu/gl/GrGpuGL_unittest.cpp b/src/gpu/gl/GrGpuGL_unittest.cpp
index 3543830730..9dbb708e1b 100644
--- a/src/gpu/gl/GrGpuGL_unittest.cpp
+++ b/src/gpu/gl/GrGpuGL_unittest.cpp
@@ -113,7 +113,7 @@ GrCustomStage* create_random_effect(StageDesc* stageDesc,
bool GrGpuGL::programUnitTest() {
- GrGLSLGeneration glslGeneration =
+ // GrGLSLGeneration glslGeneration =
GrGetGLSLGeneration(this->glBinding(), this->glInterface());
static const int STAGE_OPTS[] = {
0,
@@ -206,9 +206,6 @@ bool GrGpuGL::programUnitTest() {
stage.fOptFlags = STAGE_OPTS[random_int(&random, GR_ARRAY_COUNT(STAGE_OPTS))];
stage.fInConfigFlags = IN_CONFIG_FLAGS[random_int(&random, GR_ARRAY_COUNT(IN_CONFIG_FLAGS))];
stage.setEnabled(VertexUsesStage(s, pdesc.fVertexLayout));
- static const uint32_t kMulByAlphaMask =
- StageDesc::kMulRGBByAlpha_RoundUp_InConfigFlag |
- StageDesc::kMulRGBByAlpha_RoundDown_InConfigFlag;
bool useCustomEffect = random_bool(&random);
if (useCustomEffect) {
diff --git a/src/gpu/gl/debug/GrFrameBufferObj.cpp b/src/gpu/gl/debug/GrFrameBufferObj.cpp
index 331be8a702..24ab12056a 100644
--- a/src/gpu/gl/debug/GrFrameBufferObj.cpp
+++ b/src/gpu/gl/debug/GrFrameBufferObj.cpp
@@ -64,4 +64,4 @@ void GrFrameBufferObj::setStencil(GrFBBindableObj *buffer) {
GrAlwaysAssert(!fStencilBuffer->getStencilBound(this));
fStencilBuffer->setStencilBound(this);
}
-} \ No newline at end of file
+}
diff --git a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
index 4a04a385c9..ffeaf89fc0 100644
--- a/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
+++ b/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
@@ -30,6 +30,8 @@ static const GrGLint kDefaultMaxVertexAttribs = 8;
// the OpenGLES 2.0 spec says this must be >= 8
static const GrGLint kDefaultMaxVaryingVectors = 8;
+namespace { // suppress no previsous prototype warning
+
////////////////////////////////////////////////////////////////////////////////
GrGLvoid GR_GL_FUNCTION_TYPE debugGLActiveTexture(GrGLenum texture) {
@@ -862,6 +864,8 @@ GrGLint GR_GL_FUNCTION_TYPE debugGLGetUniformLocation(GrGLuint program, const ch
return ++gUniLocation;
}
+} // end of namespace
+
////////////////////////////////////////////////////////////////////////////////
struct GrDebugGLInterface : public GrGLInterface {
diff --git a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
index d08d6022f6..2ae8782e5c 100644
--- a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
+++ b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
@@ -15,7 +15,7 @@
#include <dlfcn.h>
-void* GetProcAddress(const char* name) {
+static void* GetProcAddress(const char* name) {
return dlsym(RTLD_DEFAULT, name);
}
diff --git a/src/gpu/gl/mac/SkNativeGLContext_mac.cpp b/src/gpu/gl/mac/SkNativeGLContext_mac.cpp
index 18b36a5608..2dcf8ae09c 100644
--- a/src/gpu/gl/mac/SkNativeGLContext_mac.cpp
+++ b/src/gpu/gl/mac/SkNativeGLContext_mac.cpp
@@ -33,7 +33,7 @@ void SkNativeGLContext::destroyGLContext() {
const GrGLInterface* SkNativeGLContext::createGLContext() {
GLint major, minor;
- AGLContext ctx;
+ // AGLContext ctx;
aglGetVersion(&major, &minor);
//SkDebugf("---- agl version %d %d\n", major, minor);