#include <inttypes.h> /* for PRId64 macro */
#include "main/errors.h"
-#include "main/imports.h"
+
#include "main/mtypes.h"
#include "main/arrayobj.h"
#include "main/bufferobj.h"
}
}
else {
+ /* These are often read by the CPU, so enable CPU caches. */
+ if (target == GL_PIXEL_PACK_BUFFER ||
+ target == GL_PIXEL_UNPACK_BUFFER)
+ return PIPE_USAGE_STAGING;
+
/* BufferData */
switch (usage) {
case GL_DYNAMIC_DRAW:
return PIPE_USAGE_DYNAMIC;
case GL_STREAM_DRAW:
case GL_STREAM_COPY:
- /* XXX: Remove this test and fall-through when we have PBO unpacking
- * acceleration. Right now, PBO unpacking is done by the CPU, so we
- * have to make sure CPU reads are fast.
- */
- if (target != GL_PIXEL_UNPACK_BUFFER_ARB) {
- return PIPE_USAGE_STREAM;
- }
- /* fall through */
+ return PIPE_USAGE_STREAM;
case GL_STATIC_READ:
case GL_DYNAMIC_READ:
case GL_STREAM_READ:
struct st_memory_object *st_mem_obj = st_memory_object(memObj);
bool is_mapped = _mesa_bufferobj_mapped(obj, MAP_USER);
+ if (size > UINT32_MAX || offset > UINT32_MAX) {
+ /* pipe_resource.width0 is 32 bits only and increasing it
+ * to 64 bits doesn't make much sense since hw support
+ * for > 4GB resources is limited.
+ */
+ st_obj->Base.Size = 0;
+ return GL_FALSE;
+ }
+
if (target != GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD &&
size && st_obj->buffer &&
st_obj->Base.Size == size &&
if (access & MESA_MAP_NOWAIT_BIT)
flags |= PIPE_TRANSFER_DONTBLOCK;
+ if (access & MESA_MAP_THREAD_SAFE_BIT)
+ flags |= PIPE_TRANSFER_THREAD_SAFE;
return flags;
}
/* buffer should not already be mapped */
assert(!_mesa_check_disallowed_mapping(src));
- assert(!_mesa_check_disallowed_mapping(dst));
+ /* dst can be mapped, just not the same range as the target range */
u_box_1d(readOffset, size, &box);