diff options
author | Brian Salomon <bsalomon@google.com> | 2018-06-19 14:33:47 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-19 20:01:29 +0000 |
commit | 92be2f74db81f0ed480b55c58cbde39270f9b772 (patch) | |
tree | d2b7135f511a318f10c5c86f2537c07051c922bd /src/gpu/gl/GrGLProgram.h | |
parent | f5ac906476cd26f2967a48340940e6af580fa71f (diff) |
Revert "Revert "Change how vertex/instance attributes are handled in geometry processors.""
This reverts commit 5045e501d2aec23e5f1e4b46346033ac3202c6b0.
TBR=csmartdalton@google.com
Change-Id: Ifbf5f1d8f8ef340fdc69653e931b6d68d4bf0854
Reviewed-on: https://skia-review.googlesource.com/135862
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/gl/GrGLProgram.h')
-rw-r--r-- | src/gpu/gl/GrGLProgram.h | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h index 6ea1f2cbf9..ca4eddce4b 100644 --- a/src/gpu/gl/GrGLProgram.h +++ b/src/gpu/gl/GrGLProgram.h @@ -10,7 +10,6 @@ #define GrGLProgram_DEFINED #include "GrGLProgramDataManager.h" -#include "GrPrimitiveProcessor.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" @@ -35,15 +34,18 @@ public: */ struct Attribute { GrVertexAttribType fType; - int fOffset; + size_t fOffset; GrGLint fLocation; - GrPrimitiveProcessor::Attribute::InputRate fInputRate; }; using UniformHandle = GrGLSLProgramDataManager::UniformHandle; using UniformInfoArray = GrGLProgramDataManager::UniformInfoArray; using VaryingInfoArray = GrGLProgramDataManager::VaryingInfoArray; + /** + * The attribute array consists of vertexAttributeCnt + instanceAttributeCnt elements with + * the vertex attributes preceding the instance attributes. + */ GrGLProgram(GrGLGpu*, const GrGLSLBuiltinUniformHandles&, GrGLuint programID, @@ -56,7 +58,8 @@ public: std::unique_ptr<std::unique_ptr<GrGLSLFragmentProcessor>[]> fragmentProcessors, int fragmentProcessorCnt, std::unique_ptr<Attribute[]>, - int attributeCnt, + int vertexAttributeCnt, + int instanceAttributeCnt, int vertexStride, int instanceStride); @@ -124,8 +127,17 @@ public: int vertexStride() const { return fVertexStride; } int instanceStride() const { return fInstanceStride; } - int numAttributes() const { return fAttributeCnt; } - const Attribute& attribute(int i) const { return fAttributes[i]; } + int numVertexAttributes() const { return fVertexAttributeCnt; } + const Attribute& vertexAttribute(int i) const { + SkASSERT(i >= 0 && i < fVertexAttributeCnt); + return fAttributes[i]; + } + + int numInstanceAttributes() const { return fInstanceAttributeCnt; } + const Attribute& instanceAttribute(int i) const { + SkASSERT(i >= 0 && i < fInstanceAttributeCnt); + return fAttributes[i + fVertexAttributeCnt]; + } private: // A helper to loop over effects, set the transforms (via subclass) and bind textures @@ -153,7 +165,8 @@ private: int fFragmentProcessorCnt; std::unique_ptr<Attribute[]> fAttributes; - int fAttributeCnt; + int fVertexAttributeCnt; + int fInstanceAttributeCnt; int fVertexStride; int fInstanceStride; |