MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CreatePersistentBuffer

Function CreatePersistentBuffer

tensorflow/lite/delegates/gpu/gl/gl_buffer.cc:124–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124Status CreatePersistentBuffer(size_t size, GlPersistentBuffer* gl_buffer) {
125 PFNGLBUFFERSTORAGEEXTPROC glBufferStorageEXT = nullptr;
126 glBufferStorageEXT = reinterpret_cast<PFNGLBUFFERSTORAGEEXTPROC>(
127 eglGetProcAddress("glBufferStorageEXT"));
128 if (!glBufferStorageEXT) {
129 return UnavailableError("glBufferStorageEXT is not supported");
130 }
131 gl_buffer_internal::BufferId id;
132 gl_buffer_internal::BufferBinder binder(GL_SHADER_STORAGE_BUFFER, id.id());
133 RETURN_IF_ERROR(TFLITE_GPU_CALL_GL(
134 glBufferStorageEXT, GL_SHADER_STORAGE_BUFFER, size, nullptr,
135 GL_MAP_COHERENT_BIT_EXT | GL_MAP_READ_BIT | GL_MAP_WRITE_BIT |
136 GL_MAP_PERSISTENT_BIT_EXT));
137 void* data = nullptr;
138 RETURN_IF_ERROR(TFLITE_GPU_CALL_GL(
139 glMapBufferRange, &data, GL_SHADER_STORAGE_BUFFER, 0, size,
140 GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT_EXT));
141 *gl_buffer = GlPersistentBuffer{
142 GL_SHADER_STORAGE_BUFFER, id.Release(), size, 0, true, data};
143 return OkStatus();
144}
145
146} // namespace gl
147} // namespace gpu

Callers 1

NewSyncMethod · 0.85

Calls 4

OkStatusFunction · 0.85
UnavailableErrorFunction · 0.50
idMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected