Flutter Engine
The Flutter Engine
Macros | Functions
GrGLBuffer.cpp File Reference
#include "src/gpu/ganesh/gl/GrGLBuffer.h"
#include "include/core/SkTraceMemoryDump.h"
#include "src/core/SkTraceEvent.h"
#include "src/gpu/ganesh/GrGpuResourcePriv.h"
#include "src/gpu/ganesh/gl/GrGLCaps.h"
#include "src/gpu/ganesh/gl/GrGLGpu.h"

Go to the source code of this file.

Macros

#define GL_CALL(X)   GR_GL_CALL(this->glGpu()->glInterface(), X)
 
#define GL_CALL_RET(RET, X)   GR_GL_CALL_RET(this->glGpu()->glInterface(), RET, X)
 
#define GL_ALLOC_CALL(gpu, call)
 
#define DYNAMIC_DRAW_PARAM   GR_GL_STREAM_DRAW
 

Functions

static GrGLenum gr_to_gl_access_pattern (GrGpuBufferType bufferType, GrAccessPattern accessPattern, const GrGLCaps &caps)
 
static GrGLenum invalidate_buffer (GrGLGpu *gpu, GrGLenum target, GrGLenum usage, GrGLuint bufferID, size_t bufferSize)
 

Macro Definition Documentation

◆ DYNAMIC_DRAW_PARAM

#define DYNAMIC_DRAW_PARAM   GR_GL_STREAM_DRAW

Definition at line 51 of file GrGLBuffer.cpp.

◆ GL_ALLOC_CALL

#define GL_ALLOC_CALL (   gpu,
  call 
)
Value:
[&] { \
if (gpu->glCaps().skipErrorChecks()) { \
GR_GL_CALL(gpu->glInterface(), call); \
return static_cast<GrGLenum>(GR_GL_NO_ERROR); \
} else { \
gpu->clearErrorsAndCheckForOOM(); \
GR_GL_CALL_NOERRCHECK(gpu->glInterface(), call); \
return gpu->getErrorAndCheckForOOM(); \
} \
}()
#define GR_GL_NO_ERROR
Definition: GrGLDefines.h:175
unsigned int GrGLenum
Definition: GrGLTypes.h:102
def call(args)
Definition: dom.py:159

Definition at line 19 of file GrGLBuffer.cpp.

◆ GL_CALL

#define GL_CALL (   X)    GR_GL_CALL(this->glGpu()->glInterface(), X)

Definition at line 16 of file GrGLBuffer.cpp.

◆ GL_CALL_RET

#define GL_CALL_RET (   RET,
  X 
)    GR_GL_CALL_RET(this->glGpu()->glInterface(), RET, X)

Definition at line 17 of file GrGLBuffer.cpp.

Function Documentation

◆ gr_to_gl_access_pattern()

static GrGLenum gr_to_gl_access_pattern ( GrGpuBufferType  bufferType,
GrAccessPattern  accessPattern,
const GrGLCaps caps 
)
inlinestatic

Definition at line 53 of file GrGLBuffer.cpp.

55 {
56 auto drawUsage = [](GrAccessPattern pattern) {
57 switch (pattern) {
59 // TODO: Do we really want to use STREAM_DRAW here on non-Chromium?
60 return DYNAMIC_DRAW_PARAM;
62 return GR_GL_STATIC_DRAW;
64 return GR_GL_STREAM_DRAW;
65 }
67 };
68
69 auto readUsage = [](GrAccessPattern pattern) {
70 switch (pattern) {
72 return GR_GL_DYNAMIC_READ;
74 return GR_GL_STATIC_READ;
76 return GR_GL_STREAM_READ;
77 }
79 };
80
81 auto usageType = [&drawUsage, &readUsage, &caps](GrGpuBufferType type,
82 GrAccessPattern pattern) {
83 // GL_NV_pixel_buffer_object adds transfer buffers but not the related <usage> values.
85 return drawUsage(pattern);
86 }
87 switch (type) {
93 return drawUsage(pattern);
95 return readUsage(pattern);
96 }
98 };
99
100 return usageType(bufferType, accessPattern);
101}
#define DYNAMIC_DRAW_PARAM
Definition: GrGLBuffer.cpp:51
#define GR_GL_STATIC_READ
Definition: GrGLDefines.h:126
#define GR_GL_STATIC_DRAW
Definition: GrGLDefines.h:125
#define GR_GL_STREAM_DRAW
Definition: GrGLDefines.h:123
#define GR_GL_DYNAMIC_READ
Definition: GrGLDefines.h:128
#define GR_GL_STREAM_READ
Definition: GrGLDefines.h:124
GrGpuBufferType
Definition: GrTypesPriv.h:411
GrAccessPattern
Definition: GrTypesPriv.h:424
@ kDynamic_GrAccessPattern
Definition: GrTypesPriv.h:426
@ kStatic_GrAccessPattern
Definition: GrTypesPriv.h:428
@ kStream_GrAccessPattern
Definition: GrTypesPriv.h:430
#define SkUNREACHABLE
Definition: SkAssert.h:135
GLenum type
TransferBufferType transferBufferType() const
What type of transfer buffer is supported?
Definition: GrGLCaps.h:329

◆ invalidate_buffer()

static GrGLenum invalidate_buffer ( GrGLGpu gpu,
GrGLenum  target,
GrGLenum  usage,
GrGLuint  bufferID,
size_t  bufferSize 
)
inlinestatic

Definition at line 161 of file GrGLBuffer.cpp.

165 {
166 switch (gpu->glCaps().invalidateBufferType()) {
168 return GR_GL_NO_ERROR;
170 return GL_ALLOC_CALL(gpu, BufferData(target, bufferSize, nullptr, usage));
172 GR_GL_CALL(gpu->glInterface(), InvalidateBufferData(bufferID));
173 return GR_GL_NO_ERROR;
174 }
176}
#define GL_ALLOC_CALL(gpu, call)
Definition: GrGLBuffer.cpp:19
#define GR_GL_CALL(IFACE, X)
Definition: GrGLUtil.h:381
InvalidateBufferType invalidateBufferType() const
Definition: GrGLCaps.h:396
const GrGLCaps & glCaps() const
Definition: GrGLGpu.h:108
const GrGLInterface * glInterface() const
Definition: GrGLGpu.h:103
uint32_t * target
static void usage(char *argv0)