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

Unified Diff: src/gpu/gl/GrGLShaderBuilder.h

Issue 24853002: Make GPU coord transforms automatic (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 months 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
Index: src/gpu/gl/GrGLShaderBuilder.h
diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h
index d73a731a7cd9aaf52d7518d5dfb66413553740b8..7ddf46f9872548e0ca89f1b17fd2bfd5121430c1 100644
--- a/src/gpu/gl/GrGLShaderBuilder.h
+++ b/src/gpu/gl/GrGLShaderBuilder.h
@@ -13,6 +13,7 @@
#include "GrColor.h"
#include "GrEffect.h"
#include "SkTypes.h"
+#include "gl/GrGLCoordTransform.h"
#include "gl/GrGLSL.h"
#include "gl/GrGLUniformManager.h"
@@ -96,8 +97,10 @@ public:
friend class GrGLShaderBuilder; // to call init().
};
+ typedef SkTArray<GrGLCoordTransform::TransformedCoords> TransformedCoordsArray;
typedef SkTArray<TextureSampler> TextureSamplerArray;
typedef GrTAllocator<GrGLShaderVar> VarArray;
+ typedef GrBackendEffectFactory::EffectKey EffectKey;
enum ShaderVisibility {
kVertex_Visibility = 0x1,
@@ -175,8 +178,7 @@ public:
/** Generates a EffectKey for the shader code based on the texture access parameters and the
capabilities of the GL context. This is useful for keying the shader programs that may
have multiple representations, based on the type/format of textures used. */
- static GrBackendEffectFactory::EffectKey KeyForTextureAccess(const GrTextureAccess&,
- const GrGLCaps&);
+ static EffectKey KeyForTextureAccess(const GrTextureAccess&, const GrGLCaps&);
typedef uint8_t DstReadKey;
typedef uint8_t FragPosKey;
@@ -225,6 +227,13 @@ public:
return this->getUniformVariable(u).c_str();
}
+ /**
+ * This returns a variable name to access the 2D, perspective correct version of the coords in
+ * the fragment shader. If the coordinates at index are 3-dimensional, it emits a perspective
+ * divide (xy / z) to convert them to 2D.
+ */
+ SkString ensureFSCoords2D(const TransformedCoordsArray&, int index);
bsalomon 2013/09/27 20:04:25 Might want to document that this may emit code int
Chris Dalton 2013/09/27 23:33:45 Done.
+
/** Returns a variable name that represents the position of the fragment in the FS. The position
is in device space (e.g. 0,0 is the top left and pixel centers are at half-integers). */
const char* fragmentPosition();
@@ -255,10 +264,11 @@ public:
* effectStages.
*/
void emitEffects(const GrEffectStage* effectStages[],
- const GrBackendEffectFactory::EffectKey effectKeys[],
+ const EffectKey effectKeys[],
int effectCnt,
SkString* inOutFSColor,
GrSLConstantVec* fsInOutColorKnownValue,
+ SkTArray<GrGLCoordTransform, false>* effectCoordTransformArrays[],
SkTArray<GrGLUniformManager::UniformHandle, true>* effectSamplerHandles[],
GrGLEffect* glEffects[]);

Powered by Google App Engine
This is Rietveld 408576698