13f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com/* 23f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com * Copyright 2011 Google Inc. 33f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com * 43f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com * Use of this source code is governed by a BSD-style license that can be 53f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com * found in the LICENSE file. 63f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com */ 73f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com 83f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com 93f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com#ifndef GrGLProgram_DEFINED 103f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com#define GrGLProgram_DEFINED 113f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com 12b6b7f6d275d9f518b9d84c265c0e50a801458a23tomhudson@google.com#include "GrDrawState.h" 13860f3b88452e3dd2cf47282f1a1527e8876d41e1robertphillips@google.com#include "GrGLContext.h" 1484dd5d4d09fa17feaea61280eea8fa12f429014absalomon@google.com#include "GrGLProgramDesc.h" 1585058df499f3212717d691b39e3250fdd8e76043tomhudson@google.com#include "GrGLSL.h" 168a245d9ca73b73967c7c76825261a79d47ff12e1bsalomon@google.com#include "GrGLTexture.h" 17e00b4571a397999a5120758f947bc00e812dee82bsalomon@google.com#include "GrGLUniformManager.h" 183f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com 19bfdf20d85e455c31aae4aa7800c65b149bde2cd2bsalomon@google.com#include "SkString.h" 203f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com#include "SkXfermode.h" 213f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com 223f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.comclass GrBinHashKeyBuilder; 23aab3f0a5176fa13f1f0452386651dc5c8676ba68bsalomon@google.comclass GrGLEffect; 246c09952db60814e0c97611ba715db21000705d09tomhudson@google.comclass GrGLShaderBuilder; 253f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com 263f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com/** 273f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com * This class manages a GPU program and records per-program information. 283f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com * We can specify the attribute locations so that they are constant 293f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com * across our shaders. But the driver determines the uniform locations 303f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com * at link time. We don't need to remember the sampler uniform location 313f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com * because we will bind a texture slot to it and never change it 323f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com * Uniforms are program-local so we can't rely on fHWState to hold the 333f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com * previous uniform state after a program change. 343f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com */ 3585f928e239fa940a6089adad9f68438aa373b2b0bsalomon@google.comclass GrGLProgram : public GrRefCnt { 363f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.compublic: 3785f928e239fa940a6089adad9f68438aa373b2b0bsalomon@google.com SK_DECLARE_INST_COUNT(GrGLProgram) 383f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com 39860f3b88452e3dd2cf47282f1a1527e8876d41e1robertphillips@google.com static GrGLProgram* Create(const GrGLContext& gl, 4084dd5d4d09fa17feaea61280eea8fa12f429014absalomon@google.com const GrGLProgramDesc& desc, 41388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com const GrEffectStage* colorStages[], 42388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com const GrEffectStage* coverageStages[]); 43cc9477a26fc4998e1f2094d563efd322da1e49aabsalomon@google.com 4485f928e239fa940a6089adad9f68438aa373b2b0bsalomon@google.com virtual ~GrGLProgram(); 453f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com 4657d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com /** 4757d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com * Call to abandon GL objects owned by this program. 4857d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com */ 49cc9477a26fc4998e1f2094d563efd322da1e49aabsalomon@google.com void abandon(); 50cc9477a26fc4998e1f2094d563efd322da1e49aabsalomon@google.com 513f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com /** 5266307f1cfee47ae4d2a1f7dff821bdf1c0e853a8bsalomon@google.com * The shader may modify the blend coefficients. Params are in/out. 533f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com */ 54cc9477a26fc4998e1f2094d563efd322da1e49aabsalomon@google.com void overrideBlend(GrBlendCoeff* srcCoeff, GrBlendCoeff* dstCoeff) const; 553f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com 5684dd5d4d09fa17feaea61280eea8fa12f429014absalomon@google.com const GrGLProgramDesc& getDesc() { return fDesc; } 5785f928e239fa940a6089adad9f68438aa373b2b0bsalomon@google.com 583f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com /** 59f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com * Gets the GL program ID for this program. 60f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com */ 61f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com GrGLuint programID() const { return fProgramID; } 62f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com 63f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com /** 642419b53383d572e3f3b7adcbcb2574a569bce0dcjvanverth@google.com * Some GL state that is relevant to programs is not stored per-program. In particular color 652c3b0650210f7d163690ecf77e8769d82ecfe7b3skia.committer@gmail.com * and coverage attributes can be global state. This struct is read and updated by 662c3b0650210f7d163690ecf77e8769d82ecfe7b3skia.committer@gmail.com * GrGLProgram::setColor and GrGLProgram::setCoverage to allow us to avoid setting this state 672419b53383d572e3f3b7adcbcb2574a569bce0dcjvanverth@google.com * redundantly. 6849467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com */ 6949467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com struct SharedGLState { 7049467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com GrColor fConstAttribColor; 712419b53383d572e3f3b7adcbcb2574a569bce0dcjvanverth@google.com int fConstAttribColorIndex; 7249467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com GrColor fConstAttribCoverage; 732419b53383d572e3f3b7adcbcb2574a569bce0dcjvanverth@google.com int fConstAttribCoverageIndex; 7449467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com 7549467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com SharedGLState() { this->invalidate(); } 7649467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com void invalidate() { 7749467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com fConstAttribColor = GrColor_ILLEGAL; 782419b53383d572e3f3b7adcbcb2574a569bce0dcjvanverth@google.com fConstAttribColorIndex = -1; 7949467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com fConstAttribCoverage = GrColor_ILLEGAL; 802419b53383d572e3f3b7adcbcb2574a569bce0dcjvanverth@google.com fConstAttribCoverageIndex = -1; 8149467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com } 8249467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com }; 8349467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com 8449467dd13b26cc2f1f3fc3e2c8dfd432af04a8eabsalomon@google.com /** 85f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com * The GrDrawState's view matrix along with the aspects of the render target determine the 86f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com * matrix sent to GL. The size of the render target affects the GL matrix because we must 87f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com * convert from Skia device coords to GL's normalized coords. Also the origin of the render 88f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com * target may require us to perform a mirror-flip. 89f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com */ 90f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com struct MatrixState { 91f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com SkMatrix fViewMatrix; 92f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com SkISize fRenderTargetSize; 93f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com GrSurfaceOrigin fRenderTargetOrigin; 94f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com 95f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com MatrixState() { this->invalidate(); } 96f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com void invalidate() { 97f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com fViewMatrix = SkMatrix::InvalidMatrix(); 98adced265c6117a813aeeadaf485e511d8647fec7bsalomon@google.com fRenderTargetSize.fWidth = -1; 99adced265c6117a813aeeadaf485e511d8647fec7bsalomon@google.com fRenderTargetSize.fHeight = -1; 100f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com fRenderTargetOrigin = (GrSurfaceOrigin) -1; 101f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com } 102f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com }; 103f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com 104f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com /** 10557d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com * This function uploads uniforms and calls each GrGLEffect's setData. It is called before a 10657d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com * draw occurs using the program after the program has already been bound. It also uses the 107388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com * GrGpuGL object to bind the textures required by the GrGLEffects. The color and coverage 108388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com * stages come from GrGLProgramDesc::Build(). 10992b8e75b89542ab880d228796af254a5134cd73fbsalomon@google.com */ 11003d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com void setData(GrGpuGL*, 11166307f1cfee47ae4d2a1f7dff821bdf1c0e853a8bsalomon@google.com GrDrawState::BlendOptFlags, 112388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com const GrEffectStage* colorStages[], 113388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com const GrEffectStage* coverageStages[], 11403d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com const GrDeviceCoordTexture* dstCopy, // can be NULL 11503d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com SharedGLState*); 1163f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com 117d90c2b696b2cc1ccb81055f35a65058299cc33d9tomhudson@google.comprivate: 118e00b4571a397999a5120758f947bc00e812dee82bsalomon@google.com typedef GrGLUniformManager::UniformHandle UniformHandle; 119e00b4571a397999a5120758f947bc00e812dee82bsalomon@google.com 120636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com // handles for uniforms (aside from per-effect samplers) 12157d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com struct UniformHandles { 12257d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com UniformHandle fViewMatrixUni; 12357d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com UniformHandle fColorUni; 12457d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com UniformHandle fCoverageUni; 12557d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com UniformHandle fColorFilterUni; 12603d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com 12725c5de00a3906b6f60b407a80033cf32efc13eb0bsalomon@google.com // We use the render target height to provide a y-down frag coord when specifying 12825c5de00a3906b6f60b407a80033cf32efc13eb0bsalomon@google.com // origin_upper_left is not supported. 12957d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com UniformHandle fRTHeightUni; 13003d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com 13103d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com // Uniforms for computing texture coords to do the dst-copy lookup 13203d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com UniformHandle fDstCopyTopLeftUni; 13303d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com UniformHandle fDstCopyScaleUni; 13403d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com UniformHandle fDstCopySamplerUni; 13503d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com 13657d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com UniformHandles() { 137e00b4571a397999a5120758f947bc00e812dee82bsalomon@google.com fViewMatrixUni = GrGLUniformManager::kInvalidUniformHandle; 138e00b4571a397999a5120758f947bc00e812dee82bsalomon@google.com fColorUni = GrGLUniformManager::kInvalidUniformHandle; 139e00b4571a397999a5120758f947bc00e812dee82bsalomon@google.com fCoverageUni = GrGLUniformManager::kInvalidUniformHandle; 140e00b4571a397999a5120758f947bc00e812dee82bsalomon@google.com fColorFilterUni = GrGLUniformManager::kInvalidUniformHandle; 14157d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com fRTHeightUni = GrGLUniformManager::kInvalidUniformHandle; 14203d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com fDstCopyTopLeftUni = GrGLUniformManager::kInvalidUniformHandle; 14303d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com fDstCopyScaleUni = GrGLUniformManager::kInvalidUniformHandle; 14403d5ebc1af70a1c30c7b0ac72e7f0d3311f0e97dbsalomon@google.com fDstCopySamplerUni = GrGLUniformManager::kInvalidUniformHandle; 1453f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com } 1463f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com }; 1473f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com 148636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com typedef SkSTArray<4, UniformHandle, true> SamplerUniSArray; 149636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com typedef SkSTArray<4, int, true> TextureUnitSArray; 150636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com 151636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com struct EffectAndSamplers { 152636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com EffectAndSamplers() : fGLEffect(NULL) {} 153636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com ~EffectAndSamplers() { delete fGLEffect; } 154636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com GrGLEffect* fGLEffect; 155636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com SamplerUniSArray fSamplerUnis; // sampler uni handles for effect's GrTextureAccess 156636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com TextureUnitSArray fTextureUnits; // texture unit used for each entry of fSamplerUnis 157636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com }; 158636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com 159388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com GrGLProgram(const GrGLContext& gl, 160388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com const GrGLProgramDesc& desc, 161388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com const GrEffectStage* colorStages[], 162388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com const GrEffectStage* coverageStages[]); 163388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 164388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com bool succeeded() const { return 0 != fProgramID; } 165388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 166388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com /** 167388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com * This is the heavy initialization routine for building a GLProgram. colorStages and 168388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com * coverageStages correspond to the output of GrGLProgramDesc::Build(). 169388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com */ 170388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com bool genProgram(const GrEffectStage* colorStages[], const GrEffectStage* coverageStages[]); 171388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 172388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com GrSLConstantVec genInputColor(GrGLShaderBuilder* builder, SkString* inColor); 173388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 174388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com GrSLConstantVec genInputCoverage(GrGLShaderBuilder* builder, SkString* inCoverage); 175388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 176388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com void genGeometryShader(GrGLShaderBuilder* segments) const; 177388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 178388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com // Creates a GL program ID, binds shader attributes to GL vertex attrs, and links the program 179388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com bool bindOutputsAttribsAndLinkProgram(const GrGLShaderBuilder& builder, 180388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com bool bindColorOut, 181388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com bool bindDualSrcOut); 182388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 183388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com // Sets the texture units for samplers 184388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com void initSamplerUniforms(); 185388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com void initEffectSamplerUniforms(EffectAndSamplers* effect, int* texUnitIdx); 186388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 187388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com bool compileShaders(const GrGLShaderBuilder& builder); 188388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 189388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com const char* adjustInColor(const SkString& inColor) const; 190388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 191388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com // Helper for setData(). 192388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com void setEffectData(GrGpuGL* gpu, const GrEffectStage& stage, const EffectAndSamplers& effect); 193388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 194388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com // Helper for setData(). Makes GL calls to specify the initial color when there is not 195388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com // per-vertex colors. 196388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com void setColor(const GrDrawState&, GrColor color, SharedGLState*); 197388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 198388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com // Helper for setData(). Makes GL calls to specify the initial coverage when there is not 199388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com // per-vertex coverages. 200388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com void setCoverage(const GrDrawState&, GrColor coverage, SharedGLState*); 201388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 202388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com // Helper for setData() that sets the view matrix and loads the render target height uniform 203388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com void setMatrixAndRenderTargetHeight(const GrDrawState&); 204388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com 20557d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com // GL IDs 20657d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com GrGLuint fVShaderID; 20757d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com GrGLuint fGShaderID; 20857d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com GrGLuint fFShaderID; 20957d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com GrGLuint fProgramID; 21085f928e239fa940a6089adad9f68438aa373b2b0bsalomon@google.com 21157d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com // these reflect the current values of uniforms (GL uniform values travel with program) 212f2d487999e61c562fafa76d8d597070636b2d1a8bsalomon@google.com MatrixState fMatrixState; 21385f928e239fa940a6089adad9f68438aa373b2b0bsalomon@google.com GrColor fColor; 21485f928e239fa940a6089adad9f68438aa373b2b0bsalomon@google.com GrColor fCoverage; 21585f928e239fa940a6089adad9f68438aa373b2b0bsalomon@google.com GrColor fColorFilterColor; 216636e4bc5fc3b22916ab7543b7bcafd2b9b17059ebsalomon@google.com int fDstCopyTexUnit; 21785f928e239fa940a6089adad9f68438aa373b2b0bsalomon@google.com 218388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com SkTArray<EffectAndSamplers> fColorEffects; 219388fc3191dc73013bfe66564297ffa6b6df8382bbsalomon@google.com SkTArray<EffectAndSamplers> fCoverageEffects; 22085f928e239fa940a6089adad9f68438aa373b2b0bsalomon@google.com 22184dd5d4d09fa17feaea61280eea8fa12f429014absalomon@google.com GrGLProgramDesc fDesc; 222860f3b88452e3dd2cf47282f1a1527e8876d41e1robertphillips@google.com const GrGLContext& fContext; 22385f928e239fa940a6089adad9f68438aa373b2b0bsalomon@google.com 224e00b4571a397999a5120758f947bc00e812dee82bsalomon@google.com GrGLUniformManager fUniformManager; 22557d258a610dff47be00cdc1c075557ac38b74a10bsalomon@google.com UniformHandles fUniformHandles; 226e00b4571a397999a5120758f947bc00e812dee82bsalomon@google.com 22785f928e239fa940a6089adad9f68438aa373b2b0bsalomon@google.com typedef GrRefCnt INHERITED; 2283f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com}; 2293f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com 2303f30e3a41fc16816105e28e0d4c241eff6d391b4bsalomon@google.com#endif 231