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

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

Issue 1336763003: remove path specific program building classes (Closed) Base URL: https://skia.googlesource.com/skia.git@pathgp
Patch Set: a few more tidys Created 5 years, 3 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/GrGLProgram.h ('k') | src/gpu/gl/GrGLProgramDataManager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLProgram.cpp
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index c89c5089b2fed727ca4d6a5890ccc4747c5d4bec..5f6d4edd7dbcce852162dfb96be91bd971c74ea6 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -31,6 +31,7 @@ GrGLProgram::GrGLProgram(GrGLGpu* gpu,
const BuiltinUniformHandles& builtinUniforms,
GrGLuint programID,
const UniformInfoArray& uniforms,
+ const SeparableVaryingInfoArray& separableVaryings,
GrGLInstalledGeoProc* geometryProcessor,
GrGLInstalledXferProc* xferProcessor,
GrGLInstalledFragProcs* fragmentProcessors,
@@ -45,7 +46,7 @@ GrGLProgram::GrGLProgram(GrGLGpu* gpu,
, fFragmentProcessors(SkRef(fragmentProcessors))
, fDesc(desc)
, fGpu(gpu)
- , fProgramDataManager(gpu, uniforms) {
+ , fProgramDataManager(gpu, programID, uniforms, separableVaryings) {
fSamplerUniforms.swap(passSamplerUniforms);
// Assign texture units to sampler uniforms one time up front.
GL_CALL(UseProgram(fProgramID));
@@ -95,9 +96,6 @@ void GrGLProgram::setData(const GrPrimitiveProcessor& primProc,
const GrXferProcessor& xp = *pipeline.getXferProcessor();
fXferProcessor->fGLProc->setData(fProgramDataManager, xp);
append_texture_bindings(fXferProcessor.get(), xp, textureBindings);
-
- // Some of GrGLProgram subclasses need to update state here
- this->didSetData();
}
void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc,
@@ -118,8 +116,7 @@ void GrGLProgram::setTransformData(const GrPrimitiveProcessor& primProc,
const GrFragmentProcessor& processor,
int index,
GrGLInstalledFragProc* ip) {
- GrGLGeometryProcessor* gp =
- static_cast<GrGLGeometryProcessor*>(fGeometryProcessor.get()->fGLProc.get());
+ GrGLPrimitiveProcessor* gp = fGeometryProcessor.get()->fGLProc.get();
gp->setTransformData(primProc, fProgramDataManager, index,
processor.coordTransforms());
}
@@ -133,23 +130,24 @@ void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc,
SkIntToScalar(pipeline.getRenderTarget()->height()));
}
- // call subclasses to set the actual view matrix
- this->onSetRenderTargetState(primProc, pipeline);
-}
-
-void GrGLProgram::onSetRenderTargetState(const GrPrimitiveProcessor&,
- const GrPipeline& pipeline) {
+ // set RT adjustment
const GrRenderTarget* rt = pipeline.getRenderTarget();
SkISize size;
size.set(rt->width(), rt->height());
- if (fRenderTargetState.fRenderTargetOrigin != rt->origin() ||
- fRenderTargetState.fRenderTargetSize != size) {
- fRenderTargetState.fRenderTargetSize = size;
- fRenderTargetState.fRenderTargetOrigin = rt->origin();
-
- GrGLfloat rtAdjustmentVec[4];
- fRenderTargetState.getRTAdjustmentVec(rtAdjustmentVec);
- fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, rtAdjustmentVec);
+ if (!primProc.isPathRendering()) {
+ if (fRenderTargetState.fRenderTargetOrigin != rt->origin() ||
+ fRenderTargetState.fRenderTargetSize != size) {
+ fRenderTargetState.fRenderTargetSize = size;
+ fRenderTargetState.fRenderTargetOrigin = rt->origin();
+
+ GrGLfloat rtAdjustmentVec[4];
+ fRenderTargetState.getRTAdjustmentVec(rtAdjustmentVec);
+ fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, rtAdjustmentVec);
+ }
+ } else {
+ SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport());
+ const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
+ fGpu->glPathRendering()->setProjectionMatrix(pathProc.viewMatrix(),
+ size, rt->origin());
}
}
-
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/gl/GrGLProgramDataManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698