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
This commit is contained in:
parent
2a2cc20573
commit
cf6285b89b
@ -84,7 +84,7 @@ public:
|
||||
StageKey stageID = GLProgramStage::GenKey(stage);
|
||||
#if GR_DEBUG
|
||||
static const StageKey kIllegalIDMask =
|
||||
~((1 << kProgramStageKeyBits) - 1);
|
||||
(uint16_t) (~((1U << kProgramStageKeyBits) - 1));
|
||||
GrAssert(!(kIllegalIDMask & stageID));
|
||||
#endif
|
||||
return fStageClassID | stageID;
|
||||
|
@ -152,7 +152,7 @@ private:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper functions
|
||||
|
||||
static const GrTexture::TextureKey gUNCACHED_KEY = ~0;
|
||||
static const GrTexture::TextureKey gUNCACHED_KEY = ~0U;
|
||||
GrContext::TextureCacheEntry sk_gr_create_bitmap_texture(GrContext* ctx,
|
||||
GrTexture::TextureKey key,
|
||||
const GrSamplerState* sampler,
|
||||
|
@ -307,7 +307,7 @@ bool GrDefaultPathRenderer::createGeom(const SkPath& path,
|
||||
case kClose_PathCmd:
|
||||
break;
|
||||
case kEnd_PathCmd:
|
||||
uint16_t currIdx = (uint16_t) (vert - base);
|
||||
// uint16_t currIdx = (uint16_t) (vert - base);
|
||||
goto FINISHED;
|
||||
}
|
||||
first = false;
|
||||
|
@ -804,7 +804,7 @@ private:
|
||||
sizeof(fPodEndMarker);
|
||||
}
|
||||
|
||||
static const StageMask kIllegalStageMaskBits = ~((1 << kNumStages)-1);
|
||||
static const StageMask kIllegalStageMaskBits = ~((1U << kNumStages)-1);
|
||||
// @{ these fields can be initialized with memset to 0
|
||||
union {
|
||||
GrColor fBlendConstant;
|
||||
|
@ -723,7 +723,6 @@ void GrDrawTarget::pushGeometrySource() {
|
||||
}
|
||||
|
||||
void GrDrawTarget::popGeometrySource() {
|
||||
const GeometrySrcState& geoSrc = this->getGeomSrc();
|
||||
// if popping last element then pops are unbalanced with pushes
|
||||
GrAssert(fGeoSrcStateStack.count() > 1);
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "GrTypes.h"
|
||||
|
||||
void* GrMalloc(size_t bytes) {
|
||||
void* ptr = ::malloc(bytes);
|
||||
|
@ -292,15 +292,13 @@ void GrResourceCache::purgeAsNeeded() {
|
||||
void GrResourceCache::removeAll() {
|
||||
GrAutoResourceCacheValidate atcv(this);
|
||||
|
||||
GrResourceEntry* entry = fHead;
|
||||
|
||||
// we can have one GrResource holding a lock on another
|
||||
// so we don't want to just do a simple loop kicking each
|
||||
// entry out. Instead change the budget and purge.
|
||||
|
||||
int savedMaxBytes = fMaxBytes;
|
||||
int savedMaxCount = fMaxCount;
|
||||
fMaxBytes = -1;
|
||||
fMaxBytes = (size_t) -1;
|
||||
fMaxCount = 0;
|
||||
this->purgeAsNeeded();
|
||||
|
||||
|
@ -124,8 +124,8 @@ void gen_texture_key_values(const GrGpu* gpu,
|
||||
// assert that texture creation will fail anyway if this assumption
|
||||
// would cause key collisions.
|
||||
GrAssert(gpu->getCaps().fMaxTextureSize <= SK_MaxU16);
|
||||
v[0] = clientKey & 0xffffffffUL;
|
||||
v[1] = (clientKey >> 32) & 0xffffffffUL;
|
||||
v[0] = (uint32_t) (clientKey & 0xffffffffUL);
|
||||
v[1] = (uint32_t) ((clientKey >> 32) & 0xffffffffUL);
|
||||
v[2] = desc.fWidth | (desc.fHeight << 16);
|
||||
|
||||
v[3] = (desc.fSampleCnt << 24);
|
||||
|
@ -84,8 +84,8 @@ void GrGLConvolutionEffect::emitFS(GrGLShaderBuilder* state,
|
||||
const char* inputColor,
|
||||
const char* samplerName) {
|
||||
GrStringBuilder* code = &state->fFSCode;
|
||||
const char* texFunc = "texture2D";
|
||||
bool complexCoord = false;
|
||||
// const char* texFunc = "texture2D";
|
||||
// bool complexCoord = false;
|
||||
|
||||
state->fFSCode.appendf("\t\tvec4 sum = vec4(0, 0, 0, 0);\n");
|
||||
|
||||
|
@ -82,8 +82,8 @@ void GrGLMorphologyEffect ::emitFS(GrGLShaderBuilder* state,
|
||||
const char* inputColor,
|
||||
const char* samplerName) {
|
||||
GrStringBuilder* code = &state->fFSCode;
|
||||
const char* texFunc = "texture2D";
|
||||
bool complexCoord = false;
|
||||
// const char* texFunc = "texture2D";
|
||||
// bool complexCoord = false;
|
||||
|
||||
const char* func;
|
||||
switch (fType) {
|
||||
|
@ -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()) {
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -64,4 +64,4 @@ void GrFrameBufferObj::setStencil(GrFBBindableObj *buffer) {
|
||||
GrAlwaysAssert(!fStencilBuffer->getStencilBound(this));
|
||||
fStencilBuffer->setStencilBound(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
void* GetProcAddress(const char* name) {
|
||||
static void* GetProcAddress(const char* name) {
|
||||
return dlsym(RTLD_DEFAULT, name);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -14,6 +14,9 @@
|
||||
#include "GrRedBlackTree.h"
|
||||
#include "GrTDArray.h"
|
||||
|
||||
// FIXME: needs to be in a header
|
||||
void gr_run_unittests();
|
||||
|
||||
// If we aren't inheriting these as #defines from elsewhere,
|
||||
// clang demands they be declared before we #include the template
|
||||
// that relies on them.
|
||||
|
Loading…
Reference in New Issue
Block a user