diff options
author | egdaniel <egdaniel@google.com> | 2014-09-22 12:29:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-22 12:29:52 -0700 |
commit | ae444965c43ad16575730ce8e3abdcaded296d94 (patch) | |
tree | 65daeba6e2e8d71919ed3860e4ccd859baba7b43 /src/gpu | |
parent | 9959c21dc7908b488c9f24535eb76682810accc7 (diff) |
Change GrGLProgramDesc header to have DoPathRendering flag instead of RequiresVertexShader
Also update GLProgramTests to fix bug where it would incorrectly try to PathRendering when we did
not want to.
BUG=skia:
R=bsalomon@google.com, joshualitt@chromium.org
Author: egdaniel@google.com
Review URL: https://codereview.chromium.org/586793002
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/gl/GrGLProgram.cpp | 7 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProgramDesc.cpp | 19 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProgramDesc.h | 9 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLProgramBuilder.cpp | 4 |
5 files changed, 20 insertions, 21 deletions
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index dccd4bbd36..a695173f4c 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -29,9 +29,10 @@ GrGLProgram* GrGLProgram::Create(GrGpuGL* gpu, const GrEffectStage* colorStages[], const GrEffectStage* coverageStages[]) { SkAutoTDelete<GrGLProgramBuilder> builder; - if (!desc.getHeader().fRequiresVertexShader && - gpu->glCaps().pathRenderingSupport() && - gpu->glPathRendering()->texturingMode() == GrGLPathRendering::FixedFunction_TexturingMode) { + if (desc.getHeader().fUseFragShaderOnly) { + SkASSERT(gpu->glCaps().pathRenderingSupport()); + SkASSERT(gpu->glPathRendering()->texturingMode() == + GrGLPathRendering::FixedFunction_TexturingMode); SkASSERT(NULL == geometryProcessor); builder.reset(SkNEW_ARGS(GrGLFragmentOnlyProgramBuilder, (gpu, desc))); } else { diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp index c6560be2b2..c0a9e13ed1 100644 --- a/src/gpu/gl/GrGLProgramDesc.cpp +++ b/src/gpu/gl/GrGLProgramDesc.cpp @@ -163,7 +163,7 @@ bool GrGLProgramDesc::Build(const GrOptDrawState& optState, GrGpu::DrawType drawType, GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff, - const GrGpuGL* gpu, + GrGpuGL* gpu, const GrDeviceCoordTexture* dstCopy, const GrEffectStage** geometryProcessor, SkTArray<const GrEffectStage*, true>* colorStages, @@ -260,12 +260,11 @@ bool GrGLProgramDesc::Build(const GrOptDrawState& optState, // Because header is a pointer into the dynamic array, we can't push any new data into the key // below here. - // We will only require a vertex shader if we have more than just the position VA attrib. - // If we have a geom processor we must us a vertex shader and we should not have a geometry - // processor if we are doing path rendering. - SkASSERT(!GrGpu::IsPathRenderingDrawType(drawType) || !optState.requiresVertexShader()); - header->fRequiresVertexShader = optState.requiresVertexShader() || - !GrGpu::IsPathRenderingDrawType(drawType); + header->fUseFragShaderOnly = gpu->caps()->pathRenderingSupport() && + GrGpu::IsPathRenderingDrawType(drawType) && + gpu->glPathRendering()->texturingMode() == GrGLPathRendering::FixedFunction_TexturingMode; + SkASSERT(!header->fUseFragShaderOnly || !optState.hasGeometryProcessor()); + header->fEmitsPointSize = GrGpu::kDrawPoints_DrawType == drawType; // Currently the experimental GS will only work with triangle prims (and it doesn't do anything @@ -277,7 +276,7 @@ bool GrGLProgramDesc::Build(const GrOptDrawState& optState, header->fExperimentalGS = false; #endif #endif - bool defaultToUniformInputs = GR_GL_NO_CONSTANT_ATTRIBUTES || gpu->caps()->pathRenderingSupport(); + bool defaultToUniformInputs = GR_GL_NO_CONSTANT_ATTRIBUTES || header->fUseFragShaderOnly; if (!inputColorIsUsed) { header->fColorInput = kAllOnes_ColorInput; @@ -285,7 +284,7 @@ bool GrGLProgramDesc::Build(const GrOptDrawState& optState, header->fColorInput = kUniform_ColorInput; } else { header->fColorInput = kAttribute_ColorInput; - header->fRequiresVertexShader = true; + header->fUseFragShaderOnly = false; } bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == optState.getCoverageColor(); @@ -296,7 +295,7 @@ bool GrGLProgramDesc::Build(const GrOptDrawState& optState, header->fCoverageInput = kUniform_ColorInput; } else { header->fCoverageInput = kAttribute_ColorInput; - header->fRequiresVertexShader = true; + header->fUseFragShaderOnly = false; } if (optState.readsDst()) { diff --git a/src/gpu/gl/GrGLProgramDesc.h b/src/gpu/gl/GrGLProgramDesc.h index 8cee707dbc..c9bdac54ee 100644 --- a/src/gpu/gl/GrGLProgramDesc.h +++ b/src/gpu/gl/GrGLProgramDesc.h @@ -45,14 +45,15 @@ public: // For unit testing. bool setRandom(SkRandom*, - const GrGpuGL* gpu, + GrGpuGL* gpu, const GrRenderTarget* dummyDstRenderTarget, const GrTexture* dummyDstCopyTexture, const GrEffectStage* geometryProcessor, const GrEffectStage* stages[], int numColorStages, int numCoverageStages, - int currAttribIndex); + int currAttribIndex, + GrGpu::DrawType); /** * Builds a program descriptor from a GrOptDrawState. Whether the primitive type is points, and @@ -64,7 +65,7 @@ public: GrGpu::DrawType drawType, GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff, - const GrGpuGL* gpu, + GrGpuGL* gpu, const GrDeviceCoordTexture* dstCopy, const GrEffectStage** outGeometryProcessor, SkTArray<const GrEffectStage*, true>* outColorStages, @@ -151,7 +152,7 @@ private: ColorInput fCoverageInput : 8; CoverageOutput fCoverageOutput : 8; - SkBool8 fRequiresVertexShader; + SkBool8 fUseFragShaderOnly; SkBool8 fEmitsPointSize; // To enable experimental geometry shader code (not for use in diff --git a/src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.cpp index 16def638b5..9c32433782 100644 --- a/src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.cpp @@ -11,7 +11,7 @@ GrGLFragmentOnlyProgramBuilder::GrGLFragmentOnlyProgramBuilder(GrGpuGL* gpu, const GrGLProgramDesc& desc) : INHERITED(gpu, desc) { - SkASSERT(!desc.getHeader().fRequiresVertexShader); + SkASSERT(desc.getHeader().fUseFragShaderOnly); SkASSERT(gpu->glCaps().pathRenderingSupport()); SkASSERT(GrGLProgramDesc::kAttribute_ColorInput != desc.getHeader().fColorInput); SkASSERT(GrGLProgramDesc::kAttribute_ColorInput != desc.getHeader().fCoverageInput); diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index a0dd555587..328243d954 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -84,9 +84,7 @@ bool GrGLProgramBuilder::genProgram(const GrEffectStage* geometryProcessor, GrGLProgramBuilder::GrGLProgramBuilder(GrGpuGL* gpu, const GrGLProgramDesc& desc) - : fFragOnly(!desc.getHeader().fRequiresVertexShader && - gpu->glCaps().pathRenderingSupport() && - gpu->glPathRendering()->texturingMode() == GrGLPathRendering::FixedFunction_TexturingMode) + : fFragOnly(SkToBool(desc.getHeader().fUseFragShaderOnly)) , fTexCoordSetCnt(0) , fProgramID(0) , fFS(this, desc) |