aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLProgram.cpp
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2015-02-04 06:25:28 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-04 06:25:28 -0800
commit4dce32c46675efb901618161771d450241af4307 (patch)
treef00c93110fbeda3d399105c40cee3fe6745e0c72 /src/gpu/gl/GrGLProgram.cpp
parent7adb35559430303a25be37f21af56c0df6c62f2b (diff)
Revert "Move DstCopy on gpu into the GrXferProcessor."
This reverts commit 74a11753604768bf461b80cabb66060e8564d82c. TBR=joshualitt@google.com,bsalomon@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Committed: https://skia.googlesource.com/skia/+/3e9dfdb3784c0cbfecf7589a74aa9aff7ef40abd Review URL: https://codereview.chromium.org/896163003
Diffstat (limited to 'src/gpu/gl/GrGLProgram.cpp')
-rw-r--r--src/gpu/gl/GrGLProgram.cpp35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index eebcf6b2f3..ad63dc4ea7 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -61,6 +61,10 @@ void GrGLProgram::abandon() {
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 @@ void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline
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