Update libretro-common

This commit is contained in:
twinaphex 2016-08-16 08:13:07 +02:00 committed by zeromus
parent f8d129b164
commit 3b0fc202b2
118 changed files with 16510 additions and 1307 deletions

View File

@ -0,0 +1,139 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (mismatch.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <retro_inline.h>
#include <algorithms/mismatch.h>
#include <compat/intrinsics.h>
#if defined(__x86_64__) || defined(__i386__) || defined(__i486__) || defined(__i686__)
#define CPU_X86
#endif
/* Other arches SIGBUS (usually) on unaligned accesses. */
#ifndef CPU_X86
#define NO_UNALIGNED_MEM
#endif
#if __SSE2__
#include <emmintrin.h>
#endif
/* There's no equivalent in libc, you'd think so ...
* std::mismatch exists, but it's not optimized at all. */
size_t find_change(const uint16_t *a, const uint16_t *b)
{
#if __SSE2__
const __m128i *a128 = (const __m128i*)a;
const __m128i *b128 = (const __m128i*)b;
for (;;)
{
__m128i v0 = _mm_loadu_si128(a128);
__m128i v1 = _mm_loadu_si128(b128);
__m128i c = _mm_cmpeq_epi32(v0, v1);
uint32_t mask = _mm_movemask_epi8(c);
if (mask != 0xffff) /* Something has changed, figure out where. */
{
size_t ret = (((uint8_t*)a128 - (uint8_t*)a) |
(compat_ctz(~mask))) >> 1;
return ret | (a[ret] == b[ret]);
}
a128++;
b128++;
}
#else
const uint16_t *a_org = a;
#ifdef NO_UNALIGNED_MEM
while (((uintptr_t)a & (sizeof(size_t) - 1)) && *a == *b)
{
a++;
b++;
}
if (*a == *b)
#endif
{
const size_t *a_big = (const size_t*)a;
const size_t *b_big = (const size_t*)b;
while (*a_big == *b_big)
{
a_big++;
b_big++;
}
a = (const uint16_t*)a_big;
b = (const uint16_t*)b_big;
while (*a == *b)
{
a++;
b++;
}
}
return a - a_org;
#endif
}
size_t find_same(const uint16_t *a, const uint16_t *b)
{
const uint16_t *a_org = a;
#ifdef NO_UNALIGNED_MEM
if (((uintptr_t)a & (sizeof(uint32_t) - 1)) && *a != *b)
{
a++;
b++;
}
if (*a != *b)
#endif
{
/* With this, it's random whether two consecutive identical
* words are caught.
*
* Luckily, compression rate is the same for both cases, and
* three is always caught.
*
* (We prefer to miss two-word blocks, anyways; fewer iterations
* of the outer loop, as well as in the decompressor.) */
const uint32_t *a_big = (const uint32_t*)a;
const uint32_t *b_big = (const uint32_t*)b;
while (*a_big != *b_big)
{
a_big++;
b_big++;
}
a = (const uint16_t*)a_big;
b = (const uint16_t*)b_big;
if (a != a_org && a[-1] == b[-1])
{
a--;
b--;
}
}
return a - a_org;
}

View File

@ -167,11 +167,11 @@ static void shuffle_block(char **begin, char **last, char **end)
retro_assert(tmp);
memcpy(tmp, begin, len * sizeof(const char*));
memcpy((void*)tmp, begin, len * sizeof(const char*));
memmove(begin, last, (end - last) * sizeof(const char*));
memcpy(end - len, tmp, len * sizeof(const char*));
free(tmp);
free((void*)tmp);
}
int getopt_long(int argc, char *argv[],

View File

@ -34,7 +34,11 @@ int c99_vsnprintf_retro__(char *outBuf, size_t size, const char *format, va_list
int count = -1;
if (size != 0)
#if (_MSC_VER <= 1310)
count = _vsnprintf(outBuf, size, format, ap);
#else
count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap);
#endif
if (count == -1)
count = _vscprintf(format, ap);

View File

@ -29,6 +29,8 @@
/* Implementation of strlcpy()/strlcat() based on OpenBSD. */
#ifndef __MACH__
size_t strlcpy(char *dest, const char *source, size_t size)
{
size_t src_size = 0;
@ -59,3 +61,4 @@ size_t strlcat(char *dest, const char *source, size_t size)
return len + strlcpy(dest, source, size);
}
#endif

View File

@ -0,0 +1,217 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (float_to_s16.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdint.h>
#include <stddef.h>
#if defined(__SSE2__)
#include <emmintrin.h>
#elif defined(__ALTIVEC__)
#include <altivec.h>
#endif
#include <features/features_cpu.h>
#include <conversion/float_to_s16.h>
/**
* convert_float_to_s16_C:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
*
* Converts floating point
* to signed integer 16-bit.
*
* C implementation callback function.
**/
void convert_float_to_s16_C(int16_t *out,
const float *in, size_t samples)
{
size_t i;
for (i = 0; i < samples; i++)
{
int32_t val = (int32_t)(in[i] * 0x8000);
out[i] = (val > 0x7FFF) ? 0x7FFF :
(val < -0x8000 ? -0x8000 : (int16_t)val);
}
}
#if defined(__SSE2__)
/**
* convert_float_to_s16_SSE2:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
*
* Converts floating point
* to signed integer 16-bit.
*
* SSE2 implementation callback function.
**/
void convert_float_to_s16_SSE2(int16_t *out,
const float *in, size_t samples)
{
size_t i;
__m128 factor = _mm_set1_ps((float)0x8000);
for (i = 0; i + 8 <= samples; i += 8, in += 8, out += 8)
{
__m128 input_l = _mm_loadu_ps(in + 0);
__m128 input_r = _mm_loadu_ps(in + 4);
__m128 res_l = _mm_mul_ps(input_l, factor);
__m128 res_r = _mm_mul_ps(input_r, factor);
__m128i ints_l = _mm_cvtps_epi32(res_l);
__m128i ints_r = _mm_cvtps_epi32(res_r);
__m128i packed = _mm_packs_epi32(ints_l, ints_r);
_mm_storeu_si128((__m128i *)out, packed);
}
convert_float_to_s16_C(out, in, samples - i);
}
#elif defined(__ALTIVEC__)
/**
* convert_float_to_s16_altivec:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
*
* Converts floating point
* to signed integer 16-bit.
*
* AltiVec implementation callback function.
**/
void convert_float_to_s16_altivec(int16_t *out,
const float *in, size_t samples)
{
int samples_in = samples;
/* Unaligned loads/store is a bit expensive,
* so we optimize for the good path (very likely). */
if (((uintptr_t)out & 15) + ((uintptr_t)in & 15) == 0)
{
size_t i;
for (i = 0; i + 8 <= samples; i += 8, in += 8, out += 8)
{
vector float input0 = vec_ld( 0, in);
vector float input1 = vec_ld(16, in);
vector signed int result0 = vec_cts(input0, 15);
vector signed int result1 = vec_cts(input1, 15);
vec_st(vec_packs(result0, result1), 0, out);
}
samples_in -= i;
}
convert_float_to_s16_C(out, in, samples_in);
}
#elif defined(__ARM_NEON__) && !defined(VITA)
void convert_float_s16_asm(int16_t *out, const float *in, size_t samples);
/**
* convert_float_to_s16_neon:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
*
* Converts floating point
* to signed integer 16-bit.
*
* ARM NEON implementation callback function.
**/
static void convert_float_to_s16_neon(int16_t *out,
const float *in, size_t samples)
{
size_t aligned_samples = samples & ~7;
if (aligned_samples)
convert_float_s16_asm(out, in, aligned_samples);
convert_float_to_s16_C(out + aligned_samples, in + aligned_samples,
samples - aligned_samples);
}
#elif defined(_MIPS_ARCH_ALLEGREX)
/**
* convert_float_to_s16_ALLEGREX:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
*
* Converts floating point
* to signed integer 16-bit.
*
* MIPS ALLEGREX implementation callback function.
**/
void convert_float_to_s16_ALLEGREX(int16_t *out,
const float *in, size_t samples)
{
size_t i;
#ifdef DEBUG
/* Make sure the buffers are 16 byte aligned, this should be
* the default behaviour of malloc in the PSPSDK.
* Assume alignment. */
retro_assert(((uintptr_t)in & 0xf) == 0);
retro_assert(((uintptr_t)out & 0xf) == 0);
#endif
for (i = 0; i + 8 <= samples; i += 8)
{
__asm__ (
".set push \n"
".set noreorder \n"
"lv.q c100, 0(%0) \n"
"lv.q c110, 16(%0) \n"
"vf2in.q c100, c100, 31 \n"
"vf2in.q c110, c110, 31 \n"
"vi2s.q c100, c100 \n"
"vi2s.q c102, c110 \n"
"sv.q c100, 0(%1) \n"
".set pop \n"
:: "r"(in + i), "r"(out + i));
}
for (; i < samples; i++)
{
int32_t val = (int32_t)(in[i] * 0x8000);
out[i] = (val > 0x7FFF) ? 0x7FFF :
(val < -0x8000 ? -0x8000 : (int16_t)val);
}
}
#endif
/**
* convert_float_to_s16_init_simd:
*
* Sets up function pointers for conversion
* functions based on CPU features.
**/
void convert_float_to_s16_init_simd(void)
{
unsigned cpu = cpu_features_get();
(void)cpu;
#if defined(__ARM_NEON__) && !defined(VITA)
convert_float_to_s16_arm = (cpu & RETRO_SIMD_NEON) ?
convert_float_to_s16_neon : convert_float_to_s16_C;
#endif
}

View File

@ -0,0 +1,56 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(__ARM_NEON__)
#ifndef __MACH__
.arm
#endif
.align 4
.globl convert_float_s16_asm
.globl _convert_float_s16_asm
# convert_float_s16_asm(int16_t *out, const float *in, size_t samples)
convert_float_s16_asm:
_convert_float_s16_asm:
# Hacky way to get a constant of 2^15.
# ((2^4)^2)^2 * 0.5 = 2^15
vmov.f32 q8, #16.0
vmov.f32 q9, #0.5
vmul.f32 q8, q8, q8
vmul.f32 q8, q8, q8
vmul.f32 q8, q8, q9
1:
# Preload here?
vld1.f32 {q0-q1}, [r1]!
vmul.f32 q0, q0, q8
vmul.f32 q1, q1, q8
vcvt.s32.f32 q0, q0
vcvt.s32.f32 q1, q1
vqmovn.s32 d4, q0
vqmovn.s32 d5, q1
vst1.f32 {d4-d5}, [r0]!
# Guaranteed to get samples in multiples of 8.
subs r2, r2, #8
bne 1b
bx lr
#endif

View File

@ -0,0 +1,242 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2014-2016 - Ali Bouhlel ( aliaspider@gmail.com )
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(__SSE2__)
#include <emmintrin.h>
#elif defined(__ALTIVEC__)
#include <altivec.h>
#endif
#include <boolean.h>
#include <features/features_cpu.h>
#include <conversion/s16_to_float.h>
/**
* convert_s16_to_float_C:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
* @gain : gain applied (.e.g. audio volume)
*
* Converts from signed integer 16-bit
* to floating point.
*
* C implementation callback function.
**/
void convert_s16_to_float_C(float *out,
const int16_t *in, size_t samples, float gain)
{
size_t i;
gain = gain / 0x8000;
for (i = 0; i < samples; i++)
out[i] = (float)in[i] * gain;
}
#if defined(__SSE2__)
/**
* convert_s16_to_float_SSE2:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
* @gain : gain applied (e.g. audio volume)
*
* Converts from signed integer 16-bit
* to floating point.
*
* SSE2 implementation callback function.
**/
void convert_s16_to_float_SSE2(float *out,
const int16_t *in, size_t samples, float gain)
{
size_t i;
float fgain = gain / UINT32_C(0x80000000);
__m128 factor = _mm_set1_ps(fgain);
for (i = 0; i + 8 <= samples; i += 8, in += 8, out += 8)
{
__m128i input = _mm_loadu_si128((const __m128i *)in);
__m128i regs_l = _mm_unpacklo_epi16(_mm_setzero_si128(), input);
__m128i regs_r = _mm_unpackhi_epi16(_mm_setzero_si128(), input);
__m128 output_l = _mm_mul_ps(_mm_cvtepi32_ps(regs_l), factor);
__m128 output_r = _mm_mul_ps(_mm_cvtepi32_ps(regs_r), factor);
_mm_storeu_ps(out + 0, output_l);
_mm_storeu_ps(out + 4, output_r);
}
convert_s16_to_float_C(out, in, samples - i, gain);
}
#elif defined(__ALTIVEC__)
/**
* convert_s16_to_float_altivec:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
* @gain : gain applied (e.g. audio volume)
*
* Converts from signed integer 16-bit
* to floating point.
*
* AltiVec implementation callback function.
**/
void convert_s16_to_float_altivec(float *out,
const int16_t *in, size_t samples, float gain)
{
size_t samples_in = samples;
/* Unaligned loads/store is a bit expensive, so we
* optimize for the good path (very likely). */
if (((uintptr_t)out & 15) + ((uintptr_t)in & 15) == 0)
{
size_t i;
const vector float gain_vec = { gain, gain , gain, gain };
const vector float zero_vec = { 0.0f, 0.0f, 0.0f, 0.0f};
for (i = 0; i + 8 <= samples; i += 8, in += 8, out += 8)
{
vector signed short input = vec_ld(0, in);
vector signed int hi = vec_unpackh(input);
vector signed int lo = vec_unpackl(input);
vector float out_hi = vec_madd(vec_ctf(hi, 15), gain_vec, zero_vec);
vector float out_lo = vec_madd(vec_ctf(lo, 15), gain_vec, zero_vec);
vec_st(out_hi, 0, out);
vec_st(out_lo, 16, out);
}
samples_in -= i;
}
convert_s16_to_float_C(out, in, samples_in, gain);
}
#elif defined(__ARM_NEON__) && !defined(VITA)
/* Avoid potential hard-float/soft-float ABI issues. */
void convert_s16_float_asm(float *out, const int16_t *in,
size_t samples, const float *gain);
/**
* convert_s16_to_float_neon:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
* @gain : gain applied (.e.g audio volume)
*
* Converts from signed integer 16-bit
* to floating point.
*
* ARM NEON implementation callback function.
**/
static void convert_s16_to_float_neon(float *out,
const int16_t *in, size_t samples, float gain)
{
size_t aligned_samples = samples & ~7;
if (aligned_samples)
convert_s16_float_asm(out, in, aligned_samples, &gain);
/* Could do all conversion in ASM, but keep it simple for now. */
convert_s16_to_float_C(out + aligned_samples, in + aligned_samples,
samples - aligned_samples, gain);
}
#elif defined(_MIPS_ARCH_ALLEGREX)
/**
* convert_s16_to_float_ALLEGREX:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
* @gain : gain applied (.e.g audio volume)
*
* Converts from signed integer 16-bit
* to floating point.
*
* MIPS ALLEGREX implementation callback function.
**/
void convert_s16_to_float_ALLEGREX(float *out,
const int16_t *in, size_t samples, float gain)
{
#ifdef DEBUG
/* Make sure the buffer is 16 byte aligned, this should be the
* default behaviour of malloc in the PSPSDK.
* Only the output buffer can be assumed to be 16-byte aligned. */
retro_assert(((uintptr_t)out & 0xf) == 0);
#endif
size_t i;
gain = gain / 0x8000;
__asm__ (
".set push \n"
".set noreorder \n"
"mtv %0, s200 \n"
".set pop \n"
::"r"(gain));
for (i = 0; i + 16 <= samples; i += 16)
{
__asm__ (
".set push \n"
".set noreorder \n"
"lv.s s100, 0(%0) \n"
"lv.s s101, 4(%0) \n"
"lv.s s110, 8(%0) \n"
"lv.s s111, 12(%0) \n"
"lv.s s120, 16(%0) \n"
"lv.s s121, 20(%0) \n"
"lv.s s130, 24(%0) \n"
"lv.s s131, 28(%0) \n"
"vs2i.p c100, c100 \n"
"vs2i.p c110, c110 \n"
"vs2i.p c120, c120 \n"
"vs2i.p c130, c130 \n"
"vi2f.q c100, c100, 16 \n"
"vi2f.q c110, c110, 16 \n"
"vi2f.q c120, c120, 16 \n"
"vi2f.q c130, c130, 16 \n"
"vmscl.q e100, e100, s200 \n"
"sv.q c100, 0(%1) \n"
"sv.q c110, 16(%1) \n"
"sv.q c120, 32(%1) \n"
"sv.q c130, 48(%1) \n"
".set pop \n"
:: "r"(in + i), "r"(out + i));
}
for (; i < samples; i++)
out[i] = (float)in[i] * gain;
}
#endif
/**
* convert_s16_to_float_init_simd:
*
* Sets up function pointers for conversion
* functions based on CPU features.
**/
void convert_s16_to_float_init_simd(void)
{
unsigned cpu = cpu_features_get();
(void)cpu;
#if defined(__ARM_NEON__) && !defined(VITA)
convert_s16_to_float_arm = (cpu & RETRO_SIMD_NEON) ?
convert_s16_to_float_neon : convert_s16_to_float_C;
#endif
}

View File

@ -0,0 +1,63 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(__ARM_NEON__)
#ifndef __MACH__
.arm
#endif
.align 4
.globl convert_s16_float_asm
.globl _convert_s16_float_asm
# convert_s16_float_asm(float *out, const int16_t *in, size_t samples, const float *gain)
convert_s16_float_asm:
_convert_s16_float_asm:
# Hacky way to get a constant of 2^-15.
# Might be faster to just load a constant from memory.
# It's just done once however ...
vmov.f32 q8, #0.25
vmul.f32 q8, q8, q8
vmul.f32 q8, q8, q8
vmul.f32 q8, q8, q8
vadd.f32 q8, q8, q8
# Apply gain
vld1.f32 {d6[0]}, [r3]
vmul.f32 q8, q8, d6[0]
1:
# Preload here?
vld1.s16 {q0}, [r1]!
# Widen to 32-bit
vmovl.s16 q1, d0
vmovl.s16 q2, d1
# Convert to float
vcvt.f32.s32 q1, q1
vcvt.f32.s32 q2, q2
vmul.f32 q1, q1, q8
vmul.f32 q2, q2, q8
vst1.f32 {q1-q2}, [r0]!
# Guaranteed to get samples in multiples of 8.
subs r2, r2, #8
bne 1b
bx lr
#endif

View File

@ -0,0 +1,731 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (features_cpu.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#if defined(_WIN32)
#include <direct.h>
#else
#include <unistd.h>
#endif
#include <compat/strl.h>
#include <streams/file_stream.h>
#include <libretro.h>
#include <features/features_cpu.h>
#if defined(_WIN32) && !defined(_XBOX)
#include <windows.h>
#endif
#if defined(__CELLOS_LV2__)
#ifndef _PPU_INTRINSICS_H
#include <ppu_intrinsics.h>
#endif
#elif defined(_XBOX360)
#include <PPCIntrinsics.h>
#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(ANDROID) || defined(__QNX__)
/* POSIX_MONOTONIC_CLOCK is not being defined in Android headers despite support being present. */
#include <time.h>
#endif
#if defined(__QNX__) && !defined(CLOCK_MONOTONIC)
#define CLOCK_MONOTONIC 2
#endif
#if defined(PSP)
#include <sys/time.h>
#include <psprtc.h>
#endif
#if defined(VITA)
#include <psp2/kernel/processmgr.h>
#include <psp2/rtc.h>
#endif
#if defined(__PSL1GHT__)
#include <sys/time.h>
#elif defined(__CELLOS_LV2__)
#include <sys/sys_time.h>
#endif
#ifdef GEKKO
#include <ogc/lwp_watchdog.h>
#endif
/* iOS/OSX specific. Lacks clock_gettime(), so implement it. */
#ifdef __MACH__
#include <sys/time.h>
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC 0
#endif
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME 0
#endif
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 100000
// this function is part of iOS 10 now
static int clock_gettime(int clk_ik, struct timespec *t)
{
struct timeval now;
int rv = gettimeofday(&now, NULL);
if (rv)
return rv;
t->tv_sec = now.tv_sec;
t->tv_nsec = now.tv_usec * 1000;
return 0;
}
#endif
#endif
#ifdef EMSCRIPTEN
#include <emscripten.h>
#endif
#if defined(BSD) || defined(__APPLE__)
#include <sys/sysctl.h>
#endif
#include <string.h>
/**
* cpu_features_get_perf_counter:
*
* Gets performance counter.
*
* Returns: performance counter.
**/
retro_perf_tick_t cpu_features_get_perf_counter(void)
{
retro_perf_tick_t time_ticks = 0;
#if defined(_WIN32)
long tv_sec, tv_usec;
static const unsigned __int64 epoch = 11644473600000000ULL;
FILETIME file_time;
SYSTEMTIME system_time;
ULARGE_INTEGER ularge;
GetSystemTime(&system_time);
SystemTimeToFileTime(&system_time, &file_time);
ularge.LowPart = file_time.dwLowDateTime;
ularge.HighPart = file_time.dwHighDateTime;
tv_sec = (long)((ularge.QuadPart - epoch) / 10000000L);
tv_usec = (long)(system_time.wMilliseconds * 1000);
time_ticks = (1000000 * tv_sec + tv_usec);
#elif defined(__linux__) || defined(__QNX__) || defined(__MACH__)
struct timespec tv;
if (clock_gettime(CLOCK_MONOTONIC, &tv) == 0)
time_ticks = (retro_perf_tick_t)tv.tv_sec * 1000000000 +
(retro_perf_tick_t)tv.tv_nsec;
#elif defined(__GNUC__) && defined(__i386__) || defined(__i486__) || defined(__i686__)
__asm__ volatile ("rdtsc" : "=A" (time_ticks));
#elif defined(__GNUC__) && defined(__x86_64__)
unsigned a, d;
__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
time_ticks = (retro_perf_tick_t)a | ((retro_perf_tick_t)d << 32);
#elif defined(__ARM_ARCH_6__)
__asm__ volatile( "mrc p15, 0, %0, c9, c13, 0" : "=r"(time_ticks) );
#elif defined(__CELLOS_LV2__) || defined(_XBOX360) || defined(__powerpc__) || defined(__ppc__) || defined(__POWERPC__)
time_ticks = __mftb();
#elif defined(GEKKO)
time_ticks = gettime();
#elif defined(PSP) || defined(VITA)
sceRtcGetCurrentTick(&time_ticks);
#elif defined(_3DS)
time_ticks = svcGetSystemTick();
#elif defined(__mips__)
struct timeval tv;
gettimeofday(&tv,NULL);
time_ticks = (1000000 * tv.tv_sec + tv.tv_usec);
#endif
return time_ticks;
}
/**
* cpu_features_get_time_usec:
*
* Gets time in microseconds.
*
* Returns: time in microseconds.
**/
retro_time_t cpu_features_get_time_usec(void)
{
#if defined(_WIN32)
static LARGE_INTEGER freq;
LARGE_INTEGER count;
/* Frequency is guaranteed to not change. */
if (!freq.QuadPart && !QueryPerformanceFrequency(&freq))
return 0;
if (!QueryPerformanceCounter(&count))
return 0;
return count.QuadPart * 1000000 / freq.QuadPart;
#elif defined(__CELLOS_LV2__)
return sys_time_get_system_time();
#elif defined(GEKKO)
return ticks_to_microsecs(gettime());
#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(__QNX__) || defined(ANDROID) || defined(__MACH__)
struct timespec tv = {0};
if (clock_gettime(CLOCK_MONOTONIC, &tv) < 0)
return 0;
return tv.tv_sec * INT64_C(1000000) + (tv.tv_nsec + 500) / 1000;
#elif defined(EMSCRIPTEN)
return emscripten_get_now() * 1000;
#elif defined(__mips__)
struct timeval tv;
gettimeofday(&tv,NULL);
return (1000000 * tv.tv_sec + tv.tv_usec);
#elif defined(_3DS)
return osGetTime() * 1000;
#elif defined(VITA)
return sceKernelGetProcessTimeWide();
#else
#error "Your platform does not have a timer function implemented in cpu_features_get_time_usec(). Cannot continue."
#endif
}
#if defined(__x86_64__) || defined(__i386__) || defined(__i486__) || defined(__i686__)
#define CPU_X86
#endif
#if defined(_MSC_VER) && !defined(_XBOX)
#if (_MSC_VER > 1310)
#include <intrin.h>
#endif
#endif
#if defined(CPU_X86) && !defined(__MACH__)
void x86_cpuid(int func, int flags[4])
{
/* On Android, we compile RetroArch with PIC, and we
* are not allowed to clobber the ebx register. */
#ifdef __x86_64__
#define REG_b "rbx"
#define REG_S "rsi"
#else
#define REG_b "ebx"
#define REG_S "esi"
#endif
#if defined(__GNUC__)
__asm__ volatile (
"mov %%" REG_b ", %%" REG_S "\n"
"cpuid\n"
"xchg %%" REG_b ", %%" REG_S "\n"
: "=a"(flags[0]), "=S"(flags[1]), "=c"(flags[2]), "=d"(flags[3])
: "a"(func));
#elif defined(_MSC_VER)
__cpuid(flags, func);
#else
printf("Unknown compiler. Cannot check CPUID with inline assembly.\n");
memset(flags, 0, 4 * sizeof(int));
#endif
}
/* Only runs on i686 and above. Needs to be conditionally run. */
static uint64_t xgetbv_x86(uint32_t idx)
{
#if defined(__GNUC__)
uint32_t eax, edx;
__asm__ volatile (
/* Older GCC versions (Apple's GCC for example) do
* not understand xgetbv instruction.
* Stamp out the machine code directly.
*/
".byte 0x0f, 0x01, 0xd0\n"
: "=a"(eax), "=d"(edx) : "c"(idx));
return ((uint64_t)edx << 32) | eax;
#elif _MSC_FULL_VER >= 160040219
/* Intrinsic only works on 2010 SP1 and above. */
return _xgetbv(idx);
#else
printf("Unknown compiler. Cannot check xgetbv bits.\n");
return 0;
#endif
}
#endif
#if defined(__ARM_NEON__)
static void arm_enable_runfast_mode(void)
{
/* RunFast mode. Enables flush-to-zero and some
* floating point optimizations. */
static const unsigned x = 0x04086060;
static const unsigned y = 0x03000000;
int r;
__asm__ volatile(
"fmrx %0, fpscr \n\t" /* r0 = FPSCR */
"and %0, %0, %1 \n\t" /* r0 = r0 & 0x04086060 */
"orr %0, %0, %2 \n\t" /* r0 = r0 | 0x03000000 */
"fmxr fpscr, %0 \n\t" /* FPSCR = r0 */
: "=r"(r)
: "r"(x), "r"(y)
);
}
#endif
#if defined(__linux__) && !defined(CPU_X86)
static unsigned char check_arm_cpu_feature(const char* feature)
{
char line[1024];
unsigned char status = 0;
RFILE *fp = filestream_open("/proc/cpuinfo", RFILE_MODE_READ_TEXT, -1);
if (!fp)
return 0;
while (filestream_gets(fp, line, sizeof(line)) != NULL)
{
if (strncmp(line, "Features\t: ", 11))
continue;
if (strstr(line + 11, feature) != NULL)
status = 1;
break;
}
filestream_close(fp);
return status;
}
#if !defined(_SC_NPROCESSORS_ONLN)
/* Parse an decimal integer starting from 'input', but not going further
* than 'limit'. Return the value into '*result'.
*
* NOTE: Does not skip over leading spaces, or deal with sign characters.
* NOTE: Ignores overflows.
*
* The function returns NULL in case of error (bad format), or the new
* position after the decimal number in case of success (which will always
* be <= 'limit').
*/
static const char *parse_decimal(const char* input,
const char* limit, int* result)
{
const char* p = input;
int val = 0;
while (p < limit)
{
int d = (*p - '0');
if ((unsigned)d >= 10U)
break;
val = val*10 + d;
p++;
}
if (p == input)
return NULL;
*result = val;
return p;
}
/* Parse a textual list of cpus and store the result inside a CpuList object.
* Input format is the following:
* - comma-separated list of items (no spaces)
* - each item is either a single decimal number (cpu index), or a range made
* of two numbers separated by a single dash (-). Ranges are inclusive.
*
* Examples: 0
* 2,4-127,128-143
* 0-1
*/
static void cpulist_parse(CpuList* list, char **buf, ssize_t length)
{
const char* p = (const char*)buf;
const char* end = p + length;
/* NOTE: the input line coming from sysfs typically contains a
* trailing newline, so take care of it in the code below
*/
while (p < end && *p != '\n')
{
int val, start_value, end_value;
/* Find the end of current item, and put it into 'q' */
const char *q = (const char*)memchr(p, ',', end-p);
if (!q)
q = end;
/* Get first value */
p = parse_decimal(p, q, &start_value);
if (p == NULL)
return;
end_value = start_value;
/* If we're not at the end of the item, expect a dash and
* and integer; extract end value.
*/
if (p < q && *p == '-')
{
p = parse_decimal(p+1, q, &end_value);
if (p == NULL)
return;
}
/* Set bits CPU list bits */
for (val = start_value; val <= end_value; val++)
{
if ((unsigned)val < 32)
list->mask |= (uint32_t)(1U << val);
}
/* Jump to next item */
p = q;
if (p < end)
p++;
}
}
/* Read a CPU list from one sysfs file */
static void cpulist_read_from(CpuList* list, const char* filename)
{
ssize_t length;
char *buf = NULL;
list->mask = 0;
if (filestream_read_file(filename, (void**)&buf, &length) != 1)
return;
cpulist_parse(list, &buf, length);
if (buf)
free(buf);
buf = NULL;
}
#endif
#endif
/**
* cpu_features_get_core_amount:
*
* Gets the amount of available CPU cores.
*
* Returns: amount of CPU cores available.
**/
unsigned cpu_features_get_core_amount(void)
{
#if defined(_WIN32) && !defined(_XBOX)
/* Win32 */
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
return sysinfo.dwNumberOfProcessors;
#elif defined(GEKKO)
return 1;
#elif defined(PSP)
return 1;
#elif defined(VITA)
return 4;
#elif defined(_3DS)
return 1;
#elif defined(_SC_NPROCESSORS_ONLN)
/* Linux, most UNIX-likes. */
long ret = sysconf(_SC_NPROCESSORS_ONLN);
if (ret <= 0)
return (unsigned)1;
return ret;
#elif defined(BSD) || defined(__APPLE__)
/* BSD */
/* Copypasta from stackoverflow, dunno if it works. */
int num_cpu = 0;
int mib[4];
size_t len = sizeof(num_cpu);
mib[0] = CTL_HW;
mib[1] = HW_AVAILCPU;
sysctl(mib, 2, &num_cpu, &len, NULL, 0);
if (num_cpu < 1)
{
mib[1] = HW_NCPU;
sysctl(mib, 2, &num_cpu, &len, NULL, 0);
if (num_cpu < 1)
num_cpu = 1;
}
return num_cpu;
#elif defined(__linux__)
CpuList cpus_present[1];
CpuList cpus_possible[1];
int amount = 0;
cpulist_read_from(cpus_present, "/sys/devices/system/cpu/present");
cpulist_read_from(cpus_possible, "/sys/devices/system/cpu/possible");
/* Compute the intersection of both sets to get the actual number of
* CPU cores that can be used on this device by the kernel.
*/
cpus_present->mask &= cpus_possible->mask;
amount = __builtin_popcount(cpus_present->mask);
if (amount == 0)
return 1;
return amount;
#elif defined(_XBOX360)
return 3;
#else
/* No idea, assume single core. */
return 1;
#endif
}
/* According to http://en.wikipedia.org/wiki/CPUID */
#define VENDOR_INTEL_b 0x756e6547
#define VENDOR_INTEL_c 0x6c65746e
#define VENDOR_INTEL_d 0x49656e69
/**
* cpu_features_get:
*
* Gets CPU features..
*
* Returns: bitmask of all CPU features available.
**/
uint64_t cpu_features_get(void)
{
int flags[4];
int vendor_shuffle[3];
char vendor[13] = {0};
size_t len = 0;
uint64_t cpu_flags = 0;
uint64_t cpu = 0;
unsigned max_flag = 0;
#if defined(CPU_X86) && !defined(__MACH__)
int vendor_is_intel = 0;
const int avx_flags = (1 << 27) | (1 << 28);
#endif
char buf[sizeof(" MMX MMXEXT SSE SSE2 SSE3 SSSE3 SS4 SSE4.2 AES AVX AVX2 NEON VMX VMX128 VFPU PS")];
memset(buf, 0, sizeof(buf));
(void)len;
(void)cpu_flags;
(void)flags;
(void)max_flag;
(void)vendor;
(void)vendor_shuffle;
#if defined(__MACH__)
len = sizeof(size_t);
if (sysctlbyname("hw.optional.mmx", NULL, &len, NULL, 0) == 0)
{
cpu |= RETRO_SIMD_MMX;
cpu |= RETRO_SIMD_MMXEXT;
}
len = sizeof(size_t);
if (sysctlbyname("hw.optional.sse", NULL, &len, NULL, 0) == 0)
cpu |= RETRO_SIMD_SSE;
len = sizeof(size_t);
if (sysctlbyname("hw.optional.sse2", NULL, &len, NULL, 0) == 0)
cpu |= RETRO_SIMD_SSE2;
len = sizeof(size_t);
if (sysctlbyname("hw.optional.sse3", NULL, &len, NULL, 0) == 0)
cpu |= RETRO_SIMD_SSE3;
len = sizeof(size_t);
if (sysctlbyname("hw.optional.supplementalsse3", NULL, &len, NULL, 0) == 0)
cpu |= RETRO_SIMD_SSSE3;
len = sizeof(size_t);
if (sysctlbyname("hw.optional.sse4_1", NULL, &len, NULL, 0) == 0)
cpu |= RETRO_SIMD_SSE4;
len = sizeof(size_t);
if (sysctlbyname("hw.optional.sse4_2", NULL, &len, NULL, 0) == 0)
cpu |= RETRO_SIMD_SSE42;
len = sizeof(size_t);
if (sysctlbyname("hw.optional.aes", NULL, &len, NULL, 0) == 0)
cpu |= RETRO_SIMD_AES;
len = sizeof(size_t);
if (sysctlbyname("hw.optional.avx1_0", NULL, &len, NULL, 0) == 0)
cpu |= RETRO_SIMD_AVX;
len = sizeof(size_t);
if (sysctlbyname("hw.optional.avx2_0", NULL, &len, NULL, 0) == 0)
cpu |= RETRO_SIMD_AVX2;
len = sizeof(size_t);
if (sysctlbyname("hw.optional.altivec", NULL, &len, NULL, 0) == 0)
cpu |= RETRO_SIMD_VMX;
len = sizeof(size_t);
if (sysctlbyname("hw.optional.neon", NULL, &len, NULL, 0) == 0)
cpu |= RETRO_SIMD_NEON;
#elif defined(CPU_X86)
(void)avx_flags;
x86_cpuid(0, flags);
vendor_shuffle[0] = flags[1];
vendor_shuffle[1] = flags[3];
vendor_shuffle[2] = flags[2];
memcpy(vendor, vendor_shuffle, sizeof(vendor_shuffle));
/* printf("[CPUID]: Vendor: %s\n", vendor); */
vendor_is_intel = (
flags[1] == VENDOR_INTEL_b &&
flags[2] == VENDOR_INTEL_c &&
flags[3] == VENDOR_INTEL_d);
max_flag = flags[0];
if (max_flag < 1) /* Does CPUID not support func = 1? (unlikely ...) */
return 0;
x86_cpuid(1, flags);
if (flags[3] & (1 << 23))
cpu |= RETRO_SIMD_MMX;
if (flags[3] & (1 << 25))
{
/* SSE also implies MMXEXT (according to FFmpeg source). */
cpu |= RETRO_SIMD_SSE;
cpu |= RETRO_SIMD_MMXEXT;
}
if (flags[3] & (1 << 26))
cpu |= RETRO_SIMD_SSE2;
if (flags[2] & (1 << 0))
cpu |= RETRO_SIMD_SSE3;
if (flags[2] & (1 << 9))
cpu |= RETRO_SIMD_SSSE3;
if (flags[2] & (1 << 19))
cpu |= RETRO_SIMD_SSE4;
if (flags[2] & (1 << 20))
cpu |= RETRO_SIMD_SSE42;
if ((flags[2] & (1 << 23)))
cpu |= RETRO_SIMD_POPCNT;
if (vendor_is_intel && (flags[2] & (1 << 22)))
cpu |= RETRO_SIMD_MOVBE;
if (flags[2] & (1 << 25))
cpu |= RETRO_SIMD_AES;
/* Must only perform xgetbv check if we have
* AVX CPU support (guaranteed to have at least i686). */
if (((flags[2] & avx_flags) == avx_flags)
&& ((xgetbv_x86(0) & 0x6) == 0x6))
cpu |= RETRO_SIMD_AVX;
if (max_flag >= 7)
{
x86_cpuid(7, flags);
if (flags[1] & (1 << 5))
cpu |= RETRO_SIMD_AVX2;
}
x86_cpuid(0x80000000, flags);
max_flag = flags[0];
if (max_flag >= 0x80000001u)
{
x86_cpuid(0x80000001, flags);
if (flags[3] & (1 << 23))
cpu |= RETRO_SIMD_MMX;
if (flags[3] & (1 << 22))
cpu |= RETRO_SIMD_MMXEXT;
}
#elif defined(__linux__)
if (check_arm_cpu_feature("neon"))
{
cpu |= RETRO_SIMD_NEON;
#ifdef __ARM_NEON__
arm_enable_runfast_mode();
#endif
}
if (check_arm_cpu_feature("vfpv3"))
cpu |= RETRO_SIMD_VFPV3;
if (check_arm_cpu_feature("vfpv4"))
cpu |= RETRO_SIMD_VFPV4;
#if 0
check_arm_cpu_feature("swp");
check_arm_cpu_feature("half");
check_arm_cpu_feature("thumb");
check_arm_cpu_feature("fastmult");
check_arm_cpu_feature("vfp");
check_arm_cpu_feature("edsp");
check_arm_cpu_feature("thumbee");
check_arm_cpu_feature("tls");
check_arm_cpu_feature("idiva");
check_arm_cpu_feature("idivt");
#endif
#elif defined(__ARM_NEON__)
cpu |= RETRO_SIMD_NEON;
arm_enable_runfast_mode();
#elif defined(__ALTIVEC__)
cpu |= RETRO_SIMD_VMX;
#elif defined(XBOX360)
cpu |= RETRO_SIMD_VMX128;
#elif defined(PSP)
cpu |= RETRO_SIMD_VFPU;
#elif defined(GEKKO)
cpu |= RETRO_SIMD_PS;
#endif
if (cpu & RETRO_SIMD_MMX) strlcat(buf, " MMX", sizeof(buf));
if (cpu & RETRO_SIMD_MMXEXT) strlcat(buf, " MMXEXT", sizeof(buf));
if (cpu & RETRO_SIMD_SSE) strlcat(buf, " SSE", sizeof(buf));
if (cpu & RETRO_SIMD_SSE2) strlcat(buf, " SSE2", sizeof(buf));
if (cpu & RETRO_SIMD_SSE3) strlcat(buf, " SSE3", sizeof(buf));
if (cpu & RETRO_SIMD_SSSE3) strlcat(buf, " SSSE3", sizeof(buf));
if (cpu & RETRO_SIMD_SSE4) strlcat(buf, " SSE4", sizeof(buf));
if (cpu & RETRO_SIMD_SSE42) strlcat(buf, " SSE4.2", sizeof(buf));
if (cpu & RETRO_SIMD_AES) strlcat(buf, " AES", sizeof(buf));
if (cpu & RETRO_SIMD_AVX) strlcat(buf, " AVX", sizeof(buf));
if (cpu & RETRO_SIMD_AVX2) strlcat(buf, " AVX2", sizeof(buf));
if (cpu & RETRO_SIMD_NEON) strlcat(buf, " NEON", sizeof(buf));
if (cpu & RETRO_SIMD_VFPV3) strlcat(buf, " VFPv3", sizeof(buf));
if (cpu & RETRO_SIMD_VFPV4) strlcat(buf, " VFPv4", sizeof(buf));
if (cpu & RETRO_SIMD_VMX) strlcat(buf, " VMX", sizeof(buf));
if (cpu & RETRO_SIMD_VMX128) strlcat(buf, " VMX128", sizeof(buf));
if (cpu & RETRO_SIMD_VFPU) strlcat(buf, " VFPU", sizeof(buf));
if (cpu & RETRO_SIMD_PS) strlcat(buf, " PS", sizeof(buf));
return cpu;
}

View File

@ -451,7 +451,7 @@ static int file_archive_decompress_data_to_file(
}
end:
if (handle->data)
if (handle && handle->data)
free(handle->data);
return ret;
}

View File

@ -43,6 +43,7 @@
#include <file/file_path.h>
#include <retro_stat.h>
#include <lists/string_list.h>
#include <string/stdstring.h>
#include <rhash.h>
#define MAX_INCLUDE_DEPTH 16
@ -75,12 +76,12 @@ struct config_file
struct config_include_list *includes;
};
static config_file_t *config_file_new_internal(const char *path, unsigned depth);
void config_file_free(config_file_t *conf);
static config_file_t *config_file_new_internal(
const char *path, unsigned depth);
static char *getaline(FILE *file)
{
char* newline = (char*)malloc(9);
char* newline = (char*)malloc(9);
char* newline_tmp = NULL;
size_t cur_size = 8;
size_t idx = 0;
@ -112,6 +113,45 @@ static char *getaline(FILE *file)
return newline;
}
static char *strip_comment(char *str)
{
/* Remove everything after comment.
* Keep #s inside string literals. */
char *string_end = str + strlen(str);
bool cut_comment = true;
while (!string_is_empty(str))
{
char *comment = NULL;
char *literal = strchr(str, '\"');
if (!literal)
literal = string_end;
comment = (char*)strchr(str, '#');
if (!comment)
comment = string_end;
if (cut_comment && literal < comment)
{
cut_comment = false;
str = literal + 1;
}
else if (!cut_comment && literal)
{
cut_comment = true;
str = literal + 1;
}
else if (comment)
{
*comment = '\0';
str = comment;
}
else
str = string_end;
}
return str;
}
static char *extract_value(char *line, bool is_value)
{
char *save = NULL;
@ -152,6 +192,27 @@ static char *extract_value(char *line, bool is_value)
return NULL;
}
static void add_include_list(config_file_t *conf, const char *path)
{
struct config_include_list *head = conf->includes;
struct config_include_list *node = (struct config_include_list*)calloc(1, sizeof(*node));
if (!node)
return;
node->path = strdup(path);
if (head)
{
while (head->next)
head = head->next;
head->next = node;
}
else
conf->includes = node;
}
static void set_list_readonly(struct config_entry_list *list)
{
while (list)
@ -195,27 +256,6 @@ static void add_child_list(config_file_t *parent, config_file_t *child)
parent->tail = NULL;
}
static void add_include_list(config_file_t *conf, const char *path)
{
struct config_include_list *head = conf->includes;
struct config_include_list *node = (struct config_include_list*)calloc(1, sizeof(*node));
if (!node)
return;
node->path = strdup(path);
if (head)
{
while (head->next)
head = head->next;
head->next = node;
}
else
conf->includes = node;
}
static void add_sub_conf(config_file_t *conf, char *line)
{
char real_path[PATH_MAX_LENGTH] = {0};
@ -258,53 +298,14 @@ static void add_sub_conf(config_file_t *conf, char *line)
free(path);
}
static char *strip_comment(char *str)
{
/* Remove everything after comment.
* Keep #s inside string literals. */
char *strend = str + strlen(str);
bool cut_comment = true;
while (*str)
{
char *comment = NULL;
char *literal = strchr(str, '\"');
if (!literal)
literal = strend;
comment = (char*)strchr(str, '#');
if (!comment)
comment = strend;
if (cut_comment && literal < comment)
{
cut_comment = false;
str = literal + 1;
}
else if (!cut_comment && literal)
{
cut_comment = true;
str = literal + 1;
}
else if (comment)
{
*comment = '\0';
str = comment;
}
else
str = strend;
}
return str;
}
static bool parse_line(config_file_t *conf,
struct config_entry_list *list, char *line)
{
char *comment = NULL;
char *key = (char*)malloc(9);
char *key_tmp = NULL;
size_t cur_size = 8;
size_t idx = 0;
char *key = (char*)malloc(9);
if (!key)
return false;
@ -370,23 +371,6 @@ static bool parse_line(config_file_t *conf,
return true;
}
bool config_append_file(config_file_t *conf, const char *path)
{
config_file_t *new_conf = config_file_new(path);
if (!new_conf)
return false;
if (new_conf->tail)
{
new_conf->tail->next = conf->entries;
conf->entries = new_conf->entries; /* Pilfer. */
new_conf->entries = NULL;
}
config_file_free(new_conf);
return true;
}
static config_file_t *config_file_new_internal(
const char *path, unsigned depth)
{
@ -429,26 +413,24 @@ static config_file_t *config_file_new_internal(
line = getaline(file);
if (line)
{
if (parse_line(conf, list, line))
{
if (conf->entries)
conf->tail->next = list;
else
conf->entries = list;
conf->tail = list;
}
free(line);
}
else
if (!line)
{
free(list);
continue;
}
if (parse_line(conf, list, line))
{
if (conf->entries)
conf->tail->next = list;
else
conf->entries = list;
conf->tail = list;
}
free(line);
if (list != conf->tail)
free(list);
}
@ -463,6 +445,65 @@ error:
return NULL;
}
void config_file_free(config_file_t *conf)
{
struct config_include_list *inc_tmp = NULL;
struct config_entry_list *tmp = NULL;
if (!conf)
return;
tmp = conf->entries;
while (tmp)
{
struct config_entry_list *hold = NULL;
if (tmp->key)
free(tmp->key);
if (tmp->value)
free(tmp->value);
tmp->value = NULL;
tmp->key = NULL;
hold = tmp;
tmp = tmp->next;
if (hold)
free(hold);
}
inc_tmp = (struct config_include_list*)conf->includes;
while (inc_tmp)
{
struct config_include_list *hold = NULL;
free(inc_tmp->path);
hold = (struct config_include_list*)inc_tmp;
inc_tmp = inc_tmp->next;
free(hold);
}
if (conf->path)
free(conf->path);
free(conf);
}
bool config_append_file(config_file_t *conf, const char *path)
{
config_file_t *new_conf = config_file_new(path);
if (!new_conf)
return false;
if (new_conf->tail)
{
new_conf->tail->next = conf->entries;
conf->entries = new_conf->entries; /* Pilfer. */
new_conf->entries = NULL;
}
config_file_free(new_conf);
return true;
}
config_file_t *config_file_new_from_string(const char *from_string)
{
size_t i;
@ -521,46 +562,6 @@ config_file_t *config_file_new(const char *path)
return config_file_new_internal(path, 0);
}
void config_file_free(config_file_t *conf)
{
struct config_include_list *inc_tmp = NULL;
struct config_entry_list *tmp = NULL;
if (!conf)
return;
tmp = conf->entries;
while (tmp)
{
struct config_entry_list *hold = NULL;
if (tmp->key)
free(tmp->key);
if (tmp->value)
free(tmp->value);
tmp->value = NULL;
tmp->key = NULL;
hold = tmp;
tmp = tmp->next;
if (hold)
free(hold);
}
inc_tmp = (struct config_include_list*)conf->includes;
while (inc_tmp)
{
struct config_include_list *hold = NULL;
free(inc_tmp->path);
hold = (struct config_include_list*)inc_tmp;
inc_tmp = inc_tmp->next;
free(hold);
}
if (conf->path)
free(conf->path);
free(conf);
}
static struct config_entry_list *config_get_entry(const config_file_t *conf,
const char *key, struct config_entry_list **prev)
@ -887,8 +888,9 @@ bool config_file_write(config_file_t *conf, const char *path)
void config_file_dump(config_file_t *conf, FILE *file)
{
struct config_entry_list *list = NULL;
struct config_entry_list *list = NULL;
struct config_include_list *includes = conf->includes;
while (includes)
{
fprintf(file, "#include \"%s\"\n", includes->path);
@ -896,11 +898,9 @@ void config_file_dump(config_file_t *conf, FILE *file)
}
list = (struct config_entry_list*)conf->entries;
while (list)
{
if (!list)
break;
if (!list->readonly && list->key)
fprintf(file, "%s = \"%s\"\n", list->key, list->value);
list = list->next;

View File

@ -218,8 +218,7 @@ void fill_pathname(char *out_path, const char *in_path,
if ((tok = (char*)strrchr(path_basename(tmp_path), '.')))
*tok = '\0';
retro_assert(strlcpy(out_path, tmp_path, size) < size);
retro_assert(strlcat(out_path, replace, size) < size);
fill_pathname_noext(out_path, tmp_path, replace, size);
}
/**
@ -243,9 +242,9 @@ void fill_pathname_noext(char *out_path, const char *in_path,
retro_assert(strlcat(out_path, replace, size) < size);
}
static char *find_last_slash(const char *str)
char *find_last_slash(const char *str)
{
const char *slash = strrchr(str, '/');
const char *slash = strrchr(str, '/');
#ifdef _WIN32
const char *backslash = strrchr(str, '\\');
@ -346,6 +345,19 @@ void fill_pathname_base(char *out, const char *in_path, size_t size)
retro_assert(strlcpy(out, ptr, size) < size);
}
void fill_pathname_base_noext(char *out, const char *in_path, size_t size)
{
fill_pathname_base(out, in_path, size);
path_remove_extension(out);
}
void fill_pathname_base_ext(char *out, const char *in_path, const char *ext,
size_t size)
{
fill_pathname_base_noext(out, in_path, size);
strlcat(out, ext, size);
}
/**
* fill_pathname_basedir:
* @out_dir : output directory
@ -364,6 +376,13 @@ void fill_pathname_basedir(char *out_dir,
path_basedir(out_dir);
}
void fill_pathname_basedir_noext(char *out_dir,
const char *in_path, size_t size)
{
fill_pathname_basedir(out_dir, in_path, size);
path_remove_extension(out_dir);
}
/**
* fill_pathname_parent_dir:
* @out_dir : output directory
@ -505,7 +524,7 @@ bool path_is_absolute(const char *path)
void path_resolve_realpath(char *buf, size_t size)
{
#ifndef RARCH_CONSOLE
char tmp[PATH_MAX_LENGTH];
char tmp[PATH_MAX_LENGTH] = {0};
strlcpy(tmp, buf, sizeof(tmp));
@ -546,8 +565,7 @@ void fill_pathname_resolve_relative(char *out_path,
return;
}
retro_assert(strlcpy(out_path, in_refpath, size) < size);
path_basedir(out_path);
fill_pathname_basedir(out_path, in_refpath, size);
retro_assert(strlcat(out_path, in_path, size) < size);
}
@ -574,7 +592,7 @@ void fill_pathname_join(char *out_path,
retro_assert(strlcat(out_path, path, size) < size);
}
void fill_string_join(char *out_path,
static void fill_string_join(char *out_path,
const char *append, size_t size)
{
if (*out_path)
@ -583,6 +601,33 @@ void fill_string_join(char *out_path,
retro_assert(strlcat(out_path, append, size) < size);
}
void fill_pathname_join_special_ext(char *out_path,
const char *dir, const char *path,
const char *last, const char *ext,
size_t size)
{
fill_pathname_join(out_path, dir, path, size);
fill_string_join(out_path, last, size);
strlcat(out_path, ext, size);
}
void fill_pathname_join_concat(char *out_path,
const char *dir, const char *path,
const char *concat,
size_t size)
{
fill_pathname_join(out_path, dir, path, size);
strlcat(out_path, concat, size);
}
void fill_pathname_join_noext(char *out_path,
const char *dir, const char *path, size_t size)
{
fill_pathname_join(out_path, dir, path, size);
path_remove_extension(out_path);
}
/**
* fill_pathname_join_delim:
* @out_path : output path
@ -606,6 +651,14 @@ void fill_pathname_join_delim(char *out_path, const char *dir,
retro_assert(strlcat(out_path, path, size) < size);
}
void fill_pathname_join_delim_concat(char *out_path, const char *dir,
const char *path, const char delim, const char *concat,
size_t size)
{
fill_pathname_join_delim(out_path, dir, path, delim, size);
strlcat(out_path, concat, size);
}
/**
* fill_short_pathname_representation:
* @out_rep : output representation
@ -625,11 +678,14 @@ void fill_short_pathname_representation(char* out_rep,
const char *in_path, size_t size)
{
char path_short[PATH_MAX_LENGTH] = {0};
#ifdef HAVE_COMPRESSION
char *last_hash = NULL;
#endif
fill_pathname(path_short, path_basename(in_path), "",
sizeof(path_short));
#ifdef HAVE_COMPRESSION
last_hash = (char*)strchr(path_short,'#');
if(last_hash != NULL)
{
@ -644,5 +700,13 @@ void fill_short_pathname_representation(char* out_rep,
strlcpy(out_rep, last_hash + 1, size);
}
else
#endif
strlcpy(out_rep, path_short, size);
}
void fill_short_pathname_representation_noext(char* out_rep,
const char *in_path, size_t size)
{
fill_short_pathname_representation(out_rep, in_path, size);
path_remove_extension(out_rep);
}

View File

@ -158,7 +158,7 @@ const char *retro_dirent_get_name(struct RDIR *rdir)
* Returns: true if directory listing entry is
* a directory, false if not.
*/
bool retro_dirent_is_dir(struct RDIR *rdir)
bool retro_dirent_is_dir(struct RDIR *rdir, const char *path)
{
#if defined(_WIN32)
const WIN32_FIND_DATA *entry = (const WIN32_FIND_DATA*)&rdir->entry;
@ -168,7 +168,7 @@ bool retro_dirent_is_dir(struct RDIR *rdir)
#if defined(PSP)
return (entry->d_stat.st_attr & FIO_SO_IFDIR) == FIO_SO_IFDIR;
#elif defined(VITA)
return PSP2_S_ISDIR(entry->d_stat.st_mode);
return SCE_S_ISDIR(entry->d_stat.st_mode);
#endif
#elif defined(__CELLOS_LV2__)
CellFsDirent *entry = (CellFsDirent*)&rdir->entry;
@ -178,13 +178,11 @@ bool retro_dirent_is_dir(struct RDIR *rdir)
if (entry->d_type == DT_DIR)
return true;
/* This can happen on certain file systems. */
const char *path = retro_dirent_get_name(rdir);
if (entry->d_type == DT_UNKNOWN || entry->d_type == DT_LNK)
return path_is_directory(path);
return false;
#else
/* dirent struct doesn't have d_type, do it the slow way ... */
const char *path = retro_dirent_get_name(rdir);
return path_is_directory(path);
#endif
}

View File

@ -62,7 +62,7 @@
#endif
#if defined(VITA)
#define FIO_S_ISDIR PSP2_S_ISDIR
#define FIO_S_ISDIR SCE_S_ISDIR
#endif
#if (defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)) || defined(__QNX__) || defined(PSP)

View File

@ -0,0 +1,624 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rbmp.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* Modified version of stb_image's BMP sources. */
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include <stddef.h> /* ptrdiff_t on osx */
#include <stdlib.h>
#include <string.h>
#include <retro_assert.h>
#include <retro_inline.h>
#include <formats/image.h>
#include <formats/rbmp.h>
typedef struct
{
int (*read) (void *user,char *data,int size); /* fill 'data' with 'size' bytes. return number of bytes actually read */
void (*skip) (void *user,int n); /* skip the next 'n' bytes, or 'unget' the last -n bytes if negative */
int (*eof) (void *user); /* returns nonzero if we are at end of file/data */
} rbmp_io_callbacks;
typedef struct
{
uint32_t img_x, img_y;
int img_n, img_out_n;
rbmp_io_callbacks io;
void *io_user_data;
int read_from_callbacks;
int buflen;
unsigned char buffer_start[128];
unsigned char *img_buffer, *img_buffer_end;
unsigned char *img_buffer_original;
} rbmp__context;
struct rbmp
{
uint8_t *buff_data;
uint32_t *output_image;
void *empty;
};
static void rbmp__refill_buffer(rbmp__context *s);
/* initialize a memory-decode context */
static void rbmp__start_mem(rbmp__context *s, unsigned char const *buffer, int len)
{
s->io.read = NULL;
s->read_from_callbacks = 0;
s->img_buffer = s->img_buffer_original = (unsigned char *) buffer;
s->img_buffer_end = (unsigned char *) buffer+len;
}
static unsigned char *rbmp__bmp_load(rbmp__context *s, unsigned *x, unsigned *y, int *comp, int req_comp);
#define rbmp__err(x,y) 0
#define rbmp__errpf(x,y) ((float *) (rbmp__err(x,y)?NULL:NULL))
#define rbmp__errpuc(x,y) ((unsigned char *) (rbmp__err(x,y)?NULL:NULL))
static unsigned char *rbmp_load_from_memory(unsigned char const *buffer, int len, unsigned *x, unsigned *y, int *comp, int req_comp)
{
rbmp__context s;
rbmp__start_mem(&s,buffer,len);
return rbmp__bmp_load(&s,x,y,comp,req_comp);
}
static void rbmp__refill_buffer(rbmp__context *s)
{
int n = (s->io.read)(s->io_user_data,(char*)s->buffer_start,s->buflen);
if (n == 0)
{
/* at end of file, treat same as if from memory, but need to handle case
* where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file */
s->read_from_callbacks = 0;
s->img_buffer = s->buffer_start;
s->img_buffer_end = s->buffer_start+1;
*s->img_buffer = 0;
}
else
{
s->img_buffer = s->buffer_start;
s->img_buffer_end = s->buffer_start + n;
}
}
static INLINE unsigned char rbmp__get8(rbmp__context *s)
{
if (s->img_buffer < s->img_buffer_end)
return *s->img_buffer++;
if (s->read_from_callbacks)
{
rbmp__refill_buffer(s);
return *s->img_buffer++;
}
return 0;
}
static void rbmp__skip(rbmp__context *s, int n)
{
if (n < 0)
{
s->img_buffer = s->img_buffer_end;
return;
}
if (s->io.read)
{
int blen = (int) (s->img_buffer_end - s->img_buffer);
if (blen < n)
{
s->img_buffer = s->img_buffer_end;
(s->io.skip)(s->io_user_data, n - blen);
return;
}
}
s->img_buffer += n;
}
static int rbmp__get16le(rbmp__context *s)
{
int z = rbmp__get8(s);
return z + (rbmp__get8(s) << 8);
}
static uint32_t rbmp__get32le(rbmp__context *s)
{
uint32_t z = rbmp__get16le(s);
return z + (rbmp__get16le(s) << 16);
}
#define RBMP__BYTECAST(x) ((unsigned char) ((x) & 255)) /* truncate int to byte without warnings */
static unsigned char rbmp__compute_y(int r, int g, int b)
{
return (unsigned char) (((r*77) + (g*150) + (29*b)) >> 8);
}
static unsigned char *rbmp__convert_format(
unsigned char *data,
int img_n,
int req_comp,
unsigned int x,
unsigned int y)
{
int i,j;
unsigned char *good;
if (req_comp == img_n) return data;
retro_assert(req_comp >= 1 && req_comp <= 4);
good = (unsigned char *) malloc(req_comp * x * y);
if (good == NULL)
{
free(data);
return rbmp__errpuc("outofmem", "Out of memory");
}
for (j=0; j < (int) y; ++j)
{
unsigned char *src = data + j * x * img_n ;
unsigned char *dest = good + j * x * req_comp;
switch (((img_n)*8+(req_comp)))
{
case ((1)*8+(2)):
for(i=x-1; i >= 0; --i, src += 1, dest += 2)
dest[0]=src[0], dest[1]=255;
break;
case ((1)*8+(3)):
for(i=x-1; i >= 0; --i, src += 1, dest += 3)
dest[0]=dest[1]=dest[2]=src[0];
break;
case ((1)*8+(4)):
for(i=x-1; i >= 0; --i, src += 1, dest += 4)
dest[0]=dest[1]=dest[2]=src[0], dest[3]=255;
break;
case ((2)*8+(1)):
for(i=x-1; i >= 0; --i, src += 2, dest += 1)
dest[0]=src[0];
break;
case ((2)*8+(3)):
for(i=x-1; i >= 0; --i, src += 2, dest += 3)
dest[0]=dest[1]=dest[2]=src[0];
break;
case ((2)*8+(4)):
for(i=x-1; i >= 0; --i, src += 2, dest += 4)
dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1];
break;
case ((3)*8+(4)):
for(i=x-1; i >= 0; --i, src += 3, dest += 4)
dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255;
break;
case ((3)*8+(1)):
for(i=x-1; i >= 0; --i, src += 3, dest += 1)
dest[0]=rbmp__compute_y(src[0],src[1],src[2]);
break;
case ((3)*8+(2)):
for(i=x-1; i >= 0; --i, src += 3, dest += 2)
dest[0]=rbmp__compute_y(src[0],src[1],src[2]), dest[1] = 255;
break;
case ((4)*8+(1)):
for(i=x-1; i >= 0; --i, src += 4, dest += 1)
dest[0]=rbmp__compute_y(src[0],src[1],src[2]);
break;
case ((4)*8+(2)):
for(i=x-1; i >= 0; --i, src += 4, dest += 2)
dest[0]=rbmp__compute_y(src[0],src[1],src[2]), dest[1] = src[3];
break;
case ((4)*8+(3)):
for(i=x-1; i >= 0; --i, src += 4, dest += 3)
dest[0]=src[0],dest[1]=src[1],dest[2]=src[2];
break;
default:
retro_assert(0);
break;
}
}
free(data);
return good;
}
/* Microsoft/Windows BMP image */
/* returns 0..31 for the highest set bit */
static int rbmp__high_bit(unsigned int z)
{
int n=0;
if (z == 0) return -1;
if (z >= 0x10000) n += 16, z >>= 16;
if (z >= 0x00100) n += 8, z >>= 8;
if (z >= 0x00010) n += 4, z >>= 4;
if (z >= 0x00004) n += 2, z >>= 2;
if (z >= 0x00002) n += 1, z >>= 1;
return n;
}
static int rbmp__bitcount(unsigned int a)
{
a = (a & 0x55555555) + ((a >> 1) & 0x55555555); /* max 2 */
a = (a & 0x33333333) + ((a >> 2) & 0x33333333); /* max 4 */
a = (a + (a >> 4)) & 0x0f0f0f0f; /* max 8 per 4, now 8 bits */
a = (a + (a >> 8)); /* max 16 per 8 bits */
a = (a + (a >> 16)); /* max 32 per 8 bits */
return a & 0xff;
}
static int rbmp__shiftsigned(int v, int shift, int bits)
{
int result;
int z=0;
if (shift < 0)
v <<= -shift;
else
v >>= shift;
result = v;
z = bits;
while (z < 8)
{
result += v >> z;
z += bits;
}
return result;
}
static unsigned char *rbmp__bmp_load(rbmp__context *s, unsigned *x, unsigned *y, int *comp, int req_comp)
{
unsigned char *out;
unsigned int mr=0,mg=0,mb=0,ma=0;
unsigned char pal[256][4];
int psize=0,i,j,compress=0,width;
int bpp, flip_vertically, pad, target, offset, hsz;
if (rbmp__get8(s) != 'B' || rbmp__get8(s) != 'M')
return rbmp__errpuc("not BMP", "Corrupt BMP");
rbmp__get32le(s); /* discard filesize */
rbmp__get16le(s); /* discard reserved */
rbmp__get16le(s); /* discard reserved */
offset = rbmp__get32le(s);
hsz = rbmp__get32le(s);
if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108 && hsz != 124)
return rbmp__errpuc("unknown BMP", "BMP type not supported: unknown");
if (hsz == 12)
{
s->img_x = rbmp__get16le(s);
s->img_y = rbmp__get16le(s);
}
else
{
s->img_x = rbmp__get32le(s);
s->img_y = rbmp__get32le(s);
}
if (rbmp__get16le(s) != 1)
return rbmp__errpuc("bad BMP", "bad BMP");
bpp = rbmp__get16le(s);
if (bpp == 1)
return rbmp__errpuc("monochrome", "BMP type not supported: 1-bit");
flip_vertically = ((int) s->img_y) > 0;
s->img_y = abs((int) s->img_y);
if (hsz == 12)
{
if (bpp < 24)
psize = (offset - 14 - 24) / 3;
}
else
{
compress = rbmp__get32le(s);
if (compress == 1 || compress == 2)
return rbmp__errpuc("BMP RLE", "BMP type not supported: RLE");
rbmp__get32le(s); /* discard sizeof */
rbmp__get32le(s); /* discard hres */
rbmp__get32le(s); /* discard vres */
rbmp__get32le(s); /* discard colors used */
rbmp__get32le(s); /* discard max important */
if (hsz == 40 || hsz == 56)
{
if (hsz == 56)
{
rbmp__get32le(s);
rbmp__get32le(s);
rbmp__get32le(s);
rbmp__get32le(s);
}
if (bpp == 16 || bpp == 32)
{
mr = mg = mb = 0;
switch (compress)
{
case 0:
if (bpp == 32)
{
mr = 0xffu << 16;
mg = 0xffu << 8;
mb = 0xffu << 0;
ma = 0xffu << 24;
}
else
{
mr = 31u << 10;
mg = 31u << 5;
mb = 31u << 0;
}
break;
case 3:
mr = rbmp__get32le(s);
mg = rbmp__get32le(s);
mb = rbmp__get32le(s);
/* not documented, but generated by photoshop and handled by mspaint */
if (mr == mg && mg == mb)
return rbmp__errpuc("bad BMP", "bad BMP");
break;
default:
break;
}
return rbmp__errpuc("bad BMP", "bad BMP");
}
}
else
{
retro_assert(hsz == 108 || hsz == 124);
mr = rbmp__get32le(s);
mg = rbmp__get32le(s);
mb = rbmp__get32le(s);
ma = rbmp__get32le(s);
rbmp__get32le(s); /* discard color space */
for (i=0; i < 12; ++i)
rbmp__get32le(s); /* discard color space parameters */
if (hsz == 124)
{
rbmp__get32le(s); /* discard rendering intent */
rbmp__get32le(s); /* discard offset of profile data */
rbmp__get32le(s); /* discard size of profile data */
rbmp__get32le(s); /* discard reserved */
}
}
if (bpp < 16)
psize = (offset - 14 - hsz) >> 2;
}
s->img_n = ma ? 4 : 3;
if (req_comp && req_comp >= 3) /* we can directly decode 3 or 4 */
target = req_comp;
else
target = s->img_n; /* if they want monochrome, we'll post-convert */
out = (unsigned char *) malloc(target * s->img_x * s->img_y);
if (!out)
return rbmp__errpuc("outofmem", "Out of memory");
if (bpp < 16)
{
int z=0;
if (psize == 0 || psize > 256)
{
free(out);
return rbmp__errpuc("invalid", "Corrupt BMP");
}
for (i=0; i < psize; ++i)
{
pal[i][2] = rbmp__get8(s);
pal[i][1] = rbmp__get8(s);
pal[i][0] = rbmp__get8(s);
if (hsz != 12) rbmp__get8(s);
pal[i][3] = 255;
}
rbmp__skip(s, offset - 14 - hsz - psize * (hsz == 12 ? 3 : 4));
if (bpp == 4)
width = (s->img_x + 1) >> 1;
else if (bpp == 8)
width = s->img_x;
else
{
free(out);
return rbmp__errpuc("bad bpp", "Corrupt BMP");
}
pad = (-width)&3;
for (j=0; j < (int) s->img_y; ++j)
{
for (i=0; i < (int) s->img_x; i += 2)
{
int v=rbmp__get8(s),v2=0;
if (bpp == 4)
{
v2 = v & 15;
v >>= 4;
}
out[z++] = pal[v][0];
out[z++] = pal[v][1];
out[z++] = pal[v][2];
if (target == 4) out[z++] = 255;
if (i+1 == (int) s->img_x) break;
v = (bpp == 8) ? rbmp__get8(s) : v2;
out[z++] = pal[v][0];
out[z++] = pal[v][1];
out[z++] = pal[v][2];
if (target == 4) out[z++] = 255;
}
rbmp__skip(s, pad);
}
}
else
{
int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0;
int z = 0;
int easy=0;
rbmp__skip(s, offset - 14 - hsz);
if (bpp == 24) width = 3 * s->img_x;
else if (bpp == 16) width = 2*s->img_x;
else /* bpp = 32 and pad = 0 */ width=0;
pad = (-width) & 3;
switch (bpp)
{
case 24:
easy = 1;
break;
case 32:
if (mb == 0xff && mg == 0xff00 && mr == 0x00ff0000 && ma == 0xff000000)
easy = 2;
break;
default:
break;
}
if (!easy)
{
if (!mr || !mg || !mb)
{
free(out);
return rbmp__errpuc("bad masks", "Corrupt BMP");
}
/* right shift amt to put high bit in position #7 */
rshift = rbmp__high_bit(mr)-7; rcount = rbmp__bitcount(mr);
gshift = rbmp__high_bit(mg)-7; gcount = rbmp__bitcount(mg);
bshift = rbmp__high_bit(mb)-7; bcount = rbmp__bitcount(mb);
ashift = rbmp__high_bit(ma)-7; acount = rbmp__bitcount(ma);
}
for (j=0; j < (int) s->img_y; ++j)
{
if (easy)
{
for (i=0; i < (int) s->img_x; ++i)
{
unsigned char a;
out[z+2] = rbmp__get8(s);
out[z+1] = rbmp__get8(s);
out[z+0] = rbmp__get8(s);
z += 3;
a = (easy == 2 ? rbmp__get8(s) : 255);
if (target == 4) out[z++] = a;
}
}
else
{
for (i=0; i < (int) s->img_x; ++i)
{
uint32_t v = (bpp == 16 ? (uint32_t) rbmp__get16le(s) : rbmp__get32le(s));
int a;
out[z++] = RBMP__BYTECAST(rbmp__shiftsigned(v & mr, rshift, rcount));
out[z++] = RBMP__BYTECAST(rbmp__shiftsigned(v & mg, gshift, gcount));
out[z++] = RBMP__BYTECAST(rbmp__shiftsigned(v & mb, bshift, bcount));
a = (ma ? rbmp__shiftsigned(v & ma, ashift, acount) : 255);
if (target == 4) out[z++] = RBMP__BYTECAST(a);
}
}
rbmp__skip(s, pad);
}
}
if (flip_vertically)
{
unsigned char t;
for (j=0; j < (int) s->img_y>>1; ++j)
{
unsigned char *p1 = out + j *s->img_x*target;
unsigned char *p2 = out + (s->img_y-1-j)*s->img_x*target;
for (i=0; i < (int) s->img_x*target; ++i)
{
t = p1[i], p1[i] = p2[i], p2[i] = t;
}
}
}
if (req_comp && req_comp != target)
{
out = rbmp__convert_format(out, target, req_comp, s->img_x, s->img_y);
if (out == NULL)
return out; /* rbmp__convert_format frees input on failure */
}
*x = s->img_x;
*y = s->img_y;
if (comp) *comp = s->img_n;
return out;
}
static void rbmp_convert_frame(uint32_t *frame, unsigned width, unsigned height)
{
uint32_t *end = frame + (width * height * sizeof(uint32_t))/4;
while(frame < end)
{
uint32_t pixel = *frame;
*frame = (pixel & 0xff00ff00) | ((pixel << 16) & 0x00ff0000) | ((pixel >> 16) & 0xff);
frame++;
}
}
int rbmp_process_image(rbmp_t *rbmp, void **buf_data,
size_t size, unsigned *width, unsigned *height)
{
int comp;
if (!rbmp)
return IMAGE_PROCESS_ERROR;
rbmp->output_image = (uint32_t*)rbmp_load_from_memory(rbmp->buff_data, size, width, height, &comp, 4);
*buf_data = rbmp->output_image;
rbmp_convert_frame(rbmp->output_image, *width, *height);
return IMAGE_PROCESS_END;
}
bool rbmp_set_buf_ptr(rbmp_t *rbmp, void *data)
{
if (!rbmp)
return false;
rbmp->buff_data = (uint8_t*)data;
return true;
}
void rbmp_free(rbmp_t *rbmp)
{
if (!rbmp)
return;
free(rbmp);
}
rbmp_t *rbmp_alloc(void)
{
rbmp_t *rbmp = (rbmp_t*)calloc(1, sizeof(*rbmp));
if (!rbmp)
return NULL;
return rbmp;
}

View File

@ -28,10 +28,10 @@
static bool write_header_bmp(RFILE *file, unsigned width, unsigned height, bool is32bpp)
{
uint8_t header[54];
unsigned line_size = (width * (is32bpp?4:3) + 3) & ~3;
unsigned size = line_size * height + 54;
unsigned size_array = line_size * height;
uint8_t header[54];
/* Generic BMP stuff. */
@ -140,9 +140,9 @@ static void dump_line_32_to_24(uint8_t *line, const uint32_t *src, unsigned widt
static void dump_content(RFILE *file, const void *frame,
int width, int height, int pitch, enum rbmp_source_type type)
{
uint8_t *line;
size_t line_size;
int j;
size_t line_size;
uint8_t *line = NULL;
int bytes_per_pixel = (type==RBMP_SOURCE_TYPE_ARGB8888?4:3);
union
{
@ -151,59 +151,70 @@ static void dump_content(RFILE *file, const void *frame,
const uint32_t *u32;
} u;
u.u8 = (const uint8_t*)frame + (height-1) * pitch;
u.u8 = (const uint8_t*)frame;
line_size = (width * bytes_per_pixel + 3) & ~3;
if (type == RBMP_SOURCE_TYPE_BGR24)
switch (type)
{
/* BGR24 byte order input matches output. Can directly copy, but... need to make sure we pad it. */
uint32_t zeros = 0;
int pad = line_size-pitch;
for (j = height-1; j >= 0; j--, u.u8 -= pitch)
{
filestream_write(file, u.u8, pitch);
if(pad != 0)
filestream_write(file, &zeros, pad);
}
return;
}
else if(type == RBMP_SOURCE_TYPE_ARGB8888)
{
/* ARGB8888 byte order input matches output. Can directly copy. */
for (j = height-1; j >= 0; j--, u.u8 -= pitch)
filestream_write(file, u.u8, line_size);
return;
case RBMP_SOURCE_TYPE_BGR24:
{
/* BGR24 byte order input matches output. Can directly copy, but... need to make sure we pad it. */
uint32_t zeros = 0;
int pad = line_size-pitch;
for (j = 0; j < height; j++, u.u8 += pitch)
{
filestream_write(file, u.u8, pitch);
if(pad != 0)
filestream_write(file, &zeros, pad);
}
}
break;
case RBMP_SOURCE_TYPE_ARGB8888:
/* ARGB8888 byte order input matches output. Can directly copy. */
for (j = 0; j < height; j++, u.u8 += pitch)
filestream_write(file, u.u8, line_size);
return;
default:
break;
}
/* allocate line buffer, and initialize the final four bytes to zero, for deterministic padding */
line = (uint8_t*)malloc(line_size);
if (!line) return;
if (!line)
return;
*(uint32_t*)(line + line_size - 4) = 0;
if (type == RBMP_SOURCE_TYPE_XRGB888)
switch (type)
{
for (j = height-1; j >= 0; j--, u.u8 -= pitch)
{
dump_line_32_to_24(line, u.u32, width);
filestream_write(file, line, line_size);
}
}
else /* type == RBMP_SOURCE_TYPE_RGB565 */
{
for (j = height-1; j >= 0; j--, u.u8 -= pitch)
{
dump_line_565_to_24(line, u.u16, width);
filestream_write(file, line, line_size);
}
case RBMP_SOURCE_TYPE_XRGB888:
for (j = 0; j < height; j++, u.u8 += pitch)
{
dump_line_32_to_24(line, u.u32, width);
filestream_write(file, line, line_size);
}
break;
case RBMP_SOURCE_TYPE_RGB565:
for (j = 0; j < height; j++, u.u8 += pitch)
{
dump_line_565_to_24(line, u.u16, width);
filestream_write(file, line, line_size);
}
break;
default:
break;
}
/* Free allocated line buffer */
free(line);
}
bool rbmp_save_image(const char *filename, const void *frame,
bool rbmp_save_image(
const char *filename,
const void *frame,
unsigned width, unsigned height,
unsigned pitch, enum rbmp_source_type type)
{
bool ret;
bool ret = false;
RFILE *file = filestream_open(filename, RFILE_MODE_WRITE, -1);
if (!file)
return false;

View File

@ -0,0 +1,322 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (image_texture.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <boolean.h>
#include <formats/image.h>
#include <file/nbio.h>
enum video_image_format
{
IMAGE_FORMAT_NONE = 0,
IMAGE_FORMAT_TGA,
IMAGE_FORMAT_PNG,
IMAGE_FORMAT_JPEG,
IMAGE_FORMAT_BMP
};
static bool image_texture_supports_rgba = false;
void image_texture_set_rgba(void)
{
image_texture_supports_rgba = true;
}
void image_texture_unset_rgba(void)
{
image_texture_supports_rgba = false;
}
bool image_texture_set_color_shifts(
unsigned *r_shift, unsigned *g_shift, unsigned *b_shift,
unsigned *a_shift)
{
*a_shift = 24;
*r_shift = 16;
*g_shift = 8;
*b_shift = 0;
if (image_texture_supports_rgba)
{
*r_shift = 0;
*b_shift = 16;
return true;
}
return false;
}
bool image_texture_color_convert(unsigned r_shift,
unsigned g_shift, unsigned b_shift, unsigned a_shift,
struct texture_image *out_img)
{
/* This is quite uncommon. */
if (a_shift != 24 || r_shift != 16 || g_shift != 8 || b_shift != 0)
{
uint32_t i;
uint32_t num_pixels = out_img->width * out_img->height;
uint32_t *pixels = (uint32_t*)out_img->pixels;
for (i = 0; i < num_pixels; i++)
{
uint32_t col = pixels[i];
uint8_t a = (uint8_t)(col >> 24);
uint8_t r = (uint8_t)(col >> 16);
uint8_t g = (uint8_t)(col >> 8);
uint8_t b = (uint8_t)(col >> 0);
pixels[i] = (a << a_shift) |
(r << r_shift) | (g << g_shift) | (b << b_shift);
}
return true;
}
return false;
}
#ifdef GEKKO
#define GX_BLIT_LINE_32(off) \
{ \
unsigned x; \
const uint16_t *tmp_src = src; \
uint16_t *tmp_dst = dst; \
for (x = 0; x < width2 >> 3; x++, tmp_src += 8, tmp_dst += 32) \
{ \
tmp_dst[ 0 + off] = tmp_src[0]; \
tmp_dst[ 16 + off] = tmp_src[1]; \
tmp_dst[ 1 + off] = tmp_src[2]; \
tmp_dst[ 17 + off] = tmp_src[3]; \
tmp_dst[ 2 + off] = tmp_src[4]; \
tmp_dst[ 18 + off] = tmp_src[5]; \
tmp_dst[ 3 + off] = tmp_src[6]; \
tmp_dst[ 19 + off] = tmp_src[7]; \
} \
src += tmp_pitch; \
}
static bool image_texture_internal_gx_convert_texture32(
struct texture_image *image)
{
unsigned tmp_pitch, width2, i;
const uint16_t *src = NULL;
uint16_t *dst = NULL;
/* Memory allocation in libogc is extremely primitive so try
* to avoid gaps in memory when converting by copying over to
* a temporary buffer first, then converting over into
* main buffer again. */
void *tmp = malloc(image->width
* image->height * sizeof(uint32_t));
if (!tmp)
return false;
memcpy(tmp, image->pixels, image->width
* image->height * sizeof(uint32_t));
tmp_pitch = (image->width * sizeof(uint32_t)) >> 1;
image->width &= ~3;
image->height &= ~3;
width2 = image->width << 1;
src = (uint16_t*)tmp;
dst = (uint16_t*)image->pixels;
for (i = 0; i < image->height; i += 4, dst += 4 * width2)
{
GX_BLIT_LINE_32(0)
GX_BLIT_LINE_32(4)
GX_BLIT_LINE_32(8)
GX_BLIT_LINE_32(12)
}
free(tmp);
return true;
}
#endif
static bool image_texture_load_internal(
enum image_type_enum type,
void *ptr,
size_t len,
struct texture_image *out_img,
unsigned a_shift, unsigned r_shift,
unsigned g_shift, unsigned b_shift)
{
int ret;
bool success = false;
void *img = image_transfer_new(type);
if (!img)
goto end;
image_transfer_set_buffer_ptr(img, type, (uint8_t*)ptr);
if (!image_transfer_start(img, type))
goto end;
while (image_transfer_iterate(img, type));
if (!image_transfer_is_valid(img, type))
goto end;
do
{
ret = image_transfer_process(img, type,
(uint32_t**)&out_img->pixels, len, &out_img->width,
&out_img->height);
}while(ret == IMAGE_PROCESS_NEXT);
if (ret == IMAGE_PROCESS_ERROR || ret == IMAGE_PROCESS_ERROR_END)
goto end;
image_texture_color_convert(r_shift, g_shift, b_shift,
a_shift, out_img);
#ifdef GEKKO
if (!image_texture_internal_gx_convert_texture32(out_img))
{
image_texture_free(out_img);
goto end;
}
#endif
success = true;
end:
if (img)
image_transfer_free(img, type);
return success;
}
void image_texture_free(struct texture_image *img)
{
if (!img)
return;
if (img->pixels)
free(img->pixels);
memset(img, 0, sizeof(*img));
}
static enum video_image_format image_texture_get_type(const char *path)
{
#ifdef HAVE_RTGA
if (strstr(path, ".tga"))
return IMAGE_FORMAT_TGA;
#endif
#ifdef HAVE_RPNG
if (strstr(path, ".png"))
return IMAGE_FORMAT_PNG;
#endif
#ifdef HAVE_RJPEG
if (strstr(path, ".jpg") || strstr(path, ".jpeg"))
return IMAGE_FORMAT_JPEG;
#endif
#ifdef HAVE_RBMP
if (strstr(path, ".bmp"))
return IMAGE_FORMAT_BMP;
#endif
return IMAGE_FORMAT_NONE;
}
static enum image_type_enum image_texture_convert_fmt_to_type(enum video_image_format fmt)
{
switch (fmt)
{
#ifdef HAVE_RPNG
case IMAGE_FORMAT_PNG:
return IMAGE_TYPE_PNG;
#endif
#ifdef HAVE_RJPEG
case IMAGE_FORMAT_JPEG:
return IMAGE_TYPE_JPEG;
#endif
#ifdef HAVE_RBMP
case IMAGE_FORMAT_BMP:
return IMAGE_TYPE_BMP;
#endif
#ifdef HAVE_RTGA
case IMAGE_FORMAT_TGA:
return IMAGE_TYPE_TGA;
#endif
case IMAGE_FORMAT_NONE:
default:
break;
}
return IMAGE_TYPE_NONE;
}
bool image_texture_load(struct texture_image *out_img,
const char *path)
{
unsigned r_shift, g_shift, b_shift, a_shift;
size_t file_len = 0;
struct nbio_t *handle = NULL;
void *ptr = NULL;
enum video_image_format fmt = image_texture_get_type(path);
image_texture_set_color_shifts(&r_shift, &g_shift, &b_shift,
&a_shift);
if (fmt != IMAGE_FORMAT_NONE)
{
handle = (struct nbio_t*)nbio_open(path, NBIO_READ);
if (!handle)
goto error;
nbio_begin_read(handle);
while (!nbio_iterate(handle));
ptr = nbio_get_ptr(handle, &file_len);
if (!ptr)
goto error;
if (image_texture_load_internal(
image_texture_convert_fmt_to_type(fmt),
ptr, file_len, out_img,
a_shift, r_shift, g_shift, b_shift))
goto success;
}
error:
out_img->pixels = NULL;
out_img->width = 0;
out_img->height = 0;
if (handle)
nbio_free(handle);
return false;
success:
if (handle)
nbio_free(handle);
return true;
}

View File

@ -0,0 +1,282 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (image_transfer.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdint.h>
#include <string.h>
#include <errno.h>
#ifdef HAVE_RPNG
#include <formats/rpng.h>
#endif
#ifdef HAVE_RJPEG
#include <formats/rjpeg.h>
#endif
#ifdef HAVE_RTGA
#include <formats/rtga.h>
#endif
#ifdef HAVE_RBMP
#include <formats/rbmp.h>
#endif
#include <formats/image.h>
void image_transfer_free(void *data, enum image_type_enum type)
{
switch (type)
{
case IMAGE_TYPE_TGA:
#ifdef HAVE_RTGA
rtga_free((rtga_t*)data);
#endif
break;
case IMAGE_TYPE_PNG:
#ifdef HAVE_RPNG
rpng_free((rpng_t*)data);
#endif
break;
case IMAGE_TYPE_JPEG:
#ifdef HAVE_RJPEG
rjpeg_free((rjpeg_t*)data);
#endif
break;
case IMAGE_TYPE_BMP:
#ifdef HAVE_RBMP
rbmp_free((rbmp_t*)data);
#endif
break;
case IMAGE_TYPE_NONE:
break;
}
}
void *image_transfer_new(enum image_type_enum type)
{
switch (type)
{
case IMAGE_TYPE_PNG:
#ifdef HAVE_RPNG
return rpng_alloc();
#else
break;
#endif
case IMAGE_TYPE_JPEG:
#ifdef HAVE_RJPEG
return rjpeg_alloc();
#else
break;
#endif
case IMAGE_TYPE_TGA:
#ifdef HAVE_RTGA
return rtga_alloc();
#else
break;
#endif
case IMAGE_TYPE_BMP:
#ifdef HAVE_RBMP
return rbmp_alloc();
#else
break;
#endif
default:
break;
}
return NULL;
}
bool image_transfer_start(void *data, enum image_type_enum type)
{
switch (type)
{
case IMAGE_TYPE_PNG:
#ifdef HAVE_RPNG
if (!rpng_start((rpng_t*)data))
break;
return true;
#else
break;
#endif
case IMAGE_TYPE_JPEG:
#ifdef HAVE_RJPEG
return true;
#else
break;
#endif
case IMAGE_TYPE_TGA:
#ifdef HAVE_RTGA
return true;
#else
break;
#endif
case IMAGE_TYPE_BMP:
return true;
case IMAGE_TYPE_NONE:
break;
}
return false;
}
bool image_transfer_is_valid(
void *data,
enum image_type_enum type)
{
switch (type)
{
case IMAGE_TYPE_PNG:
#ifdef HAVE_RPNG
return rpng_is_valid((rpng_t*)data);
#else
break;
#endif
case IMAGE_TYPE_JPEG:
#ifdef HAVE_RJPEG
return true;
#else
break;
#endif
case IMAGE_TYPE_TGA:
#ifdef HAVE_RTGA
return true;
#else
break;
#endif
case IMAGE_TYPE_BMP:
return true;
case IMAGE_TYPE_NONE:
break;
}
return false;
}
void image_transfer_set_buffer_ptr(
void *data,
enum image_type_enum type,
void *ptr)
{
switch (type)
{
case IMAGE_TYPE_PNG:
#ifdef HAVE_RPNG
rpng_set_buf_ptr((rpng_t*)data, (uint8_t*)ptr);
#endif
break;
case IMAGE_TYPE_JPEG:
#ifdef HAVE_RJPEG
rjpeg_set_buf_ptr((rjpeg_t*)data, (uint8_t*)ptr);
#endif
break;
case IMAGE_TYPE_TGA:
#ifdef HAVE_RTGA
rtga_set_buf_ptr((rtga_t*)data, (uint8_t*)ptr);
#endif
break;
case IMAGE_TYPE_BMP:
#ifdef HAVE_RBMP
rbmp_set_buf_ptr((rbmp_t*)data, (uint8_t*)ptr);
#endif
break;
case IMAGE_TYPE_NONE:
break;
}
}
int image_transfer_process(
void *data,
enum image_type_enum type,
uint32_t **buf, size_t len,
unsigned *width, unsigned *height)
{
switch (type)
{
case IMAGE_TYPE_PNG:
#ifdef HAVE_RPNG
if (!rpng_is_valid((rpng_t*)data))
return IMAGE_PROCESS_ERROR;
return rpng_process_image(
(rpng_t*)data,
(void**)buf, len, width, height);
#else
break;
#endif
case IMAGE_TYPE_JPEG:
#ifdef HAVE_RJPEG
return rjpeg_process_image((rjpeg_t*)data,
(void**)buf, len, width, height);
#else
break;
#endif
case IMAGE_TYPE_TGA:
#ifdef HAVE_RTGA
return rtga_process_image((rtga_t*)data,
(void**)buf, len, width, height);
#else
break;
#endif
case IMAGE_TYPE_BMP:
#ifdef HAVE_RBMP
return rbmp_process_image((rbmp_t*)data,
(void**)buf, len, width, height);
#else
break;
#endif
case IMAGE_TYPE_NONE:
break;
}
return 0;
}
bool image_transfer_iterate(void *data, enum image_type_enum type)
{
switch (type)
{
case IMAGE_TYPE_PNG:
#ifdef HAVE_RPNG
if (!rpng_iterate_image((rpng_t*)data))
return false;
#endif
break;
case IMAGE_TYPE_JPEG:
#ifdef HAVE_RJPEG
return false;
#else
break;
#endif
case IMAGE_TYPE_TGA:
#ifdef HAVE_RTGA
return false;
#else
break;
#endif
case IMAGE_TYPE_BMP:
return false;
case IMAGE_TYPE_NONE:
return false;
}
return true;
}

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@
#endif
#include <boolean.h>
#include <file/nbio.h>
#include <formats/image.h>
#include <formats/rpng.h>
#include <file/archive_file.h>
@ -61,6 +61,7 @@ enum png_chunk_type
PNG_CHUNK_IHDR,
PNG_CHUNK_IDAT,
PNG_CHUNK_PLTE,
PNG_CHUNK_tRNS,
PNG_CHUNK_IEND
};
@ -85,9 +86,8 @@ struct png_chunk
uint8_t *data;
};
struct rpng_process_t
struct rpng_process
{
bool initialized;
bool inflate_initialized;
bool adam7_pass_initialized;
bool pass_initialized;
@ -117,25 +117,18 @@ struct rpng_process_t
struct rpng
{
struct rpng_process_t process;
struct rpng_process *process;
bool has_ihdr;
bool has_idat;
bool has_iend;
bool has_plte;
bool has_trns;
struct idat_buffer idat_buf;
struct png_ihdr ihdr;
uint8_t *buff_data;
uint32_t palette[256];
};
enum png_process_code
{
PNG_PROCESS_ERROR = -2,
PNG_PROCESS_ERROR_END = -1,
PNG_PROCESS_NEXT = 0,
PNG_PROCESS_END = 1
};
static INLINE uint32_t dword_be(const uint8_t *buf)
{
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | (buf[3] << 0);
@ -153,6 +146,7 @@ static enum png_chunk_type png_chunk_type(const struct png_chunk *chunk)
{ "IDAT", PNG_CHUNK_IDAT },
{ "IEND", PNG_CHUNK_IEND },
{ "PLTE", PNG_CHUNK_PLTE },
{ "tRNS", PNG_CHUNK_tRNS },
};
for (i = 0; i < ARRAY_SIZE(chunk_map); i++)
@ -333,18 +327,100 @@ static void png_reverse_filter_copy_line_plt(uint32_t *data,
const uint8_t *decoded, unsigned width,
unsigned depth, const uint32_t *palette)
{
unsigned i, bit;
unsigned mask = (1 << depth) - 1;
bit = 0;
for (i = 0; i < width; i++, bit += depth)
switch (depth)
{
unsigned byte = bit >> 3;
unsigned val = decoded[byte] >> (8 - depth - (bit & 7));
val &= mask;
data[i] = palette[val];
case 1:
{
unsigned w = width / 8;
unsigned i;
for (i = 0; i < w; i++, decoded++)
{
*data++ = palette[(*decoded >> 7) & 1];
*data++ = palette[(*decoded >> 6) & 1];
*data++ = palette[(*decoded >> 5) & 1];
*data++ = palette[(*decoded >> 4) & 1];
*data++ = palette[(*decoded >> 3) & 1];
*data++ = palette[(*decoded >> 2) & 1];
*data++ = palette[(*decoded >> 1) & 1];
*data++ = palette[*decoded & 1];
}
switch (width & 7)
{
case 7:
data[6] = palette[(*decoded >> 1) & 1];
case 6:
data[5] = palette[(*decoded >> 2) & 1];
case 5:
data[4] = palette[(*decoded >> 3) & 1];
case 4:
data[3] = palette[(*decoded >> 4) & 1];
case 3:
data[2] = palette[(*decoded >> 5) & 1];
case 2:
data[1] = palette[(*decoded >> 6) & 1];
case 1:
data[0] = palette[(*decoded >> 7) & 1];
break;
}
}
break;
case 2:
{
unsigned w = width / 4;
unsigned i;
for (i = 0; i < w; i++, decoded++)
{
*data++ = palette[(*decoded >> 6) & 3];
*data++ = palette[(*decoded >> 4) & 3];
*data++ = palette[(*decoded >> 2) & 3];
*data++ = palette[*decoded & 3];
}
switch (width & 3)
{
case 3:
data[2] = palette[(*decoded >> 2) & 3];
case 2:
data[1] = palette[(*decoded >> 4) & 3];
case 1:
data[0] = palette[(*decoded >> 6) & 3];
break;
}
}
break;
case 4:
{
unsigned w = width / 2;
unsigned i;
for (i = 0; i < w; i++, decoded++)
{
*data++ = palette[*decoded >> 4];
*data++ = palette[*decoded & 0x0f];
}
if (width & 1)
{
*data = palette[*decoded >> 4];
}
}
break;
case 8:
{
unsigned i;
for (i = 0; i < width; i++, decoded++, data++)
{
*data = palette[*decoded];
}
}
break;
}
}
@ -410,7 +486,7 @@ static void png_reverse_filter_adam7_deinterlace_pass(uint32_t *data,
}
}
static void png_reverse_filter_deinit(struct rpng_process_t *pngp)
static void png_reverse_filter_deinit(struct rpng_process *pngp)
{
if (pngp->decoded_scanline)
free(pngp->decoded_scanline);
@ -434,7 +510,7 @@ static const struct adam7_pass passes[] = {
};
static int png_reverse_filter_init(const struct png_ihdr *ihdr,
struct rpng_process_t *pngp)
struct rpng_process *pngp)
{
size_t pass_size;
@ -500,7 +576,7 @@ error:
}
static int png_reverse_filter_copy_line(uint32_t *data, const struct png_ihdr *ihdr,
struct rpng_process_t *pngp, unsigned filter)
struct rpng_process *pngp, unsigned filter)
{
unsigned i;
@ -540,7 +616,7 @@ static int png_reverse_filter_copy_line(uint32_t *data, const struct png_ihdr *i
break;
default:
return PNG_PROCESS_ERROR_END;
return IMAGE_PROCESS_ERROR_END;
}
switch (ihdr->color_type)
@ -566,13 +642,13 @@ static int png_reverse_filter_copy_line(uint32_t *data, const struct png_ihdr *i
memcpy(pngp->prev_scanline, pngp->decoded_scanline, pngp->pitch);
return PNG_PROCESS_NEXT;
return IMAGE_PROCESS_NEXT;
}
static int png_reverse_filter_regular_iterate(uint32_t **data, const struct png_ihdr *ihdr,
struct rpng_process_t *pngp)
struct rpng_process *pngp)
{
int ret = PNG_PROCESS_END;
int ret = IMAGE_PROCESS_END;
if (pngp->h < ihdr->height)
{
@ -582,7 +658,7 @@ static int png_reverse_filter_regular_iterate(uint32_t **data, const struct png_
ihdr, pngp, filter);
}
if (ret == PNG_PROCESS_END || ret == PNG_PROCESS_ERROR_END)
if (ret == IMAGE_PROCESS_END || ret == IMAGE_PROCESS_ERROR_END)
goto end;
pngp->h++;
@ -592,7 +668,7 @@ static int png_reverse_filter_regular_iterate(uint32_t **data, const struct png_
*data += ihdr->width;
pngp->data_restore_buf_size += ihdr->width;
return PNG_PROCESS_NEXT;
return IMAGE_PROCESS_NEXT;
end:
png_reverse_filter_deinit(pngp);
@ -605,32 +681,32 @@ end:
static int png_reverse_filter_adam7_iterate(uint32_t **data_,
const struct png_ihdr *ihdr,
struct rpng_process_t *pngp)
struct rpng_process *pngp)
{
int ret = 0;
bool to_next = pngp->pass.pos < ARRAY_SIZE(passes);
uint32_t *data = *data_;
if (!to_next)
return PNG_PROCESS_END;
return IMAGE_PROCESS_END;
ret = png_reverse_filter_init(ihdr, pngp);
if (ret == 1)
return PNG_PROCESS_NEXT;
return IMAGE_PROCESS_NEXT;
if (ret == -1)
return PNG_PROCESS_ERROR_END;
return IMAGE_PROCESS_ERROR_END;
if (png_reverse_filter_init(&pngp->ihdr, pngp) == -1)
return PNG_PROCESS_ERROR;
return IMAGE_PROCESS_ERROR;
do{
ret = png_reverse_filter_regular_iterate(&pngp->data,
&pngp->ihdr, pngp);
}while(ret == PNG_PROCESS_NEXT);
}while(ret == IMAGE_PROCESS_NEXT);
if (ret == PNG_PROCESS_ERROR || ret == PNG_PROCESS_ERROR_END)
return PNG_PROCESS_ERROR;
if (ret == IMAGE_PROCESS_ERROR || ret == IMAGE_PROCESS_ERROR_END)
return IMAGE_PROCESS_ERROR;
pngp->inflate_buf += pngp->pass.size;
pngp->adam7_restore_buf_size += pngp->pass.size;
@ -647,25 +723,25 @@ static int png_reverse_filter_adam7_iterate(uint32_t **data_,
pngp->pass.size = 0;
pngp->adam7_pass_initialized = false;
return PNG_PROCESS_NEXT;
return IMAGE_PROCESS_NEXT;
}
static int png_reverse_filter_adam7(uint32_t **data_,
const struct png_ihdr *ihdr,
struct rpng_process_t *pngp)
struct rpng_process *pngp)
{
int ret = png_reverse_filter_adam7_iterate(data_,
ihdr, pngp);
switch (ret)
{
case PNG_PROCESS_ERROR_END:
case PNG_PROCESS_END:
case IMAGE_PROCESS_ERROR_END:
case IMAGE_PROCESS_END:
break;
case PNG_PROCESS_NEXT:
case IMAGE_PROCESS_NEXT:
pngp->pass.pos++;
return 0;
case PNG_PROCESS_ERROR:
case IMAGE_PROCESS_ERROR:
if (pngp->data)
free(pngp->data);
pngp->inflate_buf -= pngp->adam7_restore_buf_size;
@ -684,22 +760,23 @@ static int png_reverse_filter_iterate(rpng_t *rpng, uint32_t **data)
return false;
if (rpng->ihdr.interlace)
return png_reverse_filter_adam7(data, &rpng->ihdr, &rpng->process);
return png_reverse_filter_adam7(data, &rpng->ihdr, rpng->process);
return png_reverse_filter_regular_iterate(data, &rpng->ihdr, &rpng->process);
return png_reverse_filter_regular_iterate(data, &rpng->ihdr, rpng->process);
}
static int rpng_load_image_argb_process_inflate_init(rpng_t *rpng,
uint32_t **data, unsigned *width, unsigned *height)
{
int zstatus;
bool to_continue = (rpng->process.stream_backend->stream_get_avail_in(rpng->process.stream) > 0
&& rpng->process.stream_backend->stream_get_avail_out(rpng->process.stream) > 0);
struct rpng_process *process = (struct rpng_process*)rpng->process;
bool to_continue = (process->stream_backend->stream_get_avail_in(process->stream) > 0
&& process->stream_backend->stream_get_avail_out(process->stream) > 0);
if (!to_continue)
goto end;
zstatus = rpng->process.stream_backend->stream_decompress_data_to_file_iterate(rpng->process.stream);
zstatus = process->stream_backend->stream_decompress_data_to_file_iterate(process->stream);
switch (zstatus)
{
@ -714,7 +791,7 @@ static int rpng_load_image_argb_process_inflate_init(rpng_t *rpng,
return 0;
end:
rpng->process.stream_backend->stream_free(rpng->process.stream);
process->stream_backend->stream_free(process->stream);
*width = rpng->ihdr.width;
*height = rpng->ihdr.height;
@ -729,22 +806,20 @@ end:
if (!*data)
goto false_end;
rpng->process.adam7_restore_buf_size = 0;
rpng->process.restore_buf_size = 0;
rpng->process.palette = rpng->palette;
process->adam7_restore_buf_size = 0;
process->restore_buf_size = 0;
process->palette = rpng->palette;
if (rpng->ihdr.interlace != 1)
if (png_reverse_filter_init(&rpng->ihdr, &rpng->process) == -1)
if (png_reverse_filter_init(&rpng->ihdr, process) == -1)
goto false_end;
rpng->process.inflate_initialized = true;
process->inflate_initialized = true;
return 1;
error:
rpng->process.stream_backend->stream_free(rpng->process.stream);
false_end:
rpng->process.inflate_initialized = false;
process->inflate_initialized = false;
return -1;
}
@ -764,6 +839,18 @@ static bool png_read_plte(uint8_t *buf,
return true;
}
static bool png_read_trns(uint8_t *buf, uint32_t *palette, unsigned entries)
{
unsigned i;
for (i = 0; i < entries; i++, buf++, palette++)
{
*palette = (*palette & 0x00ffffff) | *buf << 24;
}
return true;
}
bool png_realloc_idat(const struct png_chunk *chunk, struct idat_buffer *buf)
{
uint8_t *new_buffer = (uint8_t*)realloc(buf->data, buf->size + chunk->size);
@ -775,39 +862,57 @@ bool png_realloc_idat(const struct png_chunk *chunk, struct idat_buffer *buf)
return true;
}
static bool rpng_load_image_argb_process_init(rpng_t *rpng,
uint32_t **data, unsigned *width, unsigned *height)
static struct rpng_process *rpng_process_init(rpng_t *rpng, unsigned *width, unsigned *height)
{
rpng->process.inflate_buf_size = 0;
rpng->process.inflate_buf = NULL;
uint8_t *inflate_buf = NULL;
struct rpng_process *process = (struct rpng_process*)calloc(1, sizeof(*process));
if (!process)
return NULL;
process->stream_backend = file_archive_get_default_file_backend();
png_pass_geom(&rpng->ihdr, rpng->ihdr.width,
rpng->ihdr.height, NULL, NULL, &rpng->process.inflate_buf_size);
rpng->ihdr.height, NULL, NULL, &process->inflate_buf_size);
if (rpng->ihdr.interlace == 1) /* To be sure. */
rpng->process.inflate_buf_size *= 2;
process->inflate_buf_size *= 2;
rpng->process.stream = rpng->process.stream_backend->stream_new();
process->stream = process->stream_backend->stream_new();
if (!rpng->process.stream)
return false;
if (!process->stream)
{
free(process);
return NULL;
}
if (!rpng->process.stream_backend->stream_decompress_init(rpng->process.stream))
return false;
if (!process->stream_backend->stream_decompress_init(process->stream))
{
free(process);
return NULL;
}
rpng->process.inflate_buf = (uint8_t*)malloc(rpng->process.inflate_buf_size);
if (!rpng->process.inflate_buf)
return false;
inflate_buf = (uint8_t*)malloc(process->inflate_buf_size);
if (!inflate_buf)
goto error;
rpng->process.stream_backend->stream_set(
rpng->process.stream,
process->inflate_buf = inflate_buf;
process->stream_backend->stream_set(
process->stream,
rpng->idat_buf.size,
rpng->process.inflate_buf_size,
process->inflate_buf_size,
rpng->idat_buf.data,
rpng->process.inflate_buf);
process->inflate_buf);
rpng->process.initialized = true;
return process;
return true;
error:
if (process)
{
if (process->stream)
process->stream_backend->stream_free(process->stream);
free(process);
}
return NULL;
}
static bool read_chunk_header(uint8_t *buf, struct png_chunk *chunk)
@ -818,14 +923,10 @@ static bool read_chunk_header(uint8_t *buf, struct png_chunk *chunk)
for (i = 0; i < 4; i++)
dword[i] = buf[i];
buf += 4;
chunk->size = dword_be(dword);
for (i = 0; i < 4; i++)
chunk->type[i] = buf[i];
buf += 4;
chunk->type[i] = buf[i + 4];
return true;
}
@ -849,17 +950,17 @@ static bool png_parse_ihdr(uint8_t *buf,
return true;
}
bool rpng_nbio_load_image_argb_iterate(rpng_t *rpng)
bool rpng_iterate_image(rpng_t *rpng)
{
unsigned i;
unsigned ret;
uint8_t *buf = (uint8_t*)rpng->buff_data;
struct png_chunk chunk = {0};
uint8_t *buf = (uint8_t*)rpng->buff_data;
if (!read_chunk_header(buf, &chunk))
return false;
*buf += 8;
#if 0
for (i = 0; i < 4; i++)
{
@ -896,7 +997,7 @@ bool rpng_nbio_load_image_argb_iterate(rpng_t *rpng)
{
unsigned entries = chunk.size / 3;
if (!rpng->has_ihdr || rpng->has_plte || rpng->has_iend || rpng->has_idat)
if (!rpng->has_ihdr || rpng->has_plte || rpng->has_iend || rpng->has_idat || rpng->has_trns)
goto error;
if (chunk.size % 3)
@ -914,6 +1015,26 @@ bool rpng_nbio_load_image_argb_iterate(rpng_t *rpng)
}
break;
case PNG_CHUNK_tRNS:
if (rpng->has_idat)
goto error;
if (rpng->ihdr.color_type == PNG_IHDR_COLOR_PLT)
{
/* we should compare with the number of palette entries */
if (chunk.size > 256)
goto error;
buf += 8;
if (!png_read_trns(buf, rpng->palette, chunk.size))
goto error;
}
/* TODO: support colorkey in grayscale and truecolor images */
rpng->has_trns = true;
break;
case PNG_CHUNK_IDAT:
if (!(rpng->has_ihdr) || rpng->has_iend || (rpng->ihdr.color_type == PNG_IHDR_COLOR_PLT && !(rpng->has_plte)))
goto error;
@ -939,8 +1060,7 @@ bool rpng_nbio_load_image_argb_iterate(rpng_t *rpng)
goto error;
}
ret = 4 + 4 + chunk.size + 4;
rpng->buff_data += ret;
rpng->buff_data += chunk.size + 12;
return true;
@ -948,51 +1068,71 @@ error:
return false;
}
int rpng_nbio_load_image_argb_process(rpng_t *rpng,
uint32_t **data, unsigned *width, unsigned *height)
int rpng_process_image(rpng_t *rpng,
void **_data, size_t size, unsigned *width, unsigned *height)
{
if (!rpng->process.initialized)
{
if (!rpng->process.stream_backend)
rpng->process.stream_backend = file_archive_get_default_file_backend();
uint32_t **data = (uint32_t**)_data;
if (!rpng_load_image_argb_process_init(rpng, data, width,
height))
return PNG_PROCESS_ERROR;
return 0;
(void)size;
if (!rpng->process)
{
struct rpng_process *process = rpng_process_init(
rpng, width, height);
if (!process)
goto error;
rpng->process = process;
return IMAGE_PROCESS_NEXT;
}
if (!rpng->process.inflate_initialized)
if (!rpng->process->inflate_initialized)
{
int ret = rpng_load_image_argb_process_inflate_init(rpng, data,
width, height);
if (ret == -1)
return PNG_PROCESS_ERROR;
return 0;
if (rpng_load_image_argb_process_inflate_init(rpng, data,
width, height) == -1)
goto error;
return IMAGE_PROCESS_NEXT;
}
return png_reverse_filter_iterate(rpng, data);
error:
if (rpng->process)
{
if (rpng->process->inflate_buf)
free(rpng->process->inflate_buf);
if (rpng->process->stream)
rpng->process->stream_backend->stream_free(rpng->process->stream);
free(rpng->process);
}
return IMAGE_PROCESS_ERROR;
}
void rpng_nbio_load_image_free(rpng_t *rpng)
void rpng_free(rpng_t *rpng)
{
if (!rpng)
return;
if (rpng->idat_buf.data)
free(rpng->idat_buf.data);
if (rpng->process.inflate_buf)
free(rpng->process.inflate_buf);
if (rpng->process.stream)
if (rpng->process)
{
rpng->process.stream_backend->stream_free(rpng->process.stream);
free(rpng->process.stream);
if (rpng->process->inflate_buf)
free(rpng->process->inflate_buf);
if (rpng->process->stream)
{
if (rpng->process->stream_backend)
rpng->process->stream_backend->stream_free(rpng->process->stream);
free(rpng->process->stream);
}
free(rpng->process);
}
free(rpng);
}
bool rpng_nbio_load_image_argb_start(rpng_t *rpng)
bool rpng_start(rpng_t *rpng)
{
unsigned i;
char header[8] = {0};
@ -1025,12 +1165,12 @@ bool rpng_is_valid(rpng_t *rpng)
return false;
}
bool rpng_set_buf_ptr(rpng_t *rpng, uint8_t *data)
bool rpng_set_buf_ptr(rpng_t *rpng, void *data)
{
if (!rpng)
return false;
rpng->buff_data = data;
rpng->buff_data = (uint8_t*)data;
return true;
}
@ -1042,77 +1182,3 @@ rpng_t *rpng_alloc(void)
return NULL;
return rpng;
}
bool rpng_load_image_argb(const char *path, uint32_t **data,
unsigned *width, unsigned *height)
{
int retval;
size_t file_len;
bool ret = true;
rpng_t *rpng = NULL;
void *ptr = NULL;
struct nbio_t* handle = (struct nbio_t*)nbio_open(path, NBIO_READ);
if (!handle)
goto end;
ptr = nbio_get_ptr(handle, &file_len);
nbio_begin_read(handle);
while (!nbio_iterate(handle));
ptr = nbio_get_ptr(handle, &file_len);
if (!ptr)
{
ret = false;
goto end;
}
rpng = rpng_alloc();
if (!rpng)
{
ret = false;
goto end;
}
if (!rpng_set_buf_ptr(rpng, (uint8_t*)ptr))
{
ret = false;
goto end;
}
if (!rpng_nbio_load_image_argb_start(rpng))
{
ret = false;
goto end;
}
while (rpng_nbio_load_image_argb_iterate(rpng));
if (!rpng_is_valid(rpng))
{
ret = false;
goto end;
}
do
{
retval = rpng_nbio_load_image_argb_process(rpng, data, width, height);
}while(retval == PNG_PROCESS_NEXT);
if (retval == PNG_PROCESS_ERROR || retval == PNG_PROCESS_ERROR_END)
ret = false;
end:
if (handle)
nbio_free(handle);
if (rpng)
rpng_nbio_load_image_free(rpng);
rpng = NULL;
if (!ret)
free(*data);
return ret;
}

View File

@ -25,6 +25,7 @@
#include <string.h>
#include <streams/file_stream.h>
#include <file/archive_file.h>
#include "rpng_internal.h"
@ -35,8 +36,6 @@
goto end; \
} while(0)
#ifdef HAVE_ZLIB_DEFLATE
static void dword_write_be(uint8_t *buf, uint32_t val)
{
*buf++ = (uint8_t)(val >> 24);
@ -348,8 +347,8 @@ static bool rpng_save_image(const char *path,
stream_backend->stream_compress_free(stream);
memcpy(deflate_buf + 4, "IDAT", 4);
dword_write_be(deflate_buf + 0, stream_backend->stream_get_total_out(stream));
if (!png_write_idat(file, deflate_buf, stream_backend->stream_get_total_out(stream) + 8))
dword_write_be(deflate_buf + 0, ((uint32_t)stream_backend->stream_get_total_out(stream)));
if (!png_write_idat(file, deflate_buf, ((size_t)stream_backend->stream_get_total_out(stream) + 8)))
GOTO_END_ERROR();
if (!png_write_iend(file))
@ -366,7 +365,8 @@ end:
free(avg_filtered);
free(paeth_filtered);
stream_backend->stream_free(stream);
if (stream_backend)
stream_backend->stream_free(stream);
return ret;
}
@ -383,5 +383,3 @@ bool rpng_save_image_bgr24(const char *path, const uint8_t *data,
return rpng_save_image(path, (const uint8_t*)data,
width, height, pitch, 3);
}
#endif

View File

@ -27,7 +27,7 @@ SOURCES_C := \
OBJS := $(SOURCES_C:.c=.o)
CFLAGS += -Wall -pedantic -std=gnu99 -O0 -g -DHAVE_ZLIB -DHAVE_ZLIB_DEFLATE -DRPNG_TEST -I$(LIBRETRO_COMM_DIR)/include
CFLAGS += -Wall -pedantic -std=gnu99 -O0 -g -DHAVE_ZLIB -DRPNG_TEST -I$(LIBRETRO_COMM_DIR)/include
all: $(TARGET)

View File

@ -30,6 +30,80 @@
#include <file/nbio.h>
#include <formats/rpng.h>
#include <formats/image.h>
static bool rpng_load_image_argb(const char *path, uint32_t **data,
unsigned *width, unsigned *height)
{
int retval;
size_t file_len;
bool ret = true;
rpng_t *rpng = NULL;
void *ptr = NULL;
struct nbio_t* handle = (struct nbio_t*)nbio_open(path, NBIO_READ);
if (!handle)
goto end;
nbio_begin_read(handle);
while (!nbio_iterate(handle));
ptr = nbio_get_ptr(handle, &file_len);
if (!ptr)
{
ret = false;
goto end;
}
rpng = rpng_alloc();
if (!rpng)
{
ret = false;
goto end;
}
if (!rpng_set_buf_ptr(rpng, (uint8_t*)ptr))
{
ret = false;
goto end;
}
if (!rpng_start(rpng))
{
ret = false;
goto end;
}
while (rpng_iterate_image(rpng));
if (!rpng_is_valid(rpng))
{
ret = false;
goto end;
}
do
{
retval = rpng_process_image(rpng,
(void**)data, file_len, width, height);
}while(retval == IMAGE_PROCESS_NEXT);
if (retval == IMAGE_PROCESS_ERROR || retval == IMAGE_PROCESS_ERROR_END)
ret = false;
end:
if (handle)
nbio_free(handle);
if (rpng)
rpng_free(rpng);
rpng = NULL;
if (!ret)
free(*data);
return ret;
}
static int test_rpng(const char *in_path)
{

View File

@ -1,103 +1,478 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rtga.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include <stddef.h> /* ptrdiff_t on osx */
#include <stdlib.h>
#include <string.h>
#include <formats/tga.h>
#include <retro_assert.h>
#include <retro_inline.h>
#include <formats/image.h>
#include <formats/rtga.h>
bool rtga_image_load_shift(uint8_t *buf,
void *data,
unsigned a_shift, unsigned r_shift,
unsigned g_shift, unsigned b_shift)
struct rtga
{
unsigned i, bits, size, bits_mul;
uint8_t info[6] = {0};
unsigned width = 0;
unsigned height = 0;
const uint8_t *tmp = NULL;
struct texture_image *out_img = (struct texture_image*)data;
uint8_t *buff_data;
uint32_t *output_image;
void *empty;
};
if (!buf || buf[2] != 2)
typedef struct
{
int (*read) (void *user,char *data,int size); /* fill 'data' with 'size' bytes. return number of bytes actually read */
void (*skip) (void *user,int n); /* skip the next 'n' bytes, or 'unget' the last -n bytes if negative */
int (*eof) (void *user); /* returns nonzero if we are at end of file/data */
} rtga_io_callbacks;
typedef struct
{
uint32_t img_x, img_y;
int img_n, img_out_n;
rtga_io_callbacks io;
void *io_user_data;
int read_from_callbacks;
int buflen;
uint8_t buffer_start[128];
uint8_t *img_buffer, *img_buffer_end;
uint8_t *img_buffer_original;
} rtga__context;
static void rtga__refill_buffer(rtga__context *s);
static void rtga__start_mem(rtga__context *s, uint8_t const *buffer, int len)
{
s->io.read = NULL;
s->read_from_callbacks = 0;
s->img_buffer = s->img_buffer_original = (uint8_t *) buffer;
s->img_buffer_end = (uint8_t *) buffer+len;
}
static uint8_t *rtga__tga_load(rtga__context *s, unsigned *x, unsigned *y, int *comp, int req_comp);
#define rtga__err(x,y) 0
#define rtga__errpf(x,y) ((float *) (rtga__err(x,y)?NULL:NULL))
#define rtga__errpuc(x,y) ((unsigned char *) (rtga__err(x,y)?NULL:NULL))
static uint8_t *rtga_load_from_memory(uint8_t const *buffer, int len, unsigned *x, unsigned *y, int *comp, int req_comp)
{
rtga__context s;
rtga__start_mem(&s,buffer,len);
return rtga__tga_load(&s,x,y,comp,req_comp);
}
static void rtga__refill_buffer(rtga__context *s)
{
int n = (s->io.read)(s->io_user_data,(char*)s->buffer_start,s->buflen);
if (n == 0)
{
fprintf(stderr, "TGA image is not uncompressed RGB.\n");
goto error;
/* at end of file, treat same as if from memory, but need to handle case
* where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file */
s->read_from_callbacks = 0;
s->img_buffer = s->buffer_start;
s->img_buffer_end = s->buffer_start+1;
*s->img_buffer = 0;
} else {
s->img_buffer = s->buffer_start;
s->img_buffer_end = s->buffer_start + n;
}
}
static INLINE uint8_t rtga__get8(rtga__context *s)
{
if (s->img_buffer < s->img_buffer_end)
return *s->img_buffer++;
if (s->read_from_callbacks) {
rtga__refill_buffer(s);
return *s->img_buffer++;
}
return 0;
}
static void rtga__skip(rtga__context *s, int n)
{
if (n < 0) {
s->img_buffer = s->img_buffer_end;
return;
}
if (s->io.read) {
int blen = (int) (s->img_buffer_end - s->img_buffer);
if (blen < n) {
s->img_buffer = s->img_buffer_end;
(s->io.skip)(s->io_user_data, n - blen);
return;
}
}
s->img_buffer += n;
}
static int rtga__getn(rtga__context *s, uint8_t *buffer, int n)
{
if (s->io.read) {
int blen = (int) (s->img_buffer_end - s->img_buffer);
if (blen < n) {
int res, count;
memcpy(buffer, s->img_buffer, blen);
count = (s->io.read)(s->io_user_data, (char*) buffer + blen, n - blen);
res = (count == (n-blen));
s->img_buffer = s->img_buffer_end;
return res;
}
}
memcpy(info, buf + 12, 6);
if (s->img_buffer+n <= s->img_buffer_end) {
memcpy(buffer, s->img_buffer, n);
s->img_buffer += n;
return 1;
} else
return 0;
}
width = info[0] + ((unsigned)info[1] * 256);
height = info[2] + ((unsigned)info[3] * 256);
bits = info[4];
static int rtga__get16le(rtga__context *s)
{
int z = rtga__get8(s);
return z + (rtga__get8(s) << 8);
}
fprintf(stderr, "Loaded TGA: (%ux%u @ %u bpp)\n", width, height, bits);
static uint8_t rtga__compute_y(int r, int g, int b)
{
return (uint8_t) (((r*77) + (g*150) + (29*b)) >> 8);
}
size = width * height * sizeof(uint32_t);
out_img->pixels = (uint32_t*)malloc(size);
out_img->width = width;
out_img->height = height;
static unsigned char *rtga__convert_format(
unsigned char *data,
int img_n,
int req_comp,
unsigned int x,
unsigned int y)
{
int i,j;
unsigned char *good;
if (!out_img->pixels)
if (req_comp == img_n) return data;
retro_assert(req_comp >= 1 && req_comp <= 4);
good = (unsigned char *) malloc(req_comp * x * y);
if (good == NULL)
{
fprintf(stderr, "Failed to allocate TGA pixels.\n");
goto error;
free(data);
return rtga__errpuc("outofmem", "Out of memory");
}
tmp = buf + 18;
bits_mul = 3;
if (bits != 32 && bits != 24)
for (j=0; j < (int) y; ++j)
{
fprintf(stderr, "Bit depth of TGA image is wrong. Only 32-bit and 24-bit supported.\n");
goto error;
unsigned char *src = data + j * x * img_n ;
unsigned char *dest = good + j * x * req_comp;
switch (((img_n)*8+(req_comp)))
{
case ((1)*8+(2)):
for(i=x-1; i >= 0; --i, src += 1, dest += 2)
dest[0]=src[0], dest[1]=255;
break;
case ((1)*8+(3)):
for(i=x-1; i >= 0; --i, src += 1, dest += 3)
dest[0]=dest[1]=dest[2]=src[0];
break;
case ((1)*8+(4)):
for(i=x-1; i >= 0; --i, src += 1, dest += 4)
dest[0]=dest[1]=dest[2]=src[0], dest[3]=255;
break;
case ((2)*8+(1)):
for(i=x-1; i >= 0; --i, src += 2, dest += 1)
dest[0]=src[0];
break;
case ((2)*8+(3)):
for(i=x-1; i >= 0; --i, src += 2, dest += 3)
dest[0]=dest[1]=dest[2]=src[0];
break;
case ((2)*8+(4)):
for(i=x-1; i >= 0; --i, src += 2, dest += 4)
dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1];
break;
case ((3)*8+(4)):
for(i=x-1; i >= 0; --i, src += 3, dest += 4)
dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255;
break;
case ((3)*8+(1)):
for(i=x-1; i >= 0; --i, src += 3, dest += 1)
dest[0]=rtga__compute_y(src[0],src[1],src[2]);
break;
case ((3)*8+(2)):
for(i=x-1; i >= 0; --i, src += 3, dest += 2)
dest[0]=rtga__compute_y(src[0],src[1],src[2]), dest[1] = 255;
break;
case ((4)*8+(1)):
for(i=x-1; i >= 0; --i, src += 4, dest += 1)
dest[0]=rtga__compute_y(src[0],src[1],src[2]);
break;
case ((4)*8+(2)):
for(i=x-1; i >= 0; --i, src += 4, dest += 2)
dest[0]=rtga__compute_y(src[0],src[1],src[2]), dest[1] = src[3];
break;
case ((4)*8+(3)):
for(i=x-1; i >= 0; --i, src += 4, dest += 3)
dest[0]=src[0],dest[1]=src[1],dest[2]=src[2];
break;
default:
retro_assert(0);
break;
}
}
if (bits == 32)
bits_mul = 4;
free(data);
return good;
}
for (i = 0; i < width * height; i++)
static uint8_t *rtga__tga_load(rtga__context *s, unsigned *x, unsigned *y, int *comp, int req_comp)
{
/* Read in the TGA header stuff */
int tga_offset = rtga__get8(s);
int tga_indexed = rtga__get8(s);
int tga_image_type = rtga__get8(s);
int tga_is_RLE = 0;
int tga_palette_start = rtga__get16le(s);
int tga_palette_len = rtga__get16le(s);
int tga_palette_bits = rtga__get8(s);
int tga_x_origin = rtga__get16le(s);
int tga_y_origin = rtga__get16le(s);
int tga_width = rtga__get16le(s);
int tga_height = rtga__get16le(s);
int tga_bits_per_pixel = rtga__get8(s);
int tga_comp = tga_bits_per_pixel / 8;
int tga_inverted = rtga__get8(s);
/* image data */
unsigned char *tga_data;
unsigned char *tga_palette = NULL;
int i, j;
unsigned char raw_data[4] = {0};
int RLE_count = 0;
int RLE_repeating = 0;
int read_next_pixel = 1;
(void)tga_palette_start;
(void)tga_x_origin;
(void)tga_y_origin;
/* do a tiny bit of precessing */
if ( tga_image_type >= 8 )
{
uint32_t b = tmp[i * bits_mul + 0];
uint32_t g = tmp[i * bits_mul + 1];
uint32_t r = tmp[i * bits_mul + 2];
uint32_t a = tmp[i * bits_mul + 3];
if (bits == 24)
a = 0xff;
out_img->pixels[i] = (a << a_shift) |
(r << r_shift) | (g << g_shift) | (b << b_shift);
tga_image_type -= 8;
tga_is_RLE = 1;
}
/* int tga_alpha_bits = tga_inverted & 15; */
tga_inverted = 1 - ((tga_inverted >> 5) & 1);
/* error check */
if (
(tga_width < 1) || (tga_height < 1) ||
(tga_image_type < 1) || (tga_image_type > 3) ||
((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16) &&
(tga_bits_per_pixel != 24) && (tga_bits_per_pixel != 32))
)
return NULL; /* we don't report this as a bad TGA because we don't even know if it's TGA */
/* If paletted, then we will use the number of bits from the palette */
if ( tga_indexed )
tga_comp = tga_palette_bits / 8;
/* TGA info */
*x = tga_width;
*y = tga_height;
if (comp) *comp = tga_comp;
tga_data = (unsigned char*)malloc( (size_t)tga_width * tga_height * tga_comp );
if (!tga_data)
return rtga__errpuc("outofmem", "Out of memory");
/* skip to the data's starting position (offset usually = 0) */
rtga__skip(s, tga_offset );
if ( !tga_indexed && !tga_is_RLE)
{
for (i=0; i < tga_height; ++i)
{
int y = tga_inverted ? tga_height -i - 1 : i;
uint8_t *tga_row = tga_data + y*tga_width*tga_comp;
rtga__getn(s, tga_row, tga_width * tga_comp);
}
}
else
{
/* Do I need to load a palette? */
if ( tga_indexed)
{
/* any data to skip? (offset usually = 0) */
rtga__skip(s, tga_palette_start );
/* load the palette */
tga_palette = (unsigned char*)malloc( tga_palette_len * tga_palette_bits / 8 );
if (!tga_palette)
{
free(tga_data);
return rtga__errpuc("outofmem", "Out of memory");
}
if (!rtga__getn(s, tga_palette, tga_palette_len * tga_palette_bits / 8 )) {
free(tga_data);
free(tga_palette);
return rtga__errpuc("bad palette", "Corrupt TGA");
}
}
/* load the data */
for (i=0; i < tga_width * tga_height; ++i)
{
/* if I'm in RLE mode, do I need to get a RLE rtga__pngchunk? */
if ( tga_is_RLE )
{
if ( RLE_count == 0 )
{
/* yep, get the next byte as a RLE command */
int RLE_cmd = rtga__get8(s);
RLE_count = 1 + (RLE_cmd & 127);
RLE_repeating = RLE_cmd >> 7;
read_next_pixel = 1;
}
else if ( !RLE_repeating )
read_next_pixel = 1;
}
else
read_next_pixel = 1;
/* OK, if I need to read a pixel, do it now */
if ( read_next_pixel )
{
/* load however much data we did have */
if ( tga_indexed )
{
/* read in 1 byte, then perform the lookup */
int pal_idx = rtga__get8(s);
if ( pal_idx >= tga_palette_len ) /* invalid index */
pal_idx = 0;
pal_idx *= tga_bits_per_pixel / 8;
for (j = 0; j*8 < tga_bits_per_pixel; ++j)
raw_data[j] = tga_palette[pal_idx+j];
}
else
{
/* read in the data raw */
for (j = 0; j*8 < tga_bits_per_pixel; ++j)
raw_data[j] = rtga__get8(s);
}
/* clear the reading flag for the next pixel */
read_next_pixel = 0;
} /* end of reading a pixel */
/* copy data */
for (j = 0; j < tga_comp; ++j)
tga_data[i*tga_comp+j] = raw_data[j];
/* in case we're in RLE mode, keep counting down */
--RLE_count;
}
/* do I need to invert the image? */
if ( tga_inverted )
{
for (j = 0; j*2 < tga_height; ++j)
{
int index1 = j * tga_width * tga_comp;
int index2 = (tga_height - 1 - j) * tga_width * tga_comp;
for (i = tga_width * tga_comp; i > 0; --i)
{
unsigned char temp = tga_data[index1];
tga_data[index1] = tga_data[index2];
tga_data[index2] = temp;
++index1;
++index2;
}
}
}
/* Clear my palette, if I had one */
if ( tga_palette != NULL )
free( tga_palette );
}
/* swap RGB */
if (tga_comp >= 3)
{
unsigned char* tga_pixel = tga_data;
for (i=0; i < tga_width * tga_height; ++i)
{
unsigned char temp = tga_pixel[0];
tga_pixel[0] = tga_pixel[2];
tga_pixel[2] = temp;
tga_pixel += tga_comp;
}
}
/* convert to target component count */
if (req_comp && req_comp != tga_comp)
tga_data = rtga__convert_format(tga_data, tga_comp, req_comp, tga_width, tga_height);
return tga_data;
}
int rtga_process_image(rtga_t *rtga, void **buf_data,
size_t size, unsigned *width, unsigned *height)
{
int comp;
unsigned size_tex = 0;
if (!rtga)
return IMAGE_PROCESS_ERROR;
rtga->output_image = (uint32_t*)rtga_load_from_memory(rtga->buff_data, size, width, height, &comp, 4);
*buf_data = rtga->output_image;
size_tex = (*width) * (*height);
/* Convert RGBA to ARGB */
while(size_tex--)
{
unsigned int texel = rtga->output_image[size_tex];
unsigned int A = texel & 0xFF000000;
unsigned int B = texel & 0x00FF0000;
unsigned int G = texel & 0x0000FF00;
unsigned int R = texel & 0x000000FF;
((unsigned int*)rtga->output_image)[size_tex] = A | (R << 16) | G | (B >> 16);
};
return IMAGE_PROCESS_END;
}
bool rtga_set_buf_ptr(rtga_t *rtga, void *data)
{
if (!rtga)
return false;
rtga->buff_data = (uint8_t*)data;
return true;
error:
if (out_img->pixels)
free(out_img->pixels);
out_img->pixels = NULL;
out_img->width = out_img->height = 0;
return false;
}
void rtga_free(rtga_t *rtga)
{
if (!rtga)
return;
free(rtga);
}
rtga_t *rtga_alloc(void)
{
rtga_t *rtga = (rtga_t*)calloc(1, sizeof(*rtga));
if (!rtga)
return NULL;
return rtga;
}

View File

@ -25,6 +25,15 @@
#include <gfx/math/matrix_4x4.h>
void matrix_4x4_copy(math_matrix_4x4 *dst, const math_matrix_4x4 *src)
{
unsigned i, j;
for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++)
MAT_ELEM_4X4(*dst, i, j) = MAT_ELEM_4X4(*src, i, j);
}
/*
* Sets mat to an identity matrix
*/

View File

@ -0,0 +1,54 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (vector_2.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdint.h>
#include <math.h>
#include <gfx/math/vector_2.h>
float vec2_dot(const float *a, const float *b)
{
return (a[0]*b[0]) + (a[1]*b[1]);
}
float vec2_cross(const float *a, const float *b)
{
return (a[0]*b[1]) - (a[1]*b[0]);
}
void vec2_add(float *dst, const float *src)
{
dst[0] += src[0];
dst[1] += src[1];
}
void vec2_subtract(float *dst, const float *src)
{
dst[0] -= src[0];
dst[1] -= src[1];
}
void vec2_copy(float *dst, const float *src)
{
dst[0] = src[0];
dst[1] = src[1];
}

View File

@ -0,0 +1,79 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (vector_3.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdint.h>
#include <math.h>
#include <gfx/math/vector_3.h>
float vec3_dot(const float *a, const float *b)
{
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}
void vec3_cross(float* dst, const float *a, const float *b)
{
dst[0] = a[1]*b[2] - a[2]*b[1];
dst[1] = a[2]*b[0] - a[0]*b[2];
dst[2] = a[0]*b[1] - a[1]*b[0];
}
float vec3_length(const float *a)
{
float length_sq = vec3_dot(a,a);
float length = sqrtf(length_sq);
return length;
}
void vec3_add(float *dst, const float *src)
{
dst[0] += src[0];
dst[1] += src[1];
dst[2] += src[2];
}
void vec3_subtract(float *dst, const float *src)
{
dst[0] -= src[0];
dst[1] -= src[1];
dst[2] -= src[2];
}
void vec3_scale(float *dst, const float scale)
{
dst[0] *= scale;
dst[1] *= scale;
dst[2] *= scale;
}
void vec3_copy(float *dst, const float *src)
{
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
}
void vec3_normalize(float *dst)
{
float length = vec3_length(dst);
vec3_scale(dst,1.0f/length);
}

File diff suppressed because it is too large Load Diff

4
desmume/src/libretro-common/glsym/glgen.py Normal file → Executable file
View File

@ -25,7 +25,7 @@ import sys
import os
import re
banned_ext = [ 'AMD', 'APPLE', 'EXT', 'NV', 'NVX', 'ATI', '3DLABS', 'SUN', 'SGI', 'SGIX', 'SGIS', 'INTEL', '3DFX', 'IBM', 'MESA', 'GREMEDY', 'OML', 'PGI', 'I3D', 'INGL', 'MTX', 'QCOM', 'IMG', 'ANGLE', 'SUNX', 'INGR' ]
banned_ext = [ 'AMD', 'APPLE', 'NV', 'NVX', 'ATI', '3DLABS', 'SUN', 'SGI', 'SGIX', 'SGIS', 'INTEL', '3DFX', 'IBM', 'MESA', 'GREMEDY', 'OML', 'PGI', 'I3D', 'INGL', 'MTX', 'QCOM', 'IMG', 'ANGLE', 'SUNX', 'INGR' ]
def noext(sym):
for ext in banned_ext:
@ -128,7 +128,7 @@ if __name__ == '__main__':
f.write('#endif\n')
with open(sys.argv[3], 'w') as f:
f.write('#include "glsym.h"\n')
f.write('#include "glsym/glsym.h"\n')
f.write('#include <stddef.h>\n')
f.write('#define SYM(x) { "gl" #x, &(gl##x) }\n')
f.write('const struct rglgen_sym_map rglgen_symbol_map[] = {\n')

View File

@ -1,30 +1,8 @@
/* Copyright (C) 2010-2015 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this libretro SDK code part (glsym).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <glsym/glsym.h>
#include "glsym/glsym.h"
#include <stddef.h>
#define SYM(x) { "gl" #x, &(gl##x) }
const struct rglgen_sym_map rglgen_symbol_map[] = {
SYM(BlendBarrierKHR),
SYM(DebugMessageControlKHR),
SYM(DebugMessageInsertKHR),
SYM(DebugMessageCallbackKHR),
@ -36,26 +14,184 @@ const struct rglgen_sym_map rglgen_symbol_map[] = {
SYM(ObjectPtrLabelKHR),
SYM(GetObjectPtrLabelKHR),
SYM(GetPointervKHR),
SYM(GetGraphicsResetStatusKHR),
SYM(ReadnPixelsKHR),
SYM(GetnUniformfvKHR),
SYM(GetnUniformivKHR),
SYM(GetnUniformuivKHR),
SYM(EGLImageTargetTexture2DOES),
SYM(EGLImageTargetRenderbufferStorageOES),
SYM(CopyImageSubDataOES),
SYM(EnableiOES),
SYM(DisableiOES),
SYM(BlendEquationiOES),
SYM(BlendEquationSeparateiOES),
SYM(BlendFunciOES),
SYM(BlendFuncSeparateiOES),
SYM(ColorMaskiOES),
SYM(IsEnablediOES),
SYM(DrawElementsBaseVertexOES),
SYM(DrawRangeElementsBaseVertexOES),
SYM(DrawElementsInstancedBaseVertexOES),
SYM(MultiDrawElementsBaseVertexOES),
SYM(FramebufferTextureOES),
SYM(GetProgramBinaryOES),
SYM(ProgramBinaryOES),
SYM(MapBufferOES),
SYM(UnmapBufferOES),
SYM(GetBufferPointervOES),
SYM(PrimitiveBoundingBoxOES),
SYM(MinSampleShadingOES),
SYM(PatchParameteriOES),
SYM(TexImage3DOES),
SYM(TexSubImage3DOES),
SYM(CopyTexSubImage3DOES),
SYM(CompressedTexImage3DOES),
SYM(CompressedTexSubImage3DOES),
SYM(FramebufferTexture3DOES),
SYM(TexParameterIivOES),
SYM(TexParameterIuivOES),
SYM(GetTexParameterIivOES),
SYM(GetTexParameterIuivOES),
SYM(SamplerParameterIivOES),
SYM(SamplerParameterIuivOES),
SYM(GetSamplerParameterIivOES),
SYM(GetSamplerParameterIuivOES),
SYM(TexBufferOES),
SYM(TexBufferRangeOES),
SYM(TexStorage3DMultisampleOES),
SYM(TextureViewOES),
SYM(BindVertexArrayOES),
SYM(DeleteVertexArraysOES),
SYM(GenVertexArraysOES),
SYM(IsVertexArrayOES),
SYM(DrawArraysInstancedBaseInstanceEXT),
SYM(DrawElementsInstancedBaseInstanceEXT),
SYM(DrawElementsInstancedBaseVertexBaseInstanceEXT),
SYM(BindFragDataLocationIndexedEXT),
SYM(BindFragDataLocationEXT),
SYM(GetProgramResourceLocationIndexEXT),
SYM(GetFragDataIndexEXT),
SYM(BufferStorageEXT),
SYM(CopyImageSubDataEXT),
SYM(LabelObjectEXT),
SYM(GetObjectLabelEXT),
SYM(InsertEventMarkerEXT),
SYM(PushGroupMarkerEXT),
SYM(PopGroupMarkerEXT),
SYM(DiscardFramebufferEXT),
SYM(GenQueriesEXT),
SYM(DeleteQueriesEXT),
SYM(IsQueryEXT),
SYM(BeginQueryEXT),
SYM(EndQueryEXT),
SYM(QueryCounterEXT),
SYM(GetQueryivEXT),
SYM(GetQueryObjectivEXT),
SYM(GetQueryObjectuivEXT),
SYM(DrawBuffersEXT),
SYM(EnableiEXT),
SYM(DisableiEXT),
SYM(BlendEquationiEXT),
SYM(BlendEquationSeparateiEXT),
SYM(BlendFunciEXT),
SYM(BlendFuncSeparateiEXT),
SYM(ColorMaskiEXT),
SYM(IsEnablediEXT),
SYM(DrawElementsBaseVertexEXT),
SYM(DrawRangeElementsBaseVertexEXT),
SYM(DrawElementsInstancedBaseVertexEXT),
SYM(MultiDrawElementsBaseVertexEXT),
SYM(DrawArraysInstancedEXT),
SYM(DrawElementsInstancedEXT),
SYM(FramebufferTextureEXT),
SYM(VertexAttribDivisorEXT),
SYM(MapBufferRangeEXT),
SYM(FlushMappedBufferRangeEXT),
SYM(MultiDrawArraysEXT),
SYM(MultiDrawElementsEXT),
SYM(MultiDrawArraysIndirectEXT),
SYM(MultiDrawElementsIndirectEXT),
SYM(RenderbufferStorageMultisampleEXT),
SYM(FramebufferTexture2DMultisampleEXT),
SYM(ReadBufferIndexedEXT),
SYM(DrawBuffersIndexedEXT),
SYM(GetIntegeri_vEXT),
SYM(PrimitiveBoundingBoxEXT),
SYM(RasterSamplesEXT),
SYM(GetGraphicsResetStatusEXT),
SYM(ReadnPixelsEXT),
SYM(GetnUniformfvEXT),
SYM(GetnUniformivEXT),
SYM(ActiveShaderProgramEXT),
SYM(BindProgramPipelineEXT),
SYM(CreateShaderProgramvEXT),
SYM(DeleteProgramPipelinesEXT),
SYM(GenProgramPipelinesEXT),
SYM(GetProgramPipelineInfoLogEXT),
SYM(GetProgramPipelineivEXT),
SYM(IsProgramPipelineEXT),
SYM(ProgramParameteriEXT),
SYM(ProgramUniform1fEXT),
SYM(ProgramUniform1fvEXT),
SYM(ProgramUniform1iEXT),
SYM(ProgramUniform1ivEXT),
SYM(ProgramUniform2fEXT),
SYM(ProgramUniform2fvEXT),
SYM(ProgramUniform2iEXT),
SYM(ProgramUniform2ivEXT),
SYM(ProgramUniform3fEXT),
SYM(ProgramUniform3fvEXT),
SYM(ProgramUniform3iEXT),
SYM(ProgramUniform3ivEXT),
SYM(ProgramUniform4fEXT),
SYM(ProgramUniform4fvEXT),
SYM(ProgramUniform4iEXT),
SYM(ProgramUniform4ivEXT),
SYM(ProgramUniformMatrix2fvEXT),
SYM(ProgramUniformMatrix3fvEXT),
SYM(ProgramUniformMatrix4fvEXT),
SYM(UseProgramStagesEXT),
SYM(ValidateProgramPipelineEXT),
SYM(ProgramUniform1uiEXT),
SYM(ProgramUniform2uiEXT),
SYM(ProgramUniform3uiEXT),
SYM(ProgramUniform4uiEXT),
SYM(ProgramUniform1uivEXT),
SYM(ProgramUniform2uivEXT),
SYM(ProgramUniform3uivEXT),
SYM(ProgramUniform4uivEXT),
SYM(ProgramUniformMatrix2x3fvEXT),
SYM(ProgramUniformMatrix3x2fvEXT),
SYM(ProgramUniformMatrix2x4fvEXT),
SYM(ProgramUniformMatrix4x2fvEXT),
SYM(ProgramUniformMatrix3x4fvEXT),
SYM(ProgramUniformMatrix4x3fvEXT),
SYM(TexPageCommitmentEXT),
SYM(PatchParameteriEXT),
SYM(TexParameterIivEXT),
SYM(TexParameterIuivEXT),
SYM(GetTexParameterIivEXT),
SYM(GetTexParameterIuivEXT),
SYM(SamplerParameterIivEXT),
SYM(SamplerParameterIuivEXT),
SYM(GetSamplerParameterIivEXT),
SYM(GetSamplerParameterIuivEXT),
SYM(TexBufferEXT),
SYM(TexBufferRangeEXT),
SYM(TexStorage1DEXT),
SYM(TexStorage2DEXT),
SYM(TexStorage3DEXT),
SYM(TextureStorage1DEXT),
SYM(TextureStorage2DEXT),
SYM(TextureStorage3DEXT),
SYM(TextureViewEXT),
SYM(FramebufferTextureMultiviewOVR),
SYM(FramebufferTextureMultisampleMultiviewOVR),
{ NULL, NULL },
};
RGLSYMGLBLENDBARRIERKHRPROC __rglgen_glBlendBarrierKHR;
RGLSYMGLDEBUGMESSAGECONTROLKHRPROC __rglgen_glDebugMessageControlKHR;
RGLSYMGLDEBUGMESSAGEINSERTKHRPROC __rglgen_glDebugMessageInsertKHR;
RGLSYMGLDEBUGMESSAGECALLBACKKHRPROC __rglgen_glDebugMessageCallbackKHR;
@ -67,21 +203,178 @@ RGLSYMGLGETOBJECTLABELKHRPROC __rglgen_glGetObjectLabelKHR;
RGLSYMGLOBJECTPTRLABELKHRPROC __rglgen_glObjectPtrLabelKHR;
RGLSYMGLGETOBJECTPTRLABELKHRPROC __rglgen_glGetObjectPtrLabelKHR;
RGLSYMGLGETPOINTERVKHRPROC __rglgen_glGetPointervKHR;
RGLSYMGLGETGRAPHICSRESETSTATUSKHRPROC __rglgen_glGetGraphicsResetStatusKHR;
RGLSYMGLREADNPIXELSKHRPROC __rglgen_glReadnPixelsKHR;
RGLSYMGLGETNUNIFORMFVKHRPROC __rglgen_glGetnUniformfvKHR;
RGLSYMGLGETNUNIFORMIVKHRPROC __rglgen_glGetnUniformivKHR;
RGLSYMGLGETNUNIFORMUIVKHRPROC __rglgen_glGetnUniformuivKHR;
RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC __rglgen_glEGLImageTargetTexture2DOES;
RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC __rglgen_glEGLImageTargetRenderbufferStorageOES;
RGLSYMGLCOPYIMAGESUBDATAOESPROC __rglgen_glCopyImageSubDataOES;
RGLSYMGLENABLEIOESPROC __rglgen_glEnableiOES;
RGLSYMGLDISABLEIOESPROC __rglgen_glDisableiOES;
RGLSYMGLBLENDEQUATIONIOESPROC __rglgen_glBlendEquationiOES;
RGLSYMGLBLENDEQUATIONSEPARATEIOESPROC __rglgen_glBlendEquationSeparateiOES;
RGLSYMGLBLENDFUNCIOESPROC __rglgen_glBlendFunciOES;
RGLSYMGLBLENDFUNCSEPARATEIOESPROC __rglgen_glBlendFuncSeparateiOES;
RGLSYMGLCOLORMASKIOESPROC __rglgen_glColorMaskiOES;
RGLSYMGLISENABLEDIOESPROC __rglgen_glIsEnablediOES;
RGLSYMGLDRAWELEMENTSBASEVERTEXOESPROC __rglgen_glDrawElementsBaseVertexOES;
RGLSYMGLDRAWRANGEELEMENTSBASEVERTEXOESPROC __rglgen_glDrawRangeElementsBaseVertexOES;
RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC __rglgen_glDrawElementsInstancedBaseVertexOES;
RGLSYMGLMULTIDRAWELEMENTSBASEVERTEXOESPROC __rglgen_glMultiDrawElementsBaseVertexOES;
RGLSYMGLFRAMEBUFFERTEXTUREOESPROC __rglgen_glFramebufferTextureOES;
RGLSYMGLGETPROGRAMBINARYOESPROC __rglgen_glGetProgramBinaryOES;
RGLSYMGLPROGRAMBINARYOESPROC __rglgen_glProgramBinaryOES;
RGLSYMGLMAPBUFFEROESPROC __rglgen_glMapBufferOES;
RGLSYMGLUNMAPBUFFEROESPROC __rglgen_glUnmapBufferOES;
RGLSYMGLGETBUFFERPOINTERVOESPROC __rglgen_glGetBufferPointervOES;
RGLSYMGLPRIMITIVEBOUNDINGBOXOESPROC __rglgen_glPrimitiveBoundingBoxOES;
RGLSYMGLMINSAMPLESHADINGOESPROC __rglgen_glMinSampleShadingOES;
RGLSYMGLPATCHPARAMETERIOESPROC __rglgen_glPatchParameteriOES;
RGLSYMGLTEXIMAGE3DOESPROC __rglgen_glTexImage3DOES;
RGLSYMGLTEXSUBIMAGE3DOESPROC __rglgen_glTexSubImage3DOES;
RGLSYMGLCOPYTEXSUBIMAGE3DOESPROC __rglgen_glCopyTexSubImage3DOES;
RGLSYMGLCOMPRESSEDTEXIMAGE3DOESPROC __rglgen_glCompressedTexImage3DOES;
RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DOESPROC __rglgen_glCompressedTexSubImage3DOES;
RGLSYMGLFRAMEBUFFERTEXTURE3DOESPROC __rglgen_glFramebufferTexture3DOES;
RGLSYMGLTEXPARAMETERIIVOESPROC __rglgen_glTexParameterIivOES;
RGLSYMGLTEXPARAMETERIUIVOESPROC __rglgen_glTexParameterIuivOES;
RGLSYMGLGETTEXPARAMETERIIVOESPROC __rglgen_glGetTexParameterIivOES;
RGLSYMGLGETTEXPARAMETERIUIVOESPROC __rglgen_glGetTexParameterIuivOES;
RGLSYMGLSAMPLERPARAMETERIIVOESPROC __rglgen_glSamplerParameterIivOES;
RGLSYMGLSAMPLERPARAMETERIUIVOESPROC __rglgen_glSamplerParameterIuivOES;
RGLSYMGLGETSAMPLERPARAMETERIIVOESPROC __rglgen_glGetSamplerParameterIivOES;
RGLSYMGLGETSAMPLERPARAMETERIUIVOESPROC __rglgen_glGetSamplerParameterIuivOES;
RGLSYMGLTEXBUFFEROESPROC __rglgen_glTexBufferOES;
RGLSYMGLTEXBUFFERRANGEOESPROC __rglgen_glTexBufferRangeOES;
RGLSYMGLTEXSTORAGE3DMULTISAMPLEOESPROC __rglgen_glTexStorage3DMultisampleOES;
RGLSYMGLTEXTUREVIEWOESPROC __rglgen_glTextureViewOES;
RGLSYMGLBINDVERTEXARRAYOESPROC __rglgen_glBindVertexArrayOES;
RGLSYMGLDELETEVERTEXARRAYSOESPROC __rglgen_glDeleteVertexArraysOES;
RGLSYMGLGENVERTEXARRAYSOESPROC __rglgen_glGenVertexArraysOES;
RGLSYMGLISVERTEXARRAYOESPROC __rglgen_glIsVertexArrayOES;
RGLSYMGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC __rglgen_glDrawArraysInstancedBaseInstanceEXT;
RGLSYMGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC __rglgen_glDrawElementsInstancedBaseInstanceEXT;
RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC __rglgen_glDrawElementsInstancedBaseVertexBaseInstanceEXT;
RGLSYMGLBINDFRAGDATALOCATIONINDEXEDEXTPROC __rglgen_glBindFragDataLocationIndexedEXT;
RGLSYMGLBINDFRAGDATALOCATIONEXTPROC __rglgen_glBindFragDataLocationEXT;
RGLSYMGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC __rglgen_glGetProgramResourceLocationIndexEXT;
RGLSYMGLGETFRAGDATAINDEXEXTPROC __rglgen_glGetFragDataIndexEXT;
RGLSYMGLBUFFERSTORAGEEXTPROC __rglgen_glBufferStorageEXT;
RGLSYMGLCOPYIMAGESUBDATAEXTPROC __rglgen_glCopyImageSubDataEXT;
RGLSYMGLLABELOBJECTEXTPROC __rglgen_glLabelObjectEXT;
RGLSYMGLGETOBJECTLABELEXTPROC __rglgen_glGetObjectLabelEXT;
RGLSYMGLINSERTEVENTMARKEREXTPROC __rglgen_glInsertEventMarkerEXT;
RGLSYMGLPUSHGROUPMARKEREXTPROC __rglgen_glPushGroupMarkerEXT;
RGLSYMGLPOPGROUPMARKEREXTPROC __rglgen_glPopGroupMarkerEXT;
RGLSYMGLDISCARDFRAMEBUFFEREXTPROC __rglgen_glDiscardFramebufferEXT;
RGLSYMGLGENQUERIESEXTPROC __rglgen_glGenQueriesEXT;
RGLSYMGLDELETEQUERIESEXTPROC __rglgen_glDeleteQueriesEXT;
RGLSYMGLISQUERYEXTPROC __rglgen_glIsQueryEXT;
RGLSYMGLBEGINQUERYEXTPROC __rglgen_glBeginQueryEXT;
RGLSYMGLENDQUERYEXTPROC __rglgen_glEndQueryEXT;
RGLSYMGLQUERYCOUNTEREXTPROC __rglgen_glQueryCounterEXT;
RGLSYMGLGETQUERYIVEXTPROC __rglgen_glGetQueryivEXT;
RGLSYMGLGETQUERYOBJECTIVEXTPROC __rglgen_glGetQueryObjectivEXT;
RGLSYMGLGETQUERYOBJECTUIVEXTPROC __rglgen_glGetQueryObjectuivEXT;
RGLSYMGLDRAWBUFFERSEXTPROC __rglgen_glDrawBuffersEXT;
RGLSYMGLENABLEIEXTPROC __rglgen_glEnableiEXT;
RGLSYMGLDISABLEIEXTPROC __rglgen_glDisableiEXT;
RGLSYMGLBLENDEQUATIONIEXTPROC __rglgen_glBlendEquationiEXT;
RGLSYMGLBLENDEQUATIONSEPARATEIEXTPROC __rglgen_glBlendEquationSeparateiEXT;
RGLSYMGLBLENDFUNCIEXTPROC __rglgen_glBlendFunciEXT;
RGLSYMGLBLENDFUNCSEPARATEIEXTPROC __rglgen_glBlendFuncSeparateiEXT;
RGLSYMGLCOLORMASKIEXTPROC __rglgen_glColorMaskiEXT;
RGLSYMGLISENABLEDIEXTPROC __rglgen_glIsEnablediEXT;
RGLSYMGLDRAWELEMENTSBASEVERTEXEXTPROC __rglgen_glDrawElementsBaseVertexEXT;
RGLSYMGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC __rglgen_glDrawRangeElementsBaseVertexEXT;
RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC __rglgen_glDrawElementsInstancedBaseVertexEXT;
RGLSYMGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC __rglgen_glMultiDrawElementsBaseVertexEXT;
RGLSYMGLDRAWARRAYSINSTANCEDEXTPROC __rglgen_glDrawArraysInstancedEXT;
RGLSYMGLDRAWELEMENTSINSTANCEDEXTPROC __rglgen_glDrawElementsInstancedEXT;
RGLSYMGLFRAMEBUFFERTEXTUREEXTPROC __rglgen_glFramebufferTextureEXT;
RGLSYMGLVERTEXATTRIBDIVISOREXTPROC __rglgen_glVertexAttribDivisorEXT;
RGLSYMGLMAPBUFFERRANGEEXTPROC __rglgen_glMapBufferRangeEXT;
RGLSYMGLFLUSHMAPPEDBUFFERRANGEEXTPROC __rglgen_glFlushMappedBufferRangeEXT;
RGLSYMGLMULTIDRAWARRAYSEXTPROC __rglgen_glMultiDrawArraysEXT;
RGLSYMGLMULTIDRAWELEMENTSEXTPROC __rglgen_glMultiDrawElementsEXT;
RGLSYMGLMULTIDRAWARRAYSINDIRECTEXTPROC __rglgen_glMultiDrawArraysIndirectEXT;
RGLSYMGLMULTIDRAWELEMENTSINDIRECTEXTPROC __rglgen_glMultiDrawElementsIndirectEXT;
RGLSYMGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __rglgen_glRenderbufferStorageMultisampleEXT;
RGLSYMGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC __rglgen_glFramebufferTexture2DMultisampleEXT;
RGLSYMGLREADBUFFERINDEXEDEXTPROC __rglgen_glReadBufferIndexedEXT;
RGLSYMGLDRAWBUFFERSINDEXEDEXTPROC __rglgen_glDrawBuffersIndexedEXT;
RGLSYMGLGETINTEGERI_VEXTPROC __rglgen_glGetIntegeri_vEXT;
RGLSYMGLPRIMITIVEBOUNDINGBOXEXTPROC __rglgen_glPrimitiveBoundingBoxEXT;
RGLSYMGLRASTERSAMPLESEXTPROC __rglgen_glRasterSamplesEXT;
RGLSYMGLGETGRAPHICSRESETSTATUSEXTPROC __rglgen_glGetGraphicsResetStatusEXT;
RGLSYMGLREADNPIXELSEXTPROC __rglgen_glReadnPixelsEXT;
RGLSYMGLGETNUNIFORMFVEXTPROC __rglgen_glGetnUniformfvEXT;
RGLSYMGLGETNUNIFORMIVEXTPROC __rglgen_glGetnUniformivEXT;
RGLSYMGLACTIVESHADERPROGRAMEXTPROC __rglgen_glActiveShaderProgramEXT;
RGLSYMGLBINDPROGRAMPIPELINEEXTPROC __rglgen_glBindProgramPipelineEXT;
RGLSYMGLCREATESHADERPROGRAMVEXTPROC __rglgen_glCreateShaderProgramvEXT;
RGLSYMGLDELETEPROGRAMPIPELINESEXTPROC __rglgen_glDeleteProgramPipelinesEXT;
RGLSYMGLGENPROGRAMPIPELINESEXTPROC __rglgen_glGenProgramPipelinesEXT;
RGLSYMGLGETPROGRAMPIPELINEINFOLOGEXTPROC __rglgen_glGetProgramPipelineInfoLogEXT;
RGLSYMGLGETPROGRAMPIPELINEIVEXTPROC __rglgen_glGetProgramPipelineivEXT;
RGLSYMGLISPROGRAMPIPELINEEXTPROC __rglgen_glIsProgramPipelineEXT;
RGLSYMGLPROGRAMPARAMETERIEXTPROC __rglgen_glProgramParameteriEXT;
RGLSYMGLPROGRAMUNIFORM1FEXTPROC __rglgen_glProgramUniform1fEXT;
RGLSYMGLPROGRAMUNIFORM1FVEXTPROC __rglgen_glProgramUniform1fvEXT;
RGLSYMGLPROGRAMUNIFORM1IEXTPROC __rglgen_glProgramUniform1iEXT;
RGLSYMGLPROGRAMUNIFORM1IVEXTPROC __rglgen_glProgramUniform1ivEXT;
RGLSYMGLPROGRAMUNIFORM2FEXTPROC __rglgen_glProgramUniform2fEXT;
RGLSYMGLPROGRAMUNIFORM2FVEXTPROC __rglgen_glProgramUniform2fvEXT;
RGLSYMGLPROGRAMUNIFORM2IEXTPROC __rglgen_glProgramUniform2iEXT;
RGLSYMGLPROGRAMUNIFORM2IVEXTPROC __rglgen_glProgramUniform2ivEXT;
RGLSYMGLPROGRAMUNIFORM3FEXTPROC __rglgen_glProgramUniform3fEXT;
RGLSYMGLPROGRAMUNIFORM3FVEXTPROC __rglgen_glProgramUniform3fvEXT;
RGLSYMGLPROGRAMUNIFORM3IEXTPROC __rglgen_glProgramUniform3iEXT;
RGLSYMGLPROGRAMUNIFORM3IVEXTPROC __rglgen_glProgramUniform3ivEXT;
RGLSYMGLPROGRAMUNIFORM4FEXTPROC __rglgen_glProgramUniform4fEXT;
RGLSYMGLPROGRAMUNIFORM4FVEXTPROC __rglgen_glProgramUniform4fvEXT;
RGLSYMGLPROGRAMUNIFORM4IEXTPROC __rglgen_glProgramUniform4iEXT;
RGLSYMGLPROGRAMUNIFORM4IVEXTPROC __rglgen_glProgramUniform4ivEXT;
RGLSYMGLPROGRAMUNIFORMMATRIX2FVEXTPROC __rglgen_glProgramUniformMatrix2fvEXT;
RGLSYMGLPROGRAMUNIFORMMATRIX3FVEXTPROC __rglgen_glProgramUniformMatrix3fvEXT;
RGLSYMGLPROGRAMUNIFORMMATRIX4FVEXTPROC __rglgen_glProgramUniformMatrix4fvEXT;
RGLSYMGLUSEPROGRAMSTAGESEXTPROC __rglgen_glUseProgramStagesEXT;
RGLSYMGLVALIDATEPROGRAMPIPELINEEXTPROC __rglgen_glValidateProgramPipelineEXT;
RGLSYMGLPROGRAMUNIFORM1UIEXTPROC __rglgen_glProgramUniform1uiEXT;
RGLSYMGLPROGRAMUNIFORM2UIEXTPROC __rglgen_glProgramUniform2uiEXT;
RGLSYMGLPROGRAMUNIFORM3UIEXTPROC __rglgen_glProgramUniform3uiEXT;
RGLSYMGLPROGRAMUNIFORM4UIEXTPROC __rglgen_glProgramUniform4uiEXT;
RGLSYMGLPROGRAMUNIFORM1UIVEXTPROC __rglgen_glProgramUniform1uivEXT;
RGLSYMGLPROGRAMUNIFORM2UIVEXTPROC __rglgen_glProgramUniform2uivEXT;
RGLSYMGLPROGRAMUNIFORM3UIVEXTPROC __rglgen_glProgramUniform3uivEXT;
RGLSYMGLPROGRAMUNIFORM4UIVEXTPROC __rglgen_glProgramUniform4uivEXT;
RGLSYMGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC __rglgen_glProgramUniformMatrix2x3fvEXT;
RGLSYMGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC __rglgen_glProgramUniformMatrix3x2fvEXT;
RGLSYMGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC __rglgen_glProgramUniformMatrix2x4fvEXT;
RGLSYMGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC __rglgen_glProgramUniformMatrix4x2fvEXT;
RGLSYMGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC __rglgen_glProgramUniformMatrix3x4fvEXT;
RGLSYMGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC __rglgen_glProgramUniformMatrix4x3fvEXT;
RGLSYMGLTEXPAGECOMMITMENTEXTPROC __rglgen_glTexPageCommitmentEXT;
RGLSYMGLPATCHPARAMETERIEXTPROC __rglgen_glPatchParameteriEXT;
RGLSYMGLTEXPARAMETERIIVEXTPROC __rglgen_glTexParameterIivEXT;
RGLSYMGLTEXPARAMETERIUIVEXTPROC __rglgen_glTexParameterIuivEXT;
RGLSYMGLGETTEXPARAMETERIIVEXTPROC __rglgen_glGetTexParameterIivEXT;
RGLSYMGLGETTEXPARAMETERIUIVEXTPROC __rglgen_glGetTexParameterIuivEXT;
RGLSYMGLSAMPLERPARAMETERIIVEXTPROC __rglgen_glSamplerParameterIivEXT;
RGLSYMGLSAMPLERPARAMETERIUIVEXTPROC __rglgen_glSamplerParameterIuivEXT;
RGLSYMGLGETSAMPLERPARAMETERIIVEXTPROC __rglgen_glGetSamplerParameterIivEXT;
RGLSYMGLGETSAMPLERPARAMETERIUIVEXTPROC __rglgen_glGetSamplerParameterIuivEXT;
RGLSYMGLTEXBUFFEREXTPROC __rglgen_glTexBufferEXT;
RGLSYMGLTEXBUFFERRANGEEXTPROC __rglgen_glTexBufferRangeEXT;
RGLSYMGLTEXSTORAGE1DEXTPROC __rglgen_glTexStorage1DEXT;
RGLSYMGLTEXSTORAGE2DEXTPROC __rglgen_glTexStorage2DEXT;
RGLSYMGLTEXSTORAGE3DEXTPROC __rglgen_glTexStorage3DEXT;
RGLSYMGLTEXTURESTORAGE1DEXTPROC __rglgen_glTextureStorage1DEXT;
RGLSYMGLTEXTURESTORAGE2DEXTPROC __rglgen_glTextureStorage2DEXT;
RGLSYMGLTEXTURESTORAGE3DEXTPROC __rglgen_glTextureStorage3DEXT;
RGLSYMGLTEXTUREVIEWEXTPROC __rglgen_glTextureViewEXT;
RGLSYMGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC __rglgen_glFramebufferTextureMultiviewOVR;
RGLSYMGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC __rglgen_glFramebufferTextureMultisampleMultiviewOVR;

View File

@ -0,0 +1,138 @@
#include "glsym/glsym.h"
#include <stddef.h>
#define SYM(x) { "gl" #x, &(gl##x) }
const struct rglgen_sym_map rglgen_symbol_map[] = {
SYM(BlendBarrierKHR),
SYM(DebugMessageControlKHR),
SYM(DebugMessageInsertKHR),
SYM(DebugMessageCallbackKHR),
SYM(GetDebugMessageLogKHR),
SYM(PushDebugGroupKHR),
SYM(PopDebugGroupKHR),
SYM(ObjectLabelKHR),
SYM(GetObjectLabelKHR),
SYM(ObjectPtrLabelKHR),
SYM(GetObjectPtrLabelKHR),
SYM(GetPointervKHR),
SYM(GetGraphicsResetStatusKHR),
SYM(ReadnPixelsKHR),
SYM(GetnUniformfvKHR),
SYM(GetnUniformivKHR),
SYM(GetnUniformuivKHR),
SYM(EGLImageTargetTexture2DOES),
SYM(EGLImageTargetRenderbufferStorageOES),
SYM(CopyImageSubDataOES),
SYM(EnableiOES),
SYM(DisableiOES),
SYM(BlendEquationiOES),
SYM(BlendEquationSeparateiOES),
SYM(BlendFunciOES),
SYM(BlendFuncSeparateiOES),
SYM(ColorMaskiOES),
SYM(IsEnablediOES),
SYM(DrawElementsBaseVertexOES),
SYM(DrawRangeElementsBaseVertexOES),
SYM(DrawElementsInstancedBaseVertexOES),
SYM(MultiDrawElementsBaseVertexOES),
SYM(FramebufferTextureOES),
SYM(GetProgramBinaryOES),
SYM(ProgramBinaryOES),
SYM(MapBufferOES),
SYM(UnmapBufferOES),
SYM(GetBufferPointervOES),
SYM(PrimitiveBoundingBoxOES),
SYM(MinSampleShadingOES),
SYM(PatchParameteriOES),
SYM(TexImage3DOES),
SYM(TexSubImage3DOES),
SYM(CopyTexSubImage3DOES),
SYM(CompressedTexImage3DOES),
SYM(CompressedTexSubImage3DOES),
SYM(FramebufferTexture3DOES),
SYM(TexParameterIivOES),
SYM(TexParameterIuivOES),
SYM(GetTexParameterIivOES),
SYM(GetTexParameterIuivOES),
SYM(SamplerParameterIivOES),
SYM(SamplerParameterIuivOES),
SYM(GetSamplerParameterIivOES),
SYM(GetSamplerParameterIuivOES),
SYM(TexBufferOES),
SYM(TexBufferRangeOES),
SYM(TexStorage3DMultisampleOES),
SYM(TextureViewOES),
SYM(BindVertexArrayOES),
SYM(DeleteVertexArraysOES),
SYM(GenVertexArraysOES),
SYM(IsVertexArrayOES),
SYM(FramebufferTextureMultiviewOVR),
SYM(FramebufferTextureMultisampleMultiviewOVR),
{ NULL, NULL },
};
RGLSYMGLBLENDBARRIERKHRPROC __rglgen_glBlendBarrierKHR;
RGLSYMGLDEBUGMESSAGECONTROLKHRPROC __rglgen_glDebugMessageControlKHR;
RGLSYMGLDEBUGMESSAGEINSERTKHRPROC __rglgen_glDebugMessageInsertKHR;
RGLSYMGLDEBUGMESSAGECALLBACKKHRPROC __rglgen_glDebugMessageCallbackKHR;
RGLSYMGLGETDEBUGMESSAGELOGKHRPROC __rglgen_glGetDebugMessageLogKHR;
RGLSYMGLPUSHDEBUGGROUPKHRPROC __rglgen_glPushDebugGroupKHR;
RGLSYMGLPOPDEBUGGROUPKHRPROC __rglgen_glPopDebugGroupKHR;
RGLSYMGLOBJECTLABELKHRPROC __rglgen_glObjectLabelKHR;
RGLSYMGLGETOBJECTLABELKHRPROC __rglgen_glGetObjectLabelKHR;
RGLSYMGLOBJECTPTRLABELKHRPROC __rglgen_glObjectPtrLabelKHR;
RGLSYMGLGETOBJECTPTRLABELKHRPROC __rglgen_glGetObjectPtrLabelKHR;
RGLSYMGLGETPOINTERVKHRPROC __rglgen_glGetPointervKHR;
RGLSYMGLGETGRAPHICSRESETSTATUSKHRPROC __rglgen_glGetGraphicsResetStatusKHR;
RGLSYMGLREADNPIXELSKHRPROC __rglgen_glReadnPixelsKHR;
RGLSYMGLGETNUNIFORMFVKHRPROC __rglgen_glGetnUniformfvKHR;
RGLSYMGLGETNUNIFORMIVKHRPROC __rglgen_glGetnUniformivKHR;
RGLSYMGLGETNUNIFORMUIVKHRPROC __rglgen_glGetnUniformuivKHR;
RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC __rglgen_glEGLImageTargetTexture2DOES;
RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC __rglgen_glEGLImageTargetRenderbufferStorageOES;
RGLSYMGLCOPYIMAGESUBDATAOESPROC __rglgen_glCopyImageSubDataOES;
RGLSYMGLENABLEIOESPROC __rglgen_glEnableiOES;
RGLSYMGLDISABLEIOESPROC __rglgen_glDisableiOES;
RGLSYMGLBLENDEQUATIONIOESPROC __rglgen_glBlendEquationiOES;
RGLSYMGLBLENDEQUATIONSEPARATEIOESPROC __rglgen_glBlendEquationSeparateiOES;
RGLSYMGLBLENDFUNCIOESPROC __rglgen_glBlendFunciOES;
RGLSYMGLBLENDFUNCSEPARATEIOESPROC __rglgen_glBlendFuncSeparateiOES;
RGLSYMGLCOLORMASKIOESPROC __rglgen_glColorMaskiOES;
RGLSYMGLISENABLEDIOESPROC __rglgen_glIsEnablediOES;
RGLSYMGLDRAWELEMENTSBASEVERTEXOESPROC __rglgen_glDrawElementsBaseVertexOES;
RGLSYMGLDRAWRANGEELEMENTSBASEVERTEXOESPROC __rglgen_glDrawRangeElementsBaseVertexOES;
RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC __rglgen_glDrawElementsInstancedBaseVertexOES;
RGLSYMGLMULTIDRAWELEMENTSBASEVERTEXOESPROC __rglgen_glMultiDrawElementsBaseVertexOES;
RGLSYMGLFRAMEBUFFERTEXTUREOESPROC __rglgen_glFramebufferTextureOES;
RGLSYMGLGETPROGRAMBINARYOESPROC __rglgen_glGetProgramBinaryOES;
RGLSYMGLPROGRAMBINARYOESPROC __rglgen_glProgramBinaryOES;
RGLSYMGLMAPBUFFEROESPROC __rglgen_glMapBufferOES;
RGLSYMGLUNMAPBUFFEROESPROC __rglgen_glUnmapBufferOES;
RGLSYMGLGETBUFFERPOINTERVOESPROC __rglgen_glGetBufferPointervOES;
RGLSYMGLPRIMITIVEBOUNDINGBOXOESPROC __rglgen_glPrimitiveBoundingBoxOES;
RGLSYMGLMINSAMPLESHADINGOESPROC __rglgen_glMinSampleShadingOES;
RGLSYMGLPATCHPARAMETERIOESPROC __rglgen_glPatchParameteriOES;
RGLSYMGLTEXIMAGE3DOESPROC __rglgen_glTexImage3DOES;
RGLSYMGLTEXSUBIMAGE3DOESPROC __rglgen_glTexSubImage3DOES;
RGLSYMGLCOPYTEXSUBIMAGE3DOESPROC __rglgen_glCopyTexSubImage3DOES;
RGLSYMGLCOMPRESSEDTEXIMAGE3DOESPROC __rglgen_glCompressedTexImage3DOES;
RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DOESPROC __rglgen_glCompressedTexSubImage3DOES;
RGLSYMGLFRAMEBUFFERTEXTURE3DOESPROC __rglgen_glFramebufferTexture3DOES;
RGLSYMGLTEXPARAMETERIIVOESPROC __rglgen_glTexParameterIivOES;
RGLSYMGLTEXPARAMETERIUIVOESPROC __rglgen_glTexParameterIuivOES;
RGLSYMGLGETTEXPARAMETERIIVOESPROC __rglgen_glGetTexParameterIivOES;
RGLSYMGLGETTEXPARAMETERIUIVOESPROC __rglgen_glGetTexParameterIuivOES;
RGLSYMGLSAMPLERPARAMETERIIVOESPROC __rglgen_glSamplerParameterIivOES;
RGLSYMGLSAMPLERPARAMETERIUIVOESPROC __rglgen_glSamplerParameterIuivOES;
RGLSYMGLGETSAMPLERPARAMETERIIVOESPROC __rglgen_glGetSamplerParameterIivOES;
RGLSYMGLGETSAMPLERPARAMETERIUIVOESPROC __rglgen_glGetSamplerParameterIuivOES;
RGLSYMGLTEXBUFFEROESPROC __rglgen_glTexBufferOES;
RGLSYMGLTEXBUFFERRANGEOESPROC __rglgen_glTexBufferRangeOES;
RGLSYMGLTEXSTORAGE3DMULTISAMPLEOESPROC __rglgen_glTexStorage3DMultisampleOES;
RGLSYMGLTEXTUREVIEWOESPROC __rglgen_glTextureViewOES;
RGLSYMGLBINDVERTEXARRAYOESPROC __rglgen_glBindVertexArrayOES;
RGLSYMGLDELETEVERTEXARRAYSOESPROC __rglgen_glDeleteVertexArraysOES;
RGLSYMGLGENVERTEXARRAYSOESPROC __rglgen_glGenVertexArraysOES;
RGLSYMGLISVERTEXARRAYOESPROC __rglgen_glIsVertexArrayOES;
RGLSYMGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC __rglgen_glFramebufferTextureMultiviewOVR;
RGLSYMGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC __rglgen_glFramebufferTextureMultisampleMultiviewOVR;

View File

@ -0,0 +1,132 @@
#!/usr/bin/env python3
"""
License statement applies to this file (glgen.py) only.
"""
"""
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
import sys
import os
import re
banned_ext = [ 'AMD', 'APPLE', 'NV', 'NVX', 'ATI', '3DLABS', 'SUN', 'SGI', 'SGIX', 'SGIS', 'INTEL', '3DFX', 'IBM', 'MESA', 'GREMEDY', 'OML', 'PGI', 'I3D', 'INGL', 'MTX', 'QCOM', 'IMG', 'ANGLE', 'SUNX', 'INGR' ]
def noext(sym):
for ext in banned_ext:
if sym.endswith(ext):
return False
return True
def find_gl_symbols(lines):
typedefs = []
syms = []
for line in lines:
m = re.search(r'^typedef.+PFN(\S+)PROC.+$', line)
g = re.search(r'^.+(gl\S+)\W*\(.+\).*$', line)
if m and noext(m.group(1)):
typedefs.append(m.group(0).replace('PFN', 'RGLSYM').replace('GLDEBUGPROC', 'RGLGENGLDEBUGPROC'))
if g and noext(g.group(1)):
syms.append(g.group(1))
return (typedefs, syms)
def generate_defines(gl_syms):
res = []
for line in gl_syms:
res.append('#define {} __rglgen_{}'.format(line, line))
return res
def generate_declarations(gl_syms):
return ['RGLSYM' + x.upper() + 'PROC ' + '__rglgen_' + x + ';' for x in gl_syms]
def generate_macros(gl_syms):
return [' SYM(' + x.replace('gl', '') + '),' for x in gl_syms]
def dump(f, lines):
f.write('\n'.join(lines))
f.write('\n\n')
if __name__ == '__main__':
if len(sys.argv) > 4:
for banned in sys.argv[4:]:
banned_ext.append(banned)
with open(sys.argv[1], 'r') as f:
lines = f.readlines()
typedefs, syms = find_gl_symbols(lines)
overrides = generate_defines(syms)
declarations = generate_declarations(syms)
externs = ['extern ' + x for x in declarations]
macros = generate_macros(syms)
with open(sys.argv[2], 'w') as f:
f.write('#ifndef RGLGEN_DECL_H__\n')
f.write('#define RGLGEN_DECL_H__\n')
f.write('#ifdef __cplusplus\n')
f.write('extern "C" {\n')
f.write('#endif\n')
f.write('#ifdef GL_APIENTRY\n')
f.write('typedef void (GL_APIENTRY *RGLGENGLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);\n')
f.write('#else\n')
f.write('#ifndef APIENTRY\n')
f.write('#define APIENTRY\n')
f.write('#endif\n')
f.write('#ifndef APIENTRYP\n')
f.write('#define APIENTRYP APIENTRY *\n')
f.write('#endif\n')
f.write('typedef void (APIENTRY *RGLGENGLDEBUGPROCARB)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);\n')
f.write('typedef void (APIENTRY *RGLGENGLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);\n')
f.write('#endif\n')
f.write('#ifndef GL_OES_EGL_image\n')
f.write('typedef void *GLeglImageOES;\n')
f.write('#endif\n')
f.write('#if !defined(GL_OES_fixed_point) && !defined(HAVE_OPENGLES2)\n')
f.write('typedef GLint GLfixed;\n')
f.write('#endif\n')
dump(f, typedefs)
dump(f, overrides)
dump(f, externs)
f.write('struct rglgen_sym_map { const char *sym; void *ptr; };\n')
f.write('extern const struct rglgen_sym_map rglgen_symbol_map[];\n')
f.write('#ifdef __cplusplus\n')
f.write('}\n')
f.write('#endif\n')
f.write('#endif\n')
with open(sys.argv[3], 'w') as f:
f.write('#include "glsym/glsym.h"\n')
f.write('#include <stddef.h>\n')
f.write('#define SYM(x) { "gl" #x, &(gl##x) }\n')
f.write('const struct rglgen_sym_map rglgen_symbol_map[] = {\n')
dump(f, macros)
f.write(' { NULL, NULL },\n')
f.write('};\n')
dump(f, declarations)

View File

@ -0,0 +1,40 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (mismatch.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_ALGORITHMS_MISMATCH_H__
#define __LIBRETRO_SDK_ALGORITHMS_MISMATCH_H__
#include <stdint.h>
#include <stddef.h>
#include <retro_common.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
size_t find_change(const uint16_t *a, const uint16_t *b);
size_t find_same(const uint16_t *a, const uint16_t *b);
RETRO_END_DECLS
#endif

View File

@ -38,9 +38,9 @@
* prefer to use the actual name. */
#define getopt_long(argc, argv, optstring, longopts, longindex) __getopt_long_retro(argc, argv, optstring, longopts, longindex)
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
struct option
{
@ -57,9 +57,8 @@ int getopt_long(int argc, char *argv[],
const char *optstring, const struct option *longopts, int *longindex);
extern char *optarg;
extern int optind, opterr, optopt;
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
/* If these are variously #defined, then we have bigger problems */
#ifndef no_argument

View File

@ -0,0 +1,91 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (intrinsics.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_COMPAT_INTRINSICS_H
#define __LIBRETRO_SDK_COMPAT_INTRINSICS_H
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <retro_common_api.h>
#include <retro_inline.h>
#ifdef _MSC_VER
#if (_MSC_VER > 1310)
#include <intrin.h>
#endif
#endif
RETRO_BEGIN_DECLS
/* Count Leading Zero, unsigned 16bit input value */
static INLINE unsigned compat_clz_u16(uint16_t val)
{
#ifdef __GNUC__
return __builtin_clz(val << 16 | 0x8000);
#else
unsigned ret = 0;
while(!(val & 0x8000) && ret < 16)
{
val <<= 1;
ret++;
}
return ret;
#endif
}
/* Count Trailing Zero */
#if defined(__GNUC__) && !defined(RARCH_CONSOLE)
static INLINE int compat_ctz(unsigned x)
{
return __builtin_ctz(x);
}
#elif _MSC_VER >= 1400
static INLINE int compat_ctz(unsigned x)
{
unsigned long r = 0;
_BitScanReverse((unsigned long*)&r, x);
return (int)r;
}
#else
/* Only checks at nibble granularity,
* because that's what we need. */
static INLINE int compat_ctz(unsigned x)
{
if (x & 0x000f)
return 0;
if (x & 0x00f0)
return 4;
if (x & 0x0f00)
return 8;
if (x & 0xf000)
return 12;
return 16;
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,13 +23,13 @@
#ifndef __LIBRETRO_SDK_COMPAT_POSIX_STRING_H
#define __LIBRETRO_SDK_COMPAT_POSIX_STRING_H
#include <retro_common_api.h>
#ifdef _MSC_VER
#include <compat/msvc.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
#ifdef _WIN32
#undef strtok_r
@ -56,8 +56,6 @@ int isblank(int c);
#endif
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -30,9 +30,9 @@
#ifndef HAVE_STRCASESTR
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
/* Avoid possible naming collisions during link
* since we prefer to use the actual name. */
@ -40,9 +40,8 @@ extern "C" {
char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif
#endif

View File

@ -30,9 +30,9 @@
#include "../../../config.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
#ifdef __MACH__
#ifndef HAVE_STRL
@ -52,9 +52,7 @@ size_t strlcat(char *dest, const char *source, size_t size);
#endif
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -0,0 +1,511 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2013 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
# define Z_PREFIX_SET
/* all linked symbols */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_bits z__tr_flush_bits
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# ifndef Z_SOLO
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# endif
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
# define deflatePending z_deflatePending
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateResetKeep z_deflateResetKeep
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# ifdef _WIN32
# define gzopen_w z_gzopen_w
# endif
# define gzprintf z_gzprintf
# define gzvprintf z_gzvprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzwrite z_gzwrite
# endif
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit_ z_inflateBackInit_
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetHeader z_inflateGetHeader
# define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateSetDictionary z_inflateSetDictionary
# define inflateGetDictionary z_inflateGetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflateResetKeep z_inflateResetKeep
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# ifndef Z_SOLO
# define uncompress z_uncompress
# endif
# define zError z_zError
# ifndef Z_SOLO
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# ifndef Z_SOLO
# define gzFile z_gzFile
# endif
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
#else
# define z_const
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
#ifndef Z_ARG /* function prototypes for stdarg */
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
# define Z_ARG(args) args
# else
# define Z_ARG(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# elif (ULONG_MAX == 0xffffffffUL)
# define Z_U4 unsigned long
# elif (USHRT_MAX == 0xffffffffUL)
# define Z_U4 unsigned short
# endif
#endif
#ifdef Z_U4
typedef Z_U4 z_crc_t;
#else
typedef unsigned long z_crc_t;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
#endif
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
# include <stdarg.h> /* for va_list */
# endif
#endif
#ifdef _WIN32
# ifndef Z_SOLO
# include <stddef.h> /* for wchar_t */
# endif
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
# define Z_HAVE_UNISTD_H
#endif
#ifndef Z_SOLO
# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET) && !defined(Z_SOLO)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

View File

@ -0,0 +1,511 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2013 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
# define Z_PREFIX_SET
/* all linked symbols */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_bits z__tr_flush_bits
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# ifndef Z_SOLO
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# endif
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
# define deflatePending z_deflatePending
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateResetKeep z_deflateResetKeep
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# ifdef _WIN32
# define gzopen_w z_gzopen_w
# endif
# define gzprintf z_gzprintf
# define gzvprintf z_gzvprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzwrite z_gzwrite
# endif
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit_ z_inflateBackInit_
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetHeader z_inflateGetHeader
# define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateSetDictionary z_inflateSetDictionary
# define inflateGetDictionary z_inflateGetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflateResetKeep z_inflateResetKeep
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# ifndef Z_SOLO
# define uncompress z_uncompress
# endif
# define zError z_zError
# ifndef Z_SOLO
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# ifndef Z_SOLO
# define gzFile z_gzFile
# endif
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
#else
# define z_const
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
#ifndef Z_ARG /* function prototypes for stdarg */
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
# define Z_ARG(args) args
# else
# define Z_ARG(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# elif (ULONG_MAX == 0xffffffffUL)
# define Z_U4 unsigned long
# elif (USHRT_MAX == 0xffffffffUL)
# define Z_U4 unsigned short
# endif
#endif
#ifdef Z_U4
typedef Z_U4 z_crc_t;
#else
typedef unsigned long z_crc_t;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
#endif
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
# include <stdarg.h> /* for va_list */
# endif
#endif
#ifdef _WIN32
# ifndef Z_SOLO
# include <stddef.h> /* for wchar_t */
# endif
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
# define Z_HAVE_UNISTD_H
#endif
#ifndef Z_SOLO
# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET) && !defined(Z_SOLO)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

View File

@ -3,6 +3,10 @@
#ifdef WANT_ZLIB
#ifdef RARCH_INTERNAL
#include "zconf.h.in"
#endif
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.8, April 28th, 2013

View File

@ -0,0 +1,113 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (float_to_s16.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_CONVERSION_FLOAT_TO_S16_H__
#define __LIBRETRO_SDK_CONVERSION_FLOAT_TO_S16_H__
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
#include <stdint.h>
#include <stddef.h>
/**
* convert_float_to_s16_C:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
*
* Converts floating point
* to signed integer 16-bit.
*
* C implementation callback function.
**/
void convert_float_to_s16_C(int16_t *out,
const float *in, size_t samples);
#if defined(__SSE2__)
#define convert_float_to_s16 convert_float_to_s16_SSE2
/**
* convert_float_to_s16_SSE2:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
*
* Converts floating point
* to signed integer 16-bit.
*
* SSE2 implementation callback function.
**/
void convert_float_to_s16_SSE2(int16_t *out,
const float *in, size_t samples);
#elif defined(__ALTIVEC__)
#define convert_float_to_s16 convert_float_to_s16_altivec
/**
* convert_float_to_s16_altivec:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
*
* Converts floating point
* to signed integer 16-bit.
*
* AltiVec implementation callback function.
**/
void convert_float_to_s16_altivec(int16_t *out,
const float *in, size_t samples);
#elif defined(__ARM_NEON__) && !defined(VITA)
#define convert_float_to_s16 convert_float_to_s16_arm
void (*convert_float_to_s16_arm)(int16_t *out,
const float *in, size_t samples);
void convert_float_s16_asm(int16_t *out, const float *in, size_t samples);
#elif defined(_MIPS_ARCH_ALLEGREX)
#define convert_float_to_s16 convert_float_to_s16_ALLEGREX
/**
* convert_float_to_s16_ALLEGREX:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
*
* Converts floating point
* to signed integer 16-bit.
*
* MIPS ALLEGREX implementation callback function.
**/
void convert_float_to_s16_ALLEGREX(int16_t *out,
const float *in, size_t samples);
#else
#define convert_float_to_s16 convert_float_to_s16_C
#endif
/**
* convert_float_to_s16_init_simd:
*
* Sets up function pointers for conversion
* functions based on CPU features.
**/
void convert_float_to_s16_init_simd(void);
RETRO_END_DECLS
#endif

View File

@ -0,0 +1,120 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (s16_to_float.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_CONVERSION_S16_TO_FLOAT_H__
#define __LIBRETRO_SDK_CONVERSION_S16_TO_FLOAT_H__
#include <stdint.h>
#include <stddef.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
#if defined(__SSE2__)
#define convert_s16_to_float convert_s16_to_float_SSE2
/**
* convert_s16_to_float_SSE2:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
* @gain : gain applied (.e.g. audio volume)
*
* Converts from signed integer 16-bit
* to floating point.
*
* SSE2 implementation callback function.
**/
void convert_s16_to_float_SSE2(float *out,
const int16_t *in, size_t samples, float gain);
#elif defined(__ALTIVEC__)
#define convert_s16_to_float convert_s16_to_float_altivec
/**
* convert_s16_to_float_altivec:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
* @gain : gain applied (.e.g. audio volume)
*
* Converts from signed integer 16-bit
* to floating point.
*
* AltiVec implementation callback function.
**/
void convert_s16_to_float_altivec(float *out,
const int16_t *in, size_t samples, float gain);
#elif defined(__ARM_NEON__) && !defined(VITA)
#define convert_s16_to_float convert_s16_to_float_arm
void (*convert_s16_to_float_arm)(float *out,
const int16_t *in, size_t samples, float gain);
#elif defined(_MIPS_ARCH_ALLEGREX)
#define convert_s16_to_float convert_s16_to_float_ALLEGREX
/**
* convert_s16_to_float_ALLEGREX:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
* @gain : gain applied (.e.g. audio volume)
*
* Converts from signed integer 16-bit
* to floating point.
*
* MIPS ALLEGREX implementation callback function.
**/
void convert_s16_to_float_ALLEGREX(float *out,
const int16_t *in, size_t samples, float gain);
#else
#define convert_s16_to_float convert_s16_to_float_C
#endif
/**
* convert_s16_to_float_C:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
* @gain : gain applied (.e.g. audio volume)
*
* Converts from signed integer 16-bit
* to floating point.
*
* C implementation callback function.
**/
void convert_s16_to_float_C(float *out,
const int16_t *in, size_t samples, float gain);
/**
* convert_s16_to_float_init_simd:
*
* Sets up function pointers for conversion
* functions based on CPU features.
**/
void convert_s16_to_float_init_simd(void);
RETRO_END_DECLS
#endif

View File

@ -29,15 +29,15 @@
#include "config.h"
#endif
#include <retro_common_api.h>
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
#define NEED_DYNAMIC
#else
#undef NEED_DYNAMIC
#endif
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
typedef void *dylib_t;
typedef void (*function_t)(void);
@ -66,9 +66,6 @@ char *dylib_error(void);
function_t dylib_proc(dylib_t lib, const char *proc);
#endif
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -0,0 +1,71 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (features_cpu.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _LIBRETRO_SDK_CPU_INFO_H
#define _LIBRETRO_SDK_CPU_INFO_H
#include <retro_common_api.h>
#include <stdint.h>
#include <libretro.h>
RETRO_BEGIN_DECLS
/**
* cpu_features_get_perf_counter:
*
* Gets performance counter.
*
* Returns: performance counter.
**/
retro_perf_tick_t cpu_features_get_perf_counter(void);
/**
* cpu_features_get_time_usec:
*
* Gets time in microseconds. *
* Returns: time in microseconds.
**/
retro_time_t cpu_features_get_time_usec(void);
/**
* cpu_features_get:
*
* Gets CPU features..
*
* Returns: bitmask of all CPU features available.
**/
uint64_t cpu_features_get(void);
/**
* cpu_features_get_core_amount:
*
* Gets the amount of available CPU cores.
*
* Returns: amount of CPU cores available.
**/
unsigned cpu_features_get_core_amount(void);
RETRO_END_DECLS
#endif

View File

@ -24,9 +24,9 @@
#ifndef __LIBRETRO_SDK_CONFIG_FILE_H
#define __LIBRETRO_SDK_CONFIG_FILE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
#include <stdio.h>
#include <stdint.h>
@ -158,9 +158,7 @@ bool config_file_write(config_file_t *conf, const char *path);
* Does not close the file. */
void config_file_dump(config_file_t *conf, FILE *file);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -28,12 +28,12 @@
#include <stddef.h>
#include <sys/types.h>
#include <retro_common_api.h>
#include <boolean.h>
#include <retro_inline.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
/* Order in this enum is equivalent to negative sort order in filelist
* (i.e. DIRECTORY is on top of PLAIN_FILE) */
@ -211,6 +211,16 @@ void fill_dated_filename(char *out_filename,
void fill_pathname_noext(char *out_path, const char *in_path,
const char *replace, size_t size);
/**
* find_last_slash:
* @str : input path
*
* Gets a pointer to the last slash in the input path.
*
* Returns: a pointer to the last slash in the input path.
**/
char *find_last_slash(const char *str);
/**
* fill_pathname_dir:
* @in_dir : input directory path
@ -241,6 +251,13 @@ void fill_pathname_dir(char *in_dir, const char *in_basename,
**/
void fill_pathname_base(char *out_path, const char *in_path, size_t size);
void fill_pathname_base_noext(char *out_dir,
const char *in_path, size_t size);
void fill_pathname_base_ext(char *out,
const char *in_path, const char *ext,
size_t size);
/**
* fill_pathname_basedir:
* @out_dir : output directory
@ -253,6 +270,9 @@ void fill_pathname_base(char *out_path, const char *in_path, size_t size);
**/
void fill_pathname_basedir(char *out_path, const char *in_path, size_t size);
void fill_pathname_basedir_noext(char *out_dir,
const char *in_path, size_t size);
/**
* fill_pathname_parent_dir:
* @out_dir : output directory
@ -294,18 +314,18 @@ void fill_pathname_resolve_relative(char *out_path, const char *in_refpath,
void fill_pathname_join(char *out_path, const char *dir,
const char *path, size_t size);
/**
* fill_string_join:
* @out_path : output path
* @path : path
* @size : size of output path
*
* Joins a string (@out_path) and path (@append) together.
* Makes sure not to get two consecutive slashes
* between directory and path.
**/
void fill_string_join(char *out_path,
const char *path, size_t size);
void fill_pathname_join_special_ext(char *out_path,
const char *dir, const char *path,
const char *last, const char *ext,
size_t size);
void fill_pathname_join_concat(char *out_path,
const char *dir, const char *path,
const char *concat,
size_t size);
void fill_pathname_join_noext(char *out_path,
const char *dir, const char *path, size_t size);
/**
* fill_pathname_join_delim:
@ -321,6 +341,10 @@ void fill_string_join(char *out_path,
void fill_pathname_join_delim(char *out_path, const char *dir,
const char *path, const char delim, size_t size);
void fill_pathname_join_delim_concat(char *out_path, const char *dir,
const char *path, const char delim, const char *concat,
size_t size);
/**
* fill_short_pathname_representation:
* @out_rep : output representation
@ -339,6 +363,9 @@ void fill_pathname_join_delim(char *out_path, const char *dir,
void fill_short_pathname_representation(char* out_rep,
const char *in_path, size_t size);
void fill_short_pathname_representation_noext(char* out_rep,
const char *in_path, size_t size);
void fill_pathname_expand_special(char *out_path,
const char *in_path, size_t size);
@ -402,8 +429,6 @@ void fill_pathname_application_path(char *buf, size_t size);
**/
bool path_mkdir(const char *dir);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -29,6 +29,7 @@
#include <stdlib.h>
#include <math.h>
#include <retro_inline.h>
#include <retro_miscellaneous.h>
static INLINE double sinc(double val)
{

View File

@ -1,6 +1,6 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
* Copyright (C) 2011-2016 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
@ -18,11 +18,12 @@
#define __RARCH_IMAGE_CONTEXT_H
#include <stdint.h>
#include <retro_common_api.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
enum image_process_code
{
@ -39,18 +40,50 @@ struct texture_image
uint32_t *pixels;
};
bool video_texture_image_set_color_shifts(unsigned *r_shift, unsigned *g_shift,
enum image_type_enum
{
IMAGE_TYPE_NONE = 0,
IMAGE_TYPE_PNG,
IMAGE_TYPE_JPEG,
IMAGE_TYPE_BMP,
IMAGE_TYPE_TGA
};
bool image_texture_set_color_shifts(unsigned *r_shift, unsigned *g_shift,
unsigned *b_shift, unsigned *a_shift);
bool video_texture_image_color_convert(unsigned r_shift,
bool image_texture_color_convert(unsigned r_shift,
unsigned g_shift, unsigned b_shift, unsigned a_shift,
struct texture_image *out_img);
bool video_texture_image_load(struct texture_image *img, const char *path);
void video_texture_image_free(struct texture_image *img);
bool image_texture_load(struct texture_image *img, const char *path);
void image_texture_free(struct texture_image *img);
void image_texture_set_rgba(void);
void image_texture_unset_rgba(void);
#ifdef __cplusplus
}
#endif
/* Image transfer */
void image_transfer_free(void *data, enum image_type_enum type);
void *image_transfer_new(enum image_type_enum type);
bool image_transfer_start(void *data, enum image_type_enum type);
void image_transfer_set_buffer_ptr(
void *data,
enum image_type_enum type,
void *ptr);
int image_transfer_process(
void *data,
enum image_type_enum type,
uint32_t **buf, size_t size,
unsigned *width, unsigned *height);
bool image_transfer_iterate(void *data, enum image_type_enum type);
bool image_transfer_is_valid(void *data, enum image_type_enum type);
RETRO_END_DECLS
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (jsonsax.h).

View File

@ -23,11 +23,11 @@
#ifndef __LIBRETRO_SDK_FORMAT_RBMP_H__
#define __LIBRETRO_SDK_FORMAT_RBMP_H__
#include <retro_common_api.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
enum rbmp_source_type
{
@ -38,6 +38,8 @@ enum rbmp_source_type
RBMP_SOURCE_TYPE_ARGB8888
};
typedef struct rbmp rbmp_t;
bool rbmp_save_image(
const char *filename,
const void *frame,
@ -46,8 +48,15 @@ bool rbmp_save_image(
unsigned pitch,
enum rbmp_source_type type);
#ifdef __cplusplus
}
#endif
int rbmp_process_image(rbmp_t *rbmp, void **buf,
size_t size, unsigned *width, unsigned *height);
bool rbmp_set_buf_ptr(rbmp_t *rbmp, void *data);
void rbmp_free(rbmp_t *rbmp);
rbmp_t *rbmp_alloc(void);
RETRO_END_DECLS
#endif

View File

@ -0,0 +1,49 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rjpeg.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_FORMAT_RJPEG_H__
#define __LIBRETRO_SDK_FORMAT_RJPEG_H__
#include <stdint.h>
#include <stddef.h>
#include <retro_common_api.h>
#include <boolean.h>
RETRO_BEGIN_DECLS
typedef struct rjpeg rjpeg_t;
int rjpeg_process_image(rjpeg_t *rjpeg, void **buf,
size_t size, unsigned *width, unsigned *height);
bool rjpeg_set_buf_ptr(rjpeg_t *rjpeg, void *data);
void rjpeg_free(rjpeg_t *rjpeg);
rjpeg_t *rjpeg_alloc(void);
RETRO_END_DECLS
#endif

View File

@ -26,45 +26,37 @@
#include <stdint.h>
#include <stddef.h>
#include <boolean.h>
#include <file/archive_file.h>
#include <retro_common_api.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <boolean.h>
RETRO_BEGIN_DECLS
typedef struct rpng rpng_t;
bool rpng_load_image_argb(const char *path, uint32_t **data,
unsigned *width, unsigned *height);
rpng_t *rpng_nbio_load_image_argb_init(const char *path);
rpng_t *rpng_init(const char *path);
bool rpng_is_valid(rpng_t *rpng);
bool rpng_set_buf_ptr(rpng_t *rpng, uint8_t *data);
bool rpng_set_buf_ptr(rpng_t *rpng, void *data);
rpng_t *rpng_alloc(void);
void rpng_nbio_load_image_free(rpng_t *rpng);
void rpng_free(rpng_t *rpng);
bool rpng_nbio_load_image_argb_iterate(rpng_t *rpng);
bool rpng_iterate_image(rpng_t *rpng);
int rpng_nbio_load_image_argb_process(rpng_t *rpng,
uint32_t **data, unsigned *width, unsigned *height);
int rpng_process_image(rpng_t *rpng,
void **data, size_t size, unsigned *width, unsigned *height);
bool rpng_nbio_load_image_argb_start(rpng_t *rpng);
bool rpng_start(rpng_t *rpng);
#ifdef HAVE_ZLIB_DEFLATE
bool rpng_save_image_argb(const char *path, const uint32_t *data,
unsigned width, unsigned height, unsigned pitch);
bool rpng_save_image_bgr24(const char *path, const uint8_t *data,
unsigned width, unsigned height, unsigned pitch);
#endif
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -0,0 +1,48 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rtga.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_FORMAT_RTGA_H__
#define __LIBRETRO_SDK_FORMAT_RTGA_H__
#include <stdint.h>
#include <stddef.h>
#include <retro_common_api.h>
#include <boolean.h>
RETRO_BEGIN_DECLS
typedef struct rtga rtga_t;
int rtga_process_image(rtga_t *rtga, void **buf,
size_t size, unsigned *width, unsigned *height);
bool rtga_set_buf_ptr(rtga_t *rtga, void *data);
void rtga_free(rtga_t *rtga);
rtga_t *rtga_alloc(void);
RETRO_END_DECLS
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2015 The RetroArch team
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rxml.h).
@ -22,9 +22,9 @@
#ifndef __LIBRETRO_SDK_FORMAT_RXML_H__
#define __LIBRETRO_SDK_FORMAT_RXML_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
/* Total NIH. Very trivial "XML" implementation for use in RetroArch.
* Error checking is minimal. Invalid documents may lead to very
@ -89,9 +89,7 @@ typedef rxml_document_t *xmlDocPtr;
#define xmlFreeParserCtxt(ctx) ((void)0)
#endif
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -41,7 +41,7 @@ void matrix_3x3_transpose(math_matrix_3x3 *out, const math_matrix_3x3 *in);
void matrix_3x3_multiply(math_matrix_3x3 *out,
const math_matrix_3x3 *a, const math_matrix_3x3 *b);
void matrix_3x3_divide_scalar(math_matrix_3x3 *mat, float s);
void matrix_3x3_divide_scalar(math_matrix_3x3 *mat, const float s);
float matrix_3x3_determinant(const math_matrix_3x3 *mat);
void matrix_3x3_adjoint(math_matrix_3x3 *mat);
bool matrix_3x3_invert(math_matrix_3x3 *mat);

View File

@ -35,6 +35,7 @@ typedef struct math_matrix_4x4
#define MAT_ELEM_4X4(mat, r, c) ((mat).data[4 * (c) + (r)])
void matrix_4x4_copy(math_matrix_4x4 *dst, const math_matrix_4x4 *src);
void matrix_4x4_identity(math_matrix_4x4 *mat);
void matrix_4x4_transpose(math_matrix_4x4 *out, const math_matrix_4x4 *in);

View File

@ -0,0 +1,41 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (vector_2.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_GFX_MATH_VECTOR_3_H__
#define __LIBRETRO_SDK_GFX_MATH_VECTOR_3_H__
#include <stdint.h>
typedef float vec2_t[2];
float vec2_dot(const float *a, const float *b);
float vec2_cross(const float *a, const float *b) ;
void vec2_add(float *dst, const float *src);
void vec2_subtract(float *dst, const float *src);
void vec2_copy(float *dst, const float *src);
#endif

View File

@ -0,0 +1,47 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (vector_3.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_GFX_MATH_VECTOR_3_H__
#define __LIBRETRO_SDK_GFX_MATH_VECTOR_3_H__
#include <stdint.h>
typedef float vec3_t[3];
float vec3_dot(const float *a, const float *b);
void vec3_cross(float* dst, const float *a, const float *b);
float vec3_length(const float *a);
void vec3_add(float *dst, const float *src);
void vec3_subtract(float *dst, const float *src);
void vec3_scale(float *dst, const float scale);
void vec3_copy(float *dst, const float *src);
void vec3_normalize(float *dst);
#endif

View File

@ -23,18 +23,16 @@
#ifndef __LIBRETRO_SDK_SCALER_FILTER_H__
#define __LIBRETRO_SDK_SCALER_FILTER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
#include <boolean.h>
#include <gfx/scaler/scaler.h>
bool scaler_gen_filter(struct scaler_ctx *ctx);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,15 +23,15 @@
#ifndef __LIBRETRO_SDK_SCALER_H__
#define __LIBRETRO_SDK_SCALER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
#include <stdint.h>
#include <stddef.h>
#include <boolean.h>
#include <clamping.h>
RETRO_BEGIN_DECLS
#define FILTER_UNITY (1 << 14)
enum scaler_pix_fmt
@ -145,9 +145,7 @@ void *scaler_alloc(size_t elem_size, size_t size);
**/
void scaler_free(void *ptr);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,13 +23,13 @@
#ifndef LIBRETRO_SDK_GLSM_H
#define LIBRETRO_SDK_GLSM_H
#include <retro_common_api.h>
#include <boolean.h>
#include <libretro.h>
#include <glsym/rglgen_headers.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
#ifdef HAVE_OPENGLES2
typedef GLfloat GLdouble;
@ -80,8 +80,11 @@ typedef GLclampf GLclampd;
#define GL_ALPHA_TEST 0x0BC0
#endif
#ifndef GL_CLIP_DISTANCE0
#define GL_CLIP_DISTANCE0 0x3000
#endif
#define MAX_ATTRIB 8
#define MAX_TEXTURE 32
enum
{
@ -113,13 +116,13 @@ enum glsm_state_ctl
GLSM_CTL_STATE_BIND,
GLSM_CTL_STATE_UNBIND,
GLSM_CTL_STATE_CONTEXT_RESET,
GLSM_CTL_STATE_CONTEXT_DESTROY,
GLSM_CTL_STATE_CONTEXT_INIT,
GLSM_CTL_IS_IMM_VBO,
GLSM_CTL_SET_IMM_VBO,
GLSM_CTL_UNSET_IMM_VBO,
GLSM_CTL_IMM_VBO_DISABLE,
GLSM_CTL_IMM_VBO_DRAW,
GLSM_CTL_IS_FRAMEBUFFER_LOCKED,
GLSM_CTL_PROC_ADDRESS_GET
};
@ -145,10 +148,10 @@ typedef struct glsm_ctx_params
unsigned minor;
} glsm_ctx_params_t;
GLuint glsm_get_current_framebuffer(void);
bool glsm_ctl(enum glsm_state_ctl state, void *data);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -25,9 +25,9 @@
#include <glsm/glsm.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
/* deprecated old FF-style GL symbols */
#define glTexCoord2f rglTexCoord2f
@ -72,6 +72,8 @@ extern "C" {
#define glEnableVertexAttribArray rglEnableVertexAttribArray
#define glDisableVertexAttribArray rglDisableVertexAttribArray
#define glVertexAttribPointer rglVertexAttribPointer
#define glVertexAttribIPointer rglVertexAttribIPointer
#define glVertexAttribLPointer rglVertexAttribLPointer
#define glGetUniformLocation rglGetUniformLocation
#define glGenBuffers rglGenBuffers
#define glDisable(T) rglDisable(S##T)
@ -93,8 +95,14 @@ extern "C" {
#define glUniform2fv rglUniform2fv
#define glUniform3f rglUniform3f
#define glUniform3fv rglUniform3fv
#define glUniform4i rglUniform4i
#define glUniform4f rglUniform4f
#define glUniform4fv rglUniform4fv
#define glUniform1ui rglUniform1ui
#define glUniform2ui rglUniform2ui
#define glUniform3ui rglUniform3ui
#define glUniform4ui rglUniform4ui
#define glGetActiveUniform rglGetActiveUniform
#define glBlendFunc rglBlendFunc
#define glBlendFuncSeparate rglBlendFuncSeparate
#define glDepthFunc rglDepthFunc
@ -119,7 +127,104 @@ extern "C" {
#define glBindVertexArray rglBindVertexArray
#define glBlendEquation rglBlendEquation
#define glBlendColor rglBlendColor
#define glBlendEquationSeparate rglBlendEquationSeparate
#define glCopyImageSubData rglCopyImageSubData
#define glMapBuffer rglMapBuffer
#define glUnmapBuffer rglUnmapBuffer
#define glMapBufferRange rglMapBufferRange
#define glUniformBlockBinding rglUniformBlockBinding
#define glGetUniformBlockIndex rglGetUniformBlockIndex
#define glGetActiveUniformBlockiv rglGetActiveUniformBlockiv
#define glBindBufferBase rglBindBufferBase
#define glGetUniformIndices rglGetUniformIndices
#define glGetActiveUniformsiv rglGetActiveUniformsiv
#define glGetError rglGetError
#define glClear rglClear
#define glPolygonMode rglPolygonMode
#define glLineWidth rglLineWidth
#define glTexImage2DMultisample rglTexImage2DMultisample
#define glTexStorage2DMultisample rglTexStorage2DMultisample
#define glMemoryBarrier rglMemoryBarrier
#define glBindImageTexture rglBindImageTexture
#define glProgramBinary rglProgramBinary
#define glGetProgramBinary rglGetProgramBinary
#define glProgramParameteri rglProgramParameteri
#define glTexSubImage2D rglTexSubImage2D
#define glDeleteVertexArrays rglDeleteVertexArrays
#define glRenderbufferStorageMultisample rglRenderbufferStorageMultisample
#define glUniform1iv rglUniform1iv
#define glUniform1fv rglUniform1fv
#define glValidateProgram rglValidateProgram
#define glGetStringi rglGetStringi
#define glTexBuffer rglTexBuffer
#define glClearBufferfv rglClearBufferfv
#define glClearBufferfi rglClearBufferfi
#define glWaitSync rglWaitSync
#define glFenceSync rglFenceSync
const GLubyte* rglGetStringi(GLenum name, GLuint index);
void rglTexBuffer(GLenum target, GLenum internalFormat, GLuint buffer);
void rglClearBufferfv( GLenum buffer,
GLint drawBuffer,
const GLfloat * value);
void rglClearBufferfi( GLenum buffer,
GLint drawBuffer,
GLfloat depth,
GLint stencil);
void rglValidateProgram(GLuint program);
void rglRenderbufferStorageMultisample( GLenum target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height);
void rglUniform1iv(GLint location, GLsizei count, const GLint *value);
void rglUniform1fv(GLint location, GLsizei count, const GLfloat *value);
void rglProgramParameteri( GLuint program,
GLenum pname,
GLint value);
void rglGetProgramBinary( GLuint program,
GLsizei bufsize,
GLsizei *length,
GLenum *binaryFormat,
void *binary);
void rglProgramBinary(GLuint program,
GLenum binaryFormat,
const void *binary,
GLsizei length);
void rglBindImageTexture( GLuint unit,
GLuint texture,
GLint level,
GLboolean layered,
GLint layer,
GLenum access,
GLenum format);
void rglTexStorage2DMultisample(GLenum target, GLsizei samples,
GLenum internalformat, GLsizei width, GLsizei height,
GLboolean fixedsamplelocations);
void rglGetActiveUniformsiv( GLuint program,
GLsizei uniformCount,
const GLuint *uniformIndices,
GLenum pname,
GLint *params);
void rglGetUniformIndices( GLuint program,
GLsizei uniformCount,
const GLchar **uniformNames,
GLuint *uniformIndices);
void rglBindBufferBase( GLenum target,
GLuint index,
GLuint buffer);
void rglGetActiveUniformBlockiv( GLuint program,
GLuint uniformBlockIndex,
GLenum pname,
GLint *params);
GLuint rglGetUniformBlockIndex( GLuint program,
const GLchar *uniformBlockName);
void * rglMapBuffer( GLenum target, GLenum access);
void *rglMapBufferRange( GLenum target,
GLintptr offset,
GLsizeiptr length,
GLbitfield access);
GLboolean rglUnmapBuffer( GLenum target);
void rglBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
void rglBlendEquation(GLenum mode);
void rglGenVertexArrays(GLsizei n, GLuint *arrays);
@ -194,6 +299,7 @@ void rglUniform2i(GLint location, GLint v0, GLint v1);
void rglUniform2fv(GLint location, GLsizei count, const GLfloat *value);
void rglUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
void rglUniform3fv(GLint location, GLsizei count, const GLfloat *value);
void rglUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
void rglUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
void rglUniform4fv(GLint location, GLsizei count, const GLfloat *value);
void rglBlendFunc(GLenum sfactor, GLenum dfactor);
@ -231,8 +337,67 @@ GLint rglGetAttribLocation(GLuint program, const GLchar *name);
void rglDrawBuffers(GLsizei n, const GLenum *bufs);
void rglBindVertexArray(GLuint array);
#ifdef __cplusplus
}
#endif
void rglGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize,
GLsizei *length, GLint *size, GLenum *type, GLchar *name);
void rglUniform1ui(GLint location, GLuint v);
void rglUniform2ui(GLint location, GLuint v0, GLuint v1);
void rglUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
void rglUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
void rglBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
void rglCopyImageSubData( GLuint srcName,
GLenum srcTarget,
GLint srcLevel,
GLint srcX,
GLint srcY,
GLint srcZ,
GLuint dstName,
GLenum dstTarget,
GLint dstLevel,
GLint dstX,
GLint dstY,
GLint dstZ,
GLsizei srcWidth,
GLsizei srcHeight,
GLsizei srcDepth);
void rglVertexAttribIPointer(
GLuint index,
GLint size,
GLenum type,
GLsizei stride,
const GLvoid * pointer);
void rglVertexAttribLPointer(
GLuint index,
GLint size,
GLenum type,
GLsizei stride,
const GLvoid * pointer);
void rglUniformBlockBinding( GLuint program,
GLuint uniformBlockIndex,
GLuint uniformBlockBinding);
GLenum rglGetError(void);
void rglClear(GLbitfield mask);
void rglPolygonMode(GLenum face, GLenum mode);
void rglLineWidth(GLfloat width);
void rglTexImage2DMultisample( GLenum target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLboolean fixedsamplelocations);
void rglMemoryBarrier( GLbitfield barriers);
void rglTexSubImage2D( GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
const GLvoid * pixels);
void rglDeleteVertexArrays(GLsizei n, const GLuint *arrays);
void *rglFenceSync(GLenum condition, GLbitfield flags);
void rglWaitSync(void *sync, GLbitfield flags, uint64_t timeout);
RETRO_END_DECLS
#endif

View File

@ -26,8 +26,10 @@
#include "rglgen.h"
#ifndef HAVE_PSGL
#ifdef HAVE_OPENGLES2
#if defined(HAVE_OPENGLES2)
#include "glsym_es2.h"
#elif defined(HAVE_OPENGLES3)
#include "glsym_es3.h"
#else
#include "glsym_gl.h"
#endif

View File

@ -1,25 +1,3 @@
/* Copyright (C) 2010-2015 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this libretro SDK code part (glsym).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef RGLGEN_DECL_H__
#define RGLGEN_DECL_H__
#ifdef __cplusplus
@ -50,6 +28,7 @@ typedef unsigned long long int GLuint64;
typedef unsigned long long int GLuint64EXT;
typedef struct __GLsync *GLsync;
#endif
typedef void (GL_APIENTRYP RGLSYMGLBLENDBARRIERKHRPROC) (void);
typedef void (GL_APIENTRYP RGLSYMGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
typedef void (GL_APIENTRYP RGLSYMGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
typedef void (GL_APIENTRYP RGLSYMGLDEBUGMESSAGECALLBACKKHRPROC) (RGLGENGLDEBUGPROCKHR callback, const void *userParam);
@ -61,24 +40,182 @@ typedef void (GL_APIENTRYP RGLSYMGLGETOBJECTLABELKHRPROC) (GLenum identifier, GL
typedef void (GL_APIENTRYP RGLSYMGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label);
typedef void (GL_APIENTRYP RGLSYMGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
typedef void (GL_APIENTRYP RGLSYMGLGETPOINTERVKHRPROC) (GLenum pname, void **params);
typedef GLenum (GL_APIENTRYP RGLSYMGLGETGRAPHICSRESETSTATUSKHRPROC) (void);
typedef void (GL_APIENTRYP RGLSYMGLREADNPIXELSKHRPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
typedef void (GL_APIENTRYP RGLSYMGLGETNUNIFORMFVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
typedef void (GL_APIENTRYP RGLSYMGLGETNUNIFORMIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETNUNIFORMUIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
typedef void (GL_APIENTRYP RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
typedef void (GL_APIENTRYP RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
typedef void (GL_APIENTRYP RGLSYMGLCOPYIMAGESUBDATAOESPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
typedef void (GL_APIENTRYP RGLSYMGLENABLEIOESPROC) (GLenum target, GLuint index);
typedef void (GL_APIENTRYP RGLSYMGLDISABLEIOESPROC) (GLenum target, GLuint index);
typedef void (GL_APIENTRYP RGLSYMGLBLENDEQUATIONIOESPROC) (GLuint buf, GLenum mode);
typedef void (GL_APIENTRYP RGLSYMGLBLENDEQUATIONSEPARATEIOESPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
typedef void (GL_APIENTRYP RGLSYMGLBLENDFUNCIOESPROC) (GLuint buf, GLenum src, GLenum dst);
typedef void (GL_APIENTRYP RGLSYMGLBLENDFUNCSEPARATEIOESPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
typedef void (GL_APIENTRYP RGLSYMGLCOLORMASKIOESPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
typedef GLboolean (GL_APIENTRYP RGLSYMGLISENABLEDIOESPROC) (GLenum target, GLuint index);
typedef void (GL_APIENTRYP RGLSYMGLDRAWELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
typedef void (GL_APIENTRYP RGLSYMGLDRAWRANGEELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
typedef void (GL_APIENTRYP RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
typedef void (GL_APIENTRYP RGLSYMGLMULTIDRAWELEMENTSBASEVERTEXOESPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex);
typedef void (GL_APIENTRYP RGLSYMGLFRAMEBUFFERTEXTUREOESPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
typedef void (GL_APIENTRYP RGLSYMGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
typedef void *(GL_APIENTRYP RGLSYMGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
typedef GLboolean (GL_APIENTRYP RGLSYMGLUNMAPBUFFEROESPROC) (GLenum target);
typedef void (GL_APIENTRYP RGLSYMGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params);
typedef void (GL_APIENTRYP RGLSYMGLPRIMITIVEBOUNDINGBOXOESPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
typedef void (GL_APIENTRYP RGLSYMGLMINSAMPLESHADINGOESPROC) (GLfloat value);
typedef void (GL_APIENTRYP RGLSYMGLPATCHPARAMETERIOESPROC) (GLenum pname, GLint value);
typedef void (GL_APIENTRYP RGLSYMGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
typedef void (GL_APIENTRYP RGLSYMGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
typedef void (GL_APIENTRYP RGLSYMGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
typedef void (GL_APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
typedef void (GL_APIENTRYP RGLSYMGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
typedef void (GL_APIENTRYP RGLSYMGLTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, const GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, const GLuint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, GLuint *params);
typedef void (GL_APIENTRYP RGLSYMGLSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, const GLint *param);
typedef void (GL_APIENTRYP RGLSYMGLSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, const GLuint *param);
typedef void (GL_APIENTRYP RGLSYMGLGETSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, GLuint *params);
typedef void (GL_APIENTRYP RGLSYMGLTEXBUFFEROESPROC) (GLenum target, GLenum internalformat, GLuint buffer);
typedef void (GL_APIENTRYP RGLSYMGLTEXBUFFERRANGEOESPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
typedef void (GL_APIENTRYP RGLSYMGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
typedef void (GL_APIENTRYP RGLSYMGLTEXTUREVIEWOESPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
typedef void (GL_APIENTRYP RGLSYMGLBINDVERTEXARRAYOESPROC) (GLuint array);
typedef void (GL_APIENTRYP RGLSYMGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
typedef void (GL_APIENTRYP RGLSYMGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
typedef GLboolean (GL_APIENTRYP RGLSYMGLISVERTEXARRAYOESPROC) (GLuint array);
typedef void (GL_APIENTRYP RGLSYMGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
typedef void (GL_APIENTRYP RGLSYMGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
typedef void (GL_APIENTRYP RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
typedef void (GL_APIENTRYP RGLSYMGLBINDFRAGDATALOCATIONINDEXEDEXTPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
typedef void (GL_APIENTRYP RGLSYMGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);
typedef GLint (GL_APIENTRYP RGLSYMGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC) (GLuint program, GLenum programInterface, const GLchar *name);
typedef GLint (GL_APIENTRYP RGLSYMGLGETFRAGDATAINDEXEXTPROC) (GLuint program, const GLchar *name);
typedef void (GL_APIENTRYP RGLSYMGLBUFFERSTORAGEEXTPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
typedef void (GL_APIENTRYP RGLSYMGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
typedef void (GL_APIENTRYP RGLSYMGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
typedef void (GL_APIENTRYP RGLSYMGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
typedef void (GL_APIENTRYP RGLSYMGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
typedef void (GL_APIENTRYP RGLSYMGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
typedef void (GL_APIENTRYP RGLSYMGLPOPGROUPMARKEREXTPROC) (void);
typedef void (GL_APIENTRYP RGLSYMGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
typedef void (GL_APIENTRYP RGLSYMGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
typedef void (GL_APIENTRYP RGLSYMGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
typedef GLboolean (GL_APIENTRYP RGLSYMGLISQUERYEXTPROC) (GLuint id);
typedef void (GL_APIENTRYP RGLSYMGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
typedef void (GL_APIENTRYP RGLSYMGLENDQUERYEXTPROC) (GLenum target);
typedef void (GL_APIENTRYP RGLSYMGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target);
typedef void (GL_APIENTRYP RGLSYMGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
typedef void (GL_APIENTRYP RGLSYMGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
typedef void (GL_APIENTRYP RGLSYMGLENABLEIEXTPROC) (GLenum target, GLuint index);
typedef void (GL_APIENTRYP RGLSYMGLDISABLEIEXTPROC) (GLenum target, GLuint index);
typedef void (GL_APIENTRYP RGLSYMGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode);
typedef void (GL_APIENTRYP RGLSYMGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
typedef void (GL_APIENTRYP RGLSYMGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst);
typedef void (GL_APIENTRYP RGLSYMGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
typedef void (GL_APIENTRYP RGLSYMGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
typedef GLboolean (GL_APIENTRYP RGLSYMGLISENABLEDIEXTPROC) (GLenum target, GLuint index);
typedef void (GL_APIENTRYP RGLSYMGLDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
typedef void (GL_APIENTRYP RGLSYMGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
typedef void (GL_APIENTRYP RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
typedef void (GL_APIENTRYP RGLSYMGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex);
typedef void (GL_APIENTRYP RGLSYMGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
typedef void (GL_APIENTRYP RGLSYMGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
typedef void (GL_APIENTRYP RGLSYMGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
typedef void (GL_APIENTRYP RGLSYMGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor);
typedef void *(GL_APIENTRYP RGLSYMGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
typedef void (GL_APIENTRYP RGLSYMGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
typedef void (GL_APIENTRYP RGLSYMGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
typedef void (GL_APIENTRYP RGLSYMGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
typedef void (GL_APIENTRYP RGLSYMGLMULTIDRAWARRAYSINDIRECTEXTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
typedef void (GL_APIENTRYP RGLSYMGLMULTIDRAWELEMENTSINDIRECTEXTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
typedef void (GL_APIENTRYP RGLSYMGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP RGLSYMGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
typedef void (GL_APIENTRYP RGLSYMGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index);
typedef void (GL_APIENTRYP RGLSYMGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices);
typedef void (GL_APIENTRYP RGLSYMGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data);
typedef void (GL_APIENTRYP RGLSYMGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
typedef void (GL_APIENTRYP RGLSYMGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations);
typedef GLenum (GL_APIENTRYP RGLSYMGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
typedef void (GL_APIENTRYP RGLSYMGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
typedef void (GL_APIENTRYP RGLSYMGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
typedef void (GL_APIENTRYP RGLSYMGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
typedef void (GL_APIENTRYP RGLSYMGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
typedef GLuint (GL_APIENTRYP RGLSYMGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
typedef void (GL_APIENTRYP RGLSYMGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
typedef void (GL_APIENTRYP RGLSYMGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
typedef void (GL_APIENTRYP RGLSYMGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
typedef void (GL_APIENTRYP RGLSYMGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
typedef GLboolean (GL_APIENTRYP RGLSYMGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
typedef void (GL_APIENTRYP RGLSYMGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
typedef void (GL_APIENTRYP RGLSYMGLTEXPAGECOMMITMENTEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
typedef void (GL_APIENTRYP RGLSYMGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value);
typedef void (GL_APIENTRYP RGLSYMGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
typedef void (GL_APIENTRYP RGLSYMGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param);
typedef void (GL_APIENTRYP RGLSYMGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param);
typedef void (GL_APIENTRYP RGLSYMGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params);
typedef void (GL_APIENTRYP RGLSYMGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
typedef void (GL_APIENTRYP RGLSYMGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
typedef void (GL_APIENTRYP RGLSYMGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
typedef void (GL_APIENTRYP RGLSYMGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP RGLSYMGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
typedef void (GL_APIENTRYP RGLSYMGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
typedef void (GL_APIENTRYP RGLSYMGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP RGLSYMGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
typedef void (GL_APIENTRYP RGLSYMGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
typedef void (GL_APIENTRYP RGLSYMGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
typedef void (GL_APIENTRYP RGLSYMGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews);
#define glBlendBarrierKHR __rglgen_glBlendBarrierKHR
#define glDebugMessageControlKHR __rglgen_glDebugMessageControlKHR
#define glDebugMessageInsertKHR __rglgen_glDebugMessageInsertKHR
#define glDebugMessageCallbackKHR __rglgen_glDebugMessageCallbackKHR
@ -90,24 +227,182 @@ typedef GLboolean (GL_APIENTRYP RGLSYMGLISVERTEXARRAYOESPROC) (GLuint array);
#define glObjectPtrLabelKHR __rglgen_glObjectPtrLabelKHR
#define glGetObjectPtrLabelKHR __rglgen_glGetObjectPtrLabelKHR
#define glGetPointervKHR __rglgen_glGetPointervKHR
#define glGetGraphicsResetStatusKHR __rglgen_glGetGraphicsResetStatusKHR
#define glReadnPixelsKHR __rglgen_glReadnPixelsKHR
#define glGetnUniformfvKHR __rglgen_glGetnUniformfvKHR
#define glGetnUniformivKHR __rglgen_glGetnUniformivKHR
#define glGetnUniformuivKHR __rglgen_glGetnUniformuivKHR
#define glEGLImageTargetTexture2DOES __rglgen_glEGLImageTargetTexture2DOES
#define glEGLImageTargetRenderbufferStorageOES __rglgen_glEGLImageTargetRenderbufferStorageOES
#define glCopyImageSubDataOES __rglgen_glCopyImageSubDataOES
#define glEnableiOES __rglgen_glEnableiOES
#define glDisableiOES __rglgen_glDisableiOES
#define glBlendEquationiOES __rglgen_glBlendEquationiOES
#define glBlendEquationSeparateiOES __rglgen_glBlendEquationSeparateiOES
#define glBlendFunciOES __rglgen_glBlendFunciOES
#define glBlendFuncSeparateiOES __rglgen_glBlendFuncSeparateiOES
#define glColorMaskiOES __rglgen_glColorMaskiOES
#define glIsEnablediOES __rglgen_glIsEnablediOES
#define glDrawElementsBaseVertexOES __rglgen_glDrawElementsBaseVertexOES
#define glDrawRangeElementsBaseVertexOES __rglgen_glDrawRangeElementsBaseVertexOES
#define glDrawElementsInstancedBaseVertexOES __rglgen_glDrawElementsInstancedBaseVertexOES
#define glMultiDrawElementsBaseVertexOES __rglgen_glMultiDrawElementsBaseVertexOES
#define glFramebufferTextureOES __rglgen_glFramebufferTextureOES
#define glGetProgramBinaryOES __rglgen_glGetProgramBinaryOES
#define glProgramBinaryOES __rglgen_glProgramBinaryOES
#define glMapBufferOES __rglgen_glMapBufferOES
#define glUnmapBufferOES __rglgen_glUnmapBufferOES
#define glGetBufferPointervOES __rglgen_glGetBufferPointervOES
#define glPrimitiveBoundingBoxOES __rglgen_glPrimitiveBoundingBoxOES
#define glMinSampleShadingOES __rglgen_glMinSampleShadingOES
#define glPatchParameteriOES __rglgen_glPatchParameteriOES
#define glTexImage3DOES __rglgen_glTexImage3DOES
#define glTexSubImage3DOES __rglgen_glTexSubImage3DOES
#define glCopyTexSubImage3DOES __rglgen_glCopyTexSubImage3DOES
#define glCompressedTexImage3DOES __rglgen_glCompressedTexImage3DOES
#define glCompressedTexSubImage3DOES __rglgen_glCompressedTexSubImage3DOES
#define glFramebufferTexture3DOES __rglgen_glFramebufferTexture3DOES
#define glTexParameterIivOES __rglgen_glTexParameterIivOES
#define glTexParameterIuivOES __rglgen_glTexParameterIuivOES
#define glGetTexParameterIivOES __rglgen_glGetTexParameterIivOES
#define glGetTexParameterIuivOES __rglgen_glGetTexParameterIuivOES
#define glSamplerParameterIivOES __rglgen_glSamplerParameterIivOES
#define glSamplerParameterIuivOES __rglgen_glSamplerParameterIuivOES
#define glGetSamplerParameterIivOES __rglgen_glGetSamplerParameterIivOES
#define glGetSamplerParameterIuivOES __rglgen_glGetSamplerParameterIuivOES
#define glTexBufferOES __rglgen_glTexBufferOES
#define glTexBufferRangeOES __rglgen_glTexBufferRangeOES
#define glTexStorage3DMultisampleOES __rglgen_glTexStorage3DMultisampleOES
#define glTextureViewOES __rglgen_glTextureViewOES
#define glBindVertexArrayOES __rglgen_glBindVertexArrayOES
#define glDeleteVertexArraysOES __rglgen_glDeleteVertexArraysOES
#define glGenVertexArraysOES __rglgen_glGenVertexArraysOES
#define glIsVertexArrayOES __rglgen_glIsVertexArrayOES
#define glDrawArraysInstancedBaseInstanceEXT __rglgen_glDrawArraysInstancedBaseInstanceEXT
#define glDrawElementsInstancedBaseInstanceEXT __rglgen_glDrawElementsInstancedBaseInstanceEXT
#define glDrawElementsInstancedBaseVertexBaseInstanceEXT __rglgen_glDrawElementsInstancedBaseVertexBaseInstanceEXT
#define glBindFragDataLocationIndexedEXT __rglgen_glBindFragDataLocationIndexedEXT
#define glBindFragDataLocationEXT __rglgen_glBindFragDataLocationEXT
#define glGetProgramResourceLocationIndexEXT __rglgen_glGetProgramResourceLocationIndexEXT
#define glGetFragDataIndexEXT __rglgen_glGetFragDataIndexEXT
#define glBufferStorageEXT __rglgen_glBufferStorageEXT
#define glCopyImageSubDataEXT __rglgen_glCopyImageSubDataEXT
#define glLabelObjectEXT __rglgen_glLabelObjectEXT
#define glGetObjectLabelEXT __rglgen_glGetObjectLabelEXT
#define glInsertEventMarkerEXT __rglgen_glInsertEventMarkerEXT
#define glPushGroupMarkerEXT __rglgen_glPushGroupMarkerEXT
#define glPopGroupMarkerEXT __rglgen_glPopGroupMarkerEXT
#define glDiscardFramebufferEXT __rglgen_glDiscardFramebufferEXT
#define glGenQueriesEXT __rglgen_glGenQueriesEXT
#define glDeleteQueriesEXT __rglgen_glDeleteQueriesEXT
#define glIsQueryEXT __rglgen_glIsQueryEXT
#define glBeginQueryEXT __rglgen_glBeginQueryEXT
#define glEndQueryEXT __rglgen_glEndQueryEXT
#define glQueryCounterEXT __rglgen_glQueryCounterEXT
#define glGetQueryivEXT __rglgen_glGetQueryivEXT
#define glGetQueryObjectivEXT __rglgen_glGetQueryObjectivEXT
#define glGetQueryObjectuivEXT __rglgen_glGetQueryObjectuivEXT
#define glDrawBuffersEXT __rglgen_glDrawBuffersEXT
#define glEnableiEXT __rglgen_glEnableiEXT
#define glDisableiEXT __rglgen_glDisableiEXT
#define glBlendEquationiEXT __rglgen_glBlendEquationiEXT
#define glBlendEquationSeparateiEXT __rglgen_glBlendEquationSeparateiEXT
#define glBlendFunciEXT __rglgen_glBlendFunciEXT
#define glBlendFuncSeparateiEXT __rglgen_glBlendFuncSeparateiEXT
#define glColorMaskiEXT __rglgen_glColorMaskiEXT
#define glIsEnablediEXT __rglgen_glIsEnablediEXT
#define glDrawElementsBaseVertexEXT __rglgen_glDrawElementsBaseVertexEXT
#define glDrawRangeElementsBaseVertexEXT __rglgen_glDrawRangeElementsBaseVertexEXT
#define glDrawElementsInstancedBaseVertexEXT __rglgen_glDrawElementsInstancedBaseVertexEXT
#define glMultiDrawElementsBaseVertexEXT __rglgen_glMultiDrawElementsBaseVertexEXT
#define glDrawArraysInstancedEXT __rglgen_glDrawArraysInstancedEXT
#define glDrawElementsInstancedEXT __rglgen_glDrawElementsInstancedEXT
#define glFramebufferTextureEXT __rglgen_glFramebufferTextureEXT
#define glVertexAttribDivisorEXT __rglgen_glVertexAttribDivisorEXT
#define glMapBufferRangeEXT __rglgen_glMapBufferRangeEXT
#define glFlushMappedBufferRangeEXT __rglgen_glFlushMappedBufferRangeEXT
#define glMultiDrawArraysEXT __rglgen_glMultiDrawArraysEXT
#define glMultiDrawElementsEXT __rglgen_glMultiDrawElementsEXT
#define glMultiDrawArraysIndirectEXT __rglgen_glMultiDrawArraysIndirectEXT
#define glMultiDrawElementsIndirectEXT __rglgen_glMultiDrawElementsIndirectEXT
#define glRenderbufferStorageMultisampleEXT __rglgen_glRenderbufferStorageMultisampleEXT
#define glFramebufferTexture2DMultisampleEXT __rglgen_glFramebufferTexture2DMultisampleEXT
#define glReadBufferIndexedEXT __rglgen_glReadBufferIndexedEXT
#define glDrawBuffersIndexedEXT __rglgen_glDrawBuffersIndexedEXT
#define glGetIntegeri_vEXT __rglgen_glGetIntegeri_vEXT
#define glPrimitiveBoundingBoxEXT __rglgen_glPrimitiveBoundingBoxEXT
#define glRasterSamplesEXT __rglgen_glRasterSamplesEXT
#define glGetGraphicsResetStatusEXT __rglgen_glGetGraphicsResetStatusEXT
#define glReadnPixelsEXT __rglgen_glReadnPixelsEXT
#define glGetnUniformfvEXT __rglgen_glGetnUniformfvEXT
#define glGetnUniformivEXT __rglgen_glGetnUniformivEXT
#define glActiveShaderProgramEXT __rglgen_glActiveShaderProgramEXT
#define glBindProgramPipelineEXT __rglgen_glBindProgramPipelineEXT
#define glCreateShaderProgramvEXT __rglgen_glCreateShaderProgramvEXT
#define glDeleteProgramPipelinesEXT __rglgen_glDeleteProgramPipelinesEXT
#define glGenProgramPipelinesEXT __rglgen_glGenProgramPipelinesEXT
#define glGetProgramPipelineInfoLogEXT __rglgen_glGetProgramPipelineInfoLogEXT
#define glGetProgramPipelineivEXT __rglgen_glGetProgramPipelineivEXT
#define glIsProgramPipelineEXT __rglgen_glIsProgramPipelineEXT
#define glProgramParameteriEXT __rglgen_glProgramParameteriEXT
#define glProgramUniform1fEXT __rglgen_glProgramUniform1fEXT
#define glProgramUniform1fvEXT __rglgen_glProgramUniform1fvEXT
#define glProgramUniform1iEXT __rglgen_glProgramUniform1iEXT
#define glProgramUniform1ivEXT __rglgen_glProgramUniform1ivEXT
#define glProgramUniform2fEXT __rglgen_glProgramUniform2fEXT
#define glProgramUniform2fvEXT __rglgen_glProgramUniform2fvEXT
#define glProgramUniform2iEXT __rglgen_glProgramUniform2iEXT
#define glProgramUniform2ivEXT __rglgen_glProgramUniform2ivEXT
#define glProgramUniform3fEXT __rglgen_glProgramUniform3fEXT
#define glProgramUniform3fvEXT __rglgen_glProgramUniform3fvEXT
#define glProgramUniform3iEXT __rglgen_glProgramUniform3iEXT
#define glProgramUniform3ivEXT __rglgen_glProgramUniform3ivEXT
#define glProgramUniform4fEXT __rglgen_glProgramUniform4fEXT
#define glProgramUniform4fvEXT __rglgen_glProgramUniform4fvEXT
#define glProgramUniform4iEXT __rglgen_glProgramUniform4iEXT
#define glProgramUniform4ivEXT __rglgen_glProgramUniform4ivEXT
#define glProgramUniformMatrix2fvEXT __rglgen_glProgramUniformMatrix2fvEXT
#define glProgramUniformMatrix3fvEXT __rglgen_glProgramUniformMatrix3fvEXT
#define glProgramUniformMatrix4fvEXT __rglgen_glProgramUniformMatrix4fvEXT
#define glUseProgramStagesEXT __rglgen_glUseProgramStagesEXT
#define glValidateProgramPipelineEXT __rglgen_glValidateProgramPipelineEXT
#define glProgramUniform1uiEXT __rglgen_glProgramUniform1uiEXT
#define glProgramUniform2uiEXT __rglgen_glProgramUniform2uiEXT
#define glProgramUniform3uiEXT __rglgen_glProgramUniform3uiEXT
#define glProgramUniform4uiEXT __rglgen_glProgramUniform4uiEXT
#define glProgramUniform1uivEXT __rglgen_glProgramUniform1uivEXT
#define glProgramUniform2uivEXT __rglgen_glProgramUniform2uivEXT
#define glProgramUniform3uivEXT __rglgen_glProgramUniform3uivEXT
#define glProgramUniform4uivEXT __rglgen_glProgramUniform4uivEXT
#define glProgramUniformMatrix2x3fvEXT __rglgen_glProgramUniformMatrix2x3fvEXT
#define glProgramUniformMatrix3x2fvEXT __rglgen_glProgramUniformMatrix3x2fvEXT
#define glProgramUniformMatrix2x4fvEXT __rglgen_glProgramUniformMatrix2x4fvEXT
#define glProgramUniformMatrix4x2fvEXT __rglgen_glProgramUniformMatrix4x2fvEXT
#define glProgramUniformMatrix3x4fvEXT __rglgen_glProgramUniformMatrix3x4fvEXT
#define glProgramUniformMatrix4x3fvEXT __rglgen_glProgramUniformMatrix4x3fvEXT
#define glTexPageCommitmentEXT __rglgen_glTexPageCommitmentEXT
#define glPatchParameteriEXT __rglgen_glPatchParameteriEXT
#define glTexParameterIivEXT __rglgen_glTexParameterIivEXT
#define glTexParameterIuivEXT __rglgen_glTexParameterIuivEXT
#define glGetTexParameterIivEXT __rglgen_glGetTexParameterIivEXT
#define glGetTexParameterIuivEXT __rglgen_glGetTexParameterIuivEXT
#define glSamplerParameterIivEXT __rglgen_glSamplerParameterIivEXT
#define glSamplerParameterIuivEXT __rglgen_glSamplerParameterIuivEXT
#define glGetSamplerParameterIivEXT __rglgen_glGetSamplerParameterIivEXT
#define glGetSamplerParameterIuivEXT __rglgen_glGetSamplerParameterIuivEXT
#define glTexBufferEXT __rglgen_glTexBufferEXT
#define glTexBufferRangeEXT __rglgen_glTexBufferRangeEXT
#define glTexStorage1DEXT __rglgen_glTexStorage1DEXT
#define glTexStorage2DEXT __rglgen_glTexStorage2DEXT
#define glTexStorage3DEXT __rglgen_glTexStorage3DEXT
#define glTextureStorage1DEXT __rglgen_glTextureStorage1DEXT
#define glTextureStorage2DEXT __rglgen_glTextureStorage2DEXT
#define glTextureStorage3DEXT __rglgen_glTextureStorage3DEXT
#define glTextureViewEXT __rglgen_glTextureViewEXT
#define glFramebufferTextureMultiviewOVR __rglgen_glFramebufferTextureMultiviewOVR
#define glFramebufferTextureMultisampleMultiviewOVR __rglgen_glFramebufferTextureMultisampleMultiviewOVR
extern RGLSYMGLBLENDBARRIERKHRPROC __rglgen_glBlendBarrierKHR;
extern RGLSYMGLDEBUGMESSAGECONTROLKHRPROC __rglgen_glDebugMessageControlKHR;
extern RGLSYMGLDEBUGMESSAGEINSERTKHRPROC __rglgen_glDebugMessageInsertKHR;
extern RGLSYMGLDEBUGMESSAGECALLBACKKHRPROC __rglgen_glDebugMessageCallbackKHR;
@ -119,23 +414,180 @@ extern RGLSYMGLGETOBJECTLABELKHRPROC __rglgen_glGetObjectLabelKHR;
extern RGLSYMGLOBJECTPTRLABELKHRPROC __rglgen_glObjectPtrLabelKHR;
extern RGLSYMGLGETOBJECTPTRLABELKHRPROC __rglgen_glGetObjectPtrLabelKHR;
extern RGLSYMGLGETPOINTERVKHRPROC __rglgen_glGetPointervKHR;
extern RGLSYMGLGETGRAPHICSRESETSTATUSKHRPROC __rglgen_glGetGraphicsResetStatusKHR;
extern RGLSYMGLREADNPIXELSKHRPROC __rglgen_glReadnPixelsKHR;
extern RGLSYMGLGETNUNIFORMFVKHRPROC __rglgen_glGetnUniformfvKHR;
extern RGLSYMGLGETNUNIFORMIVKHRPROC __rglgen_glGetnUniformivKHR;
extern RGLSYMGLGETNUNIFORMUIVKHRPROC __rglgen_glGetnUniformuivKHR;
extern RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC __rglgen_glEGLImageTargetTexture2DOES;
extern RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC __rglgen_glEGLImageTargetRenderbufferStorageOES;
extern RGLSYMGLCOPYIMAGESUBDATAOESPROC __rglgen_glCopyImageSubDataOES;
extern RGLSYMGLENABLEIOESPROC __rglgen_glEnableiOES;
extern RGLSYMGLDISABLEIOESPROC __rglgen_glDisableiOES;
extern RGLSYMGLBLENDEQUATIONIOESPROC __rglgen_glBlendEquationiOES;
extern RGLSYMGLBLENDEQUATIONSEPARATEIOESPROC __rglgen_glBlendEquationSeparateiOES;
extern RGLSYMGLBLENDFUNCIOESPROC __rglgen_glBlendFunciOES;
extern RGLSYMGLBLENDFUNCSEPARATEIOESPROC __rglgen_glBlendFuncSeparateiOES;
extern RGLSYMGLCOLORMASKIOESPROC __rglgen_glColorMaskiOES;
extern RGLSYMGLISENABLEDIOESPROC __rglgen_glIsEnablediOES;
extern RGLSYMGLDRAWELEMENTSBASEVERTEXOESPROC __rglgen_glDrawElementsBaseVertexOES;
extern RGLSYMGLDRAWRANGEELEMENTSBASEVERTEXOESPROC __rglgen_glDrawRangeElementsBaseVertexOES;
extern RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC __rglgen_glDrawElementsInstancedBaseVertexOES;
extern RGLSYMGLMULTIDRAWELEMENTSBASEVERTEXOESPROC __rglgen_glMultiDrawElementsBaseVertexOES;
extern RGLSYMGLFRAMEBUFFERTEXTUREOESPROC __rglgen_glFramebufferTextureOES;
extern RGLSYMGLGETPROGRAMBINARYOESPROC __rglgen_glGetProgramBinaryOES;
extern RGLSYMGLPROGRAMBINARYOESPROC __rglgen_glProgramBinaryOES;
extern RGLSYMGLMAPBUFFEROESPROC __rglgen_glMapBufferOES;
extern RGLSYMGLUNMAPBUFFEROESPROC __rglgen_glUnmapBufferOES;
extern RGLSYMGLGETBUFFERPOINTERVOESPROC __rglgen_glGetBufferPointervOES;
extern RGLSYMGLPRIMITIVEBOUNDINGBOXOESPROC __rglgen_glPrimitiveBoundingBoxOES;
extern RGLSYMGLMINSAMPLESHADINGOESPROC __rglgen_glMinSampleShadingOES;
extern RGLSYMGLPATCHPARAMETERIOESPROC __rglgen_glPatchParameteriOES;
extern RGLSYMGLTEXIMAGE3DOESPROC __rglgen_glTexImage3DOES;
extern RGLSYMGLTEXSUBIMAGE3DOESPROC __rglgen_glTexSubImage3DOES;
extern RGLSYMGLCOPYTEXSUBIMAGE3DOESPROC __rglgen_glCopyTexSubImage3DOES;
extern RGLSYMGLCOMPRESSEDTEXIMAGE3DOESPROC __rglgen_glCompressedTexImage3DOES;
extern RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DOESPROC __rglgen_glCompressedTexSubImage3DOES;
extern RGLSYMGLFRAMEBUFFERTEXTURE3DOESPROC __rglgen_glFramebufferTexture3DOES;
extern RGLSYMGLTEXPARAMETERIIVOESPROC __rglgen_glTexParameterIivOES;
extern RGLSYMGLTEXPARAMETERIUIVOESPROC __rglgen_glTexParameterIuivOES;
extern RGLSYMGLGETTEXPARAMETERIIVOESPROC __rglgen_glGetTexParameterIivOES;
extern RGLSYMGLGETTEXPARAMETERIUIVOESPROC __rglgen_glGetTexParameterIuivOES;
extern RGLSYMGLSAMPLERPARAMETERIIVOESPROC __rglgen_glSamplerParameterIivOES;
extern RGLSYMGLSAMPLERPARAMETERIUIVOESPROC __rglgen_glSamplerParameterIuivOES;
extern RGLSYMGLGETSAMPLERPARAMETERIIVOESPROC __rglgen_glGetSamplerParameterIivOES;
extern RGLSYMGLGETSAMPLERPARAMETERIUIVOESPROC __rglgen_glGetSamplerParameterIuivOES;
extern RGLSYMGLTEXBUFFEROESPROC __rglgen_glTexBufferOES;
extern RGLSYMGLTEXBUFFERRANGEOESPROC __rglgen_glTexBufferRangeOES;
extern RGLSYMGLTEXSTORAGE3DMULTISAMPLEOESPROC __rglgen_glTexStorage3DMultisampleOES;
extern RGLSYMGLTEXTUREVIEWOESPROC __rglgen_glTextureViewOES;
extern RGLSYMGLBINDVERTEXARRAYOESPROC __rglgen_glBindVertexArrayOES;
extern RGLSYMGLDELETEVERTEXARRAYSOESPROC __rglgen_glDeleteVertexArraysOES;
extern RGLSYMGLGENVERTEXARRAYSOESPROC __rglgen_glGenVertexArraysOES;
extern RGLSYMGLISVERTEXARRAYOESPROC __rglgen_glIsVertexArrayOES;
extern RGLSYMGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC __rglgen_glDrawArraysInstancedBaseInstanceEXT;
extern RGLSYMGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC __rglgen_glDrawElementsInstancedBaseInstanceEXT;
extern RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC __rglgen_glDrawElementsInstancedBaseVertexBaseInstanceEXT;
extern RGLSYMGLBINDFRAGDATALOCATIONINDEXEDEXTPROC __rglgen_glBindFragDataLocationIndexedEXT;
extern RGLSYMGLBINDFRAGDATALOCATIONEXTPROC __rglgen_glBindFragDataLocationEXT;
extern RGLSYMGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC __rglgen_glGetProgramResourceLocationIndexEXT;
extern RGLSYMGLGETFRAGDATAINDEXEXTPROC __rglgen_glGetFragDataIndexEXT;
extern RGLSYMGLBUFFERSTORAGEEXTPROC __rglgen_glBufferStorageEXT;
extern RGLSYMGLCOPYIMAGESUBDATAEXTPROC __rglgen_glCopyImageSubDataEXT;
extern RGLSYMGLLABELOBJECTEXTPROC __rglgen_glLabelObjectEXT;
extern RGLSYMGLGETOBJECTLABELEXTPROC __rglgen_glGetObjectLabelEXT;
extern RGLSYMGLINSERTEVENTMARKEREXTPROC __rglgen_glInsertEventMarkerEXT;
extern RGLSYMGLPUSHGROUPMARKEREXTPROC __rglgen_glPushGroupMarkerEXT;
extern RGLSYMGLPOPGROUPMARKEREXTPROC __rglgen_glPopGroupMarkerEXT;
extern RGLSYMGLDISCARDFRAMEBUFFEREXTPROC __rglgen_glDiscardFramebufferEXT;
extern RGLSYMGLGENQUERIESEXTPROC __rglgen_glGenQueriesEXT;
extern RGLSYMGLDELETEQUERIESEXTPROC __rglgen_glDeleteQueriesEXT;
extern RGLSYMGLISQUERYEXTPROC __rglgen_glIsQueryEXT;
extern RGLSYMGLBEGINQUERYEXTPROC __rglgen_glBeginQueryEXT;
extern RGLSYMGLENDQUERYEXTPROC __rglgen_glEndQueryEXT;
extern RGLSYMGLQUERYCOUNTEREXTPROC __rglgen_glQueryCounterEXT;
extern RGLSYMGLGETQUERYIVEXTPROC __rglgen_glGetQueryivEXT;
extern RGLSYMGLGETQUERYOBJECTIVEXTPROC __rglgen_glGetQueryObjectivEXT;
extern RGLSYMGLGETQUERYOBJECTUIVEXTPROC __rglgen_glGetQueryObjectuivEXT;
extern RGLSYMGLDRAWBUFFERSEXTPROC __rglgen_glDrawBuffersEXT;
extern RGLSYMGLENABLEIEXTPROC __rglgen_glEnableiEXT;
extern RGLSYMGLDISABLEIEXTPROC __rglgen_glDisableiEXT;
extern RGLSYMGLBLENDEQUATIONIEXTPROC __rglgen_glBlendEquationiEXT;
extern RGLSYMGLBLENDEQUATIONSEPARATEIEXTPROC __rglgen_glBlendEquationSeparateiEXT;
extern RGLSYMGLBLENDFUNCIEXTPROC __rglgen_glBlendFunciEXT;
extern RGLSYMGLBLENDFUNCSEPARATEIEXTPROC __rglgen_glBlendFuncSeparateiEXT;
extern RGLSYMGLCOLORMASKIEXTPROC __rglgen_glColorMaskiEXT;
extern RGLSYMGLISENABLEDIEXTPROC __rglgen_glIsEnablediEXT;
extern RGLSYMGLDRAWELEMENTSBASEVERTEXEXTPROC __rglgen_glDrawElementsBaseVertexEXT;
extern RGLSYMGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC __rglgen_glDrawRangeElementsBaseVertexEXT;
extern RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC __rglgen_glDrawElementsInstancedBaseVertexEXT;
extern RGLSYMGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC __rglgen_glMultiDrawElementsBaseVertexEXT;
extern RGLSYMGLDRAWARRAYSINSTANCEDEXTPROC __rglgen_glDrawArraysInstancedEXT;
extern RGLSYMGLDRAWELEMENTSINSTANCEDEXTPROC __rglgen_glDrawElementsInstancedEXT;
extern RGLSYMGLFRAMEBUFFERTEXTUREEXTPROC __rglgen_glFramebufferTextureEXT;
extern RGLSYMGLVERTEXATTRIBDIVISOREXTPROC __rglgen_glVertexAttribDivisorEXT;
extern RGLSYMGLMAPBUFFERRANGEEXTPROC __rglgen_glMapBufferRangeEXT;
extern RGLSYMGLFLUSHMAPPEDBUFFERRANGEEXTPROC __rglgen_glFlushMappedBufferRangeEXT;
extern RGLSYMGLMULTIDRAWARRAYSEXTPROC __rglgen_glMultiDrawArraysEXT;
extern RGLSYMGLMULTIDRAWELEMENTSEXTPROC __rglgen_glMultiDrawElementsEXT;
extern RGLSYMGLMULTIDRAWARRAYSINDIRECTEXTPROC __rglgen_glMultiDrawArraysIndirectEXT;
extern RGLSYMGLMULTIDRAWELEMENTSINDIRECTEXTPROC __rglgen_glMultiDrawElementsIndirectEXT;
extern RGLSYMGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC __rglgen_glRenderbufferStorageMultisampleEXT;
extern RGLSYMGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC __rglgen_glFramebufferTexture2DMultisampleEXT;
extern RGLSYMGLREADBUFFERINDEXEDEXTPROC __rglgen_glReadBufferIndexedEXT;
extern RGLSYMGLDRAWBUFFERSINDEXEDEXTPROC __rglgen_glDrawBuffersIndexedEXT;
extern RGLSYMGLGETINTEGERI_VEXTPROC __rglgen_glGetIntegeri_vEXT;
extern RGLSYMGLPRIMITIVEBOUNDINGBOXEXTPROC __rglgen_glPrimitiveBoundingBoxEXT;
extern RGLSYMGLRASTERSAMPLESEXTPROC __rglgen_glRasterSamplesEXT;
extern RGLSYMGLGETGRAPHICSRESETSTATUSEXTPROC __rglgen_glGetGraphicsResetStatusEXT;
extern RGLSYMGLREADNPIXELSEXTPROC __rglgen_glReadnPixelsEXT;
extern RGLSYMGLGETNUNIFORMFVEXTPROC __rglgen_glGetnUniformfvEXT;
extern RGLSYMGLGETNUNIFORMIVEXTPROC __rglgen_glGetnUniformivEXT;
extern RGLSYMGLACTIVESHADERPROGRAMEXTPROC __rglgen_glActiveShaderProgramEXT;
extern RGLSYMGLBINDPROGRAMPIPELINEEXTPROC __rglgen_glBindProgramPipelineEXT;
extern RGLSYMGLCREATESHADERPROGRAMVEXTPROC __rglgen_glCreateShaderProgramvEXT;
extern RGLSYMGLDELETEPROGRAMPIPELINESEXTPROC __rglgen_glDeleteProgramPipelinesEXT;
extern RGLSYMGLGENPROGRAMPIPELINESEXTPROC __rglgen_glGenProgramPipelinesEXT;
extern RGLSYMGLGETPROGRAMPIPELINEINFOLOGEXTPROC __rglgen_glGetProgramPipelineInfoLogEXT;
extern RGLSYMGLGETPROGRAMPIPELINEIVEXTPROC __rglgen_glGetProgramPipelineivEXT;
extern RGLSYMGLISPROGRAMPIPELINEEXTPROC __rglgen_glIsProgramPipelineEXT;
extern RGLSYMGLPROGRAMPARAMETERIEXTPROC __rglgen_glProgramParameteriEXT;
extern RGLSYMGLPROGRAMUNIFORM1FEXTPROC __rglgen_glProgramUniform1fEXT;
extern RGLSYMGLPROGRAMUNIFORM1FVEXTPROC __rglgen_glProgramUniform1fvEXT;
extern RGLSYMGLPROGRAMUNIFORM1IEXTPROC __rglgen_glProgramUniform1iEXT;
extern RGLSYMGLPROGRAMUNIFORM1IVEXTPROC __rglgen_glProgramUniform1ivEXT;
extern RGLSYMGLPROGRAMUNIFORM2FEXTPROC __rglgen_glProgramUniform2fEXT;
extern RGLSYMGLPROGRAMUNIFORM2FVEXTPROC __rglgen_glProgramUniform2fvEXT;
extern RGLSYMGLPROGRAMUNIFORM2IEXTPROC __rglgen_glProgramUniform2iEXT;
extern RGLSYMGLPROGRAMUNIFORM2IVEXTPROC __rglgen_glProgramUniform2ivEXT;
extern RGLSYMGLPROGRAMUNIFORM3FEXTPROC __rglgen_glProgramUniform3fEXT;
extern RGLSYMGLPROGRAMUNIFORM3FVEXTPROC __rglgen_glProgramUniform3fvEXT;
extern RGLSYMGLPROGRAMUNIFORM3IEXTPROC __rglgen_glProgramUniform3iEXT;
extern RGLSYMGLPROGRAMUNIFORM3IVEXTPROC __rglgen_glProgramUniform3ivEXT;
extern RGLSYMGLPROGRAMUNIFORM4FEXTPROC __rglgen_glProgramUniform4fEXT;
extern RGLSYMGLPROGRAMUNIFORM4FVEXTPROC __rglgen_glProgramUniform4fvEXT;
extern RGLSYMGLPROGRAMUNIFORM4IEXTPROC __rglgen_glProgramUniform4iEXT;
extern RGLSYMGLPROGRAMUNIFORM4IVEXTPROC __rglgen_glProgramUniform4ivEXT;
extern RGLSYMGLPROGRAMUNIFORMMATRIX2FVEXTPROC __rglgen_glProgramUniformMatrix2fvEXT;
extern RGLSYMGLPROGRAMUNIFORMMATRIX3FVEXTPROC __rglgen_glProgramUniformMatrix3fvEXT;
extern RGLSYMGLPROGRAMUNIFORMMATRIX4FVEXTPROC __rglgen_glProgramUniformMatrix4fvEXT;
extern RGLSYMGLUSEPROGRAMSTAGESEXTPROC __rglgen_glUseProgramStagesEXT;
extern RGLSYMGLVALIDATEPROGRAMPIPELINEEXTPROC __rglgen_glValidateProgramPipelineEXT;
extern RGLSYMGLPROGRAMUNIFORM1UIEXTPROC __rglgen_glProgramUniform1uiEXT;
extern RGLSYMGLPROGRAMUNIFORM2UIEXTPROC __rglgen_glProgramUniform2uiEXT;
extern RGLSYMGLPROGRAMUNIFORM3UIEXTPROC __rglgen_glProgramUniform3uiEXT;
extern RGLSYMGLPROGRAMUNIFORM4UIEXTPROC __rglgen_glProgramUniform4uiEXT;
extern RGLSYMGLPROGRAMUNIFORM1UIVEXTPROC __rglgen_glProgramUniform1uivEXT;
extern RGLSYMGLPROGRAMUNIFORM2UIVEXTPROC __rglgen_glProgramUniform2uivEXT;
extern RGLSYMGLPROGRAMUNIFORM3UIVEXTPROC __rglgen_glProgramUniform3uivEXT;
extern RGLSYMGLPROGRAMUNIFORM4UIVEXTPROC __rglgen_glProgramUniform4uivEXT;
extern RGLSYMGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC __rglgen_glProgramUniformMatrix2x3fvEXT;
extern RGLSYMGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC __rglgen_glProgramUniformMatrix3x2fvEXT;
extern RGLSYMGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC __rglgen_glProgramUniformMatrix2x4fvEXT;
extern RGLSYMGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC __rglgen_glProgramUniformMatrix4x2fvEXT;
extern RGLSYMGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC __rglgen_glProgramUniformMatrix3x4fvEXT;
extern RGLSYMGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC __rglgen_glProgramUniformMatrix4x3fvEXT;
extern RGLSYMGLTEXPAGECOMMITMENTEXTPROC __rglgen_glTexPageCommitmentEXT;
extern RGLSYMGLPATCHPARAMETERIEXTPROC __rglgen_glPatchParameteriEXT;
extern RGLSYMGLTEXPARAMETERIIVEXTPROC __rglgen_glTexParameterIivEXT;
extern RGLSYMGLTEXPARAMETERIUIVEXTPROC __rglgen_glTexParameterIuivEXT;
extern RGLSYMGLGETTEXPARAMETERIIVEXTPROC __rglgen_glGetTexParameterIivEXT;
extern RGLSYMGLGETTEXPARAMETERIUIVEXTPROC __rglgen_glGetTexParameterIuivEXT;
extern RGLSYMGLSAMPLERPARAMETERIIVEXTPROC __rglgen_glSamplerParameterIivEXT;
extern RGLSYMGLSAMPLERPARAMETERIUIVEXTPROC __rglgen_glSamplerParameterIuivEXT;
extern RGLSYMGLGETSAMPLERPARAMETERIIVEXTPROC __rglgen_glGetSamplerParameterIivEXT;
extern RGLSYMGLGETSAMPLERPARAMETERIUIVEXTPROC __rglgen_glGetSamplerParameterIuivEXT;
extern RGLSYMGLTEXBUFFEREXTPROC __rglgen_glTexBufferEXT;
extern RGLSYMGLTEXBUFFERRANGEEXTPROC __rglgen_glTexBufferRangeEXT;
extern RGLSYMGLTEXSTORAGE1DEXTPROC __rglgen_glTexStorage1DEXT;
extern RGLSYMGLTEXSTORAGE2DEXTPROC __rglgen_glTexStorage2DEXT;
extern RGLSYMGLTEXSTORAGE3DEXTPROC __rglgen_glTexStorage3DEXT;
extern RGLSYMGLTEXTURESTORAGE1DEXTPROC __rglgen_glTextureStorage1DEXT;
extern RGLSYMGLTEXTURESTORAGE2DEXTPROC __rglgen_glTextureStorage2DEXT;
extern RGLSYMGLTEXTURESTORAGE3DEXTPROC __rglgen_glTextureStorage3DEXT;
extern RGLSYMGLTEXTUREVIEWEXTPROC __rglgen_glTextureViewEXT;
extern RGLSYMGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC __rglgen_glFramebufferTextureMultiviewOVR;
extern RGLSYMGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC __rglgen_glFramebufferTextureMultisampleMultiviewOVR;
struct rglgen_sym_map { const char *sym; void *ptr; };
extern const struct rglgen_sym_map rglgen_symbol_map[];

View File

@ -0,0 +1,234 @@
#ifndef RGLGEN_DECL_H__
#define RGLGEN_DECL_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef GL_APIENTRY
typedef void (GL_APIENTRY *RGLGENGLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);
typedef void (GL_APIENTRY *RGLGENGLDEBUGPROCKHR)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);
#else
#ifndef APIENTRY
#define APIENTRY
#endif
#ifndef APIENTRYP
#define APIENTRYP APIENTRY *
#endif
typedef void (APIENTRY *RGLGENGLDEBUGPROCARB)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);
typedef void (APIENTRY *RGLGENGLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);
#endif
#ifndef GL_OES_EGL_image
typedef void *GLeglImageOES;
#endif
#if !defined(GL_OES_fixed_point) && !defined(HAVE_OPENGLES2)
typedef GLint GLfixed;
#endif
#if defined(OSX) && !defined(MAC_OS_X_VERSION_10_7)
typedef long long int GLint64;
typedef unsigned long long int GLuint64;
typedef unsigned long long int GLuint64EXT;
typedef struct __GLsync *GLsync;
#endif
typedef void (GL_APIENTRYP RGLSYMGLBLENDBARRIERKHRPROC) (void);
typedef void (GL_APIENTRYP RGLSYMGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
typedef void (GL_APIENTRYP RGLSYMGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
typedef void (GL_APIENTRYP RGLSYMGLDEBUGMESSAGECALLBACKKHRPROC) (RGLGENGLDEBUGPROCKHR callback, const void *userParam);
typedef GLuint (GL_APIENTRYP RGLSYMGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
typedef void (GL_APIENTRYP RGLSYMGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
typedef void (GL_APIENTRYP RGLSYMGLPOPDEBUGGROUPKHRPROC) (void);
typedef void (GL_APIENTRYP RGLSYMGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
typedef void (GL_APIENTRYP RGLSYMGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
typedef void (GL_APIENTRYP RGLSYMGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label);
typedef void (GL_APIENTRYP RGLSYMGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
typedef void (GL_APIENTRYP RGLSYMGLGETPOINTERVKHRPROC) (GLenum pname, void **params);
typedef GLenum (GL_APIENTRYP RGLSYMGLGETGRAPHICSRESETSTATUSKHRPROC) (void);
typedef void (GL_APIENTRYP RGLSYMGLREADNPIXELSKHRPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
typedef void (GL_APIENTRYP RGLSYMGLGETNUNIFORMFVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
typedef void (GL_APIENTRYP RGLSYMGLGETNUNIFORMIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETNUNIFORMUIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
typedef void (GL_APIENTRYP RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
typedef void (GL_APIENTRYP RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
typedef void (GL_APIENTRYP RGLSYMGLCOPYIMAGESUBDATAOESPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
typedef void (GL_APIENTRYP RGLSYMGLENABLEIOESPROC) (GLenum target, GLuint index);
typedef void (GL_APIENTRYP RGLSYMGLDISABLEIOESPROC) (GLenum target, GLuint index);
typedef void (GL_APIENTRYP RGLSYMGLBLENDEQUATIONIOESPROC) (GLuint buf, GLenum mode);
typedef void (GL_APIENTRYP RGLSYMGLBLENDEQUATIONSEPARATEIOESPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
typedef void (GL_APIENTRYP RGLSYMGLBLENDFUNCIOESPROC) (GLuint buf, GLenum src, GLenum dst);
typedef void (GL_APIENTRYP RGLSYMGLBLENDFUNCSEPARATEIOESPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
typedef void (GL_APIENTRYP RGLSYMGLCOLORMASKIOESPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
typedef GLboolean (GL_APIENTRYP RGLSYMGLISENABLEDIOESPROC) (GLenum target, GLuint index);
typedef void (GL_APIENTRYP RGLSYMGLDRAWELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
typedef void (GL_APIENTRYP RGLSYMGLDRAWRANGEELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
typedef void (GL_APIENTRYP RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
typedef void (GL_APIENTRYP RGLSYMGLMULTIDRAWELEMENTSBASEVERTEXOESPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex);
typedef void (GL_APIENTRYP RGLSYMGLFRAMEBUFFERTEXTUREOESPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
typedef void (GL_APIENTRYP RGLSYMGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
typedef void (GL_APIENTRYP RGLSYMGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
typedef void *(GL_APIENTRYP RGLSYMGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
typedef GLboolean (GL_APIENTRYP RGLSYMGLUNMAPBUFFEROESPROC) (GLenum target);
typedef void (GL_APIENTRYP RGLSYMGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params);
typedef void (GL_APIENTRYP RGLSYMGLPRIMITIVEBOUNDINGBOXOESPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
typedef void (GL_APIENTRYP RGLSYMGLMINSAMPLESHADINGOESPROC) (GLfloat value);
typedef void (GL_APIENTRYP RGLSYMGLPATCHPARAMETERIOESPROC) (GLenum pname, GLint value);
typedef void (GL_APIENTRYP RGLSYMGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
typedef void (GL_APIENTRYP RGLSYMGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
typedef void (GL_APIENTRYP RGLSYMGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
typedef void (GL_APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
typedef void (GL_APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
typedef void (GL_APIENTRYP RGLSYMGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
typedef void (GL_APIENTRYP RGLSYMGLTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, const GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, const GLuint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, GLuint *params);
typedef void (GL_APIENTRYP RGLSYMGLSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, const GLint *param);
typedef void (GL_APIENTRYP RGLSYMGLSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, const GLuint *param);
typedef void (GL_APIENTRYP RGLSYMGLGETSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, GLint *params);
typedef void (GL_APIENTRYP RGLSYMGLGETSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, GLuint *params);
typedef void (GL_APIENTRYP RGLSYMGLTEXBUFFEROESPROC) (GLenum target, GLenum internalformat, GLuint buffer);
typedef void (GL_APIENTRYP RGLSYMGLTEXBUFFERRANGEOESPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
typedef void (GL_APIENTRYP RGLSYMGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
typedef void (GL_APIENTRYP RGLSYMGLTEXTUREVIEWOESPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
typedef void (GL_APIENTRYP RGLSYMGLBINDVERTEXARRAYOESPROC) (GLuint array);
typedef void (GL_APIENTRYP RGLSYMGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
typedef void (GL_APIENTRYP RGLSYMGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
typedef GLboolean (GL_APIENTRYP RGLSYMGLISVERTEXARRAYOESPROC) (GLuint array);
typedef void (GL_APIENTRYP RGLSYMGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
typedef void (GL_APIENTRYP RGLSYMGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews);
#define glBlendBarrierKHR __rglgen_glBlendBarrierKHR
#define glDebugMessageControlKHR __rglgen_glDebugMessageControlKHR
#define glDebugMessageInsertKHR __rglgen_glDebugMessageInsertKHR
#define glDebugMessageCallbackKHR __rglgen_glDebugMessageCallbackKHR
#define glGetDebugMessageLogKHR __rglgen_glGetDebugMessageLogKHR
#define glPushDebugGroupKHR __rglgen_glPushDebugGroupKHR
#define glPopDebugGroupKHR __rglgen_glPopDebugGroupKHR
#define glObjectLabelKHR __rglgen_glObjectLabelKHR
#define glGetObjectLabelKHR __rglgen_glGetObjectLabelKHR
#define glObjectPtrLabelKHR __rglgen_glObjectPtrLabelKHR
#define glGetObjectPtrLabelKHR __rglgen_glGetObjectPtrLabelKHR
#define glGetPointervKHR __rglgen_glGetPointervKHR
#define glGetGraphicsResetStatusKHR __rglgen_glGetGraphicsResetStatusKHR
#define glReadnPixelsKHR __rglgen_glReadnPixelsKHR
#define glGetnUniformfvKHR __rglgen_glGetnUniformfvKHR
#define glGetnUniformivKHR __rglgen_glGetnUniformivKHR
#define glGetnUniformuivKHR __rglgen_glGetnUniformuivKHR
#define glEGLImageTargetTexture2DOES __rglgen_glEGLImageTargetTexture2DOES
#define glEGLImageTargetRenderbufferStorageOES __rglgen_glEGLImageTargetRenderbufferStorageOES
#define glCopyImageSubDataOES __rglgen_glCopyImageSubDataOES
#define glEnableiOES __rglgen_glEnableiOES
#define glDisableiOES __rglgen_glDisableiOES
#define glBlendEquationiOES __rglgen_glBlendEquationiOES
#define glBlendEquationSeparateiOES __rglgen_glBlendEquationSeparateiOES
#define glBlendFunciOES __rglgen_glBlendFunciOES
#define glBlendFuncSeparateiOES __rglgen_glBlendFuncSeparateiOES
#define glColorMaskiOES __rglgen_glColorMaskiOES
#define glIsEnablediOES __rglgen_glIsEnablediOES
#define glDrawElementsBaseVertexOES __rglgen_glDrawElementsBaseVertexOES
#define glDrawRangeElementsBaseVertexOES __rglgen_glDrawRangeElementsBaseVertexOES
#define glDrawElementsInstancedBaseVertexOES __rglgen_glDrawElementsInstancedBaseVertexOES
#define glMultiDrawElementsBaseVertexOES __rglgen_glMultiDrawElementsBaseVertexOES
#define glFramebufferTextureOES __rglgen_glFramebufferTextureOES
#define glGetProgramBinaryOES __rglgen_glGetProgramBinaryOES
#define glProgramBinaryOES __rglgen_glProgramBinaryOES
#define glMapBufferOES __rglgen_glMapBufferOES
#define glUnmapBufferOES __rglgen_glUnmapBufferOES
#define glGetBufferPointervOES __rglgen_glGetBufferPointervOES
#define glPrimitiveBoundingBoxOES __rglgen_glPrimitiveBoundingBoxOES
#define glMinSampleShadingOES __rglgen_glMinSampleShadingOES
#define glPatchParameteriOES __rglgen_glPatchParameteriOES
#define glTexImage3DOES __rglgen_glTexImage3DOES
#define glTexSubImage3DOES __rglgen_glTexSubImage3DOES
#define glCopyTexSubImage3DOES __rglgen_glCopyTexSubImage3DOES
#define glCompressedTexImage3DOES __rglgen_glCompressedTexImage3DOES
#define glCompressedTexSubImage3DOES __rglgen_glCompressedTexSubImage3DOES
#define glFramebufferTexture3DOES __rglgen_glFramebufferTexture3DOES
#define glTexParameterIivOES __rglgen_glTexParameterIivOES
#define glTexParameterIuivOES __rglgen_glTexParameterIuivOES
#define glGetTexParameterIivOES __rglgen_glGetTexParameterIivOES
#define glGetTexParameterIuivOES __rglgen_glGetTexParameterIuivOES
#define glSamplerParameterIivOES __rglgen_glSamplerParameterIivOES
#define glSamplerParameterIuivOES __rglgen_glSamplerParameterIuivOES
#define glGetSamplerParameterIivOES __rglgen_glGetSamplerParameterIivOES
#define glGetSamplerParameterIuivOES __rglgen_glGetSamplerParameterIuivOES
#define glTexBufferOES __rglgen_glTexBufferOES
#define glTexBufferRangeOES __rglgen_glTexBufferRangeOES
#define glTexStorage3DMultisampleOES __rglgen_glTexStorage3DMultisampleOES
#define glTextureViewOES __rglgen_glTextureViewOES
#define glBindVertexArrayOES __rglgen_glBindVertexArrayOES
#define glDeleteVertexArraysOES __rglgen_glDeleteVertexArraysOES
#define glGenVertexArraysOES __rglgen_glGenVertexArraysOES
#define glIsVertexArrayOES __rglgen_glIsVertexArrayOES
#define glFramebufferTextureMultiviewOVR __rglgen_glFramebufferTextureMultiviewOVR
#define glFramebufferTextureMultisampleMultiviewOVR __rglgen_glFramebufferTextureMultisampleMultiviewOVR
extern RGLSYMGLBLENDBARRIERKHRPROC __rglgen_glBlendBarrierKHR;
extern RGLSYMGLDEBUGMESSAGECONTROLKHRPROC __rglgen_glDebugMessageControlKHR;
extern RGLSYMGLDEBUGMESSAGEINSERTKHRPROC __rglgen_glDebugMessageInsertKHR;
extern RGLSYMGLDEBUGMESSAGECALLBACKKHRPROC __rglgen_glDebugMessageCallbackKHR;
extern RGLSYMGLGETDEBUGMESSAGELOGKHRPROC __rglgen_glGetDebugMessageLogKHR;
extern RGLSYMGLPUSHDEBUGGROUPKHRPROC __rglgen_glPushDebugGroupKHR;
extern RGLSYMGLPOPDEBUGGROUPKHRPROC __rglgen_glPopDebugGroupKHR;
extern RGLSYMGLOBJECTLABELKHRPROC __rglgen_glObjectLabelKHR;
extern RGLSYMGLGETOBJECTLABELKHRPROC __rglgen_glGetObjectLabelKHR;
extern RGLSYMGLOBJECTPTRLABELKHRPROC __rglgen_glObjectPtrLabelKHR;
extern RGLSYMGLGETOBJECTPTRLABELKHRPROC __rglgen_glGetObjectPtrLabelKHR;
extern RGLSYMGLGETPOINTERVKHRPROC __rglgen_glGetPointervKHR;
extern RGLSYMGLGETGRAPHICSRESETSTATUSKHRPROC __rglgen_glGetGraphicsResetStatusKHR;
extern RGLSYMGLREADNPIXELSKHRPROC __rglgen_glReadnPixelsKHR;
extern RGLSYMGLGETNUNIFORMFVKHRPROC __rglgen_glGetnUniformfvKHR;
extern RGLSYMGLGETNUNIFORMIVKHRPROC __rglgen_glGetnUniformivKHR;
extern RGLSYMGLGETNUNIFORMUIVKHRPROC __rglgen_glGetnUniformuivKHR;
extern RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC __rglgen_glEGLImageTargetTexture2DOES;
extern RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC __rglgen_glEGLImageTargetRenderbufferStorageOES;
extern RGLSYMGLCOPYIMAGESUBDATAOESPROC __rglgen_glCopyImageSubDataOES;
extern RGLSYMGLENABLEIOESPROC __rglgen_glEnableiOES;
extern RGLSYMGLDISABLEIOESPROC __rglgen_glDisableiOES;
extern RGLSYMGLBLENDEQUATIONIOESPROC __rglgen_glBlendEquationiOES;
extern RGLSYMGLBLENDEQUATIONSEPARATEIOESPROC __rglgen_glBlendEquationSeparateiOES;
extern RGLSYMGLBLENDFUNCIOESPROC __rglgen_glBlendFunciOES;
extern RGLSYMGLBLENDFUNCSEPARATEIOESPROC __rglgen_glBlendFuncSeparateiOES;
extern RGLSYMGLCOLORMASKIOESPROC __rglgen_glColorMaskiOES;
extern RGLSYMGLISENABLEDIOESPROC __rglgen_glIsEnablediOES;
extern RGLSYMGLDRAWELEMENTSBASEVERTEXOESPROC __rglgen_glDrawElementsBaseVertexOES;
extern RGLSYMGLDRAWRANGEELEMENTSBASEVERTEXOESPROC __rglgen_glDrawRangeElementsBaseVertexOES;
extern RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC __rglgen_glDrawElementsInstancedBaseVertexOES;
extern RGLSYMGLMULTIDRAWELEMENTSBASEVERTEXOESPROC __rglgen_glMultiDrawElementsBaseVertexOES;
extern RGLSYMGLFRAMEBUFFERTEXTUREOESPROC __rglgen_glFramebufferTextureOES;
extern RGLSYMGLGETPROGRAMBINARYOESPROC __rglgen_glGetProgramBinaryOES;
extern RGLSYMGLPROGRAMBINARYOESPROC __rglgen_glProgramBinaryOES;
extern RGLSYMGLMAPBUFFEROESPROC __rglgen_glMapBufferOES;
extern RGLSYMGLUNMAPBUFFEROESPROC __rglgen_glUnmapBufferOES;
extern RGLSYMGLGETBUFFERPOINTERVOESPROC __rglgen_glGetBufferPointervOES;
extern RGLSYMGLPRIMITIVEBOUNDINGBOXOESPROC __rglgen_glPrimitiveBoundingBoxOES;
extern RGLSYMGLMINSAMPLESHADINGOESPROC __rglgen_glMinSampleShadingOES;
extern RGLSYMGLPATCHPARAMETERIOESPROC __rglgen_glPatchParameteriOES;
extern RGLSYMGLTEXIMAGE3DOESPROC __rglgen_glTexImage3DOES;
extern RGLSYMGLTEXSUBIMAGE3DOESPROC __rglgen_glTexSubImage3DOES;
extern RGLSYMGLCOPYTEXSUBIMAGE3DOESPROC __rglgen_glCopyTexSubImage3DOES;
extern RGLSYMGLCOMPRESSEDTEXIMAGE3DOESPROC __rglgen_glCompressedTexImage3DOES;
extern RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DOESPROC __rglgen_glCompressedTexSubImage3DOES;
extern RGLSYMGLFRAMEBUFFERTEXTURE3DOESPROC __rglgen_glFramebufferTexture3DOES;
extern RGLSYMGLTEXPARAMETERIIVOESPROC __rglgen_glTexParameterIivOES;
extern RGLSYMGLTEXPARAMETERIUIVOESPROC __rglgen_glTexParameterIuivOES;
extern RGLSYMGLGETTEXPARAMETERIIVOESPROC __rglgen_glGetTexParameterIivOES;
extern RGLSYMGLGETTEXPARAMETERIUIVOESPROC __rglgen_glGetTexParameterIuivOES;
extern RGLSYMGLSAMPLERPARAMETERIIVOESPROC __rglgen_glSamplerParameterIivOES;
extern RGLSYMGLSAMPLERPARAMETERIUIVOESPROC __rglgen_glSamplerParameterIuivOES;
extern RGLSYMGLGETSAMPLERPARAMETERIIVOESPROC __rglgen_glGetSamplerParameterIivOES;
extern RGLSYMGLGETSAMPLERPARAMETERIUIVOESPROC __rglgen_glGetSamplerParameterIuivOES;
extern RGLSYMGLTEXBUFFEROESPROC __rglgen_glTexBufferOES;
extern RGLSYMGLTEXBUFFERRANGEOESPROC __rglgen_glTexBufferRangeOES;
extern RGLSYMGLTEXSTORAGE3DMULTISAMPLEOESPROC __rglgen_glTexStorage3DMultisampleOES;
extern RGLSYMGLTEXTUREVIEWOESPROC __rglgen_glTextureViewOES;
extern RGLSYMGLBINDVERTEXARRAYOESPROC __rglgen_glBindVertexArrayOES;
extern RGLSYMGLDELETEVERTEXARRAYSOESPROC __rglgen_glDeleteVertexArraysOES;
extern RGLSYMGLGENVERTEXARRAYSOESPROC __rglgen_glGenVertexArraysOES;
extern RGLSYMGLISVERTEXARRAYOESPROC __rglgen_glIsVertexArrayOES;
extern RGLSYMGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC __rglgen_glFramebufferTextureMultiviewOVR;
extern RGLSYMGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC __rglgen_glFramebufferTextureMultisampleMultiviewOVR;
struct rglgen_sym_map { const char *sym; void *ptr; };
extern const struct rglgen_sym_map rglgen_symbol_map[];
#ifdef __cplusplus
}
#endif
#endif

View File

@ -27,11 +27,11 @@
#include "config.h"
#endif
#include <retro_common_api.h>
#include "rglgen_headers.h"
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
struct rglgen_sym_map;
@ -41,9 +41,7 @@ void rglgen_resolve_symbols(rglgen_proc_address_t proc);
void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc,
const struct rglgen_sym_map *map);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -49,7 +49,7 @@
#include <GL3/gl3ext.h>
#elif defined(HAVE_OPENGLES3)
#include <GLES3/gl3.h>
#include <GLES2/gl2ext.h> /* There are no GLES3 extensions yet. */
#include <GLES2/gl2ext.h>
#elif defined(HAVE_OPENGLES2)
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

View File

@ -0,0 +1,557 @@
/* Copyright (C) 2010-2015 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (rhash.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <string.h>
#include <stdio.h>
#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
#include <rhash.h>
#include <retro_miscellaneous.h>
#include <retro_endianness.h>
#include <streams/file_stream.h>
#define LSL32(x, n) ((uint32_t)(x) << (n))
#define LSR32(x, n) ((uint32_t)(x) >> (n))
#define ROR32(x, n) (LSR32(x, n) | LSL32(x, 32 - (n)))
/* First 32 bits of the fractional parts of the square roots of the first 8 primes 2..19 */
static const uint32_t T_H[8] = {
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
};
/* First 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311 */
static const uint32_t T_K[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
};
/* SHA256 implementation from bSNES. Written by valditx. */
struct sha256_ctx
{
union
{
uint8_t u8[64];
uint32_t u32[16];
} in;
unsigned inlen;
uint32_t w[64];
uint32_t h[8];
uint64_t len;
};
static void sha256_init(struct sha256_ctx *p)
{
memset(p, 0, sizeof(struct sha256_ctx));
memcpy(p->h, T_H, sizeof(T_H));
}
static void sha256_block(struct sha256_ctx *p)
{
unsigned i;
uint32_t s0, s1;
uint32_t a, b, c, d, e, f, g, h;
for (i = 0; i < 16; i++)
p->w[i] = load32be(p->in.u32 + i);
for (i = 16; i < 64; i++)
{
s0 = ROR32(p->w[i - 15], 7) ^ ROR32(p->w[i - 15], 18) ^ LSR32(p->w[i - 15], 3);
s1 = ROR32(p->w[i - 2], 17) ^ ROR32(p->w[i - 2], 19) ^ LSR32(p->w[i - 2], 10);
p->w[i] = p->w[i - 16] + s0 + p->w[i - 7] + s1;
}
a = p->h[0]; b = p->h[1]; c = p->h[2]; d = p->h[3];
e = p->h[4]; f = p->h[5]; g = p->h[6]; h = p->h[7];
for (i = 0; i < 64; i++)
{
uint32_t t1, t2, maj, ch;
s0 = ROR32(a, 2) ^ ROR32(a, 13) ^ ROR32(a, 22);
maj = (a & b) ^ (a & c) ^ (b & c);
t2 = s0 + maj;
s1 = ROR32(e, 6) ^ ROR32(e, 11) ^ ROR32(e, 25);
ch = (e & f) ^ (~e & g);
t1 = h + s1 + ch + T_K[i] + p->w[i];
h = g;
g = f;
f = e;
e = d + t1;
d = c;
c = b;
b = a;
a = t1 + t2;
}
p->h[0] += a; p->h[1] += b; p->h[2] += c; p->h[3] += d;
p->h[4] += e; p->h[5] += f; p->h[6] += g; p->h[7] += h;
/* Next block */
p->inlen = 0;
}
static void sha256_chunk(struct sha256_ctx *p,
const uint8_t *s, unsigned len)
{
p->len += len;
while (len)
{
unsigned l = 64 - p->inlen;
if (len < l)
l = len;
memcpy(p->in.u8 + p->inlen, s, l);
s += l;
p->inlen += l;
len -= l;
if (p->inlen == 64)
sha256_block(p);
}
}
static void sha256_final(struct sha256_ctx *p)
{
uint64_t len;
p->in.u8[p->inlen++] = 0x80;
if (p->inlen > 56)
{
memset(p->in.u8 + p->inlen, 0, 64 - p->inlen);
sha256_block(p);
}
memset(p->in.u8 + p->inlen, 0, 56 - p->inlen);
len = p->len << 3;
store32be(p->in.u32 + 14, (uint32_t)(len >> 32));
store32be(p->in.u32 + 15, (uint32_t)len);
sha256_block(p);
}
static void sha256_subhash(struct sha256_ctx *p, uint32_t *t)
{
unsigned i;
for (i = 0; i < 8; i++)
store32be(t++, p->h[i]);
}
/**
* sha256_hash:
* @s : Output.
* @in : Input.
* @size : Size of @s.
*
* Hashes SHA256 and outputs a human readable string.
**/
void sha256_hash(char *s, const uint8_t *in, size_t size)
{
unsigned i;
struct sha256_ctx sha;
union
{
uint32_t u32[8];
uint8_t u8[32];
} shahash;
sha256_init(&sha);
sha256_chunk(&sha, in, size);
sha256_final(&sha);
sha256_subhash(&sha, shahash.u32);
for (i = 0; i < 32; i++)
snprintf(s + 2 * i, 3, "%02x", (unsigned)shahash.u8[i]);
}
#ifndef HAVE_ZLIB
/* Zlib CRC32. */
static const uint32_t crc32_table[256] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
uint32_t crc32_adjust(uint32_t checksum, uint8_t input)
{
return ((checksum >> 8) & 0x00ffffff) ^ crc32_table[(checksum ^ input) & 0xff];
}
uint32_t crc32_calculate(const uint8_t *data, size_t length)
{
size_t i;
uint32_t checksum = ~0;
for (i = 0; i < length; i++)
checksum = crc32_adjust(checksum, data[i]);
return ~checksum;
}
#endif
/* SHA-1 implementation. */
/*
* sha1.c
*
* Copyright (C) 1998, 2009
* Paul E. Jones <paulej@packetizer.com>
* All Rights Reserved
*
*****************************************************************************
* $Id: sha1.c 12 2009-06-22 19:34:25Z paulej $
*****************************************************************************
*
* Description:
* This file implements the Secure Hashing Standard as defined
* in FIPS PUB 180-1 published April 17, 1995.
*
* The Secure Hashing Standard, which uses the Secure Hashing
* Algorithm (SHA), produces a 160-bit message digest for a
* given data stream. In theory, it is highly improbable that
* two messages will produce the same message digest. Therefore,
* this algorithm can serve as a means of providing a "fingerprint"
* for a message.
*
* Portability Issues:
* SHA-1 is defined in terms of 32-bit "words". This code was
* written with the expectation that the processor has at least
* a 32-bit machine word size. If the machine word size is larger,
* the code should still function properly. One caveat to that
* is that the input functions taking characters and character
* arrays assume that only 8 bits of information are stored in each
* character.
*
* Caveats:
* SHA-1 is designed to work with messages less than 2^64 bits
* long. Although SHA-1 allows a message digest to be generated for
* messages of any number of bits less than 2^64, this
* implementation only works with messages with a length that is a
* multiple of the size of an 8-bit character.
*
*/
/* Define the circular shift macro */
#define SHA1CircularShift(bits,word) ((((word) << (bits)) & 0xFFFFFFFF) | ((word) >> (32-(bits))))
static void SHA1Reset(SHA1Context *context)
{
if (!context)
return;
context->Length_Low = 0;
context->Length_High = 0;
context->Message_Block_Index = 0;
context->Message_Digest[0] = 0x67452301;
context->Message_Digest[1] = 0xEFCDAB89;
context->Message_Digest[2] = 0x98BADCFE;
context->Message_Digest[3] = 0x10325476;
context->Message_Digest[4] = 0xC3D2E1F0;
context->Computed = 0;
context->Corrupted = 0;
}
static void SHA1ProcessMessageBlock(SHA1Context *context)
{
const unsigned K[] = /* Constants defined in SHA-1 */
{
0x5A827999,
0x6ED9EBA1,
0x8F1BBCDC,
0xCA62C1D6
};
int t; /* Loop counter */
unsigned temp; /* Temporary word value */
unsigned W[80]; /* Word sequence */
unsigned A, B, C, D, E; /* Word buffers */
/* Initialize the first 16 words in the array W */
for(t = 0; t < 16; t++)
{
W[t] = ((unsigned) context->Message_Block[t * 4]) << 24;
W[t] |= ((unsigned) context->Message_Block[t * 4 + 1]) << 16;
W[t] |= ((unsigned) context->Message_Block[t * 4 + 2]) << 8;
W[t] |= ((unsigned) context->Message_Block[t * 4 + 3]);
}
for(t = 16; t < 80; t++)
W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]);
A = context->Message_Digest[0];
B = context->Message_Digest[1];
C = context->Message_Digest[2];
D = context->Message_Digest[3];
E = context->Message_Digest[4];
for(t = 0; t < 20; t++)
{
temp = SHA1CircularShift(5,A) +
((B & C) | ((~B) & D)) + E + W[t] + K[0];
temp &= 0xFFFFFFFF;
E = D;
D = C;
C = SHA1CircularShift(30,B);
B = A;
A = temp;
}
for(t = 20; t < 40; t++)
{
temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1];
temp &= 0xFFFFFFFF;
E = D;
D = C;
C = SHA1CircularShift(30,B);
B = A;
A = temp;
}
for(t = 40; t < 60; t++)
{
temp = SHA1CircularShift(5,A) +
((B & C) | (B & D) | (C & D)) + E + W[t] + K[2];
temp &= 0xFFFFFFFF;
E = D;
D = C;
C = SHA1CircularShift(30,B);
B = A;
A = temp;
}
for(t = 60; t < 80; t++)
{
temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3];
temp &= 0xFFFFFFFF;
E = D;
D = C;
C = SHA1CircularShift(30,B);
B = A;
A = temp;
}
context->Message_Digest[0] =
(context->Message_Digest[0] + A) & 0xFFFFFFFF;
context->Message_Digest[1] =
(context->Message_Digest[1] + B) & 0xFFFFFFFF;
context->Message_Digest[2] =
(context->Message_Digest[2] + C) & 0xFFFFFFFF;
context->Message_Digest[3] =
(context->Message_Digest[3] + D) & 0xFFFFFFFF;
context->Message_Digest[4] =
(context->Message_Digest[4] + E) & 0xFFFFFFFF;
context->Message_Block_Index = 0;
}
static void SHA1PadMessage(SHA1Context *context)
{
if (!context)
return;
/*
* Check to see if the current message block is too small to hold
* the initial padding bits and length. If so, we will pad the
* block, process it, and then continue padding into a second
* block.
*/
context->Message_Block[context->Message_Block_Index++] = 0x80;
if (context->Message_Block_Index > 55)
{
while(context->Message_Block_Index < 64)
context->Message_Block[context->Message_Block_Index++] = 0;
SHA1ProcessMessageBlock(context);
}
while(context->Message_Block_Index < 56)
context->Message_Block[context->Message_Block_Index++] = 0;
/* Store the message length as the last 8 octets */
context->Message_Block[56] = (context->Length_High >> 24) & 0xFF;
context->Message_Block[57] = (context->Length_High >> 16) & 0xFF;
context->Message_Block[58] = (context->Length_High >> 8) & 0xFF;
context->Message_Block[59] = (context->Length_High) & 0xFF;
context->Message_Block[60] = (context->Length_Low >> 24) & 0xFF;
context->Message_Block[61] = (context->Length_Low >> 16) & 0xFF;
context->Message_Block[62] = (context->Length_Low >> 8) & 0xFF;
context->Message_Block[63] = (context->Length_Low) & 0xFF;
SHA1ProcessMessageBlock(context);
}
static int SHA1Result(SHA1Context *context)
{
if (context->Corrupted)
return 0;
if (!context->Computed)
{
SHA1PadMessage(context);
context->Computed = 1;
}
return 1;
}
static void SHA1Input(SHA1Context *context,
const unsigned char *message_array,
unsigned length)
{
if (!length)
return;
if (context->Computed || context->Corrupted)
{
context->Corrupted = 1;
return;
}
while(length-- && !context->Corrupted)
{
context->Message_Block[context->Message_Block_Index++] =
(*message_array & 0xFF);
context->Length_Low += 8;
/* Force it to 32 bits */
context->Length_Low &= 0xFFFFFFFF;
if (context->Length_Low == 0)
{
context->Length_High++;
/* Force it to 32 bits */
context->Length_High &= 0xFFFFFFFF;
if (context->Length_High == 0)
context->Corrupted = 1; /* Message is too long */
}
if (context->Message_Block_Index == 64)
SHA1ProcessMessageBlock(context);
message_array++;
}
}
int sha1_calculate(const char *path, char *result)
{
unsigned char buff[4096] = {0};
SHA1Context sha;
int rv = 1;
RFILE *fd = filestream_open(path, RFILE_MODE_READ, -1);
if (!fd)
goto error;
SHA1Reset(&sha);
do
{
rv = filestream_read(fd, buff, 4096);
if (rv < 0)
goto error;
SHA1Input(&sha, buff, rv);
}while(rv);
if (!SHA1Result(&sha))
goto error;
sprintf(result, "%08X%08X%08X%08X%08X",
sha.Message_Digest[0],
sha.Message_Digest[1],
sha.Message_Digest[2],
sha.Message_Digest[3], sha.Message_Digest[4]);
filestream_close(fd);
return 0;
error:
if (fd)
filestream_close(fd);
return -1;
}
uint32_t djb2_calculate(const char *str)
{
const unsigned char *aux = (const unsigned char*)str;
uint32_t hash = 5381;
while ( *aux )
hash = ( hash << 5 ) + hash + *aux++;
return hash;
}

View File

@ -23,6 +23,8 @@
#ifndef LIBCO_H
#define LIBCO_H
#include <retro_common_api.h>
#ifdef LIBCO_C
#ifdef LIBCO_MP
#define thread_local __thread
@ -31,9 +33,7 @@
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
typedef void* cothread_t;
@ -73,9 +73,7 @@ void co_delete(cothread_t cothread);
*/
void co_switch(cothread_t cothread);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
/* ifndef LIBCO_H */
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,398 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------------
* The following license statement only applies to this libretro API header (libretro_vulkan.h)
* ---------------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef LIBRETRO_VULKAN_H__
#define LIBRETRO_VULKAN_H__
#include <libretro.h>
#include <vulkan/vulkan.h>
#define RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION 5
#define RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN_VERSION 1
struct retro_vulkan_image
{
VkImageView image_view;
VkImageLayout image_layout;
VkImageViewCreateInfo create_info;
};
typedef void (*retro_vulkan_set_image_t)(void *handle,
const struct retro_vulkan_image *image,
uint32_t num_semaphores,
const VkSemaphore *semaphores,
uint32_t src_queue_family);
typedef uint32_t (*retro_vulkan_get_sync_index_t)(void *handle);
typedef uint32_t (*retro_vulkan_get_sync_index_mask_t)(void *handle);
typedef void (*retro_vulkan_set_command_buffers_t)(void *handle,
uint32_t num_cmd,
const VkCommandBuffer *cmd);
typedef void (*retro_vulkan_wait_sync_index_t)(void *handle);
typedef void (*retro_vulkan_lock_queue_t)(void *handle);
typedef void (*retro_vulkan_unlock_queue_t)(void *handle);
typedef void (*retro_vulkan_set_signal_semaphore_t)(void *handle, VkSemaphore semaphore);
typedef const VkApplicationInfo *(*retro_vulkan_get_application_info_t)(void);
struct retro_vulkan_context
{
VkPhysicalDevice gpu;
VkDevice device;
VkQueue queue;
uint32_t queue_family_index;
VkQueue presentation_queue;
uint32_t presentation_queue_family_index;
};
typedef bool (*retro_vulkan_create_device_t)(
struct retro_vulkan_context *context,
VkInstance instance,
VkPhysicalDevice gpu,
VkSurfaceKHR surface,
PFN_vkGetInstanceProcAddr get_instance_proc_addr,
const char **required_device_extensions,
unsigned num_required_device_extensions,
const char **required_device_layers,
unsigned num_required_device_layers,
const VkPhysicalDeviceFeatures *required_features);
typedef void (*retro_vulkan_destroy_device_t)(void);
/* Note on thread safety:
* The Vulkan API is heavily designed around multi-threading, and
* the libretro interface for it should also be threading friendly.
* A core should be able to build command buffers and submit
* command buffers to the GPU from any thread.
*/
struct retro_hw_render_context_negotiation_interface_vulkan
{
/* Must be set to RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN. */
enum retro_hw_render_context_negotiation_interface_type interface_type;
/* Must be set to RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN_VERSION. */
unsigned interface_version;
/* If non-NULL, returns a VkApplicationInfo struct that the frontend can use instead of
* its "default" application info.
*/
retro_vulkan_get_application_info_t get_application_info;
/* If non-NULL, the libretro core will choose one or more physical devices,
* create one or more logical devices and create one or more queues.
* The core must prepare a designated PhysicalDevice, Device, Queue and queue family index
* which the frontend will use for its internal operation.
*
* If gpu is not VK_NULL_HANDLE, the physical device provided to the frontend must be this PhysicalDevice.
* The core is still free to use other physical devices.
*
* The frontend will request certain extensions and layers for a device which is created.
* The core must ensure that the queue and queue_family_index support GRAPHICS and COMPUTE.
*
* If surface is not VK_NULL_HANDLE, the core must consider presentation when creating the queues.
* If presentation to "surface" is supported on the queue, presentation_queue must be equal to queue.
* If not, a second queue must be provided in presentation_queue and presentation_queue_index.
* If surface is not VK_NULL_HANDLE, the instance from frontend will have been created with supported for
* VK_KHR_surface extension.
*
* The core is free to set its own queue priorities.
* Device provided to frontend is owned by the frontend, but any additional device resources must be freed by core
* in destroy_device callback.
*
* If this function returns true, a PhysicalDevice, Device and Queues are initialized.
* If false, none of the above have been initialized and the frontend will attempt
* to fallback to "default" device creation, as if this function was never called.
*/
retro_vulkan_create_device_t create_device;
/* If non-NULL, this callback is called similar to context_destroy for HW_RENDER_INTERFACE.
* However, it will be called even if context_reset was not called.
* This can happen if the context never succeeds in being created.
* destroy_device will always be called before the VkInstance
* of the frontend is destroyed if create_device was called successfully so that the core has a chance of
* tearing down its own device resources.
*
* Only auxillary resources should be freed here, i.e. resources which are not part of retro_vulkan_context.
*/
retro_vulkan_destroy_device_t destroy_device;
};
struct retro_hw_render_interface_vulkan
{
/* Must be set to RETRO_HW_RENDER_INTERFACE_VULKAN. */
enum retro_hw_render_interface_type interface_type;
/* Must be set to RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION. */
unsigned interface_version;
/* Opaque handle to the Vulkan backend in the frontend
* which must be passed along to all function pointers
* in this interface.
*
* The rationale for including a handle here (which libretro v1
* doesn't currently do in general) is:
*
* - Vulkan cores should be able to be freely threaded without lots of fuzz.
* This would break frontends which currently rely on TLS
* to deal with multiple cores loaded at the same time.
* - Fixing this in general is TODO for an eventual libretro v2.
*/
void *handle;
/* The Vulkan instance the context is using. */
VkInstance instance;
/* The physical device used. */
VkPhysicalDevice gpu;
/* The logical device used. */
VkDevice device;
/* Allows a core to fetch all its needed symbols without having to link
* against the loader itself. */
PFN_vkGetDeviceProcAddr get_device_proc_addr;
PFN_vkGetInstanceProcAddr get_instance_proc_addr;
/* The queue the core must use to submit data.
* This queue and index must remain constant throughout the lifetime
* of the context.
*
* This queue will be the queue that supports graphics and compute
* if the device supports compute.
*/
VkQueue queue;
unsigned queue_index;
/* Before calling retro_video_refresh_t with RETRO_HW_FRAME_BUFFER_VALID,
* set which image to use for this frame.
*
* If num_semaphores is non-zero, the frontend will wait for the
* semaphores provided to be signaled before using the results further
* in the pipeline.
*
* Semaphores provided by a single call to set_image will only be
* waited for once (waiting for a semaphore resets it).
* E.g. set_image, video_refresh, and then another
* video_refresh without set_image,
* but same image will only wait for semaphores once.
*
* For this reason, ownership transfer will only occur if semaphores
* are waited on for a particular frame in the frontend.
*
* Using semaphores is optional for synchronization purposes,
* but if not using
* semaphores, an image memory barrier in vkCmdPipelineBarrier
* should be used in the graphics_queue.
* Example:
*
* vkCmdPipelineBarrier(cmd,
* srcStageMask = VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
* dstStageMask = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
* image_memory_barrier = {
* srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
* dstAccessMask = VK_ACCESS_SHADER_READ_BIT,
* });
*
* The use of pipeline barriers instead of semaphores is encouraged
* as it is simpler and more fine-grained. A layout transition
* must generally happen anyways which requires a
* pipeline barrier.
*
* The image passed to set_image must have imageUsage flags set to at least
* VK_IMAGE_USAGE_TRANSFER_SRC_BIT and VK_IMAGE_USAGE_SAMPLED_BIT.
* The core will naturally want to use flags such as
* VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT and/or
* VK_IMAGE_USAGE_TRANSFER_DST_BIT depending
* on how the final image is created.
*
* The image must also have been created with MUTABLE_FORMAT bit set if
* 8-bit formats are used, so that the frontend can reinterpret sRGB
* formats as it sees fit.
*
* Images passed to set_image should be created with TILING_OPTIMAL.
* The image layout should be transitioned to either
* VK_IMAGE_LAYOUT_GENERIC or VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL.
* The actual image layout used must be set in image_layout.
*
* The image must be a 2D texture which may or not be layered
* and/or mipmapped.
*
* The image must be suitable for linear sampling.
* While the image_view is typically the only field used,
* the frontend may want to reinterpret the texture as sRGB vs.
* non-sRGB for example so the VkImageViewCreateInfo used to
* create the image view must also be passed in.
*
* The data in the pointer to the image struct will not be copied
* as the pNext field in create_info cannot be reliably deep-copied.
* The image pointer passed to set_image must be valid until
* retro_video_refresh_t has returned.
*
* If frame duping is used when passing NULL to retro_video_refresh_t,
* the frontend is free to either use the latest image passed to
* set_image or reuse the older pointer passed to set_image the
* frame RETRO_HW_FRAME_BUFFER_VALID was last used.
*
* Essentially, the lifetime of the pointer passed to
* retro_video_refresh_t should be extended if frame duping is used
* so that the frontend can reuse the older pointer.
*
* The image itself however, must not be touched by the core until
* wait_sync_index has been completed later. The frontend may perform
* layout transitions on the image, so even read-only access is not defined.
* The exception to read-only rule is if GENERAL layout is used for the image.
* In this case, the frontend is not allowed to perform any layout transitions,
* so concurrent reads from core and frontend are allowed.
*
* If frame duping is used, or if set_command_buffers is used,
* the frontend will not wait for any semaphores.
*
* The src_queue_family is used to specify which queue family
* the image is currently owned by. If using multiple queue families
* (e.g. async compute), the frontend will need to acquire ownership of the
* image before rendering with it and release the image afterwards.
*
* If src_queue_family is equal to the queue family (queue_index),
* no ownership transfer will occur.
* Similarly, if src_queue_family is VK_QUEUE_FAMILY_IGNORED,
* no ownership transfer will occur.
*
* The frontend will always release ownership back to src_queue_family.
* Waiting for frontend to complete with wait_sync_index() ensures that
* the frontend has released ownership back to the application.
* Note that in Vulkan, transfering ownership is a two-part process.
*
* Example frame:
* - core releases ownership from src_queue_index to queue_index with VkImageMemoryBarrier.
* - core calls set_image with src_queue_index.
* - Frontend will acquire the image with src_queue_index -> queue_index as well, completing the ownership transfer.
* - Frontend renders the frame.
* - Frontend releases ownership with queue_index -> src_queue_index.
* - Next time image is used, core must acquire ownership from queue_index ...
*
* Since the frontend releases ownership, we cannot necessarily dupe the frame because
* the core needs to make the roundtrip of ownership transfer.
*/
retro_vulkan_set_image_t set_image;
/* Get the current sync index for this frame which is obtained in
* frontend by calling e.g. vkAcquireNextImageKHR before calling
* retro_run().
*
* This index will correspond to which swapchain buffer is currently
* the active one.
*
* Knowing this index is very useful for maintaining safe asynchronous CPU
* and GPU operation without stalling.
*
* The common pattern for synchronization is to receive fences when
* submitting command buffers to Vulkan (vkQueueSubmit) and add this fence
* to a list of fences for frame number get_sync_index().
*
* Next time we receive the same get_sync_index(), we can wait for the
* fences from before, which will usually return immediately as the
* frontend will generally also avoid letting the GPU run ahead too much.
*
* After the fence has signaled, we know that the GPU has completed all
* GPU work related to work submitted in the frame we last saw get_sync_index().
*
* This means we can safely reuse or free resources allocated in this frame.
*
* In theory, even if we wait for the fences correctly, it is not technically
* safe to write to the image we earlier passed to the frontend since we're
* not waiting for the frontend GPU jobs to complete.
*
* The frontend will guarantee that the appropriate pipeline barrier
* in graphics_queue has been used such that
* VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT cannot
* start until the frontend is done with the image.
*/
retro_vulkan_get_sync_index_t get_sync_index;
/* Returns a bitmask of how many swapchain images we currently have
* in the frontend.
*
* If bit #N is set in the return value, get_sync_index can return N.
* Knowing this value is useful for preallocating per-frame management
* structures ahead of time.
*
* While this value will typically remain constant throughout the
* applications lifecycle, it may for example change if the frontend
* suddently changes fullscreen state and/or latency.
*
* If this value ever changes, it is safe to assume that the device
* is completely idle and all synchronization objects can be deleted
* right away as desired.
*/
retro_vulkan_get_sync_index_mask_t get_sync_index_mask;
/* Instead of submitting the command buffer to the queue first, the core
* can pass along its command buffer to the frontend, and the frontend
* will submit the command buffer together with the frontends command buffers.
*
* This has the advantage that the overhead of vkQueueSubmit can be
* amortized into a single call. For this mode, semaphores in set_image
* will be ignored, so vkCmdPipelineBarrier must be used to synchronize
* the core and frontend.
*
* The command buffers in set_command_buffers are only executed once,
* even if frame duping is used.
*
* If frame duping is used, set_image should be used for the frames
* which should be duped instead.
*
* Command buffers passed to the frontend with set_command_buffers
* must not actually be submitted to the GPU until retro_video_refresh_t
* is called.
*
* The frontend must submit the command buffer before submitting any
* other command buffers provided by set_command_buffers. */
retro_vulkan_set_command_buffers_t set_command_buffers;
/* Waits on CPU for device activity for the current sync index to complete.
* This is useful since the core will not have a relevant fence to sync with
* when the frontend is submitting the command buffers. */
retro_vulkan_wait_sync_index_t wait_sync_index;
/* If the core submits command buffers itself to any of the queues provided
* in this interface, the core must lock and unlock the frontend from
* racing on the VkQueue.
*
* Queue submission can happen on any thread.
* Even if queue submission happens on the same thread as retro_run(),
* the lock/unlock functions must still be called.
*
* NOTE: Queue submissions are heavy-weight. */
retro_vulkan_lock_queue_t lock_queue;
retro_vulkan_unlock_queue_t unlock_queue;
/* Sets a semaphore which is signaled when the image in set_image can safely be reused.
* The semaphore is consumed next call to retro_video_refresh_t.
* The semaphore will be signalled even for duped frames.
* The semaphore will be signalled only once, so set_signal_semaphore should be called every frame.
* The semaphore may be VK_NULL_HANDLE, which disables semaphore signalling for next call to retro_video_refresh_t.
*
* This is mostly useful to support use cases where you're rendering to a single image that
* is recycled in a ping-pong fashion with the frontend to save memory (but potentially less throughput).
*/
retro_vulkan_set_signal_semaphore_t set_signal_semaphore;
};
#endif

View File

@ -23,11 +23,11 @@
#ifndef __LIBRETRO_SDK_DIR_LIST_H
#define __LIBRETRO_SDK_DIR_LIST_H
#include <retro_common_api.h>
#include <lists/string_list.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
/**
* dir_list_new:
@ -63,8 +63,6 @@ void dir_list_sort(struct string_list *list, bool dir_first);
**/
void dir_list_free(struct string_list *list);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,9 +23,9 @@
#ifndef __LIBRETRO_SDK_FILE_LIST_H__
#define __LIBRETRO_SDK_FILE_LIST_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
#include <stddef.h>
#include <stdlib.h>
@ -117,8 +117,6 @@ void file_list_sort_on_type(file_list_t *list);
bool file_list_search(const file_list_t *list, const char *needle,
size_t *index);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,13 +23,13 @@
#ifndef __LIBRETRO_SDK_STRING_LIST_H
#define __LIBRETRO_SDK_STRING_LIST_H
#include <retro_common_api.h>
#include <boolean.h>
#include <stdlib.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
union string_list_elem_attr
{
@ -141,8 +141,6 @@ void string_list_join_concat(char *buffer, size_t size,
void string_list_set(struct string_list *list, unsigned idx,
const char *str);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -0,0 +1,80 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (complex.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_MATH_COMPLEX_H__
#define __LIBRETRO_SDK_MATH_COMPLEX_H__
#include <stdint.h>
#include <retro_inline.h>
typedef struct
{
float real;
float imag;
} fft_complex_t;
static INLINE fft_complex_t fft_complex_mul(fft_complex_t a,
fft_complex_t b)
{
fft_complex_t out = {
a.real * b.real - a.imag * b.imag,
a.imag * b.real + a.real * b.imag,
};
return out;
}
static INLINE fft_complex_t fft_complex_add(fft_complex_t a,
fft_complex_t b)
{
fft_complex_t out = {
a.real + b.real,
a.imag + b.imag,
};
return out;
}
static INLINE fft_complex_t fft_complex_sub(fft_complex_t a,
fft_complex_t b)
{
fft_complex_t out = {
a.real - b.real,
a.imag - b.imag,
};
return out;
}
static INLINE fft_complex_t fft_complex_conj(fft_complex_t a)
{
fft_complex_t out = {
a.real, -a.imag,
};
return out;
}
#endif

View File

@ -0,0 +1,62 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (fxp.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_MATH_FXP_H__
#define __LIBRETRO_SDK_MATH_FXP_H__
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h>
#endif
#include <retro_inline.h>
static INLINE int64_t fx32_mul(const int32_t a, const int32_t b)
{
#ifdef _MSC_VER
return __emul(a, b);
#else
return ((int64_t)a) * ((int64_t)b);
#endif
}
static INLINE int32_t fx32_shiftdown(const int64_t a)
{
#ifdef _MSC_VER
return (int32_t)__ll_rshift(a, 12);
#else
return (int32_t)(a >> 12);
#endif
}
static INLINE int64_t fx32_shiftup(const int32_t a)
{
#ifdef _MSC_VER
return __ll_lshift(a, 12);
#else
return ((int64_t)a) << 12;
#endif
}
#endif

View File

@ -25,16 +25,16 @@
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
void *memalign_alloc(size_t boundary, size_t size);
void *memalign_alloc_aligned(size_t size);
void memalign_free(void *ptr);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -74,18 +74,18 @@
#define listen sceNetListen
#define send sceNetSend
#define recv sceNetRecv
#define MSG_DONTWAIT PSP2_NET_MSG_DONTWAIT
#define AF_INET PSP2_NET_AF_INET
#define MSG_DONTWAIT SCE_NET_MSG_DONTWAIT
#define AF_INET SCE_NET_AF_INET
#define AF_UNSPEC 0
#define INADDR_ANY PSP2_NET_INADDR_ANY
#define INADDR_ANY SCE_NET_INADDR_ANY
#define INADDR_NONE 0xffffffff
#define SOCK_STREAM PSP2_NET_SOCK_STREAM
#define SOCK_DGRAM PSP2_NET_SOCK_DGRAM
#define SOL_SOCKET PSP2_NET_SOL_SOCKET
#define SO_REUSEADDR PSP2_NET_SO_REUSEADDR
#define SO_SNDBUF PSP2_NET_SO_SNDBUF
#define SO_SNDTIMEO PSP2_NET_SO_SNDTIMEO
#define SO_NBIO PSP2_NET_SO_NBIO
#define SOCK_STREAM SCE_NET_SOCK_STREAM
#define SOCK_DGRAM SCE_NET_SOCK_DGRAM
#define SOL_SOCKET SCE_NET_SOL_SOCKET
#define SO_REUSEADDR SCE_NET_SO_REUSEADDR
#define SO_SNDBUF SCE_NET_SO_SNDBUF
#define SO_SNDTIMEO SCE_NET_SO_SNDTIMEO
#define SO_NBIO SCE_NET_SO_NBIO
#define htonl sceNetHtonl
#define ntohl sceNetNtohl
#define htons sceNetHtons
@ -136,14 +136,6 @@ struct hostent
#ifdef GEKKO
#define sendto(s, msg, len, flags, addr, tolen) net_sendto(s, msg, len, 0, addr, 8)
#define socket(domain, type, protocol) net_socket(domain, type, protocol)
static INLINE int inet_pton(int af, const char *src, void *dst)
{
if (af != AF_INET)
return -1;
return inet_aton (src, dst);
}
#endif
static INLINE bool isagain(int bytes)
@ -155,7 +147,7 @@ static INLINE bool isagain(int bytes)
return false;
return true;
#elif defined(VITA)
return (bytes<0 && (bytes == PSP2_NET_ERROR_EAGAIN || bytes == PSP2_NET_ERROR_EWOULDBLOCK));
return (bytes<0 && (bytes == SCE_NET_ERROR_EAGAIN || bytes == SCE_NET_ERROR_EWOULDBLOCK));
#else
return (bytes < 0 && (errno == EAGAIN || errno == EWOULDBLOCK));
#endif
@ -211,23 +203,15 @@ struct addrinfo
#endif
uint16_t inet_htons(uint16_t hostshort);
int inet_ptrton(int af, const char *src, void *dst);
int getaddrinfo_retro(const char *node, const char *service,
const struct addrinfo *hints,
struct addrinfo **res);
struct addrinfo *hints, struct addrinfo **res);
void freeaddrinfo_retro(struct addrinfo *res);
bool socket_nonblock(int fd);
int socket_close(int fd);
int socket_select(int nfds, fd_set *readfs, fd_set *writefds,
fd_set *errorfds, struct timeval *timeout);
int socket_send_all_blocking(int fd, const void *data_, size_t size);
int socket_receive_all_blocking(int fd, void *data_, size_t size);
/**
* network_init:
*

View File

@ -27,9 +27,9 @@
#include <boolean.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
struct http_t;
struct http_connection_t;
@ -68,8 +68,6 @@ uint8_t* net_http_data(struct http_t *state, size_t* len, bool accept_error);
/* Cleans up all memory. */
void net_http_delete(struct http_t *state);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -0,0 +1,91 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (net_socket.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _LIBRETRO_SDK_NET_SOCKET_H
#define _LIBRETRO_SDK_NET_SOCKET_H
#include <stdint.h>
#include <boolean.h>
#include <string.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
enum socket_domain
{
SOCKET_DOMAIN_INET = 0
};
enum socket_type
{
SOCKET_TYPE_DATAGRAM = 0,
SOCKET_TYPE_STREAM,
SOCKET_TYPE_SEQPACKET
};
enum socket_protocol
{
SOCKET_PROTOCOL_NONE = 0,
SOCKET_PROTOCOL_TCP,
SOCKET_PROTOCOL_UDP
};
typedef struct socket_target
{
unsigned port;
const char *server;
enum socket_domain domain;
enum socket_protocol prot;
} socket_target_t;
int socket_init(void **address, uint16_t port, const char *server, enum socket_type type);
int socket_close(int fd);
bool socket_nonblock(int fd);
int socket_select(int nfds, fd_set *readfs, fd_set *writefds,
fd_set *errorfds, struct timeval *timeout);
int socket_send_all_blocking(int fd, const void *data_, size_t size, bool no_signal);
int socket_receive_all_blocking(int fd, void *data_, size_t size);
ssize_t socket_receive_all_nonblocking(int fd, bool *error,
void *data_, size_t size);
bool socket_bind(int fd, void *data);
int socket_connect(int fd, void *data, bool timeout_enable);
int socket_create(
const char *name,
enum socket_domain domain_type,
enum socket_type socket_type,
enum socket_protocol protocol_type);
void socket_set_target(void *data, socket_target_t *in_addr);
RETRO_END_DECLS
#endif

View File

@ -26,9 +26,9 @@
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
typedef struct fifo_buffer fifo_buffer_t;
@ -46,9 +46,7 @@ size_t fifo_read_avail(fifo_buffer_t *buffer);
size_t fifo_write_avail(fifo_buffer_t *buffer);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -25,9 +25,9 @@
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
typedef struct msg_queue msg_queue_t;
@ -83,8 +83,6 @@ void msg_queue_clear(msg_queue_t *queue);
**/
void msg_queue_free(msg_queue_t *queue);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -24,11 +24,13 @@
#define __LIBRETRO_SDK_TASK_QUEUE_H__
#include <stdint.h>
#include <stddef.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
enum task_queue_ctl_state
{
@ -56,6 +58,14 @@ enum task_queue_ctl_state
*/
TASK_QUEUE_CTL_FIND,
/**
* Calls func for every running task when handler
* parameter matches task handler, allowing the
* list parameter to be filled with user-defined
* data.
*/
TASK_QUEUE_CTL_RETRIEVE,
/* Blocks until all tasks have finished.
* This must only be called from the main thread. */
TASK_QUEUE_CTL_WAIT,
@ -82,8 +92,13 @@ enum task_queue_ctl_state
TASK_QUEUE_CTL_UNSET_THREADED,
TASK_QUEUE_CTL_IS_THREADED
};
TASK_QUEUE_CTL_IS_THREADED,
/**
* Signals a task to end without waiting for
* it to complete. */
TASK_QUEUE_CTL_CANCEL
};
typedef struct retro_task retro_task_t;
typedef void (*retro_task_callback_t)(void *task_data,
@ -94,6 +109,8 @@ typedef void (*retro_task_handler_t)(retro_task_t *task);
typedef bool (*retro_task_finder_t)(retro_task_t *task,
void *userdata);
typedef bool (*retro_task_retriever_t)(retro_task_t *task, void *data);
typedef struct
{
char *source_file;
@ -106,6 +123,10 @@ struct retro_task
/* always called from the main loop */
retro_task_callback_t callback;
/* task cleanup handler to free allocated resources, will
* be called immediately after running the main callback */
retro_task_handler_t cleanup;
/* set to true by the handler to signal
* the task has finished executing. */
bool finished;
@ -114,6 +135,9 @@ struct retro_task
* to signal the task *must* end. */
bool cancelled;
/* if true no OSD messages will be displayed. */
bool mute;
/* created by the handler, destroyed by the user */
void *task_data;
@ -144,12 +168,28 @@ typedef struct task_finder_data
void *userdata;
} task_finder_data_t;
void task_queue_push_progress(retro_task_t *task);
typedef struct task_retriever_info
{
struct task_retriever_info *next;
void *data;
} task_retriever_info_t;
typedef struct task_retriever_data
{
retro_task_handler_t handler;
size_t element_size;
retro_task_retriever_t func;
task_retriever_info_t *list;
} task_retriever_data_t;
bool task_queue_ctl(enum task_queue_ctl_state state, void *data);
#ifdef __cplusplus
}
#endif
void *task_queue_retriever_info_next(task_retriever_info_t **link);
void task_queue_retriever_info_free(task_retriever_info_t *list);
void task_queue_cancel_task(void *task);
RETRO_END_DECLS
#endif

View File

@ -33,4 +33,5 @@ in a public API, you may need this.
/* conditional compilation is handled inside here */
#include <compat/msvc.h>
#endif
#endif

View File

@ -0,0 +1,108 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_common_api.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _LIBRETRO_COMMON_RETRO_COMMON_API_H
#define _LIBRETRO_COMMON_RETRO_COMMON_API_H
/*
This file is designed to normalize the libretro-common compiling environment
for public API headers. This should be leaner than a normal compiling environment,
since it gets #included into other project's sources.
*/
/* ------------------------------------ */
/*
Ordinarily we want to put #ifdef __cplusplus extern "C" in C library
headers to enable them to get used by c++ sources.
However, we want to support building this library as C++ as well, so a
special technique is called for.
*/
#define RETRO_BEGIN_DECLS
#define RETRO_END_DECLS
#ifdef __cplusplus
#ifdef CXX_BUILD
/* build wants everything to be built as c++, so no extern "C" */
#else
#undef RETRO_BEGIN_DECLS
#undef RETRO_END_DECLS
#define RETRO_BEGIN_DECLS extern "C" {
#define RETRO_END_DECLS }
#endif
#else
/* header is included by a C source file, so no extern "C" */
#endif
/*
IMO, this non-standard ssize_t should not be used.
However, it's a good example of how to handle something like this.
*/
#ifdef _MSC_VER
#ifndef HAVE_SSIZE_T
#define HAVE_SSIZE_T
#if defined(_WIN64)
typedef __int64 ssize_t;
#elif defined(_WIN32)
typedef int ssize_t;
#endif
#endif
#elif defined(__MACH__)
#include <sys/types.h>
#endif
#ifdef _WIN32
#define STRING_REP_INT64 "%I64u"
#define STRING_REP_UINT64 "%I64u"
#define STRING_REP_ULONG "%Iu"
#elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
#define STRING_REP_INT64 "%llu"
#define STRING_REP_UINT64 "%llu"
#define STRING_REP_ULONG "%zu"
#else
#define STRING_REP_INT64 "%llu"
#define STRING_REP_UINT64 "%llu"
#define STRING_REP_ULONG "%lu"
#endif
/*
I would like to see retro_inline.h moved in here; possibly boolean too.
rationale: these are used in public APIs, and it is easier to find problems
and write code that works the first time portably when theyre included uniformly
than to do the analysis from scratch each time you think you need it, for each feature.
Moreover it helps force you to make hard decisions: if you EVER bring in boolean.h,
then you should pay the price everywhere, so you can see how much grief it will cause.
Of course, another school of thought is that you should do as little damage as possible
in as few places as possible...
*/
/* _LIBRETRO_COMMON_RETRO_COMMON_API_H */
#endif

View File

@ -23,11 +23,11 @@
#ifndef __RETRO_DIRENT_H
#define __RETRO_DIRENT_H
#include <retro_common_api.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
struct RDIR;
@ -49,12 +49,10 @@ const char *retro_dirent_get_name(struct RDIR *rdir);
* Returns: true if directory listing entry is
* a directory, false if not.
*/
bool retro_dirent_is_dir(struct RDIR *rdir);
bool retro_dirent_is_dir(struct RDIR *rdir, const char *path);
void retro_closedir(struct RDIR *rdir);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,6 +23,14 @@
#ifndef __LIBRETRO_SDK_ENVIRONMENT_H
#define __LIBRETRO_SDK_ENVIRONMENT_H
/*
This file is designed to create a normalized environment for compiling
libretro-common's private implementations, or any other sources which might
enjoy use of it's environment (RetroArch for instance).
This should be an elaborately crafted environment so that sources don't
need to be full of platform-specific workarounds.
*/
#if defined (__cplusplus)
#if 0
printf("This is C++, version %d.\n", __cplusplus);
@ -65,4 +73,6 @@ printf("This is C++, version %d.\n", __cplusplus);
/* This is not standard C. __STDC__ is not defined. */
#endif
#endif

View File

@ -25,7 +25,7 @@
#ifndef INLINE
#if defined(_WIN32)
#if defined(_WIN32) || defined(__INTEL_COMPILER)
#define INLINE __inline
#elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
#define INLINE inline

View File

@ -50,6 +50,7 @@
#endif
#include <limits.h>
#include <math.h>
#ifdef _MSC_VER
#include <compat/msvc.h>

View File

@ -26,11 +26,11 @@
#include <stdint.h>
#include <stddef.h>
#include <retro_common_api.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
/**
* path_is_directory:
@ -58,8 +58,6 @@ int32_t path_get_size(const char *path);
**/
bool mkdir_norecurse(const char *dir);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,9 +23,9 @@
#ifndef __LIBRETRO_SDK_SEMAPHORE_H
#define __LIBRETRO_SDK_SEMAPHORE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
typedef struct ssem ssem_t;
@ -47,8 +47,6 @@ void ssem_wait(ssem_t *semaphore);
void ssem_signal(ssem_t *semaphore);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif /* __LIBRETRO_SDK_SEMAPHORE_H */

View File

@ -23,14 +23,14 @@
#ifndef __LIBRETRO_SDK_RTHREADS_H__
#define __LIBRETRO_SDK_RTHREADS_H__
#include <retro_common_api.h>
#include <boolean.h>
#include <stdint.h>
#include <retro_inline.h>
#include <retro_miscellaneous.h>
#if defined(__cplusplus)
extern "C" {
#endif
RETRO_BEGIN_DECLS
typedef struct sthread sthread_t;
typedef struct slock slock_t;
@ -183,8 +183,6 @@ int scond_broadcast(scond_t *cond);
**/
void scond_signal(scond_t *cond);
#if defined(__cplusplus)
}
#endif
RETRO_END_DECLS
#endif

View File

@ -28,18 +28,17 @@
#include <sys/types.h>
#include <retro_common.h>
#include <retro_common_api.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
typedef struct RFILE RFILE;
enum
{
RFILE_MODE_READ = 0,
RFILE_MODE_READ_TEXT,
RFILE_MODE_WRITE,
RFILE_MODE_READ_WRITE,
@ -64,14 +63,20 @@ int filestream_close(RFILE *stream);
int filestream_read_file(const char *path, void **buf, ssize_t *len);
char *filestream_gets(RFILE *stream, char *s, size_t len);
char *filestream_getline(RFILE *stream);
int filestream_getc(RFILE *stream);
int filestream_eof(RFILE *stream);
bool filestream_write_file(const char *path, const void *data, ssize_t size);
int filestream_putc(RFILE *stream, int c);
int filestream_get_fd(RFILE *stream);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -25,7 +25,9 @@
#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>
#include <retro_common_api.h>
#include <boolean.h>
enum intfstream_type

View File

@ -28,9 +28,9 @@
#include <string.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
bool string_is_empty(const char *data);
@ -42,11 +42,20 @@ char *string_to_upper(char *s);
char *string_to_lower(char *s);
char *string_ucwords(char* s);
char *string_replace_substring(const char *in, const char *pattern,
const char *by);
#ifdef __cplusplus
}
#endif
/* Remove leading whitespaces */
char *string_trim_whitespace_left(char *const s);
/* Remove trailing whitespaces */
char *string_trim_whitespace_right(char *const s);
/* Remove leading and trailing whitespaces */
char *string_trim_whitespace(char *const s);
RETRO_END_DECLS
#endif

View File

@ -0,0 +1,45 @@
/*
* This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
* MD5 Message-Digest Algorithm (RFC 1321).
*
* Homepage:
* http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
*
* Author:
* Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
*
* This software was written by Alexander Peslyak in 2001. No copyright is
* claimed, and the software is hereby placed in the public domain.
* In case this attempt to disclaim copyright and place the software in the
* public domain is deemed null and void, then the software is
* Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
* general public under the following terms:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
*
* There's ABSOLUTELY NO WARRANTY, express or implied.
*
* See md5.c for more information.
*/
#ifdef HAVE_OPENSSL
#include <openssl/md5.h>
#elif !defined(_MD5_H)
#define _MD5_H
/* Any 32-bit or wider unsigned integer data type will do */
typedef unsigned int MD5_u32plus;
typedef struct {
MD5_u32plus lo, hi;
MD5_u32plus a, b, c, d;
unsigned char buffer[64];
MD5_u32plus block[16];
} MD5_CTX;
extern void MD5_Init(MD5_CTX *ctx);
extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
#endif

View File

@ -0,0 +1,356 @@
/* This header is autogenerated by vulkan_loader_generator.py */
#ifndef VULKAN_SYMBOL_WRAPPER_H
#define VULKAN_SYMBOL_WRAPPER_H
#define VK_NO_PROTOTYPES
#include <vulkan/vulkan.h>
#ifdef __cplusplus
extern "C" {
#endif
extern PFN_vkCreateInstance vulkan_symbol_wrapper_vkCreateInstance;
#define vkCreateInstance vulkan_symbol_wrapper_vkCreateInstance
extern PFN_vkEnumerateInstanceExtensionProperties vulkan_symbol_wrapper_vkEnumerateInstanceExtensionProperties;
#define vkEnumerateInstanceExtensionProperties vulkan_symbol_wrapper_vkEnumerateInstanceExtensionProperties
extern PFN_vkEnumerateInstanceLayerProperties vulkan_symbol_wrapper_vkEnumerateInstanceLayerProperties;
#define vkEnumerateInstanceLayerProperties vulkan_symbol_wrapper_vkEnumerateInstanceLayerProperties
extern PFN_vkDestroyInstance vulkan_symbol_wrapper_vkDestroyInstance;
#define vkDestroyInstance vulkan_symbol_wrapper_vkDestroyInstance
extern PFN_vkEnumeratePhysicalDevices vulkan_symbol_wrapper_vkEnumeratePhysicalDevices;
#define vkEnumeratePhysicalDevices vulkan_symbol_wrapper_vkEnumeratePhysicalDevices
extern PFN_vkGetPhysicalDeviceFeatures vulkan_symbol_wrapper_vkGetPhysicalDeviceFeatures;
#define vkGetPhysicalDeviceFeatures vulkan_symbol_wrapper_vkGetPhysicalDeviceFeatures
extern PFN_vkGetPhysicalDeviceFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceFormatProperties;
#define vkGetPhysicalDeviceFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceFormatProperties
extern PFN_vkGetPhysicalDeviceImageFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceImageFormatProperties;
#define vkGetPhysicalDeviceImageFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceImageFormatProperties
extern PFN_vkGetPhysicalDeviceProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceProperties;
#define vkGetPhysicalDeviceProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceProperties
extern PFN_vkGetPhysicalDeviceQueueFamilyProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceQueueFamilyProperties;
#define vkGetPhysicalDeviceQueueFamilyProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceQueueFamilyProperties
extern PFN_vkGetPhysicalDeviceMemoryProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceMemoryProperties;
#define vkGetPhysicalDeviceMemoryProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceMemoryProperties
extern PFN_vkGetDeviceProcAddr vulkan_symbol_wrapper_vkGetDeviceProcAddr;
#define vkGetDeviceProcAddr vulkan_symbol_wrapper_vkGetDeviceProcAddr
extern PFN_vkCreateDevice vulkan_symbol_wrapper_vkCreateDevice;
#define vkCreateDevice vulkan_symbol_wrapper_vkCreateDevice
extern PFN_vkDestroyDevice vulkan_symbol_wrapper_vkDestroyDevice;
#define vkDestroyDevice vulkan_symbol_wrapper_vkDestroyDevice
extern PFN_vkEnumerateDeviceExtensionProperties vulkan_symbol_wrapper_vkEnumerateDeviceExtensionProperties;
#define vkEnumerateDeviceExtensionProperties vulkan_symbol_wrapper_vkEnumerateDeviceExtensionProperties
extern PFN_vkEnumerateDeviceLayerProperties vulkan_symbol_wrapper_vkEnumerateDeviceLayerProperties;
#define vkEnumerateDeviceLayerProperties vulkan_symbol_wrapper_vkEnumerateDeviceLayerProperties
extern PFN_vkGetDeviceQueue vulkan_symbol_wrapper_vkGetDeviceQueue;
#define vkGetDeviceQueue vulkan_symbol_wrapper_vkGetDeviceQueue
extern PFN_vkQueueSubmit vulkan_symbol_wrapper_vkQueueSubmit;
#define vkQueueSubmit vulkan_symbol_wrapper_vkQueueSubmit
extern PFN_vkQueueWaitIdle vulkan_symbol_wrapper_vkQueueWaitIdle;
#define vkQueueWaitIdle vulkan_symbol_wrapper_vkQueueWaitIdle
extern PFN_vkDeviceWaitIdle vulkan_symbol_wrapper_vkDeviceWaitIdle;
#define vkDeviceWaitIdle vulkan_symbol_wrapper_vkDeviceWaitIdle
extern PFN_vkAllocateMemory vulkan_symbol_wrapper_vkAllocateMemory;
#define vkAllocateMemory vulkan_symbol_wrapper_vkAllocateMemory
extern PFN_vkFreeMemory vulkan_symbol_wrapper_vkFreeMemory;
#define vkFreeMemory vulkan_symbol_wrapper_vkFreeMemory
extern PFN_vkMapMemory vulkan_symbol_wrapper_vkMapMemory;
#define vkMapMemory vulkan_symbol_wrapper_vkMapMemory
extern PFN_vkUnmapMemory vulkan_symbol_wrapper_vkUnmapMemory;
#define vkUnmapMemory vulkan_symbol_wrapper_vkUnmapMemory
extern PFN_vkFlushMappedMemoryRanges vulkan_symbol_wrapper_vkFlushMappedMemoryRanges;
#define vkFlushMappedMemoryRanges vulkan_symbol_wrapper_vkFlushMappedMemoryRanges
extern PFN_vkInvalidateMappedMemoryRanges vulkan_symbol_wrapper_vkInvalidateMappedMemoryRanges;
#define vkInvalidateMappedMemoryRanges vulkan_symbol_wrapper_vkInvalidateMappedMemoryRanges
extern PFN_vkGetDeviceMemoryCommitment vulkan_symbol_wrapper_vkGetDeviceMemoryCommitment;
#define vkGetDeviceMemoryCommitment vulkan_symbol_wrapper_vkGetDeviceMemoryCommitment
extern PFN_vkBindBufferMemory vulkan_symbol_wrapper_vkBindBufferMemory;
#define vkBindBufferMemory vulkan_symbol_wrapper_vkBindBufferMemory
extern PFN_vkBindImageMemory vulkan_symbol_wrapper_vkBindImageMemory;
#define vkBindImageMemory vulkan_symbol_wrapper_vkBindImageMemory
extern PFN_vkGetBufferMemoryRequirements vulkan_symbol_wrapper_vkGetBufferMemoryRequirements;
#define vkGetBufferMemoryRequirements vulkan_symbol_wrapper_vkGetBufferMemoryRequirements
extern PFN_vkGetImageMemoryRequirements vulkan_symbol_wrapper_vkGetImageMemoryRequirements;
#define vkGetImageMemoryRequirements vulkan_symbol_wrapper_vkGetImageMemoryRequirements
extern PFN_vkGetImageSparseMemoryRequirements vulkan_symbol_wrapper_vkGetImageSparseMemoryRequirements;
#define vkGetImageSparseMemoryRequirements vulkan_symbol_wrapper_vkGetImageSparseMemoryRequirements
extern PFN_vkGetPhysicalDeviceSparseImageFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceSparseImageFormatProperties;
#define vkGetPhysicalDeviceSparseImageFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceSparseImageFormatProperties
extern PFN_vkQueueBindSparse vulkan_symbol_wrapper_vkQueueBindSparse;
#define vkQueueBindSparse vulkan_symbol_wrapper_vkQueueBindSparse
extern PFN_vkCreateFence vulkan_symbol_wrapper_vkCreateFence;
#define vkCreateFence vulkan_symbol_wrapper_vkCreateFence
extern PFN_vkDestroyFence vulkan_symbol_wrapper_vkDestroyFence;
#define vkDestroyFence vulkan_symbol_wrapper_vkDestroyFence
extern PFN_vkResetFences vulkan_symbol_wrapper_vkResetFences;
#define vkResetFences vulkan_symbol_wrapper_vkResetFences
extern PFN_vkGetFenceStatus vulkan_symbol_wrapper_vkGetFenceStatus;
#define vkGetFenceStatus vulkan_symbol_wrapper_vkGetFenceStatus
extern PFN_vkWaitForFences vulkan_symbol_wrapper_vkWaitForFences;
#define vkWaitForFences vulkan_symbol_wrapper_vkWaitForFences
extern PFN_vkCreateSemaphore vulkan_symbol_wrapper_vkCreateSemaphore;
#define vkCreateSemaphore vulkan_symbol_wrapper_vkCreateSemaphore
extern PFN_vkDestroySemaphore vulkan_symbol_wrapper_vkDestroySemaphore;
#define vkDestroySemaphore vulkan_symbol_wrapper_vkDestroySemaphore
extern PFN_vkCreateEvent vulkan_symbol_wrapper_vkCreateEvent;
#define vkCreateEvent vulkan_symbol_wrapper_vkCreateEvent
extern PFN_vkDestroyEvent vulkan_symbol_wrapper_vkDestroyEvent;
#define vkDestroyEvent vulkan_symbol_wrapper_vkDestroyEvent
extern PFN_vkGetEventStatus vulkan_symbol_wrapper_vkGetEventStatus;
#define vkGetEventStatus vulkan_symbol_wrapper_vkGetEventStatus
extern PFN_vkSetEvent vulkan_symbol_wrapper_vkSetEvent;
#define vkSetEvent vulkan_symbol_wrapper_vkSetEvent
extern PFN_vkResetEvent vulkan_symbol_wrapper_vkResetEvent;
#define vkResetEvent vulkan_symbol_wrapper_vkResetEvent
extern PFN_vkCreateQueryPool vulkan_symbol_wrapper_vkCreateQueryPool;
#define vkCreateQueryPool vulkan_symbol_wrapper_vkCreateQueryPool
extern PFN_vkDestroyQueryPool vulkan_symbol_wrapper_vkDestroyQueryPool;
#define vkDestroyQueryPool vulkan_symbol_wrapper_vkDestroyQueryPool
extern PFN_vkGetQueryPoolResults vulkan_symbol_wrapper_vkGetQueryPoolResults;
#define vkGetQueryPoolResults vulkan_symbol_wrapper_vkGetQueryPoolResults
extern PFN_vkCreateBuffer vulkan_symbol_wrapper_vkCreateBuffer;
#define vkCreateBuffer vulkan_symbol_wrapper_vkCreateBuffer
extern PFN_vkDestroyBuffer vulkan_symbol_wrapper_vkDestroyBuffer;
#define vkDestroyBuffer vulkan_symbol_wrapper_vkDestroyBuffer
extern PFN_vkCreateBufferView vulkan_symbol_wrapper_vkCreateBufferView;
#define vkCreateBufferView vulkan_symbol_wrapper_vkCreateBufferView
extern PFN_vkDestroyBufferView vulkan_symbol_wrapper_vkDestroyBufferView;
#define vkDestroyBufferView vulkan_symbol_wrapper_vkDestroyBufferView
extern PFN_vkCreateImage vulkan_symbol_wrapper_vkCreateImage;
#define vkCreateImage vulkan_symbol_wrapper_vkCreateImage
extern PFN_vkDestroyImage vulkan_symbol_wrapper_vkDestroyImage;
#define vkDestroyImage vulkan_symbol_wrapper_vkDestroyImage
extern PFN_vkGetImageSubresourceLayout vulkan_symbol_wrapper_vkGetImageSubresourceLayout;
#define vkGetImageSubresourceLayout vulkan_symbol_wrapper_vkGetImageSubresourceLayout
extern PFN_vkCreateImageView vulkan_symbol_wrapper_vkCreateImageView;
#define vkCreateImageView vulkan_symbol_wrapper_vkCreateImageView
extern PFN_vkDestroyImageView vulkan_symbol_wrapper_vkDestroyImageView;
#define vkDestroyImageView vulkan_symbol_wrapper_vkDestroyImageView
extern PFN_vkCreateShaderModule vulkan_symbol_wrapper_vkCreateShaderModule;
#define vkCreateShaderModule vulkan_symbol_wrapper_vkCreateShaderModule
extern PFN_vkDestroyShaderModule vulkan_symbol_wrapper_vkDestroyShaderModule;
#define vkDestroyShaderModule vulkan_symbol_wrapper_vkDestroyShaderModule
extern PFN_vkCreatePipelineCache vulkan_symbol_wrapper_vkCreatePipelineCache;
#define vkCreatePipelineCache vulkan_symbol_wrapper_vkCreatePipelineCache
extern PFN_vkDestroyPipelineCache vulkan_symbol_wrapper_vkDestroyPipelineCache;
#define vkDestroyPipelineCache vulkan_symbol_wrapper_vkDestroyPipelineCache
extern PFN_vkGetPipelineCacheData vulkan_symbol_wrapper_vkGetPipelineCacheData;
#define vkGetPipelineCacheData vulkan_symbol_wrapper_vkGetPipelineCacheData
extern PFN_vkMergePipelineCaches vulkan_symbol_wrapper_vkMergePipelineCaches;
#define vkMergePipelineCaches vulkan_symbol_wrapper_vkMergePipelineCaches
extern PFN_vkCreateGraphicsPipelines vulkan_symbol_wrapper_vkCreateGraphicsPipelines;
#define vkCreateGraphicsPipelines vulkan_symbol_wrapper_vkCreateGraphicsPipelines
extern PFN_vkCreateComputePipelines vulkan_symbol_wrapper_vkCreateComputePipelines;
#define vkCreateComputePipelines vulkan_symbol_wrapper_vkCreateComputePipelines
extern PFN_vkDestroyPipeline vulkan_symbol_wrapper_vkDestroyPipeline;
#define vkDestroyPipeline vulkan_symbol_wrapper_vkDestroyPipeline
extern PFN_vkCreatePipelineLayout vulkan_symbol_wrapper_vkCreatePipelineLayout;
#define vkCreatePipelineLayout vulkan_symbol_wrapper_vkCreatePipelineLayout
extern PFN_vkDestroyPipelineLayout vulkan_symbol_wrapper_vkDestroyPipelineLayout;
#define vkDestroyPipelineLayout vulkan_symbol_wrapper_vkDestroyPipelineLayout
extern PFN_vkCreateSampler vulkan_symbol_wrapper_vkCreateSampler;
#define vkCreateSampler vulkan_symbol_wrapper_vkCreateSampler
extern PFN_vkDestroySampler vulkan_symbol_wrapper_vkDestroySampler;
#define vkDestroySampler vulkan_symbol_wrapper_vkDestroySampler
extern PFN_vkCreateDescriptorSetLayout vulkan_symbol_wrapper_vkCreateDescriptorSetLayout;
#define vkCreateDescriptorSetLayout vulkan_symbol_wrapper_vkCreateDescriptorSetLayout
extern PFN_vkDestroyDescriptorSetLayout vulkan_symbol_wrapper_vkDestroyDescriptorSetLayout;
#define vkDestroyDescriptorSetLayout vulkan_symbol_wrapper_vkDestroyDescriptorSetLayout
extern PFN_vkCreateDescriptorPool vulkan_symbol_wrapper_vkCreateDescriptorPool;
#define vkCreateDescriptorPool vulkan_symbol_wrapper_vkCreateDescriptorPool
extern PFN_vkDestroyDescriptorPool vulkan_symbol_wrapper_vkDestroyDescriptorPool;
#define vkDestroyDescriptorPool vulkan_symbol_wrapper_vkDestroyDescriptorPool
extern PFN_vkResetDescriptorPool vulkan_symbol_wrapper_vkResetDescriptorPool;
#define vkResetDescriptorPool vulkan_symbol_wrapper_vkResetDescriptorPool
extern PFN_vkAllocateDescriptorSets vulkan_symbol_wrapper_vkAllocateDescriptorSets;
#define vkAllocateDescriptorSets vulkan_symbol_wrapper_vkAllocateDescriptorSets
extern PFN_vkFreeDescriptorSets vulkan_symbol_wrapper_vkFreeDescriptorSets;
#define vkFreeDescriptorSets vulkan_symbol_wrapper_vkFreeDescriptorSets
extern PFN_vkUpdateDescriptorSets vulkan_symbol_wrapper_vkUpdateDescriptorSets;
#define vkUpdateDescriptorSets vulkan_symbol_wrapper_vkUpdateDescriptorSets
extern PFN_vkCreateFramebuffer vulkan_symbol_wrapper_vkCreateFramebuffer;
#define vkCreateFramebuffer vulkan_symbol_wrapper_vkCreateFramebuffer
extern PFN_vkDestroyFramebuffer vulkan_symbol_wrapper_vkDestroyFramebuffer;
#define vkDestroyFramebuffer vulkan_symbol_wrapper_vkDestroyFramebuffer
extern PFN_vkCreateRenderPass vulkan_symbol_wrapper_vkCreateRenderPass;
#define vkCreateRenderPass vulkan_symbol_wrapper_vkCreateRenderPass
extern PFN_vkDestroyRenderPass vulkan_symbol_wrapper_vkDestroyRenderPass;
#define vkDestroyRenderPass vulkan_symbol_wrapper_vkDestroyRenderPass
extern PFN_vkGetRenderAreaGranularity vulkan_symbol_wrapper_vkGetRenderAreaGranularity;
#define vkGetRenderAreaGranularity vulkan_symbol_wrapper_vkGetRenderAreaGranularity
extern PFN_vkCreateCommandPool vulkan_symbol_wrapper_vkCreateCommandPool;
#define vkCreateCommandPool vulkan_symbol_wrapper_vkCreateCommandPool
extern PFN_vkDestroyCommandPool vulkan_symbol_wrapper_vkDestroyCommandPool;
#define vkDestroyCommandPool vulkan_symbol_wrapper_vkDestroyCommandPool
extern PFN_vkResetCommandPool vulkan_symbol_wrapper_vkResetCommandPool;
#define vkResetCommandPool vulkan_symbol_wrapper_vkResetCommandPool
extern PFN_vkAllocateCommandBuffers vulkan_symbol_wrapper_vkAllocateCommandBuffers;
#define vkAllocateCommandBuffers vulkan_symbol_wrapper_vkAllocateCommandBuffers
extern PFN_vkFreeCommandBuffers vulkan_symbol_wrapper_vkFreeCommandBuffers;
#define vkFreeCommandBuffers vulkan_symbol_wrapper_vkFreeCommandBuffers
extern PFN_vkBeginCommandBuffer vulkan_symbol_wrapper_vkBeginCommandBuffer;
#define vkBeginCommandBuffer vulkan_symbol_wrapper_vkBeginCommandBuffer
extern PFN_vkEndCommandBuffer vulkan_symbol_wrapper_vkEndCommandBuffer;
#define vkEndCommandBuffer vulkan_symbol_wrapper_vkEndCommandBuffer
extern PFN_vkResetCommandBuffer vulkan_symbol_wrapper_vkResetCommandBuffer;
#define vkResetCommandBuffer vulkan_symbol_wrapper_vkResetCommandBuffer
extern PFN_vkCmdBindPipeline vulkan_symbol_wrapper_vkCmdBindPipeline;
#define vkCmdBindPipeline vulkan_symbol_wrapper_vkCmdBindPipeline
extern PFN_vkCmdSetViewport vulkan_symbol_wrapper_vkCmdSetViewport;
#define vkCmdSetViewport vulkan_symbol_wrapper_vkCmdSetViewport
extern PFN_vkCmdSetScissor vulkan_symbol_wrapper_vkCmdSetScissor;
#define vkCmdSetScissor vulkan_symbol_wrapper_vkCmdSetScissor
extern PFN_vkCmdSetLineWidth vulkan_symbol_wrapper_vkCmdSetLineWidth;
#define vkCmdSetLineWidth vulkan_symbol_wrapper_vkCmdSetLineWidth
extern PFN_vkCmdSetDepthBias vulkan_symbol_wrapper_vkCmdSetDepthBias;
#define vkCmdSetDepthBias vulkan_symbol_wrapper_vkCmdSetDepthBias
extern PFN_vkCmdSetBlendConstants vulkan_symbol_wrapper_vkCmdSetBlendConstants;
#define vkCmdSetBlendConstants vulkan_symbol_wrapper_vkCmdSetBlendConstants
extern PFN_vkCmdSetDepthBounds vulkan_symbol_wrapper_vkCmdSetDepthBounds;
#define vkCmdSetDepthBounds vulkan_symbol_wrapper_vkCmdSetDepthBounds
extern PFN_vkCmdSetStencilCompareMask vulkan_symbol_wrapper_vkCmdSetStencilCompareMask;
#define vkCmdSetStencilCompareMask vulkan_symbol_wrapper_vkCmdSetStencilCompareMask
extern PFN_vkCmdSetStencilWriteMask vulkan_symbol_wrapper_vkCmdSetStencilWriteMask;
#define vkCmdSetStencilWriteMask vulkan_symbol_wrapper_vkCmdSetStencilWriteMask
extern PFN_vkCmdSetStencilReference vulkan_symbol_wrapper_vkCmdSetStencilReference;
#define vkCmdSetStencilReference vulkan_symbol_wrapper_vkCmdSetStencilReference
extern PFN_vkCmdBindDescriptorSets vulkan_symbol_wrapper_vkCmdBindDescriptorSets;
#define vkCmdBindDescriptorSets vulkan_symbol_wrapper_vkCmdBindDescriptorSets
extern PFN_vkCmdBindIndexBuffer vulkan_symbol_wrapper_vkCmdBindIndexBuffer;
#define vkCmdBindIndexBuffer vulkan_symbol_wrapper_vkCmdBindIndexBuffer
extern PFN_vkCmdBindVertexBuffers vulkan_symbol_wrapper_vkCmdBindVertexBuffers;
#define vkCmdBindVertexBuffers vulkan_symbol_wrapper_vkCmdBindVertexBuffers
extern PFN_vkCmdDraw vulkan_symbol_wrapper_vkCmdDraw;
#define vkCmdDraw vulkan_symbol_wrapper_vkCmdDraw
extern PFN_vkCmdDrawIndexed vulkan_symbol_wrapper_vkCmdDrawIndexed;
#define vkCmdDrawIndexed vulkan_symbol_wrapper_vkCmdDrawIndexed
extern PFN_vkCmdDrawIndirect vulkan_symbol_wrapper_vkCmdDrawIndirect;
#define vkCmdDrawIndirect vulkan_symbol_wrapper_vkCmdDrawIndirect
extern PFN_vkCmdDrawIndexedIndirect vulkan_symbol_wrapper_vkCmdDrawIndexedIndirect;
#define vkCmdDrawIndexedIndirect vulkan_symbol_wrapper_vkCmdDrawIndexedIndirect
extern PFN_vkCmdDispatch vulkan_symbol_wrapper_vkCmdDispatch;
#define vkCmdDispatch vulkan_symbol_wrapper_vkCmdDispatch
extern PFN_vkCmdDispatchIndirect vulkan_symbol_wrapper_vkCmdDispatchIndirect;
#define vkCmdDispatchIndirect vulkan_symbol_wrapper_vkCmdDispatchIndirect
extern PFN_vkCmdCopyBuffer vulkan_symbol_wrapper_vkCmdCopyBuffer;
#define vkCmdCopyBuffer vulkan_symbol_wrapper_vkCmdCopyBuffer
extern PFN_vkCmdCopyImage vulkan_symbol_wrapper_vkCmdCopyImage;
#define vkCmdCopyImage vulkan_symbol_wrapper_vkCmdCopyImage
extern PFN_vkCmdBlitImage vulkan_symbol_wrapper_vkCmdBlitImage;
#define vkCmdBlitImage vulkan_symbol_wrapper_vkCmdBlitImage
extern PFN_vkCmdCopyBufferToImage vulkan_symbol_wrapper_vkCmdCopyBufferToImage;
#define vkCmdCopyBufferToImage vulkan_symbol_wrapper_vkCmdCopyBufferToImage
extern PFN_vkCmdCopyImageToBuffer vulkan_symbol_wrapper_vkCmdCopyImageToBuffer;
#define vkCmdCopyImageToBuffer vulkan_symbol_wrapper_vkCmdCopyImageToBuffer
extern PFN_vkCmdUpdateBuffer vulkan_symbol_wrapper_vkCmdUpdateBuffer;
#define vkCmdUpdateBuffer vulkan_symbol_wrapper_vkCmdUpdateBuffer
extern PFN_vkCmdFillBuffer vulkan_symbol_wrapper_vkCmdFillBuffer;
#define vkCmdFillBuffer vulkan_symbol_wrapper_vkCmdFillBuffer
extern PFN_vkCmdClearColorImage vulkan_symbol_wrapper_vkCmdClearColorImage;
#define vkCmdClearColorImage vulkan_symbol_wrapper_vkCmdClearColorImage
extern PFN_vkCmdClearDepthStencilImage vulkan_symbol_wrapper_vkCmdClearDepthStencilImage;
#define vkCmdClearDepthStencilImage vulkan_symbol_wrapper_vkCmdClearDepthStencilImage
extern PFN_vkCmdClearAttachments vulkan_symbol_wrapper_vkCmdClearAttachments;
#define vkCmdClearAttachments vulkan_symbol_wrapper_vkCmdClearAttachments
extern PFN_vkCmdResolveImage vulkan_symbol_wrapper_vkCmdResolveImage;
#define vkCmdResolveImage vulkan_symbol_wrapper_vkCmdResolveImage
extern PFN_vkCmdSetEvent vulkan_symbol_wrapper_vkCmdSetEvent;
#define vkCmdSetEvent vulkan_symbol_wrapper_vkCmdSetEvent
extern PFN_vkCmdResetEvent vulkan_symbol_wrapper_vkCmdResetEvent;
#define vkCmdResetEvent vulkan_symbol_wrapper_vkCmdResetEvent
extern PFN_vkCmdWaitEvents vulkan_symbol_wrapper_vkCmdWaitEvents;
#define vkCmdWaitEvents vulkan_symbol_wrapper_vkCmdWaitEvents
extern PFN_vkCmdPipelineBarrier vulkan_symbol_wrapper_vkCmdPipelineBarrier;
#define vkCmdPipelineBarrier vulkan_symbol_wrapper_vkCmdPipelineBarrier
extern PFN_vkCmdBeginQuery vulkan_symbol_wrapper_vkCmdBeginQuery;
#define vkCmdBeginQuery vulkan_symbol_wrapper_vkCmdBeginQuery
extern PFN_vkCmdEndQuery vulkan_symbol_wrapper_vkCmdEndQuery;
#define vkCmdEndQuery vulkan_symbol_wrapper_vkCmdEndQuery
extern PFN_vkCmdResetQueryPool vulkan_symbol_wrapper_vkCmdResetQueryPool;
#define vkCmdResetQueryPool vulkan_symbol_wrapper_vkCmdResetQueryPool
extern PFN_vkCmdWriteTimestamp vulkan_symbol_wrapper_vkCmdWriteTimestamp;
#define vkCmdWriteTimestamp vulkan_symbol_wrapper_vkCmdWriteTimestamp
extern PFN_vkCmdCopyQueryPoolResults vulkan_symbol_wrapper_vkCmdCopyQueryPoolResults;
#define vkCmdCopyQueryPoolResults vulkan_symbol_wrapper_vkCmdCopyQueryPoolResults
extern PFN_vkCmdPushConstants vulkan_symbol_wrapper_vkCmdPushConstants;
#define vkCmdPushConstants vulkan_symbol_wrapper_vkCmdPushConstants
extern PFN_vkCmdBeginRenderPass vulkan_symbol_wrapper_vkCmdBeginRenderPass;
#define vkCmdBeginRenderPass vulkan_symbol_wrapper_vkCmdBeginRenderPass
extern PFN_vkCmdNextSubpass vulkan_symbol_wrapper_vkCmdNextSubpass;
#define vkCmdNextSubpass vulkan_symbol_wrapper_vkCmdNextSubpass
extern PFN_vkCmdEndRenderPass vulkan_symbol_wrapper_vkCmdEndRenderPass;
#define vkCmdEndRenderPass vulkan_symbol_wrapper_vkCmdEndRenderPass
extern PFN_vkCmdExecuteCommands vulkan_symbol_wrapper_vkCmdExecuteCommands;
#define vkCmdExecuteCommands vulkan_symbol_wrapper_vkCmdExecuteCommands
extern PFN_vkDestroySurfaceKHR vulkan_symbol_wrapper_vkDestroySurfaceKHR;
#define vkDestroySurfaceKHR vulkan_symbol_wrapper_vkDestroySurfaceKHR
extern PFN_vkGetPhysicalDeviceSurfaceSupportKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceSupportKHR;
#define vkGetPhysicalDeviceSurfaceSupportKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceSupportKHR
extern PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
#define vkGetPhysicalDeviceSurfaceCapabilitiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
extern PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceFormatsKHR;
#define vkGetPhysicalDeviceSurfaceFormatsKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceFormatsKHR
extern PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfacePresentModesKHR;
#define vkGetPhysicalDeviceSurfacePresentModesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfacePresentModesKHR
extern PFN_vkCreateSwapchainKHR vulkan_symbol_wrapper_vkCreateSwapchainKHR;
#define vkCreateSwapchainKHR vulkan_symbol_wrapper_vkCreateSwapchainKHR
extern PFN_vkDestroySwapchainKHR vulkan_symbol_wrapper_vkDestroySwapchainKHR;
#define vkDestroySwapchainKHR vulkan_symbol_wrapper_vkDestroySwapchainKHR
extern PFN_vkGetSwapchainImagesKHR vulkan_symbol_wrapper_vkGetSwapchainImagesKHR;
#define vkGetSwapchainImagesKHR vulkan_symbol_wrapper_vkGetSwapchainImagesKHR
extern PFN_vkAcquireNextImageKHR vulkan_symbol_wrapper_vkAcquireNextImageKHR;
#define vkAcquireNextImageKHR vulkan_symbol_wrapper_vkAcquireNextImageKHR
extern PFN_vkQueuePresentKHR vulkan_symbol_wrapper_vkQueuePresentKHR;
#define vkQueuePresentKHR vulkan_symbol_wrapper_vkQueuePresentKHR
extern PFN_vkGetPhysicalDeviceDisplayPropertiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceDisplayPropertiesKHR;
#define vkGetPhysicalDeviceDisplayPropertiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceDisplayPropertiesKHR
extern PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceDisplayPlanePropertiesKHR;
#define vkGetPhysicalDeviceDisplayPlanePropertiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceDisplayPlanePropertiesKHR
extern PFN_vkGetDisplayPlaneSupportedDisplaysKHR vulkan_symbol_wrapper_vkGetDisplayPlaneSupportedDisplaysKHR;
#define vkGetDisplayPlaneSupportedDisplaysKHR vulkan_symbol_wrapper_vkGetDisplayPlaneSupportedDisplaysKHR
extern PFN_vkGetDisplayModePropertiesKHR vulkan_symbol_wrapper_vkGetDisplayModePropertiesKHR;
#define vkGetDisplayModePropertiesKHR vulkan_symbol_wrapper_vkGetDisplayModePropertiesKHR
extern PFN_vkCreateDisplayModeKHR vulkan_symbol_wrapper_vkCreateDisplayModeKHR;
#define vkCreateDisplayModeKHR vulkan_symbol_wrapper_vkCreateDisplayModeKHR
extern PFN_vkGetDisplayPlaneCapabilitiesKHR vulkan_symbol_wrapper_vkGetDisplayPlaneCapabilitiesKHR;
#define vkGetDisplayPlaneCapabilitiesKHR vulkan_symbol_wrapper_vkGetDisplayPlaneCapabilitiesKHR
extern PFN_vkCreateDisplayPlaneSurfaceKHR vulkan_symbol_wrapper_vkCreateDisplayPlaneSurfaceKHR;
#define vkCreateDisplayPlaneSurfaceKHR vulkan_symbol_wrapper_vkCreateDisplayPlaneSurfaceKHR
extern PFN_vkCreateSharedSwapchainsKHR vulkan_symbol_wrapper_vkCreateSharedSwapchainsKHR;
#define vkCreateSharedSwapchainsKHR vulkan_symbol_wrapper_vkCreateSharedSwapchainsKHR
extern PFN_vkCreateDebugReportCallbackEXT vulkan_symbol_wrapper_vkCreateDebugReportCallbackEXT;
#define vkCreateDebugReportCallbackEXT vulkan_symbol_wrapper_vkCreateDebugReportCallbackEXT
extern PFN_vkDestroyDebugReportCallbackEXT vulkan_symbol_wrapper_vkDestroyDebugReportCallbackEXT;
#define vkDestroyDebugReportCallbackEXT vulkan_symbol_wrapper_vkDestroyDebugReportCallbackEXT
extern PFN_vkDebugReportMessageEXT vulkan_symbol_wrapper_vkDebugReportMessageEXT;
#define vkDebugReportMessageEXT vulkan_symbol_wrapper_vkDebugReportMessageEXT
extern PFN_vkDebugMarkerSetObjectTagEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectTagEXT;
#define vkDebugMarkerSetObjectTagEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectTagEXT
extern PFN_vkDebugMarkerSetObjectNameEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectNameEXT;
#define vkDebugMarkerSetObjectNameEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectNameEXT
extern PFN_vkCmdDebugMarkerBeginEXT vulkan_symbol_wrapper_vkCmdDebugMarkerBeginEXT;
#define vkCmdDebugMarkerBeginEXT vulkan_symbol_wrapper_vkCmdDebugMarkerBeginEXT
extern PFN_vkCmdDebugMarkerEndEXT vulkan_symbol_wrapper_vkCmdDebugMarkerEndEXT;
#define vkCmdDebugMarkerEndEXT vulkan_symbol_wrapper_vkCmdDebugMarkerEndEXT
extern PFN_vkCmdDebugMarkerInsertEXT vulkan_symbol_wrapper_vkCmdDebugMarkerInsertEXT;
#define vkCmdDebugMarkerInsertEXT vulkan_symbol_wrapper_vkCmdDebugMarkerInsertEXT
void vulkan_symbol_wrapper_init(PFN_vkGetInstanceProcAddr get_instance_proc_addr);
PFN_vkGetInstanceProcAddr vulkan_symbol_wrapper_instance_proc_addr(void);
VkBool32 vulkan_symbol_wrapper_load_global_symbols(void);
VkBool32 vulkan_symbol_wrapper_load_core_instance_symbols(VkInstance instance);
VkBool32 vulkan_symbol_wrapper_load_core_symbols(VkInstance instance);
VkBool32 vulkan_symbol_wrapper_load_core_device_symbols(VkDevice device);
VkBool32 vulkan_symbol_wrapper_load_instance_symbol(VkInstance instance, const char *name, PFN_vkVoidFunction *ppSymbol);
VkBool32 vulkan_symbol_wrapper_load_device_symbol(VkDevice device, const char *name, PFN_vkVoidFunction *ppSymbol);
#define VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, name, pfn) vulkan_symbol_wrapper_load_instance_symbol(instance, name, (PFN_vkVoidFunction*) &(pfn))
#define VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_EXTENSION_SYMBOL(instance, name) vulkan_symbol_wrapper_load_instance_symbol(instance, #name, (PFN_vkVoidFunction*) & name)
#define VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, name, pfn) vulkan_symbol_wrapper_load_device_symbol(device, name, (PFN_vkVoidFunction*) &(pfn))
#define VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_EXTENSION_SYMBOL(device, name) vulkan_symbol_wrapper_load_device_symbol(device, #name, (PFN_vkVoidFunction*) & name)
#ifdef __cplusplus
}
#endif
#endif

View File

@ -10,6 +10,8 @@
#include "amd64.c"
#elif defined(__GNUC__) && defined(_ARCH_PPC)
#include "ppc.c"
#elif defined(__GNUC__) && defined(VITA)
#include "psp2.c"
#elif defined(__GNUC__) && (defined(__ARM_EABI__) || defined(__arm__))
#include "armeabi.c"
#elif defined(__GNUC__)

Some files were not shown because too many files have changed in this diff Show More