Remove origin field from GrSurface (take 2)
This mainly consists of rm origin from GrSurface and the wrapBackEnd*
methods and then re-adding an explicit origin parameter to all the
GrGpu methods that need it.
TBR=bsalomon@google.com
Change-Id: I4248b2a4749ef844da4233ce53b0dc504bc9eb74
Reviewed-on: https://skia-review.googlesource.com/30280
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 82a8170..f7e337c 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -70,7 +70,7 @@
///////////////////////////////////////////////////////////////////////////////
void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline) {
- this->setRenderTargetState(primProc, pipeline.renderTarget());
+ this->setRenderTargetState(primProc, pipeline.proxy());
// we set the textures, and uniforms for installed processors in a generic way, but subclasses
// of GLProgram determine how to set coord transforms
@@ -97,7 +97,8 @@
fXferProcessor->setData(fProgramDataManager, xp, dstTexture, offset);
if (dstTexture) {
fGpu->bindTexture(nextTexSamplerIdx++, GrSamplerParams::ClampNoFilter(), true,
- static_cast<GrGLTexture*>(dstTexture));
+ static_cast<GrGLTexture*>(dstTexture),
+ pipeline.dstTextureProxy()->origin());
}
SkASSERT(nextTexSamplerIdx == fNumTextureSamplers);
SkASSERT(nextTexelBufferIdx == fNumTextureSamplers + fNumTexelBuffers);
@@ -135,7 +136,8 @@
void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc,
- const GrRenderTarget* rt) {
+ const GrRenderTargetProxy* proxy) {
+ GrRenderTarget* rt = proxy->priv().peekRenderTarget();
// Load the RT height uniform if it is needed to y-flip gl_FragCoord.
if (fBuiltinUniformHandles.fRTHeightUni.isValid() &&
fRenderTargetState.fRenderTargetSize.fHeight != rt->height()) {
@@ -146,10 +148,10 @@
SkISize size;
size.set(rt->width(), rt->height());
if (!primProc.isPathRendering()) {
- if (fRenderTargetState.fRenderTargetOrigin != rt->origin() ||
+ if (fRenderTargetState.fRenderTargetOrigin != proxy->origin() ||
fRenderTargetState.fRenderTargetSize != size) {
fRenderTargetState.fRenderTargetSize = size;
- fRenderTargetState.fRenderTargetOrigin = rt->origin();
+ fRenderTargetState.fRenderTargetOrigin = proxy->origin();
float rtAdjustmentVec[4];
fRenderTargetState.getRTAdjustmentVec(rtAdjustmentVec);
@@ -159,7 +161,7 @@
SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport());
const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
fGpu->glPathRendering()->setProjectionMatrix(pathProc.viewMatrix(),
- size, rt->origin());
+ size, proxy->origin());
}
}
@@ -171,7 +173,8 @@
for (int i = 0; i < processor.numTextureSamplers(); ++i) {
const GrResourceIOProcessor::TextureSampler& sampler = processor.textureSampler(i);
fGpu->bindTexture((*nextTexSamplerIdx)++, sampler.params(),
- allowSRGBInputs, static_cast<GrGLTexture*>(sampler.peekTexture()));
+ allowSRGBInputs, static_cast<GrGLTexture*>(sampler.peekTexture()),
+ sampler.proxy()->origin());
}
for (int i = 0; i < processor.numBuffers(); ++i) {
const GrResourceIOProcessor::BufferAccess& access = processor.bufferAccess(i);
@@ -189,6 +192,7 @@
for (int i = 0; i < processor.numTextureSamplers(); ++i) {
const GrResourceIOProcessor::TextureSampler& sampler = processor.textureSampler(i);
fGpu->generateMipmaps(sampler.params(), allowSRGBInputs,
- static_cast<GrGLTexture*>(sampler.peekTexture()));
+ static_cast<GrGLTexture*>(sampler.peekTexture()),
+ sampler.proxy()->origin());
}
}