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

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

Issue 901663007: Revert of Move DstCopy on gpu into the GrXferProcessor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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/GrGLGpu.cpp ('k') | src/gpu/gl/GrGLProgramDesc.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 eebcf6b2f32c90d939de532bfceeafee7571e951..ad63dc4ea73a14ede7d659292d74055458fe1266 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -61,6 +61,10 @@
void GrGLProgram::initSamplerUniforms() {
GL_CALL(UseProgram(fProgramID));
GrGLint texUnitIdx = 0;
+ if (fBuiltinUniformHandles.fDstCopySamplerUni.isValid()) {
+ fProgramDataManager.setSampler(fBuiltinUniformHandles.fDstCopySamplerUni, texUnitIdx);
+ fDstCopyTexUnit = texUnitIdx++;
+ }
this->initSamplers(fGeometryProcessor.get(), &texUnitIdx);
if (fXferProcessor.get()) {
this->initSamplers(fXferProcessor.get(), &texUnitIdx);
@@ -103,15 +107,38 @@
const GrBatchTracker& batchTracker) {
this->setRenderTargetState(primProc, pipeline);
+ const GrDeviceCoordTexture* dstCopy = pipeline.getDstCopy();
+ if (dstCopy) {
+ if (fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid()) {
+ fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyTopLeftUni,
+ static_cast<GrGLfloat>(dstCopy->offset().fX),
+ static_cast<GrGLfloat>(dstCopy->offset().fY));
+ fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyScaleUni,
+ 1.f / dstCopy->texture()->width(),
+ 1.f / dstCopy->texture()->height());
+ GrGLTexture* texture = static_cast<GrGLTexture*>(dstCopy->texture());
+ static GrTextureParams kParams; // the default is clamp, nearest filtering.
+ fGpu->bindTexture(fDstCopyTexUnit, kParams, texture);
+ } else {
+ SkASSERT(!fBuiltinUniformHandles.fDstCopyScaleUni.isValid());
+ SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid());
+ }
+ } else {
+ SkASSERT(!fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid());
+ SkASSERT(!fBuiltinUniformHandles.fDstCopyScaleUni.isValid());
+ SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid());
+ }
+
// we set the textures, and uniforms for installed processors in a generic way, but subclasses
// of GLProgram determine how to set coord transforms
fGeometryProcessor->fGLProc->setData(fProgramDataManager, primProc, batchTracker);
this->bindTextures(fGeometryProcessor.get(), primProc);
- const GrXferProcessor& xp = *pipeline.getXferProcessor();
- fXferProcessor->fGLProc->setData(fProgramDataManager, xp);
- this->bindTextures(fXferProcessor.get(), xp);
-
+ if (fXferProcessor.get()) {
+ const GrXferProcessor& xp = *pipeline.getXferProcessor();
+ fXferProcessor->fGLProc->setData(fProgramDataManager, xp);
+ this->bindTextures(fXferProcessor.get(), xp);
+ }
this->setFragmentData(primProc, pipeline);
// Some of GrGLProgram subclasses need to update state here
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | src/gpu/gl/GrGLProgramDesc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698