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

Side by Side Diff: src/gpu/instanced/GLInstancedRendering.cpp

Issue 2182783004: Add test configs for instanced rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add test configs for instanced rendering Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/gpu/instanced/GLInstancedRendering.h ('k') | src/gpu/instanced/InstanceProcessor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GLInstancedRendering.h" 8 #include "GLInstancedRendering.h"
9 9
10 #include "GrResourceProvider.h" 10 #include "GrResourceProvider.h"
(...skipping 13 matching lines...) Expand all
24 24
25 private: 25 private:
26 int fEmulatedBaseInstance; 26 int fEmulatedBaseInstance;
27 int fGLDrawCmdsIdx; 27 int fGLDrawCmdsIdx;
28 28
29 friend class GLInstancedRendering; 29 friend class GLInstancedRendering;
30 30
31 typedef Batch INHERITED; 31 typedef Batch INHERITED;
32 }; 32 };
33 33
34 GLInstancedRendering* GLInstancedRendering::CreateIfSupported(GrGLGpu* gpu) { 34 GrCaps::InstancedSupport GLInstancedRendering::CheckSupport(const GrGLCaps& glCa ps) {
35 #ifndef SK_BUILD_FOR_MAC 35 // This method is only intended to be used for initializing fInstancedSuppor t in the caps.
36 // Only whitelisting on Mac for now. Once we've been able to work through th e various issues on 36 SkASSERT(GrCaps::InstancedSupport::kNone == glCaps.instancedSupport());
37 // other platforms we can enable more generally. 37 if (!glCaps.vertexArrayObjectSupport() || !glCaps.drawIndirectSupport()) {
38 return nullptr; 38 return GrCaps::InstancedSupport::kNone;
39 #endif
40 const GrGLCaps& glCaps = gpu->glCaps();
41 AntialiasMode lastSupportedAAMode;
42 if (!glCaps.vertexArrayObjectSupport() ||
43 !glCaps.drawIndirectSupport() ||
44 !InstanceProcessor::IsSupported(*glCaps.glslCaps(), glCaps, &lastSupport edAAMode)) {
45 return nullptr;
46 } 39 }
47 return new GLInstancedRendering(gpu, lastSupportedAAMode); 40 return InstanceProcessor::CheckSupport(*glCaps.glslCaps(), glCaps);
48 } 41 }
49 42
50 GLInstancedRendering::GLInstancedRendering(GrGLGpu* gpu, AntialiasMode lastSuppo rtedAAMode) 43 GLInstancedRendering::GLInstancedRendering(GrGLGpu* gpu)
51 : INHERITED(gpu, lastSupportedAAMode, gpu->glCaps().canDrawIndirectToFloat() ), 44 : INHERITED(gpu),
52 fVertexArrayID(0), 45 fVertexArrayID(0),
53 fGLDrawCmdsInfo(0), 46 fGLDrawCmdsInfo(0),
54 fInstanceAttribsBufferUniqueId(SK_InvalidUniqueID) { 47 fInstanceAttribsBufferUniqueId(SK_InvalidUniqueID) {
48 SkASSERT(GrCaps::InstancedSupport::kNone != this->gpu()->caps()->instancedSu pport());
55 } 49 }
56 50
57 GLInstancedRendering::~GLInstancedRendering() { 51 GLInstancedRendering::~GLInstancedRendering() {
58 if (fVertexArrayID) { 52 if (fVertexArrayID) {
59 GL_CALL(DeleteVertexArrays(1, &fVertexArrayID)); 53 GL_CALL(DeleteVertexArrays(1, &fVertexArrayID));
60 this->glGpu()->notifyVertexArrayDelete(fVertexArrayID); 54 this->glGpu()->notifyVertexArrayDelete(fVertexArrayID);
61 } 55 }
62 } 56 }
63 57
64 inline GrGLGpu* GLInstancedRendering::glGpu() const { 58 inline GrGLGpu* GLInstancedRendering::glGpu() const {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 GL_CALL(DeleteVertexArrays(1, &fVertexArrayID)); 289 GL_CALL(DeleteVertexArrays(1, &fVertexArrayID));
296 this->glGpu()->notifyVertexArrayDelete(fVertexArrayID); 290 this->glGpu()->notifyVertexArrayDelete(fVertexArrayID);
297 } 291 }
298 fVertexArrayID = 0; 292 fVertexArrayID = 0;
299 fInstanceBuffer.reset(); 293 fInstanceBuffer.reset();
300 fDrawIndirectBuffer.reset(); 294 fDrawIndirectBuffer.reset();
301 fInstanceAttribsBufferUniqueId = SK_InvalidUniqueID; 295 fInstanceAttribsBufferUniqueId = SK_InvalidUniqueID;
302 } 296 }
303 297
304 } 298 }
OLDNEW
« no previous file with comments | « src/gpu/instanced/GLInstancedRendering.h ('k') | src/gpu/instanced/InstanceProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698