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

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

Issue 794343006: Move all non-program cache functions out of GrGpuGL_program.cpp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/GrGpuGL.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL_program.cpp
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 19ddc769443cf196588aa4e9f9f1ff3250a15b80..f094ee9c80c80daa4bf86013baaa017be7e5bb05 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -196,113 +196,3 @@ GrGLProgram* GrGpuGL::ProgramCache::getProgram(const GrOptDrawState& optState) {
++fCurrLRUStamp;
return entry->fProgram;
}
-
-////////////////////////////////////////////////////////////////////////////////
-
-#define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
-
-bool GrGpuGL::flushGraphicsState(const GrOptDrawState& optState) {
- // GrGpu::setupClipAndFlushState should have already checked this and bailed if not true.
- SkASSERT(optState.getRenderTarget());
-
- if (kStencilPath_DrawType == optState.drawType()) {
- const GrRenderTarget* rt = optState.getRenderTarget();
- SkISize size;
- size.set(rt->width(), rt->height());
- this->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), size, rt->origin());
- } else {
- this->flushMiscFixedFunctionState(optState);
-
- fCurrentProgram.reset(fProgramCache->getProgram(optState));
- if (NULL == fCurrentProgram.get()) {
- SkDEBUGFAIL("Failed to create program!");
- return false;
- }
-
- fCurrentProgram.get()->ref();
-
- GrGLuint programID = fCurrentProgram->programID();
- if (fHWProgramID != programID) {
- GL_CALL(UseProgram(programID));
- fHWProgramID = programID;
- }
-
- this->flushBlend(optState);
-
- fCurrentProgram->setData(optState);
- }
-
- GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState.getRenderTarget());
- this->flushStencil(optState.getStencil(), optState.drawType());
- this->flushScissor(optState.getScissorState(), glRT->getViewport(), glRT->origin());
- this->flushAAState(optState);
-
- // This must come after textures are flushed because a texture may need
- // to be msaa-resolved (which will modify bound FBO state).
- this->flushRenderTarget(glRT, NULL);
-
- return true;
-}
-
-void GrGpuGL::setupGeometry(const GrOptDrawState& optState,
- const GrDrawTarget::DrawInfo& info,
- size_t* indexOffsetInBytes) {
- GrGLVertexBuffer* vbuf;
- vbuf = (GrGLVertexBuffer*) info.vertexBuffer();
-
- SkASSERT(vbuf);
- SkASSERT(!vbuf->isMapped());
-
- GrGLIndexBuffer* ibuf = NULL;
- if (info.isIndexed()) {
- SkASSERT(indexOffsetInBytes);
-
- *indexOffsetInBytes = 0;
- ibuf = (GrGLIndexBuffer*)info.indexBuffer();
-
- SkASSERT(ibuf);
- SkASSERT(!ibuf->isMapped());
- *indexOffsetInBytes += ibuf->baseOffset();
- }
- GrGLAttribArrayState* attribState =
- fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf);
-
- if (fCurrentProgram->hasVertexShader()) {
- const GrGeometryProcessor* gp = optState.getGeometryProcessor();
-
- GrGLsizei stride = static_cast<GrGLsizei>(gp->getVertexStride());
-
- size_t vertexOffsetInBytes = stride * info.startVertex();
-
- vertexOffsetInBytes += vbuf->baseOffset();
-
- const SkTArray<GrGeometryProcessor::GrAttribute, true>& attribs = gp->getAttribs();
- int vaCount = attribs.count();
- uint32_t usedAttribArraysMask = 0;
- size_t offset = 0;
-
- for (int attribIndex = 0; attribIndex < vaCount; attribIndex++) {
- usedAttribArraysMask |= (1 << attribIndex);
- GrVertexAttribType attribType = attribs[attribIndex].fType;
- attribState->set(this,
- attribIndex,
- vbuf,
- GrGLAttribTypeToLayout(attribType).fCount,
- GrGLAttribTypeToLayout(attribType).fType,
- GrGLAttribTypeToLayout(attribType).fNormalized,
- stride,
- reinterpret_cast<GrGLvoid*>(vertexOffsetInBytes + offset));
- offset += attribs[attribIndex].fOffset;
- }
- attribState->disableUnusedArrays(this, usedAttribArraysMask);
- }
-}
-
-void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState,
- const GrProgramDesc::DescInfo& descInfo,
- GrGpu::DrawType drawType,
- GrProgramDesc* desc) {
- if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, desc)) {
- SkDEBUGFAIL("Failed to generate GL program descriptor");
- }
-}
« no previous file with comments | « src/gpu/gl/GrGpuGL.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698