GrGLProgramStage Renaming Part 1.
Renamed cpp and h s/GrGLProgramStage/GrGLEffect/ Review URL: https://codereview.appspot.com/6759054 git-svn-id: http://skia.googlecode.com/svn/trunk@6090 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
021fc736f8
commit
d698f77c13
@ -144,6 +144,8 @@
|
||||
'<(skia_src_path)/gpu/gl/GrGLCreateNativeInterface_none.cpp',
|
||||
'<(skia_src_path)/gpu/gl/GrGLDefaultInterface_none.cpp',
|
||||
'<(skia_src_path)/gpu/gl/GrGLDefines.h',
|
||||
'<(skia_src_path)/gpu/gl/GrGLEffect.cpp',
|
||||
'<(skia_src_path)/gpu/gl/GrGLEffect.h',
|
||||
'<(skia_src_path)/gpu/gl/GrGLIndexBuffer.cpp',
|
||||
'<(skia_src_path)/gpu/gl/GrGLIndexBuffer.h',
|
||||
'<(skia_src_path)/gpu/gl/GrGLInterface.cpp',
|
||||
@ -152,8 +154,6 @@
|
||||
'<(skia_src_path)/gpu/gl/GrGLPath.h',
|
||||
'<(skia_src_path)/gpu/gl/GrGLProgram.cpp',
|
||||
'<(skia_src_path)/gpu/gl/GrGLProgram.h',
|
||||
'<(skia_src_path)/gpu/gl/GrGLProgramStage.cpp',
|
||||
'<(skia_src_path)/gpu/gl/GrGLProgramStage.h',
|
||||
'<(skia_src_path)/gpu/gl/GrGLRenderTarget.cpp',
|
||||
'<(skia_src_path)/gpu/gl/GrGLRenderTarget.h',
|
||||
'<(skia_src_path)/gpu/gl/GrGLShaderBuilder.cpp',
|
||||
|
@ -26,7 +26,7 @@ class SkString;
|
||||
their fields may not change. (Immutability isn't actually required
|
||||
until they've been used in a draw call, but supporting that would require
|
||||
setters and getters that could fail, copy-on-write, or deep copying of these
|
||||
objects when they're stored by a GrGLProgramStage.)
|
||||
objects when they're stored by a GrGLEffect.)
|
||||
*/
|
||||
class GrEffect : public GrRefCnt {
|
||||
|
||||
@ -47,7 +47,7 @@ public:
|
||||
an instance of templated class, GrTProgramStageFactory. It is templated
|
||||
on the subclass of GrEffect. The subclass must have a nested type
|
||||
(or typedef) named GLProgramStage which will be the subclass of
|
||||
GrGLProgramStage created by the factory.
|
||||
GrGLEffect created by the factory.
|
||||
|
||||
Example:
|
||||
class MyCustomEffect : public GrEffect {
|
||||
|
@ -13,12 +13,12 @@
|
||||
#include "GrNoncopyable.h"
|
||||
|
||||
/** Given a GrEffect of a particular type, creates the corresponding
|
||||
graphics-backend-specific GrGLProgramStage. Also tracks equivalence
|
||||
graphics-backend-specific GrGLEffect. Also tracks equivalence
|
||||
of shaders generated via a key.
|
||||
*/
|
||||
|
||||
class GrEffect;
|
||||
class GrGLProgramStage;
|
||||
class GrGLEffect;
|
||||
class GrGLCaps;
|
||||
|
||||
class GrProgramStageFactory : public GrNoncopyable {
|
||||
@ -30,7 +30,7 @@ public:
|
||||
};
|
||||
|
||||
virtual StageKey glStageKey(const GrEffect&, const GrGLCaps&) const = 0;
|
||||
virtual GrGLProgramStage* createGLInstance(const GrEffect&) const = 0;
|
||||
virtual GrGLEffect* createGLInstance(const GrEffect&) const = 0;
|
||||
|
||||
bool operator ==(const GrProgramStageFactory& b) const {
|
||||
return fEffectClassID == b.fEffectClassID;
|
||||
@ -72,7 +72,7 @@ public:
|
||||
typedef typename EffectClass::GLProgramStage GLProgramStage;
|
||||
|
||||
/** Returns a human-readable name that is accessible via GrEffect or
|
||||
GrGLProgramStage and is consistent between the two of them.
|
||||
GrGLEffect and is consistent between the two of them.
|
||||
*/
|
||||
virtual const char* name() const SK_OVERRIDE { return EffectClass::Name(); }
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "SkGr.h"
|
||||
#include "SkGrPixelRef.h"
|
||||
#include "gl/GrGLProgramStage.h"
|
||||
#include "gl/GrGLEffect.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
@ -275,7 +275,7 @@ void GrGLBlendEffect::emitFS(GrGLShaderBuilder* builder,
|
||||
}
|
||||
}
|
||||
|
||||
GrGLProgramStage::StageKey GrGLBlendEffect::GenKey(const GrEffect& s, const GrGLCaps&) {
|
||||
GrGLEffect::StageKey GrGLBlendEffect::GenKey(const GrEffect& s, const GrGLCaps&) {
|
||||
return static_cast<const GrBlendEffect&>(s).mode();
|
||||
}
|
||||
#endif
|
||||
|
@ -320,7 +320,7 @@ bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) {
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrEffect.h"
|
||||
#include "gl/GrGLProgramStage.h"
|
||||
#include "gl/GrGLEffect.h"
|
||||
|
||||
class ColorMatrixEffect : public GrEffect {
|
||||
public:
|
||||
|
@ -16,7 +16,7 @@
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrProgramStageFactory.h"
|
||||
#include "effects/GrSingleTextureEffect.h"
|
||||
#include "gl/GrGLProgramStage.h"
|
||||
#include "gl/GrGLEffect.h"
|
||||
#include "gl/GrGLTexture.h"
|
||||
#include "GrEffect.h"
|
||||
|
||||
@ -1168,7 +1168,7 @@ void GrGLLightingEffect::emitFS(GrGLShaderBuilder* builder,
|
||||
GrGLSLMulVarBy4f(code, 2, outputColor, inputColor);
|
||||
}
|
||||
|
||||
GrGLProgramStage::StageKey GrGLLightingEffect::GenKey(const GrEffect& s,
|
||||
GrGLEffect::StageKey GrGLLightingEffect::GenKey(const GrEffect& s,
|
||||
const GrGLCaps& caps) {
|
||||
return static_cast<const GrLightingEffect&>(s).light()->type();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "effects/GrSingleTextureEffect.h"
|
||||
#include "gl/GrGLProgramStage.h"
|
||||
#include "gl/GrGLEffect.h"
|
||||
#include "gl/GrGLSL.h"
|
||||
#include "gl/GrGLTexture.h"
|
||||
#include "GrProgramStageFactory.h"
|
||||
@ -174,7 +174,7 @@ void GrGLMagnifierEffect::setData(const GrGLUniformManager& uman,
|
||||
uman.set2f(fInsetVar, zoom.x_inset(), zoom.y_inset());
|
||||
}
|
||||
|
||||
GrGLProgramStage::StageKey GrGLMagnifierEffect::GenKey(const GrEffect& s,
|
||||
GrGLEffect::StageKey GrGLMagnifierEffect::GenKey(const GrEffect& s,
|
||||
const GrGLCaps& caps) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "SkUnPreMultiply.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "gl/GrGLProgramStage.h"
|
||||
#include "gl/GrGLEffect.h"
|
||||
#endif
|
||||
|
||||
SkMatrixConvolutionImageFilter::SkMatrixConvolutionImageFilter(const SkISize& kernelSize, const SkScalar* kernel, SkScalar gain, SkScalar bias, const SkIPoint& target, TileMode tileMode, bool convolveAlpha, SkImageFilter* input)
|
||||
@ -415,7 +415,7 @@ int encodeXY(int x, int y) {
|
||||
|
||||
};
|
||||
|
||||
GrGLProgramStage::StageKey GrGLMatrixConvolutionEffect::GenKey(const GrEffect& s,
|
||||
GrGLEffect::StageKey GrGLMatrixConvolutionEffect::GenKey(const GrEffect& s,
|
||||
const GrGLCaps& caps) {
|
||||
const GrMatrixConvolutionEffect& m = static_cast<const GrMatrixConvolutionEffect&>(s);
|
||||
StageKey key = encodeXY(m.kernelSize().width(), m.kernelSize().height());
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "GrContext.h"
|
||||
#include "GrTexture.h"
|
||||
#include "GrGpu.h"
|
||||
#include "gl/GrGLProgramStage.h"
|
||||
#include "gl/GrGLEffect.h"
|
||||
#include "effects/Gr1DKernelEffect.h"
|
||||
#endif
|
||||
|
||||
@ -341,7 +341,7 @@ void GrGLMorphologyEffect::emitFS(GrGLShaderBuilder* builder,
|
||||
GrGLSLMulVarBy4f(code, 2, outputColor, inputColor);
|
||||
}
|
||||
|
||||
GrGLProgramStage::StageKey GrGLMorphologyEffect::GenKey(const GrEffect& s,
|
||||
GrGLEffect::StageKey GrGLMorphologyEffect::GenKey(const GrEffect& s,
|
||||
const GrGLCaps& caps) {
|
||||
const GrMorphologyEffect& m = static_cast<const GrMorphologyEffect&>(s);
|
||||
StageKey key = static_cast<StageKey>(m.radius());
|
||||
|
@ -217,7 +217,7 @@ bool SkTable_ColorFilter::asComponentTable(SkBitmap* table) const {
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
#include "GrEffect.h"
|
||||
#include "gl/GrGLProgramStage.h"
|
||||
#include "gl/GrGLEffect.h"
|
||||
#include "SkGr.h"
|
||||
|
||||
class GLColorTableEffect;
|
||||
@ -312,7 +312,7 @@ void GLColorTableEffect::emitFS(GrGLShaderBuilder* builder,
|
||||
code->appendf("\t\t%s.rgb *= %s.a;\n", outputColor, outputColor);
|
||||
}
|
||||
|
||||
GrGLProgramStage::StageKey GLColorTableEffect::GenKey(const GrEffect& s,
|
||||
GrGLEffect::StageKey GLColorTableEffect::GenKey(const GrEffect& s,
|
||||
const GrGLCaps& caps) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ private:
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
#include "gl/GrGLProgramStage.h"
|
||||
#include "gl/GrGLEffect.h"
|
||||
|
||||
class GrSamplerState;
|
||||
class GrProgramStageFactory;
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "GrConfigConversionEffect.h"
|
||||
#include "gl/GrGLProgramStage.h"
|
||||
#include "gl/GrGLEffect.h"
|
||||
|
||||
class GrGLConfigConversionEffect : public GrGLLegacyProgramStage {
|
||||
public:
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "GrConvolutionEffect.h"
|
||||
#include "gl/GrGLProgramStage.h"
|
||||
#include "gl/GrGLEffect.h"
|
||||
#include "gl/GrGLSL.h"
|
||||
#include "gl/GrGLTexture.h"
|
||||
#include "GrProgramStageFactory.h"
|
||||
@ -108,7 +108,7 @@ void GrGLConvolutionEffect::setData(const GrGLUniformManager& uman, const GrEffe
|
||||
uman.set1fv(fKernelUni, 0, this->width(), conv.kernel());
|
||||
}
|
||||
|
||||
GrGLProgramStage::StageKey GrGLConvolutionEffect::GenKey(const GrEffect& s,
|
||||
GrGLEffect::StageKey GrGLConvolutionEffect::GenKey(const GrEffect& s,
|
||||
const GrGLCaps& caps) {
|
||||
return static_cast<const GrConvolutionEffect&>(s).radius();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "effects/GrSingleTextureEffect.h"
|
||||
#include "gl/GrGLProgramStage.h"
|
||||
#include "gl/GrGLEffect.h"
|
||||
#include "gl/GrGLSL.h"
|
||||
#include "gl/GrGLTexture.h"
|
||||
#include "GrProgramStageFactory.h"
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "GrTextureDomainEffect.h"
|
||||
#include "gl/GrGLProgramStage.h"
|
||||
#include "gl/GrGLEffect.h"
|
||||
#include "GrProgramStageFactory.h"
|
||||
|
||||
class GrGLTextureDomainEffect : public GrGLLegacyProgramStage {
|
||||
|
@ -6,21 +6,21 @@
|
||||
*/
|
||||
|
||||
#include "GrGLSL.h"
|
||||
#include "GrGLProgramStage.h"
|
||||
#include "GrGLEffect.h"
|
||||
|
||||
GrGLProgramStage::GrGLProgramStage(const GrProgramStageFactory& factory)
|
||||
GrGLEffect::GrGLEffect(const GrProgramStageFactory& factory)
|
||||
: fFactory(factory) {
|
||||
}
|
||||
|
||||
GrGLProgramStage::~GrGLProgramStage() {
|
||||
GrGLEffect::~GrGLEffect() {
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void GrGLProgramStage::setData(const GrGLUniformManager&, const GrEffect&) {
|
||||
void GrGLEffect::setData(const GrGLUniformManager&, const GrEffect&) {
|
||||
}
|
||||
|
||||
GrGLProgramStage::StageKey GrGLProgramStage::GenTextureKey(const GrEffect& effect,
|
||||
GrGLEffect::StageKey GrGLEffect::GenTextureKey(const GrEffect& effect,
|
||||
const GrGLCaps& caps) {
|
||||
StageKey key = 0;
|
||||
for (int index = 0; index < effect.numTextures(); ++index) {
|
@ -20,7 +20,7 @@ class GrGLTexture;
|
||||
|
||||
/** @file
|
||||
This file contains specializations for OpenGL of the shader stages declared in
|
||||
include/gpu/GrEffect.h. Objects of type GrGLProgramStage are responsible for emitting the
|
||||
include/gpu/GrEffect.h. Objects of type GrGLEffect are responsible for emitting the
|
||||
GLSL code that implements a GrEffect and for uploading uniforms at draw time. They also
|
||||
must have a function:
|
||||
static inline StageKey GenKey(const GrEffect&, const GrGLCaps&)
|
||||
@ -30,7 +30,7 @@ class GrGLTexture;
|
||||
These objects are created by the factory object returned by the GrEffect::getFactory().
|
||||
*/
|
||||
|
||||
class GrGLProgramStage {
|
||||
class GrGLEffect {
|
||||
|
||||
public:
|
||||
typedef GrEffect::StageKey StageKey;
|
||||
@ -41,9 +41,9 @@ public:
|
||||
|
||||
typedef GrGLShaderBuilder::TextureSamplerArray TextureSamplerArray;
|
||||
|
||||
GrGLProgramStage(const GrProgramStageFactory&);
|
||||
GrGLEffect(const GrProgramStageFactory&);
|
||||
|
||||
virtual ~GrGLProgramStage();
|
||||
virtual ~GrGLEffect();
|
||||
|
||||
/** Called when the program stage should insert its code into the shaders. The code in each
|
||||
shader will be in its own block ({}) and so locally scoped names will not collide across
|
||||
@ -63,7 +63,7 @@ public:
|
||||
color is solid white, trans black, known to be opaque, etc.) that allows
|
||||
the effect to communicate back similar known info about its output.
|
||||
@param samplers One entry for each GrTextureAccess of the GrEffect that generated the
|
||||
GrGLProgramStage. These can be passed to the builder to emit texture
|
||||
GrGLEffect. These can be passed to the builder to emit texture
|
||||
reads in the generated code.
|
||||
*/
|
||||
virtual void emitCode(GrGLShaderBuilder* builder,
|
||||
@ -74,7 +74,7 @@ public:
|
||||
const char* inputColor,
|
||||
const TextureSamplerArray& samplers) = 0;
|
||||
|
||||
/** A GrGLProgramStage instance can be reused with any GrEffect that produces the same stage
|
||||
/** A GrGLEffect instance can be reused with any GrEffect that produces the same stage
|
||||
key; this function reads data from a stage and uploads any uniform variables required
|
||||
by the shaders created in emitCode(). */
|
||||
virtual void setData(const GrGLUniformManager&, const GrEffect&);
|
||||
@ -89,13 +89,13 @@ protected:
|
||||
};
|
||||
|
||||
/**
|
||||
* This allows program stages that implemented an older set of virtual functions on GrGLProgramStage
|
||||
* This allows program stages that implemented an older set of virtual functions on GrGLEffect
|
||||
* to continue to work by change their parent class to this class. New program stages should not use
|
||||
* this interface. It will be removed once older stages are modified to implement emitCode().
|
||||
*/
|
||||
class GrGLLegacyProgramStage : public GrGLProgramStage {
|
||||
class GrGLLegacyProgramStage : public GrGLEffect {
|
||||
public:
|
||||
GrGLLegacyProgramStage(const GrProgramStageFactory& factory) : GrGLProgramStage(factory) {}
|
||||
GrGLLegacyProgramStage(const GrProgramStageFactory& factory) : GrGLEffect(factory) {}
|
||||
|
||||
virtual void setupVariables(GrGLShaderBuilder* builder) {};
|
||||
virtual void emitVS(GrGLShaderBuilder* builder,
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "GrAllocator.h"
|
||||
#include "GrEffect.h"
|
||||
#include "GrGLProgramStage.h"
|
||||
#include "GrGLEffect.h"
|
||||
#include "gl/GrGLShaderBuilder.h"
|
||||
#include "GrGLShaderVar.h"
|
||||
#include "GrProgramStageFactory.h"
|
||||
@ -896,7 +896,7 @@ void GrGLProgram::initSamplerUniforms() {
|
||||
// Stage code generation
|
||||
|
||||
// TODO: Move this function to GrGLShaderBuilder
|
||||
GrGLProgramStage* GrGLProgram::GenStageCode(const GrEffect* effect,
|
||||
GrGLEffect* GrGLProgram::GenStageCode(const GrEffect* effect,
|
||||
const StageDesc& desc,
|
||||
StageUniforms* uniforms,
|
||||
const char* fsInColor, // NULL means no incoming color
|
||||
@ -904,7 +904,7 @@ GrGLProgramStage* GrGLProgram::GenStageCode(const GrEffect* effect,
|
||||
const char* vsInCoord,
|
||||
GrGLShaderBuilder* builder) {
|
||||
|
||||
GrGLProgramStage* glStage = effect->getFactory().createGLInstance(*effect);
|
||||
GrGLEffect* glStage = effect->getFactory().createGLInstance(*effect);
|
||||
|
||||
/// Vertex Shader Stuff
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "SkXfermode.h"
|
||||
|
||||
class GrBinHashKeyBuilder;
|
||||
class GrGLProgramStage;
|
||||
class GrGLEffect;
|
||||
class GrGLShaderBuilder;
|
||||
|
||||
// optionally compile the experimental GS code. Set to GR_DEBUG
|
||||
@ -175,7 +175,7 @@ private:
|
||||
|
||||
void genInputColor(GrGLShaderBuilder* builder, SkString* inColor);
|
||||
|
||||
static GrGLProgramStage* GenStageCode(const GrEffect* effect,
|
||||
static GrGLEffect* GenStageCode(const GrEffect* effect,
|
||||
const StageDesc& desc, // TODO: Eliminate this
|
||||
StageUniforms* stageUniforms, // TODO: Eliminate this
|
||||
const char* fsInColor, // NULL means no incoming color
|
||||
@ -254,7 +254,7 @@ private:
|
||||
GrMatrix fTextureMatrices[GrDrawState::kNumStages];
|
||||
GrGLTexture::Orientation fTextureOrientation[GrDrawState::kNumStages];
|
||||
|
||||
GrGLProgramStage* fProgramStage[GrDrawState::kNumStages];
|
||||
GrGLEffect* fProgramStage[GrDrawState::kNumStages];
|
||||
|
||||
Desc fDesc;
|
||||
const GrGLContextInfo& fContextInfo;
|
||||
|
@ -153,7 +153,7 @@ GrSLConstantVec GrGLSLModulate4f(SkString* outAppend,
|
||||
* mulFactor may be either "" or NULL. In this case either nothing will be appended (kOnes) or an
|
||||
* assignment of vec(0,0,0,0) will be appended (kZeros). The assignment is prepended by tabCnt tabs.
|
||||
* A semicolon and newline are added after the assignment. (TODO: Remove tabCnt when we auto-insert
|
||||
* tabs to GrGLProgramStage-generated lines.) If a zeros vec is assigned then the return value is
|
||||
* tabs to GrGLEffect-generated lines.) If a zeros vec is assigned then the return value is
|
||||
* kZeros, otherwise kNone.
|
||||
*/
|
||||
GrSLConstantVec GrGLSLMulVarBy4f(SkString* outAppend,
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "GrGpuGL.h"
|
||||
|
||||
#include "GrEffect.h"
|
||||
#include "GrGLProgramStage.h"
|
||||
#include "GrGLEffect.h"
|
||||
#include "GrGpuVertex.h"
|
||||
|
||||
typedef GrGLUniformManager::UniformHandle UniformHandle;
|
||||
|
Loading…
Reference in New Issue
Block a user