Updated Remotery.
This commit is contained in:
parent
8ef9e248f1
commit
7652659dcc
128
3rdparty/remotery/lib/Remotery.c
vendored
128
3rdparty/remotery/lib/Remotery.c
vendored
@ -47,74 +47,15 @@
|
||||
#define RMT_IMPL
|
||||
#include "Remotery.h"
|
||||
|
||||
|
||||
#ifdef RMT_PLATFORM_WINDOWS
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/ashmem.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#define ASHMEM_DEVICE "/dev/ashmem"
|
||||
|
||||
/*
|
||||
* ashmem_create_region - creates a new ashmem region and returns the file
|
||||
* descriptor, or <0 on error
|
||||
*
|
||||
* `name' is an optional label to give the region (visible in /proc/pid/maps)
|
||||
* `size' is the size of the region, in page-aligned bytes
|
||||
*/
|
||||
int ashmem_create_region(const char *name, size_t size)
|
||||
{
|
||||
int fd, ret;
|
||||
|
||||
fd = open(ASHMEM_DEVICE, O_RDWR);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
if (name) {
|
||||
char buf[ASHMEM_NAME_LEN] = {0};
|
||||
|
||||
strncpy(buf, name, sizeof(buf));
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
ret = ioctl(fd, ASHMEM_SET_NAME, buf);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = ioctl(fd, ASHMEM_SET_SIZE, size);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
return fd;
|
||||
|
||||
error:
|
||||
close(fd);
|
||||
return ret;
|
||||
}
|
||||
#endif // __ANDROID__
|
||||
|
||||
#if RMT_ENABLED
|
||||
|
||||
|
||||
// Global settings
|
||||
static rmtSettings g_Settings;
|
||||
static rmtBool g_SettingsInitialized = RMT_FALSE;
|
||||
@ -582,6 +523,69 @@ typedef struct VirtualMirrorBuffer
|
||||
} VirtualMirrorBuffer;
|
||||
|
||||
|
||||
#ifdef __ANDROID__
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/ashmem.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#define ASHMEM_DEVICE "/dev/ashmem"
|
||||
|
||||
/*
|
||||
* ashmem_create_region - creates a new ashmem region and returns the file
|
||||
* descriptor, or <0 on error
|
||||
*
|
||||
* `name' is an optional label to give the region (visible in /proc/pid/maps)
|
||||
* `size' is the size of the region, in page-aligned bytes
|
||||
*/
|
||||
int ashmem_create_region(const char *name, size_t size)
|
||||
{
|
||||
int fd, ret;
|
||||
|
||||
fd = open(ASHMEM_DEVICE, O_RDWR);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
if (name) {
|
||||
char buf[ASHMEM_NAME_LEN] = {0};
|
||||
|
||||
strncpy(buf, name, sizeof(buf));
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
ret = ioctl(fd, ASHMEM_SET_NAME, buf);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = ioctl(fd, ASHMEM_SET_SIZE, size);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
return fd;
|
||||
|
||||
error:
|
||||
close(fd);
|
||||
return ret;
|
||||
}
|
||||
#endif // __ANDROID__
|
||||
|
||||
|
||||
static rmtError VirtualMirrorBuffer_Constructor(VirtualMirrorBuffer* buffer, rmtU32 size, int nb_attempts)
|
||||
{
|
||||
static const rmtU32 k_64 = 64 * 1024;
|
||||
@ -1266,7 +1270,7 @@ static const char* hex_encoding_table = "0123456789ABCDEF";
|
||||
static void itoahex_s( char *dest, rsize_t dmax, rmtS32 value )
|
||||
{
|
||||
rsize_t len;
|
||||
rmtS32 halfbytepos;
|
||||
rmtS32 halfbytepos;
|
||||
|
||||
halfbytepos = 8;
|
||||
|
||||
|
9
3rdparty/remotery/lib/Remotery.h
vendored
9
3rdparty/remotery/lib/Remotery.h
vendored
@ -290,6 +290,9 @@ typedef enum rmtError
|
||||
_rmt_BeginCPUSample(#name, &rmt_sample_hash_##name); \
|
||||
})
|
||||
|
||||
#define rmt_BeginCPUSampleDynamic(namestr) \
|
||||
RMT_OPTIONAL(RMT_ENABLED, _rmt_BeginCPUSample(namestr, NULL))
|
||||
|
||||
#define rmt_EndCPUSample() \
|
||||
RMT_OPTIONAL(RMT_ENABLED, _rmt_EndCPUSample())
|
||||
|
||||
@ -385,6 +388,9 @@ typedef struct rmtCUDABind
|
||||
_rmt_BeginD3D11Sample(#name, &rmt_sample_hash_##name); \
|
||||
})
|
||||
|
||||
#define rmt_BeginD3D11SampleDynamic(namestr) \
|
||||
RMT_OPTIONAL(RMT_USE_D3D11, _rmt_BeginD3D11Sample(namestr, NULL))
|
||||
|
||||
#define rmt_EndD3D11Sample() \
|
||||
RMT_OPTIONAL(RMT_USE_D3D11, _rmt_EndD3D11Sample())
|
||||
|
||||
@ -401,6 +407,9 @@ typedef struct rmtCUDABind
|
||||
_rmt_BeginOpenGLSample(#name, &rmt_sample_hash_##name); \
|
||||
})
|
||||
|
||||
#define rmt_BeginOpenGLSampleDynamic(namestr) \
|
||||
RMT_OPTIONAL(RMT_USE_OPENGL, _rmt_BeginOpenGLSample(namestr, NULL))
|
||||
|
||||
#define rmt_EndOpenGLSample() \
|
||||
RMT_OPTIONAL(RMT_USE_OPENGL, _rmt_EndOpenGLSample())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user