Lines Matching refs:bufObj

197    struct gl_buffer_object **bufObj = get_buffer_target(ctx, target);  in get_buffer()  local
199 if (!bufObj) { in get_buffer()
204 if (!_mesa_is_bufferobj(*bufObj)) { in get_buffer()
209 return *bufObj; in get_buffer()
300 const struct gl_buffer_object *bufObj, in buffer_object_subdata_range_good() argument
314 if (offset + size > bufObj->Size) { in buffer_object_subdata_range_good()
319 (unsigned long) bufObj->Size); in buffer_object_subdata_range_good()
323 if (bufObj->Mappings[MAP_USER].AccessFlags & GL_MAP_PERSISTENT_BIT) in buffer_object_subdata_range_good()
327 if (bufferobj_range_mapped(bufObj, offset, size)) { in buffer_object_subdata_range_good()
335 if (_mesa_bufferobj_mapped(bufObj, MAP_USER)) { in buffer_object_subdata_range_good()
463 struct gl_buffer_object *bufObj) in _mesa_delete_buffer_object() argument
467 vbo_delete_minmax_cache(bufObj); in _mesa_delete_buffer_object()
468 _mesa_align_free(bufObj->Data); in _mesa_delete_buffer_object()
471 bufObj->RefCount = -1000; in _mesa_delete_buffer_object()
472 bufObj->Name = ~0; in _mesa_delete_buffer_object()
474 simple_mtx_destroy(&bufObj->Mutex); in _mesa_delete_buffer_object()
475 free(bufObj->Label); in _mesa_delete_buffer_object()
476 free(bufObj); in _mesa_delete_buffer_object()
489 struct gl_buffer_object *bufObj) in _mesa_reference_buffer_object_() argument
511 if (bufObj) { in _mesa_reference_buffer_object_()
513 simple_mtx_lock(&bufObj->Mutex); in _mesa_reference_buffer_object_()
514 assert(bufObj->RefCount > 0); in _mesa_reference_buffer_object_()
516 bufObj->RefCount++; in _mesa_reference_buffer_object_()
517 *ptr = bufObj; in _mesa_reference_buffer_object_()
518 simple_mtx_unlock(&bufObj->Mutex); in _mesa_reference_buffer_object_()
567 const struct gl_buffer_object *bufObj = in count_buffer_size() local
572 *total = *total + bufObj->Size; in count_buffer_size()
613 struct gl_buffer_object *bufObj) in buffer_data_fallback() argument
619 _mesa_align_free( bufObj->Data ); in buffer_data_fallback()
623 bufObj->Data = (GLubyte *) new_data; in buffer_data_fallback()
624 bufObj->Size = size; in buffer_data_fallback()
625 bufObj->Usage = usage; in buffer_data_fallback()
626 bufObj->StorageFlags = storageFlags; in buffer_data_fallback()
629 memcpy( bufObj->Data, data, size ); in buffer_data_fallback()
659 struct gl_buffer_object *bufObj) in buffer_sub_data_fallback() argument
664 assert(size + offset <= bufObj->Size); in buffer_sub_data_fallback()
666 if (bufObj->Data) { in buffer_sub_data_fallback()
667 memcpy( (GLubyte *) bufObj->Data + offset, data, size ); in buffer_sub_data_fallback()
692 struct gl_buffer_object *bufObj ) in buffer_get_subdata() argument
696 if (bufObj->Data && ((GLsizeiptrARB) (size + offset) <= bufObj->Size)) { in buffer_get_subdata()
697 memcpy( data, (GLubyte *) bufObj->Data + offset, size ); in buffer_get_subdata()
724 struct gl_buffer_object *bufObj) in _mesa_ClearBufferSubData_sw() argument
733 bufObj, MAP_INTERNAL); in _mesa_ClearBufferSubData_sw()
743 ctx->Driver.UnmapBuffer(ctx, bufObj, MAP_INTERNAL); in _mesa_ClearBufferSubData_sw()
752 ctx->Driver.UnmapBuffer(ctx, bufObj, MAP_INTERNAL); in _mesa_ClearBufferSubData_sw()
763 struct gl_buffer_object *bufObj, in map_buffer_range_fallback() argument
767 assert(!_mesa_bufferobj_mapped(bufObj, index)); in map_buffer_range_fallback()
769 bufObj->Mappings[index].Pointer = bufObj->Data + offset; in map_buffer_range_fallback()
770 bufObj->Mappings[index].Length = length; in map_buffer_range_fallback()
771 bufObj->Mappings[index].Offset = offset; in map_buffer_range_fallback()
772 bufObj->Mappings[index].AccessFlags = access; in map_buffer_range_fallback()
773 return bufObj->Mappings[index].Pointer; in map_buffer_range_fallback()
804 unmap_buffer_fallback(struct gl_context *ctx, struct gl_buffer_object *bufObj, in unmap_buffer_fallback() argument
809 bufObj->Mappings[index].Pointer = NULL; in unmap_buffer_fallback()
810 bufObj->Mappings[index].Length = 0; in unmap_buffer_fallback()
811 bufObj->Mappings[index].Offset = 0; in unmap_buffer_fallback()
812 bufObj->Mappings[index].AccessFlags = 0x0; in unmap_buffer_fallback()
1102 struct gl_buffer_object *bufObj; in _mesa_lookup_bufferobj_err() local
1104 bufObj = _mesa_lookup_bufferobj(ctx, buffer); in _mesa_lookup_bufferobj_err()
1105 if (!bufObj || bufObj == &DummyBufferObject) { in _mesa_lookup_bufferobj_err()
1111 return bufObj; in _mesa_lookup_bufferobj_err()
1137 struct gl_buffer_object *bufObj; in _mesa_multi_bind_lookup_bufferobj() local
1140 bufObj = _mesa_lookup_bufferobj_locked(ctx, buffers[index]); in _mesa_multi_bind_lookup_bufferobj()
1144 if (bufObj == &DummyBufferObject) in _mesa_multi_bind_lookup_bufferobj()
1145 bufObj = NULL; in _mesa_multi_bind_lookup_bufferobj()
1147 bufObj = ctx->Shared->NullBufferObj; in _mesa_multi_bind_lookup_bufferobj()
1149 if (!bufObj) { in _mesa_multi_bind_lookup_bufferobj()
1162 return bufObj; in _mesa_multi_bind_lookup_bufferobj()
1214 struct gl_buffer_object *bufObj) in _mesa_buffer_unmap_all_mappings() argument
1217 if (_mesa_bufferobj_mapped(bufObj, i)) { in _mesa_buffer_unmap_all_mappings()
1218 ctx->Driver.UnmapBuffer(ctx, bufObj, i); in _mesa_buffer_unmap_all_mappings()
1219 assert(bufObj->Mappings[i].Pointer == NULL); in _mesa_buffer_unmap_all_mappings()
1220 bufObj->Mappings[i].AccessFlags = 0; in _mesa_buffer_unmap_all_mappings()
1269 struct gl_buffer_object *bufObj, in set_buffer_binding() argument
1274 _mesa_reference_buffer_object(ctx, &binding->BufferObject, bufObj); in set_buffer_binding()
1284 bufObj->UsageHistory |= usage; in set_buffer_binding()
1298 struct gl_buffer_object *bufObj; in set_buffer_multi_binding() local
1300 bufObj = binding->BufferObject; in set_buffer_multi_binding()
1302 bufObj = _mesa_multi_bind_lookup_bufferobj(ctx, buffers, idx, caller); in set_buffer_multi_binding()
1304 if (bufObj) { in set_buffer_multi_binding()
1305 if (bufObj == ctx->Shared->NullBufferObj) in set_buffer_multi_binding()
1306 set_buffer_binding(ctx, binding, bufObj, -1, -1, !range, usage); in set_buffer_multi_binding()
1308 set_buffer_binding(ctx, binding, bufObj, offset, size, !range, usage); in set_buffer_multi_binding()
1315 struct gl_buffer_object *bufObj, in bind_buffer() argument
1322 if (binding->BufferObject == bufObj && in bind_buffer()
1332 set_buffer_binding(ctx, binding, bufObj, offset, size, autoSize, usage); in bind_buffer()
1345 struct gl_buffer_object *bufObj, in bind_uniform_buffer() argument
1351 bufObj, offset, size, autoSize, in bind_uniform_buffer()
1366 struct gl_buffer_object *bufObj, in bind_shader_storage_buffer() argument
1372 bufObj, offset, size, autoSize, in bind_shader_storage_buffer()
1386 struct gl_buffer_object *bufObj, GLintptr offset, in bind_atomic_buffer() argument
1390 bufObj, offset, size, autoSize, in bind_atomic_buffer()
1402 struct gl_buffer_object *bufObj) in bind_buffer_base_uniform_buffer() argument
1409 _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, bufObj); in bind_buffer_base_uniform_buffer()
1411 if (bufObj == ctx->Shared->NullBufferObj) in bind_buffer_base_uniform_buffer()
1412 bind_uniform_buffer(ctx, index, bufObj, -1, -1, GL_TRUE); in bind_buffer_base_uniform_buffer()
1414 bind_uniform_buffer(ctx, index, bufObj, 0, 0, GL_TRUE); in bind_buffer_base_uniform_buffer()
1424 struct gl_buffer_object *bufObj) in bind_buffer_base_shader_storage_buffer() argument
1431 _mesa_reference_buffer_object(ctx, &ctx->ShaderStorageBuffer, bufObj); in bind_buffer_base_shader_storage_buffer()
1433 if (bufObj == ctx->Shared->NullBufferObj) in bind_buffer_base_shader_storage_buffer()
1434 bind_shader_storage_buffer(ctx, index, bufObj, -1, -1, GL_TRUE); in bind_buffer_base_shader_storage_buffer()
1436 bind_shader_storage_buffer(ctx, index, bufObj, 0, 0, GL_TRUE); in bind_buffer_base_shader_storage_buffer()
1446 struct gl_buffer_object *bufObj) in bind_buffer_base_atomic_buffer() argument
1453 _mesa_reference_buffer_object(ctx, &ctx->AtomicBuffer, bufObj); in bind_buffer_base_atomic_buffer()
1455 if (bufObj == ctx->Shared->NullBufferObj) in bind_buffer_base_atomic_buffer()
1456 bind_atomic_buffer(ctx, index, bufObj, -1, -1, GL_TRUE); in bind_buffer_base_atomic_buffer()
1458 bind_atomic_buffer(ctx, index, bufObj, 0, 0, GL_TRUE); in bind_buffer_base_atomic_buffer()
1475 struct gl_buffer_object *bufObj = in delete_buffers() local
1477 if (bufObj) { in delete_buffers()
1481 assert(bufObj->Name == ids[i] || bufObj == &DummyBufferObject); in delete_buffers()
1483 _mesa_buffer_unmap_all_mappings(ctx, bufObj); in delete_buffers()
1487 unbind(ctx, vao, j, bufObj); in delete_buffers()
1490 if (ctx->Array.ArrayBufferObj == bufObj) { in delete_buffers()
1493 if (vao->IndexBufferObj == bufObj) { in delete_buffers()
1498 if (ctx->DrawIndirectBuffer == bufObj) { in delete_buffers()
1503 if (ctx->ParameterBuffer == bufObj) { in delete_buffers()
1508 if (ctx->DispatchIndirectBuffer == bufObj) { in delete_buffers()
1513 if (ctx->CopyReadBuffer == bufObj) { in delete_buffers()
1516 if (ctx->CopyWriteBuffer == bufObj) { in delete_buffers()
1521 if (ctx->TransformFeedback.CurrentBuffer == bufObj) { in delete_buffers()
1525 if (ctx->TransformFeedback.CurrentObject->Buffers[j] == bufObj) { in delete_buffers()
1535 if (ctx->UniformBufferBindings[j].BufferObject == bufObj) { in delete_buffers()
1541 if (ctx->UniformBuffer == bufObj) { in delete_buffers()
1547 if (ctx->ShaderStorageBufferBindings[j].BufferObject == bufObj) { in delete_buffers()
1553 if (ctx->ShaderStorageBuffer == bufObj) { in delete_buffers()
1559 if (ctx->AtomicBufferBindings[j].BufferObject == bufObj) { in delete_buffers()
1565 if (ctx->AtomicBuffer == bufObj) { in delete_buffers()
1570 if (ctx->Pack.BufferObj == bufObj) { in delete_buffers()
1573 if (ctx->Unpack.BufferObj == bufObj) { in delete_buffers()
1577 if (ctx->Texture.BufferObject == bufObj) { in delete_buffers()
1581 if (ctx->ExternalVirtualMemoryBuffer == bufObj) { in delete_buffers()
1586 if (ctx->QueryBuffer == bufObj) { in delete_buffers()
1602 bufObj->DeletePending = GL_TRUE; in delete_buffers()
1603 _mesa_reference_buffer_object(ctx, &bufObj, NULL); in delete_buffers()
1748 struct gl_buffer_object *bufObj; in _mesa_IsBuffer() local
1752 bufObj = _mesa_lookup_bufferobj(ctx, id); in _mesa_IsBuffer()
1754 return bufObj && bufObj != &DummyBufferObject; in _mesa_IsBuffer()
1760 struct gl_buffer_object *bufObj, GLsizeiptr size, in validate_buffer_storage() argument
1808 if (bufObj->Immutable || bufObj->HandleAllocated) { in validate_buffer_storage()
1818 buffer_storage(struct gl_context *ctx, struct gl_buffer_object *bufObj, in buffer_storage() argument
1826 _mesa_buffer_unmap_all_mappings(ctx, bufObj); in buffer_storage()
1830 bufObj->Written = GL_TRUE; in buffer_storage()
1831 bufObj->Immutable = GL_TRUE; in buffer_storage()
1832 bufObj->MinMaxCacheDirty = true; in buffer_storage()
1837 GL_DYNAMIC_DRAW, bufObj); in buffer_storage()
1842 flags, bufObj); in buffer_storage()
1867 struct gl_buffer_object *bufObj; in inlined_buffer_storage() local
1905 bufObj = _mesa_lookup_bufferobj(ctx, buffer); in inlined_buffer_storage()
1907 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, func); in inlined_buffer_storage()
1908 if (!bufObj) in inlined_buffer_storage()
1914 bufObj = *bufObjPtr; in inlined_buffer_storage()
1916 bufObj = get_buffer(ctx, func, target, GL_INVALID_OPERATION); in inlined_buffer_storage()
1917 if (!bufObj) in inlined_buffer_storage()
1922 if (no_error || validate_buffer_storage(ctx, bufObj, size, flags, func)) in inlined_buffer_storage()
1923 buffer_storage(ctx, bufObj, memObj, target, size, data, flags, offset, func); in inlined_buffer_storage()
2005 buffer_data(struct gl_context *ctx, struct gl_buffer_object *bufObj, in buffer_data() argument
2052 if (bufObj->Immutable || bufObj->HandleAllocated) { in buffer_data()
2059 _mesa_buffer_unmap_all_mappings(ctx, bufObj); in buffer_data()
2063 bufObj->Written = GL_TRUE; in buffer_data()
2064 bufObj->MinMaxCacheDirty = true; in buffer_data()
2068 bufObj->Name, size, data, usage); in buffer_data()
2080 bufObj)) { in buffer_data()
2098 buffer_data_error(struct gl_context *ctx, struct gl_buffer_object *bufObj, in buffer_data_error() argument
2102 buffer_data(ctx, bufObj, target, size, data, usage, func, false); in buffer_data_error()
2106 buffer_data_no_error(struct gl_context *ctx, struct gl_buffer_object *bufObj, in buffer_data_no_error() argument
2110 buffer_data(ctx, bufObj, target, size, data, usage, func, true); in buffer_data_no_error()
2114 _mesa_buffer_data(struct gl_context *ctx, struct gl_buffer_object *bufObj, in _mesa_buffer_data() argument
2118 buffer_data_error(ctx, bufObj, target, size, data, usage, func); in _mesa_buffer_data()
2127 struct gl_buffer_object **bufObj = get_buffer_target(ctx, target); in _mesa_BufferData_no_error() local
2128 buffer_data_no_error(ctx, *bufObj, target, size, data, usage, in _mesa_BufferData_no_error()
2137 struct gl_buffer_object *bufObj; in _mesa_BufferData() local
2139 bufObj = get_buffer(ctx, "glBufferData", target, GL_INVALID_OPERATION); in _mesa_BufferData()
2140 if (!bufObj) in _mesa_BufferData()
2143 _mesa_buffer_data(ctx, bufObj, target, size, data, usage, in _mesa_BufferData()
2153 struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer); in _mesa_NamedBufferData_no_error() local
2154 buffer_data_no_error(ctx, bufObj, GL_NONE, size, data, usage, in _mesa_NamedBufferData_no_error()
2163 struct gl_buffer_object *bufObj; in _mesa_NamedBufferData() local
2165 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glNamedBufferData"); in _mesa_NamedBufferData()
2166 if (!bufObj) in _mesa_NamedBufferData()
2172 _mesa_buffer_data(ctx, bufObj, GL_NONE, size, data, usage, in _mesa_NamedBufferData()
2179 struct gl_buffer_object *bufObj, in validate_buffer_sub_data() argument
2183 if (!buffer_object_subdata_range_good(ctx, bufObj, offset, size, in validate_buffer_sub_data()
2189 if (bufObj->Immutable && in validate_buffer_sub_data()
2190 !(bufObj->StorageFlags & GL_DYNAMIC_STORAGE_BIT)) { in validate_buffer_sub_data()
2195 if ((bufObj->Usage == GL_STATIC_DRAW || in validate_buffer_sub_data()
2196 bufObj->Usage == GL_STATIC_COPY) && in validate_buffer_sub_data()
2197 bufObj->NumSubDataCalls >= BUFFER_WARNING_CALL_COUNT - 1) { in validate_buffer_sub_data()
2204 func, bufObj->Name, offset, size, in validate_buffer_sub_data()
2205 _mesa_enum_to_string(bufObj->Usage)); in validate_buffer_sub_data()
2224 _mesa_buffer_sub_data(struct gl_context *ctx, struct gl_buffer_object *bufObj, in _mesa_buffer_sub_data() argument
2230 bufObj->NumSubDataCalls++; in _mesa_buffer_sub_data()
2231 bufObj->Written = GL_TRUE; in _mesa_buffer_sub_data()
2232 bufObj->MinMaxCacheDirty = true; in _mesa_buffer_sub_data()
2235 ctx->Driver.BufferSubData(ctx, offset, size, data, bufObj); in _mesa_buffer_sub_data()
2245 struct gl_buffer_object *bufObj; in buffer_sub_data() local
2249 bufObj = _mesa_lookup_bufferobj(ctx, buffer); in buffer_sub_data()
2251 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, func); in buffer_sub_data()
2252 if (!bufObj) in buffer_sub_data()
2258 bufObj = *bufObjPtr; in buffer_sub_data()
2260 bufObj = get_buffer(ctx, func, target, GL_INVALID_OPERATION); in buffer_sub_data()
2261 if (!bufObj) in buffer_sub_data()
2266 if (no_error || validate_buffer_sub_data(ctx, bufObj, offset, size, func)) in buffer_sub_data()
2267 _mesa_buffer_sub_data(ctx, bufObj, offset, size, data); in buffer_sub_data()
2310 struct gl_buffer_object *bufObj; in _mesa_GetBufferSubData() local
2312 bufObj = get_buffer(ctx, "glGetBufferSubData", target, in _mesa_GetBufferSubData()
2314 if (!bufObj) in _mesa_GetBufferSubData()
2317 if (!buffer_object_subdata_range_good(ctx, bufObj, offset, size, false, in _mesa_GetBufferSubData()
2323 ctx->Driver.GetBufferSubData(ctx, offset, size, data, bufObj); in _mesa_GetBufferSubData()
2331 struct gl_buffer_object *bufObj; in _mesa_GetNamedBufferSubData() local
2333 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, in _mesa_GetNamedBufferSubData()
2335 if (!bufObj) in _mesa_GetNamedBufferSubData()
2338 if (!buffer_object_subdata_range_good(ctx, bufObj, offset, size, false, in _mesa_GetNamedBufferSubData()
2344 ctx->Driver.GetBufferSubData(ctx, offset, size, data, bufObj); in _mesa_GetNamedBufferSubData()
2352 clear_buffer_sub_data(struct gl_context *ctx, struct gl_buffer_object *bufObj, in clear_buffer_sub_data() argument
2362 if (!no_error && !buffer_object_subdata_range_good(ctx, bufObj, offset, size, in clear_buffer_sub_data()
2390 bufObj->MinMaxCacheDirty = true; in clear_buffer_sub_data()
2395 NULL, clearValueSize, bufObj); in clear_buffer_sub_data()
2405 clearValue, clearValueSize, bufObj); in clear_buffer_sub_data()
2410 struct gl_buffer_object *bufObj, in clear_buffer_sub_data_error() argument
2415 clear_buffer_sub_data(ctx, bufObj, internalformat, offset, size, format, in clear_buffer_sub_data_error()
2422 struct gl_buffer_object *bufObj, in clear_buffer_sub_data_no_error() argument
2428 clear_buffer_sub_data(ctx, bufObj, internalformat, offset, size, format, in clear_buffer_sub_data_no_error()
2439 struct gl_buffer_object **bufObj = get_buffer_target(ctx, target); in _mesa_ClearBufferData_no_error() local
2440 clear_buffer_sub_data_no_error(ctx, *bufObj, internalformat, 0, in _mesa_ClearBufferData_no_error()
2441 (*bufObj)->Size, format, type, data, in _mesa_ClearBufferData_no_error()
2451 struct gl_buffer_object *bufObj; in _mesa_ClearBufferData() local
2453 bufObj = get_buffer(ctx, "glClearBufferData", target, GL_INVALID_VALUE); in _mesa_ClearBufferData()
2454 if (!bufObj) in _mesa_ClearBufferData()
2457 clear_buffer_sub_data_error(ctx, bufObj, internalformat, 0, bufObj->Size, in _mesa_ClearBufferData()
2469 struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer); in _mesa_ClearNamedBufferData_no_error() local
2470 clear_buffer_sub_data_no_error(ctx, bufObj, internalformat, 0, bufObj->Size, in _mesa_ClearNamedBufferData_no_error()
2481 struct gl_buffer_object *bufObj; in _mesa_ClearNamedBufferData() local
2483 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glClearNamedBufferData"); in _mesa_ClearNamedBufferData()
2484 if (!bufObj) in _mesa_ClearNamedBufferData()
2487 clear_buffer_sub_data_error(ctx, bufObj, internalformat, 0, bufObj->Size, in _mesa_ClearNamedBufferData()
2501 struct gl_buffer_object **bufObj = get_buffer_target(ctx, target); in _mesa_ClearBufferSubData_no_error() local
2502 clear_buffer_sub_data_no_error(ctx, *bufObj, internalformat, offset, size, in _mesa_ClearBufferSubData_no_error()
2515 struct gl_buffer_object *bufObj; in _mesa_ClearBufferSubData() local
2517 bufObj = get_buffer(ctx, "glClearBufferSubData", target, GL_INVALID_VALUE); in _mesa_ClearBufferSubData()
2518 if (!bufObj) in _mesa_ClearBufferSubData()
2521 clear_buffer_sub_data_error(ctx, bufObj, internalformat, offset, size, in _mesa_ClearBufferSubData()
2535 struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer); in _mesa_ClearNamedBufferSubData_no_error() local
2536 clear_buffer_sub_data_no_error(ctx, bufObj, internalformat, offset, size, in _mesa_ClearNamedBufferSubData_no_error()
2549 struct gl_buffer_object *bufObj; in _mesa_ClearNamedBufferSubData() local
2551 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, in _mesa_ClearNamedBufferSubData()
2553 if (!bufObj) in _mesa_ClearNamedBufferSubData()
2556 clear_buffer_sub_data_error(ctx, bufObj, internalformat, offset, size, in _mesa_ClearNamedBufferSubData()
2562 unmap_buffer(struct gl_context *ctx, struct gl_buffer_object *bufObj) in unmap_buffer() argument
2564 GLboolean status = ctx->Driver.UnmapBuffer(ctx, bufObj, MAP_USER); in unmap_buffer()
2565 bufObj->Mappings[MAP_USER].AccessFlags = 0; in unmap_buffer()
2566 assert(bufObj->Mappings[MAP_USER].Pointer == NULL); in unmap_buffer()
2567 assert(bufObj->Mappings[MAP_USER].Offset == 0); in unmap_buffer()
2568 assert(bufObj->Mappings[MAP_USER].Length == 0); in unmap_buffer()
2575 struct gl_buffer_object *bufObj, in validate_and_unmap_buffer() argument
2580 if (!_mesa_bufferobj_mapped(bufObj, MAP_USER)) { in validate_and_unmap_buffer()
2587 if (bufObj->Access != GL_READ_ONLY_ARB) { in validate_and_unmap_buffer()
2588 GLubyte *buf = (GLubyte *) bufObj->Pointer; in validate_and_unmap_buffer()
2592 GLuint pos = bufObj->Size - i - 1; in validate_and_unmap_buffer()
2603 if (bufObj->AccessFlags & GL_MAP_WRITE_BIT) { in validate_and_unmap_buffer()
2605 GLubyte *b = (GLubyte *) bufObj->Pointer; in validate_and_unmap_buffer()
2608 for (i = 0; i < bufObj->Size - 1; i++) { in validate_and_unmap_buffer()
2617 bufObj->Name, unchanged, bufObj->Size, pos); in validate_and_unmap_buffer()
2622 return unmap_buffer(ctx, bufObj); in validate_and_unmap_buffer()
2630 struct gl_buffer_object *bufObj = *bufObjPtr; in _mesa_UnmapBuffer_no_error() local
2632 return unmap_buffer(ctx, bufObj); in _mesa_UnmapBuffer_no_error()
2639 struct gl_buffer_object *bufObj; in _mesa_UnmapBuffer() local
2641 bufObj = get_buffer(ctx, "glUnmapBuffer", target, GL_INVALID_OPERATION); in _mesa_UnmapBuffer()
2642 if (!bufObj) in _mesa_UnmapBuffer()
2645 return validate_and_unmap_buffer(ctx, bufObj, "glUnmapBuffer"); in _mesa_UnmapBuffer()
2652 struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer); in _mesa_UnmapNamedBuffer_no_error() local
2654 return unmap_buffer(ctx, bufObj); in _mesa_UnmapNamedBuffer_no_error()
2661 struct gl_buffer_object *bufObj; in _mesa_UnmapNamedBuffer() local
2663 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glUnmapNamedBuffer"); in _mesa_UnmapNamedBuffer()
2664 if (!bufObj) in _mesa_UnmapNamedBuffer()
2667 return validate_and_unmap_buffer(ctx, bufObj, "glUnmapNamedBuffer"); in _mesa_UnmapNamedBuffer()
2673 struct gl_buffer_object *bufObj, GLenum pname, in get_buffer_parameter() argument
2678 *params = bufObj->Size; in get_buffer_parameter()
2681 *params = bufObj->Usage; in get_buffer_parameter()
2685 bufObj->Mappings[MAP_USER].AccessFlags); in get_buffer_parameter()
2688 *params = _mesa_bufferobj_mapped(bufObj, MAP_USER); in get_buffer_parameter()
2693 *params = bufObj->Mappings[MAP_USER].AccessFlags; in get_buffer_parameter()
2698 *params = bufObj->Mappings[MAP_USER].Offset; in get_buffer_parameter()
2703 *params = bufObj->Mappings[MAP_USER].Length; in get_buffer_parameter()
2708 *params = bufObj->Immutable; in get_buffer_parameter()
2713 *params = bufObj->StorageFlags; in get_buffer_parameter()
2731 struct gl_buffer_object *bufObj; in _mesa_GetBufferParameteriv() local
2734 bufObj = get_buffer(ctx, "glGetBufferParameteriv", target, in _mesa_GetBufferParameteriv()
2736 if (!bufObj) in _mesa_GetBufferParameteriv()
2739 if (!get_buffer_parameter(ctx, bufObj, pname, &parameter, in _mesa_GetBufferParameteriv()
2750 struct gl_buffer_object *bufObj; in _mesa_GetBufferParameteri64v() local
2753 bufObj = get_buffer(ctx, "glGetBufferParameteri64v", target, in _mesa_GetBufferParameteri64v()
2755 if (!bufObj) in _mesa_GetBufferParameteri64v()
2758 if (!get_buffer_parameter(ctx, bufObj, pname, &parameter, in _mesa_GetBufferParameteri64v()
2769 struct gl_buffer_object *bufObj; in _mesa_GetNamedBufferParameteriv() local
2772 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, in _mesa_GetNamedBufferParameteriv()
2774 if (!bufObj) in _mesa_GetNamedBufferParameteriv()
2777 if (!get_buffer_parameter(ctx, bufObj, pname, &parameter, in _mesa_GetNamedBufferParameteriv()
2789 struct gl_buffer_object *bufObj; in _mesa_GetNamedBufferParameteri64v() local
2792 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, in _mesa_GetNamedBufferParameteri64v()
2794 if (!bufObj) in _mesa_GetNamedBufferParameteri64v()
2797 if (!get_buffer_parameter(ctx, bufObj, pname, &parameter, in _mesa_GetNamedBufferParameteri64v()
2809 struct gl_buffer_object *bufObj; in _mesa_GetBufferPointerv() local
2817 bufObj = get_buffer(ctx, "glGetBufferPointerv", target, in _mesa_GetBufferPointerv()
2819 if (!bufObj) in _mesa_GetBufferPointerv()
2822 *params = bufObj->Mappings[MAP_USER].Pointer; in _mesa_GetBufferPointerv()
2829 struct gl_buffer_object *bufObj; in _mesa_GetNamedBufferPointerv() local
2837 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, in _mesa_GetNamedBufferPointerv()
2839 if (!bufObj) in _mesa_GetNamedBufferPointerv()
2842 *params = bufObj->Mappings[MAP_USER].Pointer; in _mesa_GetNamedBufferPointerv()
2994 struct gl_buffer_object *bufObj, GLintptr offset, in validate_map_buffer_range() argument
3072 !(bufObj->StorageFlags & GL_MAP_READ_BIT)) { in validate_map_buffer_range()
3079 !(bufObj->StorageFlags & GL_MAP_WRITE_BIT)) { in validate_map_buffer_range()
3086 !(bufObj->StorageFlags & GL_MAP_COHERENT_BIT)) { in validate_map_buffer_range()
3093 !(bufObj->StorageFlags & GL_MAP_PERSISTENT_BIT)) { in validate_map_buffer_range()
3099 if (offset + length > bufObj->Size) { in validate_map_buffer_range()
3103 (unsigned long) bufObj->Size); in validate_map_buffer_range()
3107 if (_mesa_bufferobj_mapped(bufObj, MAP_USER)) { in validate_map_buffer_range()
3114 bufObj->NumMapBufferWriteCalls++; in validate_map_buffer_range()
3115 if ((bufObj->Usage == GL_STATIC_DRAW || in validate_map_buffer_range()
3116 bufObj->Usage == GL_STATIC_COPY) && in validate_map_buffer_range()
3117 bufObj->NumMapBufferWriteCalls >= BUFFER_WARNING_CALL_COUNT) { in validate_map_buffer_range()
3121 func, bufObj->Name, offset, length, in validate_map_buffer_range()
3122 _mesa_enum_to_string(bufObj->Usage)); in validate_map_buffer_range()
3130 map_buffer_range(struct gl_context *ctx, struct gl_buffer_object *bufObj, in map_buffer_range() argument
3134 if (!bufObj->Size) { in map_buffer_range()
3140 void *map = ctx->Driver.MapBufferRange(ctx, offset, length, access, bufObj, in map_buffer_range()
3150 assert(bufObj->Mappings[MAP_USER].Pointer == map); in map_buffer_range()
3151 assert(bufObj->Mappings[MAP_USER].Length == length); in map_buffer_range()
3152 assert(bufObj->Mappings[MAP_USER].Offset == offset); in map_buffer_range()
3153 assert(bufObj->Mappings[MAP_USER].AccessFlags == access); in map_buffer_range()
3157 bufObj->Written = GL_TRUE; in map_buffer_range()
3158 bufObj->MinMaxCacheDirty = true; in map_buffer_range()
3164 bufObj->Name, bufObj->Size, access); in map_buffer_range()
3168 GLubyte *b = (GLubyte *) bufObj->Pointer; in map_buffer_range()
3169 for (i = 0; i < bufObj->Size; i++) in map_buffer_range()
3177 GLubyte *buf = (GLubyte *) bufObj->Pointer; in map_buffer_range()
3181 buf[bufObj->Size - i - 1] = 123; in map_buffer_range()
3196 struct gl_buffer_object *bufObj = *bufObjPtr; in _mesa_MapBufferRange_no_error() local
3198 return map_buffer_range(ctx, bufObj, offset, length, access, in _mesa_MapBufferRange_no_error()
3207 struct gl_buffer_object *bufObj; in _mesa_MapBufferRange() local
3215 bufObj = get_buffer(ctx, "glMapBufferRange", target, GL_INVALID_OPERATION); in _mesa_MapBufferRange()
3216 if (!bufObj) in _mesa_MapBufferRange()
3219 if (!validate_map_buffer_range(ctx, bufObj, offset, length, access, in _mesa_MapBufferRange()
3223 return map_buffer_range(ctx, bufObj, offset, length, access, in _mesa_MapBufferRange()
3232 struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer); in _mesa_MapNamedBufferRange_no_error() local
3234 return map_buffer_range(ctx, bufObj, offset, length, access, in _mesa_MapNamedBufferRange_no_error()
3243 struct gl_buffer_object *bufObj; in _mesa_MapNamedBufferRange() local
3252 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glMapNamedBufferRange"); in _mesa_MapNamedBufferRange()
3253 if (!bufObj) in _mesa_MapNamedBufferRange()
3256 if (!validate_map_buffer_range(ctx, bufObj, offset, length, access, in _mesa_MapNamedBufferRange()
3260 return map_buffer_range(ctx, bufObj, offset, length, access, in _mesa_MapNamedBufferRange()
3299 struct gl_buffer_object *bufObj = *bufObjPtr; in _mesa_MapBuffer_no_error() local
3301 return map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags, in _mesa_MapBuffer_no_error()
3309 struct gl_buffer_object *bufObj; in _mesa_MapBuffer() local
3317 bufObj = get_buffer(ctx, "glMapBuffer", target, GL_INVALID_OPERATION); in _mesa_MapBuffer()
3318 if (!bufObj) in _mesa_MapBuffer()
3321 if (!validate_map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags, in _mesa_MapBuffer()
3325 return map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags, in _mesa_MapBuffer()
3337 struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer); in _mesa_MapNamedBuffer_no_error() local
3339 return map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags, in _mesa_MapNamedBuffer_no_error()
3347 struct gl_buffer_object *bufObj; in _mesa_MapNamedBuffer() local
3355 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glMapNamedBuffer"); in _mesa_MapNamedBuffer()
3356 if (!bufObj) in _mesa_MapNamedBuffer()
3359 if (!validate_map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags, in _mesa_MapNamedBuffer()
3363 return map_buffer_range(ctx, bufObj, 0, bufObj->Size, accessFlags, in _mesa_MapNamedBuffer()
3370 struct gl_buffer_object *bufObj, in flush_mapped_buffer_range() argument
3392 if (!_mesa_bufferobj_mapped(bufObj, MAP_USER)) { in flush_mapped_buffer_range()
3399 if ((bufObj->Mappings[MAP_USER].AccessFlags & in flush_mapped_buffer_range()
3406 if (offset + length > bufObj->Mappings[MAP_USER].Length) { in flush_mapped_buffer_range()
3410 (long) bufObj->Mappings[MAP_USER].Length); in flush_mapped_buffer_range()
3414 assert(bufObj->Mappings[MAP_USER].AccessFlags & GL_MAP_WRITE_BIT); in flush_mapped_buffer_range()
3417 ctx->Driver.FlushMappedBufferRange(ctx, offset, length, bufObj, in flush_mapped_buffer_range()
3427 struct gl_buffer_object *bufObj = *bufObjPtr; in _mesa_FlushMappedBufferRange_no_error() local
3430 ctx->Driver.FlushMappedBufferRange(ctx, offset, length, bufObj, in _mesa_FlushMappedBufferRange_no_error()
3439 struct gl_buffer_object *bufObj; in _mesa_FlushMappedBufferRange() local
3441 bufObj = get_buffer(ctx, "glFlushMappedBufferRange", target, in _mesa_FlushMappedBufferRange()
3443 if (!bufObj) in _mesa_FlushMappedBufferRange()
3446 flush_mapped_buffer_range(ctx, bufObj, offset, length, in _mesa_FlushMappedBufferRange()
3455 struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer); in _mesa_FlushMappedNamedBufferRange_no_error() local
3458 ctx->Driver.FlushMappedBufferRange(ctx, offset, length, bufObj, in _mesa_FlushMappedNamedBufferRange_no_error()
3467 struct gl_buffer_object *bufObj; in _mesa_FlushMappedNamedBufferRange() local
3469 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, in _mesa_FlushMappedNamedBufferRange()
3471 if (!bufObj) in _mesa_FlushMappedNamedBufferRange()
3474 flush_mapped_buffer_range(ctx, bufObj, offset, length, in _mesa_FlushMappedNamedBufferRange()
3480 struct gl_buffer_object *bufObj, in bind_buffer_range_uniform_buffer() argument
3483 if (bufObj == ctx->Shared->NullBufferObj) { in bind_buffer_range_uniform_buffer()
3488 _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, bufObj); in bind_buffer_range_uniform_buffer()
3489 bind_uniform_buffer(ctx, index, bufObj, offset, size, GL_FALSE); in bind_buffer_range_uniform_buffer()
3501 struct gl_buffer_object *bufObj, in bind_buffer_range_uniform_buffer_err() argument
3516 bind_buffer_range_uniform_buffer(ctx, index, bufObj, offset, size); in bind_buffer_range_uniform_buffer_err()
3522 struct gl_buffer_object *bufObj, in bind_buffer_range_shader_storage_buffer() argument
3526 if (bufObj == ctx->Shared->NullBufferObj) { in bind_buffer_range_shader_storage_buffer()
3531 _mesa_reference_buffer_object(ctx, &ctx->ShaderStorageBuffer, bufObj); in bind_buffer_range_shader_storage_buffer()
3532 bind_shader_storage_buffer(ctx, index, bufObj, offset, size, GL_FALSE); in bind_buffer_range_shader_storage_buffer()
3545 struct gl_buffer_object *bufObj, in bind_buffer_range_shader_storage_buffer_err() argument
3560 bind_buffer_range_shader_storage_buffer(ctx, index, bufObj, offset, size); in bind_buffer_range_shader_storage_buffer_err()
3565 struct gl_buffer_object *bufObj, in bind_buffer_range_atomic_buffer() argument
3568 if (bufObj == ctx->Shared->NullBufferObj) { in bind_buffer_range_atomic_buffer()
3573 _mesa_reference_buffer_object(ctx, &ctx->AtomicBuffer, bufObj); in bind_buffer_range_atomic_buffer()
3574 bind_atomic_buffer(ctx, index, bufObj, offset, size, GL_FALSE); in bind_buffer_range_atomic_buffer()
3587 struct gl_buffer_object *bufObj, in bind_buffer_range_atomic_buffer_err() argument
3602 bind_buffer_range_atomic_buffer(ctx, index, bufObj, offset, size); in bind_buffer_range_atomic_buffer_err()
3703 struct gl_buffer_object *bufObj = ctx->Shared->NullBufferObj; in unbind_uniform_buffers() local
3707 bufObj, -1, -1, GL_TRUE, 0); in unbind_uniform_buffers()
3718 struct gl_buffer_object *bufObj = ctx->Shared->NullBufferObj; in unbind_shader_storage_buffers() local
3722 bufObj, -1, -1, GL_TRUE, 0); in unbind_shader_storage_buffers()
3982 struct gl_buffer_object * const bufObj = ctx->Shared->NullBufferObj; in unbind_xfb_buffers() local
3986 bufObj, 0, 0); in unbind_xfb_buffers()
4045 struct gl_buffer_object *bufObj; in bind_xfb_buffers() local
4094 bufObj = boundBufObj; in bind_xfb_buffers()
4096 bufObj = _mesa_multi_bind_lookup_bufferobj(ctx, buffers, i, caller); in bind_xfb_buffers()
4098 if (bufObj) in bind_xfb_buffers()
4099 _mesa_set_transform_feedback_binding(ctx, tfObj, index, bufObj, in bind_xfb_buffers()
4141 struct gl_buffer_object * const bufObj = ctx->Shared->NullBufferObj; in unbind_atomic_buffers() local
4145 bufObj, -1, -1, GL_TRUE, 0); in unbind_atomic_buffers()
4253 struct gl_buffer_object *bufObj; in bind_buffer_range() local
4262 bufObj = ctx->Shared->NullBufferObj; in bind_buffer_range()
4264 bufObj = _mesa_lookup_bufferobj(ctx, buffer); in bind_buffer_range()
4266 &bufObj, "glBindBufferRange")) in bind_buffer_range()
4269 if (!no_error && !bufObj) { in bind_buffer_range()
4280 index, bufObj, offset, size); in bind_buffer_range()
4283 bind_buffer_range_uniform_buffer(ctx, index, bufObj, offset, size); in bind_buffer_range()
4286 bind_buffer_range_shader_storage_buffer(ctx, index, bufObj, offset, in bind_buffer_range()
4290 bind_buffer_range_atomic_buffer(ctx, index, bufObj, offset, size); in bind_buffer_range()
4308 index, bufObj, offset, size, in bind_buffer_range()
4313 index, bufObj, offset, size); in bind_buffer_range()
4316 bind_buffer_range_uniform_buffer_err(ctx, index, bufObj, offset, in bind_buffer_range()
4320 bind_buffer_range_shader_storage_buffer_err(ctx, index, bufObj, in bind_buffer_range()
4324 bind_buffer_range_atomic_buffer_err(ctx, index, bufObj, in bind_buffer_range()
4352 struct gl_buffer_object *bufObj; in _mesa_BindBufferBase() local
4360 bufObj = ctx->Shared->NullBufferObj; in _mesa_BindBufferBase()
4362 bufObj = _mesa_lookup_bufferobj(ctx, buffer); in _mesa_BindBufferBase()
4364 &bufObj, "glBindBufferBase")) in _mesa_BindBufferBase()
4367 if (!bufObj) { in _mesa_BindBufferBase()
4404 index, bufObj, false); in _mesa_BindBufferBase()
4407 bind_buffer_base_uniform_buffer(ctx, index, bufObj); in _mesa_BindBufferBase()
4410 bind_buffer_base_shader_storage_buffer(ctx, index, bufObj); in _mesa_BindBufferBase()
4413 bind_buffer_base_atomic_buffer(ctx, index, bufObj); in _mesa_BindBufferBase()
4495 struct gl_buffer_object *bufObj, GLintptr offset, in invalidate_buffer_subdata() argument
4499 ctx->Driver.InvalidateBufferSubData(ctx, bufObj, offset, length); in invalidate_buffer_subdata()
4508 struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer); in _mesa_InvalidateBufferSubData_no_error() local
4509 invalidate_buffer_subdata(ctx, bufObj, offset, length); in _mesa_InvalidateBufferSubData_no_error()
4517 struct gl_buffer_object *bufObj; in _mesa_InvalidateBufferSubData() local
4526 bufObj = _mesa_lookup_bufferobj(ctx, buffer); in _mesa_InvalidateBufferSubData()
4527 if (!bufObj || bufObj == &DummyBufferObject) { in _mesa_InvalidateBufferSubData()
4540 if (offset < 0 || length < 0 || end > bufObj->Size) { in _mesa_InvalidateBufferSubData()
4553 if (!(bufObj->Mappings[MAP_USER].AccessFlags & GL_MAP_PERSISTENT_BIT) && in _mesa_InvalidateBufferSubData()
4554 bufferobj_range_mapped(bufObj, offset, length)) { in _mesa_InvalidateBufferSubData()
4561 invalidate_buffer_subdata(ctx, bufObj, offset, length); in _mesa_InvalidateBufferSubData()
4569 struct gl_buffer_object *bufObj =_mesa_lookup_bufferobj(ctx, buffer); in _mesa_InvalidateBufferData_no_error() local
4570 invalidate_buffer_subdata(ctx, bufObj, 0, bufObj->Size); in _mesa_InvalidateBufferData_no_error()
4577 struct gl_buffer_object *bufObj; in _mesa_InvalidateBufferData() local
4585 bufObj = _mesa_lookup_bufferobj(ctx, buffer); in _mesa_InvalidateBufferData()
4586 if (!bufObj || bufObj == &DummyBufferObject) { in _mesa_InvalidateBufferData()
4600 if (_mesa_check_disallowed_mapping(bufObj)) { in _mesa_InvalidateBufferData()
4607 invalidate_buffer_subdata(ctx, bufObj, 0, bufObj->Size); in _mesa_InvalidateBufferData()