aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLGpu.h
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-05-26 15:17:19 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-30 16:02:36 +0000
commit114a3c0b2b26c84b9d0907a99fd8ab7938631246 (patch)
treea243fad112a79f3375ae98f0c916db63d9cdc9c0 /src/gpu/gl/GrGLGpu.h
parent8cc933104b0e965c4226c91701cee7586587409f (diff)
Fix glDrawRangeElements
Adds explicit min/max index value fields to GrMesh. This eliminates the previous assumption that the index values were within the range [0..vertexCount-1]. In the pattern case we still maintain this assumption. Updates GrMesh to hide its fields and handle its new complexity using a "helper" interface instead. Adds a unit test for GrMesh. Bug: skia: Change-Id: Ia23de72d510f8827cee56072b727fb70a6e46b8d Reviewed-on: https://skia-review.googlesource.com/17964 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/gl/GrGLGpu.h')
-rw-r--r--src/gpu/gl/GrGLGpu.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index d19f2ef6ee..c83ad85585 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -17,6 +17,7 @@
#include "GrGLTexture.h"
#include "GrGLVertexArray.h"
#include "GrGpu.h"
+#include "GrMesh.h"
#include "GrTexturePriv.h"
#include "GrWindowRectsState.h"
#include "GrXferProcessor.h"
@@ -34,7 +35,7 @@ namespace gr_instanced { class GLInstancedRendering; }
#define PROGRAM_CACHE_STATS
#endif
-class GrGLGpu final : public GrGpu {
+class GrGLGpu final : public GrGpu, private GrMesh::SendToGpuImpl {
public:
static GrGpu* Create(GrBackendContext backendContext, const GrContextOptions& options,
GrContext* context);
@@ -103,6 +104,17 @@ public:
const GrMesh*,
int meshCount);
+
+ // GrMesh::SendToGpuImpl methods. These issue the actual GL draw calls.
+ // Marked final as a hint to the compiler to not use virtual dispatch.
+ void sendMeshToGpu(const GrPrimitiveProcessor&, GrPrimitiveType,
+ const GrBuffer* vertexBuffer, int vertexCount, int baseVertex) final;
+
+ void sendIndexedMeshToGpu(const GrPrimitiveProcessor&, GrPrimitiveType,
+ const GrBuffer* indexBuffer, int indexCount, int baseIndex,
+ uint16_t minIndexValue, uint16_t maxIndexValue,
+ const GrBuffer* vertexBuffer, int baseVertex) final;
+
// The GrGLGpuCommandBuffer does not buffer up draws before submitting them to the gpu.
// Thus this is the implementation of the clear call for the corresponding passthrough function
// on GrGLGpuCommandBuffer.
@@ -248,9 +260,7 @@ private:
// willDrawPoints must be true if point primitives will be rendered after setting the GL state.
bool flushGLState(const GrPipeline&, const GrPrimitiveProcessor&, bool willDrawPoints);
- // Sets up vertex attribute pointers and strides. On return indexOffsetInBytes gives the offset
- // an into the index buffer. It does not account for vertices.startIndex() but rather the start
- // index is relative to the returned offset.
+ // Sets up vertex/instance attribute pointers and strides.
void setupGeometry(const GrPrimitiveProcessor&,
const GrBuffer* indexBuffer,
const GrBuffer* vertexBuffer,