Fix cleanup on program creation failure

Change-Id: Ibc9b96537f774a3b8a43848b8b626f3f036b07b3
Reviewed-on: https://skia-review.googlesource.com/29561
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Robert Phillips 2017-08-01 16:13:04 -04:00 committed by Skia Commit-Bot
parent 0e96055424
commit 369e8b70ee
9 changed files with 22 additions and 22 deletions

View File

@ -176,7 +176,7 @@ void GrGLConvolutionEffect::GenKey(const GrProcessor& processor, const GrShaderC
}
///////////////////////////////////////////////////////////////////////////////
static void fill_in_1D_guassian_kernel(float* kernel, int width, float gaussianSigma, int radius) {
static void fill_in_1D_gaussian_kernel(float* kernel, int width, float gaussianSigma, int radius) {
const float denom = 1.0f / (2.0f * gaussianSigma * gaussianSigma);
float sum = 0.0f;
@ -212,7 +212,7 @@ GrGaussianConvolutionFragmentProcessor::GrGaussianConvolutionFragmentProcessor(
this->addTextureSampler(&fTextureSampler);
SkASSERT(radius <= kMaxKernelRadius);
fill_in_1D_guassian_kernel(fKernel, this->width(), gaussianSigma, this->radius());
fill_in_1D_gaussian_kernel(fKernel, this->width(), gaussianSigma, this->radius());
memcpy(fBounds, bounds, sizeof(fBounds));
}

View File

@ -34,13 +34,13 @@ GrGLProgram::GrGLProgram(GrGLGpu* gpu,
const UniformInfoArray& texelBuffers,
const UniformInfoArray& imageStorages,
const VaryingInfoArray& pathProcVaryings,
GrGLSLPrimitiveProcessor* geometryProcessor,
GrGLSLXferProcessor* xferProcessor,
std::unique_ptr<GrGLSLPrimitiveProcessor> geometryProcessor,
std::unique_ptr<GrGLSLXferProcessor> xferProcessor,
const GrGLSLFragProcs& fragmentProcessors)
: fBuiltinUniformHandles(builtinUniforms)
, fProgramID(programID)
, fGeometryProcessor(geometryProcessor)
, fXferProcessor(xferProcessor)
, fGeometryProcessor(std::move(geometryProcessor))
, fXferProcessor(std::move(xferProcessor))
, fFragmentProcessors(fragmentProcessors)
, fDesc(desc)
, fGpu(gpu)

View File

@ -115,8 +115,8 @@ protected:
const UniformInfoArray& texelBuffers,
const UniformInfoArray& imageStorages,
const VaryingInfoArray&, // used for NVPR only currently
GrGLSLPrimitiveProcessor* geometryProcessor,
GrGLSLXferProcessor* xferProcessor,
std::unique_ptr<GrGLSLPrimitiveProcessor> geometryProcessor,
std::unique_ptr<GrGLSLXferProcessor> xferProcessor,
const GrGLSLFragProcs& fragmentProcessors);
// A helper to loop over effects, set the transforms (via subclass) and bind textures

View File

@ -275,7 +275,7 @@ GrGLProgram* GrGLProgramBuilder::createProgram(GrGLuint programID) {
fUniformHandler.fTexelBuffers,
fUniformHandler.fImageStorages,
fVaryingHandler.fPathProcVaryingInfos,
fGeometryProcessor,
fXferProcessor,
std::move(fGeometryProcessor),
std::move(fXferProcessor),
fFragmentProcessors);
}

View File

@ -95,7 +95,7 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr
fVS.codeAppendf("// Primitive Processor %s\n", proc.name());
SkASSERT(!fGeometryProcessor);
fGeometryProcessor = proc.createGLSLInstance(*this->shaderCaps());
fGeometryProcessor.reset(proc.createGLSLInstance(*this->shaderCaps()));
SkSTArray<4, SamplerHandle> texSamplers(proc.numTextureSamplers());
SkSTArray<2, TexelBufferHandle> texelBuffers(proc.numBuffers());
@ -207,7 +207,7 @@ void GrGLSLProgramBuilder::emitAndInstallXferProc(const SkString& colorIn,
SkASSERT(!fXferProcessor);
const GrXferProcessor& xp = fPipeline.getXferProcessor();
fXferProcessor = xp.createGLSLInstance();
fXferProcessor.reset(xp.createGLSLInstance());
// Enable dual source secondary output if we have one
if (xp.hasSecondaryOutput()) {

View File

@ -104,8 +104,8 @@ public:
BuiltinUniformHandles fUniformHandles;
GrGLSLPrimitiveProcessor* fGeometryProcessor;
GrGLSLXferProcessor* fXferProcessor;
std::unique_ptr<GrGLSLPrimitiveProcessor> fGeometryProcessor;
std::unique_ptr<GrGLSLXferProcessor> fXferProcessor;
GrGLSLFragProcs fFragmentProcessors;
protected:

View File

@ -40,8 +40,8 @@ GrVkPipelineState::GrVkPipelineState(GrVkGpu* gpu,
uint32_t fragmentUniformSize,
uint32_t numSamplers,
uint32_t numTexelBuffers,
GrGLSLPrimitiveProcessor* geometryProcessor,
GrGLSLXferProcessor* xferProcessor,
std::unique_ptr<GrGLSLPrimitiveProcessor> geometryProcessor,
std::unique_ptr<GrGLSLXferProcessor> xferProcessor,
const GrGLSLFragProcs& fragmentProcessors)
: fPipeline(pipeline)
, fPipelineLayout(layout)
@ -51,8 +51,8 @@ GrVkPipelineState::GrVkPipelineState(GrVkGpu* gpu,
, fSamplerDSHandle(samplerDSHandle)
, fTexelBufferDSHandle(texelBufferDSHandle)
, fBuiltinUniformHandles(builtinUniformHandles)
, fGeometryProcessor(geometryProcessor)
, fXferProcessor(xferProcessor)
, fGeometryProcessor(std::move(geometryProcessor))
, fXferProcessor(std::move(xferProcessor))
, fFragmentProcessors(fragmentProcessors)
, fDesc(desc)
, fDataManager(uniforms, geometryUniformSize, fragmentUniformSize) {

View File

@ -100,8 +100,8 @@ private:
uint32_t fragmentUniformSize,
uint32_t numSamplers,
uint32_t numTexelBuffers,
GrGLSLPrimitiveProcessor* geometryProcessor,
GrGLSLXferProcessor* xferProcessor,
std::unique_ptr<GrGLSLPrimitiveProcessor> geometryProcessor,
std::unique_ptr<GrGLSLXferProcessor> xferProcessor,
const GrGLSLFragProcs& fragmentProcessors);
void writeUniformBuffers(const GrVkGpu* gpu);

View File

@ -204,8 +204,8 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrStencilSettings& s
fUniformHandler.fCurrentFragmentUBOOffset,
(uint32_t)fUniformHandler.numSamplers(),
(uint32_t)fUniformHandler.numTexelBuffers(),
fGeometryProcessor,
fXferProcessor,
std::move(fGeometryProcessor),
std::move(fXferProcessor),
fFragmentProcessors);
}