├── .github └── workflows │ ├── PS2.yml │ └── PS4.yml ├── .gitignore ├── audio ├── audio_callback │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── jni │ │ ├── Android.mk │ │ └── Application.mk │ ├── libretro-test.c │ ├── libretro.h │ └── link.T ├── audio_no_callback │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── jni │ │ ├── Android.mk │ │ └── Application.mk │ ├── libretro-test.c │ ├── libretro.h │ └── link.T └── audio_playback_wav │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── jni │ ├── Android.mk │ └── Application.mk │ ├── libretro-test.c │ ├── libretro.h │ └── link.T ├── build └── make │ ├── Makefile │ ├── Makefile.common │ ├── jni │ ├── Android.mk │ └── Application.mk │ └── link.T ├── input └── button_test │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── internal_cores.h │ ├── jni │ ├── Android.mk │ └── Application.mk │ ├── libretro-common │ └── include │ │ ├── retro_inline.h │ │ └── retro_timers.h │ ├── libretro.c │ ├── libretro.h │ ├── link.T │ └── remotepad.h ├── lang ├── freebasic │ ├── README.md │ ├── Tupfile │ └── fbastest.bas └── pascal │ ├── LICENSE │ ├── README.md │ ├── Tupfile │ └── pong.pas ├── license ├── midi └── midi_test │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── jni │ ├── Android.mk │ └── Application.mk │ ├── libretro.c │ ├── libretro.h │ └── link.T ├── tests ├── cruzes │ ├── LICENSE │ ├── LICENSE-Carlito │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── cruzes.c │ ├── font10.h │ ├── font16.h │ ├── font24.h │ ├── libretro.h │ ├── obj │ │ ├── Carlito-Bold.ttf │ │ ├── Carlito-BoldItalic.ttf │ │ ├── Carlito-Italic.ttf │ │ └── Carlito-Regular.ttf │ ├── stb_truetype.h │ ├── ttf2c.c │ └── ttf2c.h ├── test │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── jni │ │ ├── Android.mk │ │ └── Application.mk │ ├── libretro-test.c │ ├── libretro.h │ └── link.T └── test_advanced │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── jni │ ├── Android.mk │ └── Application.mk │ ├── libretro-test.c │ ├── libretro.h │ └── link.T └── video ├── opengl ├── libretro_test_gl_compute_shaders │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── app │ │ ├── boxes.cpp │ │ ├── mesh.mtl │ │ ├── mesh.obj │ │ ├── shaders │ │ │ ├── boxcull.cs │ │ │ ├── boxrender.fs │ │ │ ├── boxrender.vs │ │ │ ├── boxrender_point.fs │ │ │ ├── boxrender_point.vs │ │ │ ├── generic.fs │ │ │ ├── generic.vs │ │ │ ├── skybox.fs │ │ │ └── skybox.vs │ │ ├── test.png │ │ ├── xneg.png │ │ ├── xpos.png │ │ ├── yneg.png │ │ ├── ypos.png │ │ ├── zneg.png │ │ └── zpos.png │ ├── gl │ │ ├── aabb.cpp │ │ ├── aabb.hpp │ │ ├── buffer.cpp │ │ ├── buffer.hpp │ │ ├── framebuffer.cpp │ │ ├── framebuffer.hpp │ │ ├── global.cpp │ │ ├── global.hpp │ │ ├── mesh.cpp │ │ ├── mesh.hpp │ │ ├── scene.cpp │ │ ├── scene.hpp │ │ ├── shader.cpp │ │ ├── shader.hpp │ │ ├── texture.cpp │ │ ├── texture.hpp │ │ ├── util.cpp │ │ ├── util.hpp │ │ ├── vertex_array.cpp │ │ └── vertex_array.hpp │ ├── glm │ │ ├── core │ │ │ ├── _detail.hpp │ │ │ ├── _fixes.hpp │ │ │ ├── _swizzle.hpp │ │ │ ├── _swizzle_func.hpp │ │ │ ├── _vectorize.hpp │ │ │ ├── dummy.cpp │ │ │ ├── func_common.hpp │ │ │ ├── func_common.inl │ │ │ ├── func_exponential.hpp │ │ │ ├── func_exponential.inl │ │ │ ├── func_geometric.hpp │ │ │ ├── func_geometric.inl │ │ │ ├── func_integer.hpp │ │ │ ├── func_integer.inl │ │ │ ├── func_matrix.hpp │ │ │ ├── func_matrix.inl │ │ │ ├── func_noise.hpp │ │ │ ├── func_noise.inl │ │ │ ├── func_packing.hpp │ │ │ ├── func_packing.inl │ │ │ ├── func_trigonometric.hpp │ │ │ ├── func_trigonometric.inl │ │ │ ├── func_vector_relational.hpp │ │ │ ├── func_vector_relational.inl │ │ │ ├── hint.hpp │ │ │ ├── intrinsic_common.hpp │ │ │ ├── intrinsic_common.inl │ │ │ ├── intrinsic_exponential.hpp │ │ │ ├── intrinsic_exponential.inl │ │ │ ├── intrinsic_geometric.hpp │ │ │ ├── intrinsic_geometric.inl │ │ │ ├── intrinsic_matrix.hpp │ │ │ ├── intrinsic_matrix.inl │ │ │ ├── intrinsic_trigonometric.hpp │ │ │ ├── intrinsic_trigonometric.inl │ │ │ ├── intrinsic_vector_relational.hpp │ │ │ ├── intrinsic_vector_relational.inl │ │ │ ├── setup.hpp │ │ │ ├── type.hpp │ │ │ ├── type_float.hpp │ │ │ ├── type_gentype.hpp │ │ │ ├── type_gentype.inl │ │ │ ├── type_half.hpp │ │ │ ├── type_half.inl │ │ │ ├── type_int.hpp │ │ │ ├── type_mat.hpp │ │ │ ├── type_mat.inl │ │ │ ├── type_mat2x2.hpp │ │ │ ├── type_mat2x2.inl │ │ │ ├── type_mat2x3.hpp │ │ │ ├── type_mat2x3.inl │ │ │ ├── type_mat2x4.hpp │ │ │ ├── type_mat2x4.inl │ │ │ ├── type_mat3x2.hpp │ │ │ ├── type_mat3x2.inl │ │ │ ├── type_mat3x3.hpp │ │ │ ├── type_mat3x3.inl │ │ │ ├── type_mat3x4.hpp │ │ │ ├── type_mat3x4.inl │ │ │ ├── type_mat4x2.hpp │ │ │ ├── type_mat4x2.inl │ │ │ ├── type_mat4x3.hpp │ │ │ ├── type_mat4x3.inl │ │ │ ├── type_mat4x4.hpp │ │ │ ├── type_mat4x4.inl │ │ │ ├── type_size.hpp │ │ │ ├── type_vec.hpp │ │ │ ├── type_vec.inl │ │ │ ├── type_vec1.hpp │ │ │ ├── type_vec1.inl │ │ │ ├── type_vec2.hpp │ │ │ ├── type_vec2.inl │ │ │ ├── type_vec3.hpp │ │ │ ├── type_vec3.inl │ │ │ ├── type_vec4.hpp │ │ │ └── type_vec4.inl │ │ ├── ext.hpp │ │ ├── glm.hpp │ │ ├── gtc │ │ │ ├── constants.hpp │ │ │ ├── constants.inl │ │ │ ├── epsilon.hpp │ │ │ ├── epsilon.inl │ │ │ ├── half_float.hpp │ │ │ ├── half_float.inl │ │ │ ├── matrix_access.hpp │ │ │ ├── matrix_access.inl │ │ │ ├── matrix_integer.hpp │ │ │ ├── matrix_inverse.hpp │ │ │ ├── matrix_inverse.inl │ │ │ ├── matrix_transform.hpp │ │ │ ├── matrix_transform.inl │ │ │ ├── noise.hpp │ │ │ ├── noise.inl │ │ │ ├── quaternion.hpp │ │ │ ├── quaternion.inl │ │ │ ├── random.hpp │ │ │ ├── random.inl │ │ │ ├── reciprocal.hpp │ │ │ ├── reciprocal.inl │ │ │ ├── swizzle.hpp │ │ │ ├── swizzle.inl │ │ │ ├── type_precision.hpp │ │ │ ├── type_precision.inl │ │ │ ├── type_ptr.hpp │ │ │ ├── type_ptr.inl │ │ │ ├── ulp.hpp │ │ │ └── ulp.inl │ │ ├── gtx │ │ │ ├── associated_min_max.hpp │ │ │ ├── associated_min_max.inl │ │ │ ├── bit.hpp │ │ │ ├── bit.inl │ │ │ ├── closest_point.hpp │ │ │ ├── closest_point.inl │ │ │ ├── color_cast.hpp │ │ │ ├── color_cast.inl │ │ │ ├── color_space.hpp │ │ │ ├── color_space.inl │ │ │ ├── color_space_YCoCg.hpp │ │ │ ├── color_space_YCoCg.inl │ │ │ ├── compatibility.hpp │ │ │ ├── compatibility.inl │ │ │ ├── component_wise.hpp │ │ │ ├── component_wise.inl │ │ │ ├── constants.hpp │ │ │ ├── epsilon.hpp │ │ │ ├── euler_angles.hpp │ │ │ ├── euler_angles.inl │ │ │ ├── extend.hpp │ │ │ ├── extend.inl │ │ │ ├── extented_min_max.hpp │ │ │ ├── extented_min_max.inl │ │ │ ├── fast_exponential.hpp │ │ │ ├── fast_exponential.inl │ │ │ ├── fast_square_root.hpp │ │ │ ├── fast_square_root.inl │ │ │ ├── fast_trigonometry.hpp │ │ │ ├── fast_trigonometry.inl │ │ │ ├── gradient_paint.hpp │ │ │ ├── gradient_paint.inl │ │ │ ├── handed_coordinate_space.hpp │ │ │ ├── handed_coordinate_space.inl │ │ │ ├── inertia.hpp │ │ │ ├── inertia.inl │ │ │ ├── int_10_10_10_2.hpp │ │ │ ├── int_10_10_10_2.inl │ │ │ ├── integer.hpp │ │ │ ├── integer.inl │ │ │ ├── intersect.hpp │ │ │ ├── intersect.inl │ │ │ ├── log_base.hpp │ │ │ ├── log_base.inl │ │ │ ├── matrix_cross_product.hpp │ │ │ ├── matrix_cross_product.inl │ │ │ ├── matrix_interpolation.hpp │ │ │ ├── matrix_interpolation.inl │ │ │ ├── matrix_major_storage.hpp │ │ │ ├── matrix_major_storage.inl │ │ │ ├── matrix_operation.hpp │ │ │ ├── matrix_operation.inl │ │ │ ├── matrix_query.hpp │ │ │ ├── matrix_query.inl │ │ │ ├── mixed_product.hpp │ │ │ ├── mixed_product.inl │ │ │ ├── multiple.hpp │ │ │ ├── multiple.inl │ │ │ ├── noise.hpp │ │ │ ├── norm.hpp │ │ │ ├── norm.inl │ │ │ ├── normal.hpp │ │ │ ├── normal.inl │ │ │ ├── normalize_dot.hpp │ │ │ ├── normalize_dot.inl │ │ │ ├── number_precision.hpp │ │ │ ├── number_precision.inl │ │ │ ├── ocl_type.hpp │ │ │ ├── ocl_type.inl │ │ │ ├── optimum_pow.hpp │ │ │ ├── optimum_pow.inl │ │ │ ├── orthonormalize.hpp │ │ │ ├── orthonormalize.inl │ │ │ ├── perpendicular.hpp │ │ │ ├── perpendicular.inl │ │ │ ├── polar_coordinates.hpp │ │ │ ├── polar_coordinates.inl │ │ │ ├── projection.hpp │ │ │ ├── projection.inl │ │ │ ├── quaternion.hpp │ │ │ ├── quaternion.inl │ │ │ ├── random.hpp │ │ │ ├── raw_data.hpp │ │ │ ├── raw_data.inl │ │ │ ├── reciprocal.hpp │ │ │ ├── rotate_vector.hpp │ │ │ ├── rotate_vector.inl │ │ │ ├── simd_mat4.hpp │ │ │ ├── simd_mat4.inl │ │ │ ├── simd_vec4.hpp │ │ │ ├── simd_vec4.inl │ │ │ ├── spline.hpp │ │ │ ├── spline.inl │ │ │ ├── std_based_type.hpp │ │ │ ├── std_based_type.inl │ │ │ ├── string_cast.hpp │ │ │ ├── string_cast.inl │ │ │ ├── transform.hpp │ │ │ ├── transform.inl │ │ │ ├── transform2.hpp │ │ │ ├── transform2.inl │ │ │ ├── ulp.hpp │ │ │ ├── unsigned_int.hpp │ │ │ ├── unsigned_int.inl │ │ │ ├── vec1.hpp │ │ │ ├── vec1.inl │ │ │ ├── vector_access.hpp │ │ │ ├── vector_access.inl │ │ │ ├── vector_angle.hpp │ │ │ ├── vector_angle.inl │ │ │ ├── vector_query.hpp │ │ │ ├── vector_query.inl │ │ │ ├── verbose_operator.hpp │ │ │ ├── verbose_operator.inl │ │ │ ├── wrap.hpp │ │ │ └── wrap.inl │ │ └── virtrev │ │ │ └── xstream.hpp │ ├── glsym │ │ ├── glgen.py │ │ ├── glsym.h │ │ ├── glsym_es2.c │ │ ├── glsym_es2.h │ │ ├── glsym_gl.c │ │ ├── glsym_gl.h │ │ ├── rglgen.c │ │ └── rglgen.h │ ├── libretro │ │ ├── libretro.cpp │ │ └── libretro.h │ ├── link.T │ └── rpng │ │ ├── rpng.c │ │ └── rpng.h ├── libretro_test_gl_fixedfunction │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── glsym │ │ ├── README.md │ │ ├── glgen.py │ │ ├── glsym.h │ │ ├── glsym_es2.c │ │ ├── glsym_es2.h │ │ ├── glsym_es3.c │ │ ├── glsym_es3.h │ │ ├── glsym_gl.c │ │ ├── glsym_gl.h │ │ ├── retro_common_api.h │ │ ├── rglgen.c │ │ ├── rglgen.h │ │ ├── rglgen.py │ │ └── rglgen_headers.h │ ├── jni │ │ ├── Android.mk │ │ └── Application.mk │ ├── libretro.h │ ├── libretro_gl_ff_test.c │ └── link.T └── libretro_test_gl_shaders │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── glsym │ ├── README.md │ ├── glgen.py │ ├── glsym.h │ ├── glsym_es2.c │ ├── glsym_es2.h │ ├── glsym_es3.c │ ├── glsym_es3.h │ ├── glsym_gl.c │ ├── glsym_gl.h │ ├── retro_common_api.h │ ├── rglgen.c │ ├── rglgen.h │ ├── rglgen.py │ └── rglgen_headers.h │ ├── jni │ ├── Android.mk │ └── Application.mk │ ├── libretro.h │ ├── libretro_gl_test.c │ └── link.T ├── software ├── rendering │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── jni │ │ ├── Android.mk │ │ └── Application.mk │ ├── libretro-test.c │ ├── libretro.h │ └── link.T └── rendering_direct_to_vram │ ├── Makefile │ ├── README.md │ ├── Tupfile │ ├── jni │ ├── Android.mk │ └── Application.mk │ ├── libretro-test.c │ ├── libretro.h │ └── link.T └── vulkan ├── vk_async_compute ├── Makefile ├── README.md ├── Tupfile ├── include │ └── vulkan │ │ ├── vk_icd.h │ │ ├── vk_layer.h │ │ ├── vk_platform.h │ │ ├── vk_sdk_platform.h │ │ ├── vulkan.h │ │ └── vulkan_intel.h ├── jni │ ├── Android.mk │ └── Application.mk ├── libretro-test.c ├── libretro.h ├── libretro_vulkan.h ├── link.T ├── shaders │ ├── Makefile │ ├── raymarch.comp │ └── raymarch.comp.inc ├── vulkan │ └── vulkan_symbol_wrapper.h └── vulkan_symbol_wrapper.c └── vk_rendering ├── Makefile ├── README.md ├── Tupfile ├── include └── vulkan │ ├── vk_icd.h │ ├── vk_layer.h │ ├── vk_platform.h │ ├── vk_sdk_platform.h │ ├── vulkan.h │ └── vulkan_intel.h ├── jni ├── Android.mk └── Application.mk ├── libretro-test.c ├── libretro.h ├── libretro_vulkan.h ├── link.T ├── shaders ├── Makefile ├── triangle.frag ├── triangle.frag.inc ├── triangle.vert └── triangle.vert.inc ├── vulkan └── vulkan_symbol_wrapper.h └── vulkan_symbol_wrapper.c /.github/workflows/PS2.yml: -------------------------------------------------------------------------------- 1 | name: CI PS2 2 | 3 | on: 4 | push: 5 | pull_request: 6 | repository_dispatch: 7 | types: [run_build] 8 | 9 | jobs: 10 | build-ps2: 11 | runs-on: ubuntu-latest 12 | container: ps2dev/ps2dev:latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: Install dependencies 17 | run: | 18 | apk add build-base 19 | 20 | - name: Get Information Variables 21 | id: core 22 | run: | 23 | echo "info=$(echo test)" >> $GITHUB_OUTPUT 24 | echo "platform=$(echo ps2)" >> $GITHUB_OUTPUT 25 | echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT 26 | 27 | - name: Compile test core 28 | run: | 29 | cd tests/test && make platform=${{ steps.core.outputs.platform }} clean all 30 | 31 | - name: Upload artifacts 32 | if: ${{ success() }} 33 | uses: actions/upload-artifact@v3 34 | with: 35 | name: ${{ steps.core.outputs.info }}_libretro_${{ steps.core.outputs.platform }}-${{ steps.core.outputs.sha8 }} 36 | path: tests/test/${{ steps.core.outputs.info }}_libretro_${{ steps.core.outputs.platform }}.a 37 | -------------------------------------------------------------------------------- /.github/workflows/PS4.yml: -------------------------------------------------------------------------------- 1 | name: CI PS4 2 | 3 | on: 4 | push: 5 | pull_request: 6 | repository_dispatch: 7 | types: [run_build] 8 | 9 | jobs: 10 | build-ps4: 11 | runs-on: ubuntu-latest 12 | container: orbisdev/orbisdev:latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: Install dependencies 17 | run: | 18 | apk add ncurses-dev make bash python2 libstdc++ 19 | 20 | - name: Get Information Variables 21 | id: core 22 | run: | 23 | echo "info=$(echo test)" >> $GITHUB_OUTPUT 24 | echo "platform=$(echo orbis)" >> $GITHUB_OUTPUT 25 | echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT 26 | 27 | - name: Compile test core 28 | run: | 29 | cd tests/test && make platform=${{ steps.core.outputs.platform }} clean all 30 | 31 | - name: Upload artifacts 32 | if: ${{ success() }} 33 | uses: actions/upload-artifact@v3 34 | with: 35 | name: ${{ steps.core.outputs.info }}_libretro_${{ steps.core.outputs.platform }}-${{ steps.core.outputs.sha8 }} 36 | path: tests/test/${{ steps.core.outputs.info }}_libretro_${{ steps.core.outputs.platform }}.a 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.dll 4 | *.dylib 5 | *.exe 6 | *.so 7 | *.bc 8 | -------------------------------------------------------------------------------- /audio/audio_callback/README.md: -------------------------------------------------------------------------------- 1 | # audio_callback 2 | This sample demonstrates how to generate sound using libretro API with an audio callback. 3 | 4 | Audio gets its own callback function to live in and libretro's audio callback function 5 | gets called independently of retro_run iteration in this case. 6 | 7 | In case the audio callback cannot be setup (a libretro frontend might not support it), 8 | we fallback to non-callback based audio instead. 9 | 10 | The audio samplerate in this sample is set to 3000KHz, sound is 16-bit stereo. 11 | 12 | ## Programming language 13 | C 14 | 15 | ## Building 16 | To compile, you will need a C compiler and assorted toolchain installed. 17 | 18 | make 19 | -------------------------------------------------------------------------------- /audio/audio_callback/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=testaudio_callback 2 | include_rules 3 | -------------------------------------------------------------------------------- /audio/audio_callback/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | APP_DIR := ../../src 6 | 7 | LOCAL_MODULE := retro 8 | 9 | ifeq ($(TARGET_ARCH),arm) 10 | LOCAL_CFLAGS += -DANDROID_ARM 11 | endif 12 | 13 | ifeq ($(TARGET_ARCH),x86) 14 | LOCAL_CFLAGS += -DANDROID_X86 15 | endif 16 | 17 | ifeq ($(TARGET_ARCH),mips) 18 | LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__ 19 | endif 20 | 21 | LOCAL_SRC_FILES += ../libretro-test.c 22 | LOCAL_CFLAGS += -O3 -std=gnu99 -ffast-math -funroll-loops 23 | 24 | 25 | include $(BUILD_SHARED_LIBRARY) 26 | -------------------------------------------------------------------------------- /audio/audio_callback/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /audio/audio_callback/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /audio/audio_no_callback/README.md: -------------------------------------------------------------------------------- 1 | # audio_no_callback 2 | This sample demonstrates how to generate sound using libretro API with no audio callback. 3 | 4 | What this means is that libretro's audio callback function has to be called inside retro_run 5 | at least once per run. 6 | 7 | The audio samplerate in this sample is set to 3000KHz, sound is 16-bit stereo. 8 | 9 | ## Programming language 10 | C 11 | 12 | ## Building 13 | To compile, you will need a C compiler and assorted toolchain installed. 14 | 15 | make 16 | -------------------------------------------------------------------------------- /audio/audio_no_callback/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=testaudio_no_callback 2 | include_rules 3 | -------------------------------------------------------------------------------- /audio/audio_no_callback/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | APP_DIR := ../../src 6 | 7 | LOCAL_MODULE := retro 8 | 9 | ifeq ($(TARGET_ARCH),arm) 10 | LOCAL_CFLAGS += -DANDROID_ARM 11 | endif 12 | 13 | ifeq ($(TARGET_ARCH),x86) 14 | LOCAL_CFLAGS += -DANDROID_X86 15 | endif 16 | 17 | ifeq ($(TARGET_ARCH),mips) 18 | LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__ 19 | endif 20 | 21 | LOCAL_SRC_FILES += ../libretro-test.c 22 | LOCAL_CFLAGS += -O3 -std=gnu99 -ffast-math -funroll-loops 23 | 24 | 25 | include $(BUILD_SHARED_LIBRARY) 26 | -------------------------------------------------------------------------------- /audio/audio_no_callback/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /audio/audio_no_callback/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /audio/audio_playback_wav/README.md: -------------------------------------------------------------------------------- 1 | # audio_playback_wav 2 | A sample libretro core that plays audio files (WAV only) 3 | 4 | NOTE: Not big-endian compatible (yet). 5 | 6 | ## Programming language 7 | C 8 | 9 | ## Building 10 | To compile, you will need a C compiler and assorted toolchain installed. 11 | 12 | make 13 | -------------------------------------------------------------------------------- /audio/audio_playback_wav/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=testaudio_playback_wav 2 | include_rules 3 | -------------------------------------------------------------------------------- /audio/audio_playback_wav/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | APP_DIR := ../../src 6 | 7 | LOCAL_MODULE := retro 8 | 9 | ifeq ($(TARGET_ARCH),arm) 10 | LOCAL_CFLAGS += -DANDROID_ARM 11 | endif 12 | 13 | ifeq ($(TARGET_ARCH),x86) 14 | LOCAL_CFLAGS += -DANDROID_X86 15 | endif 16 | 17 | ifeq ($(TARGET_ARCH),mips) 18 | LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__ 19 | endif 20 | 21 | LOCAL_SRC_FILES += ../libretro-test.c 22 | LOCAL_CFLAGS += -O3 -std=gnu99 -ffast-math -funroll-loops 23 | 24 | 25 | include $(BUILD_SHARED_LIBRARY) 26 | -------------------------------------------------------------------------------- /audio/audio_playback_wav/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /audio/audio_playback_wav/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /build/make/Makefile.common: -------------------------------------------------------------------------------- 1 | #Set the path to the core's libretro-common directory here 2 | #LIBRETRO_COMM_DIR := $(CORE_DIR)/drivers/libretro/libretro-common 3 | 4 | INCFLAGS := 5 | 6 | #Uncomment this to include the libretro-common include directory 7 | #INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include 8 | COREDEFINES = -D__LIBRETRO__ 9 | 10 | INCLUDE_STDINT = 0 11 | ifneq (,$(findstring msvc2003,$(platform))) 12 | INCLUDE_STDINT = 1 13 | endif 14 | 15 | ifneq (,$(findstring msvc2005,$(platform))) 16 | INCLUDE_STDINT = 1 17 | endif 18 | 19 | ifeq ($(INCLUDE_STDINT), 1) 20 | INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc 21 | endif 22 | 23 | ifneq (,$(findstring msvc,$(platform))) 24 | COREDEFINES += -DINLINE=_inline 25 | else 26 | COREDEFINES += -DINLINE=inline 27 | endif 28 | 29 | ifeq ($(PSS_STYLE),2) 30 | COREDEFINES += -DPSS_STYLE=2 31 | else 32 | COREDEFINES += -DPSS_STYLE=1 33 | endif 34 | 35 | # Add C sourcecode files to this 36 | SOURCES_C := 37 | 38 | # Add C++ sourcecode files to this 39 | SOURCES_CXX := 40 | 41 | ifeq ($(STATIC_LINKING),1) 42 | else 43 | # Files from libretro-common should be put inside the else block here 44 | endif 45 | -------------------------------------------------------------------------------- /build/make/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | CORE_DIR := $(LOCAL_PATH)/.. 4 | 5 | include $(LOCAL_PATH)/../Makefile.common 6 | 7 | COREFLAGS := $(COREDEFINES) -DPSS_STYLE=1 $(INCFLAGS) 8 | 9 | GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" 10 | ifneq ($(GIT_VERSION)," unknown") 11 | COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" 12 | endif 13 | 14 | include $(CLEAR_VARS) 15 | LOCAL_MODULE := retro 16 | LOCAL_SRC_FILES := $(SOURCES_C) $(SOURCES_CXX) 17 | LOCAL_CFLAGS := $(COREFLAGS) 18 | LOCAL_CXXFLAGS := $(COREFLAGS) 19 | LOCAL_LDFLAGS := -Wl,-version-script=$(CORE_DIR)/link.T 20 | include $(BUILD_SHARED_LIBRARY) 21 | -------------------------------------------------------------------------------- /build/make/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /build/make/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /input/button_test/README.md: -------------------------------------------------------------------------------- 1 | # buttontest 2 | A libretro core showing a graphic representation of the Retropad gamepad. Pressing the buttons on the physical pad will 3 | highlight the buttons onscreen. 4 | 5 | ## Programming language 6 | C 7 | 8 | ## Building 9 | To compile, you will need a C compiler and assorted toolchain installed. 10 | 11 | make 12 | -------------------------------------------------------------------------------- /input/button_test/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=button_test 2 | include_rules 3 | -------------------------------------------------------------------------------- /input/button_test/internal_cores.h: -------------------------------------------------------------------------------- 1 | #include "../internal_cores.h" 2 | -------------------------------------------------------------------------------- /input/button_test/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | APP_DIR := ../../src 6 | 7 | LOCAL_MODULE := retro 8 | 9 | ifeq ($(TARGET_ARCH),arm) 10 | LOCAL_CFLAGS += -DANDROID_ARM 11 | endif 12 | 13 | ifeq ($(TARGET_ARCH),x86) 14 | LOCAL_CFLAGS += -DANDROID_X86 15 | endif 16 | 17 | ifeq ($(TARGET_ARCH),mips) 18 | LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__ 19 | endif 20 | 21 | LOCAL_SRC_FILES += ../libretro-test.c 22 | LOCAL_CFLAGS += -O3 -std=gnu99 -ffast-math -funroll-loops 23 | 24 | 25 | include $(BUILD_SHARED_LIBRARY) 26 | -------------------------------------------------------------------------------- /input/button_test/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /input/button_test/libretro-common/include/retro_inline.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2017 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_inline.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_INLINE_H 24 | #define __LIBRETRO_SDK_INLINE_H 25 | 26 | #ifndef INLINE 27 | 28 | #if defined(_WIN32) || defined(__INTEL_COMPILER) 29 | #define INLINE __inline 30 | #elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L 31 | #define INLINE inline 32 | #elif defined(__GNUC__) 33 | #define INLINE __inline__ 34 | #else 35 | #define INLINE 36 | #endif 37 | 38 | #endif 39 | #endif 40 | -------------------------------------------------------------------------------- /input/button_test/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /lang/freebasic/README.md: -------------------------------------------------------------------------------- 1 | # freebasic 2 | A test core written in FreeBasic for libretro. 3 | 4 | ## Programming language 5 | Basic 6 | 7 | ## Building 8 | To compile, you will need FreeBasic installed. 9 | 10 | fbc -dll fbastest.bas -x freebasic_libretro.so 11 | -------------------------------------------------------------------------------- /lang/freebasic/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=freebasic 2 | include_rules 3 | -------------------------------------------------------------------------------- /lang/pascal/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2015-2016, Higor Eurípedes 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, this 12 | list of conditions and the following disclaimer in the documentation and/or 13 | other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 22 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | -------------------------------------------------------------------------------- /lang/pascal/README.md: -------------------------------------------------------------------------------- 1 | # pascal_pong 2 | A Pong game written in Pascal for libretro. 3 | 4 | ## Programming language 5 | Pascal 6 | 7 | ## Building 8 | To compile, you will need Free Pascal installed. 9 | 10 | fpc -opong_libretro.so pong.pas 11 | -------------------------------------------------------------------------------- /lang/pascal/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=pascal_pong 2 | include_rules 3 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | Copyright (C) 2010-2015 The RetroArch team 2 | 3 | Permission is hereby granted, free of charge, 4 | to any person obtaining a copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 7 | and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 14 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 15 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | -------------------------------------------------------------------------------- /midi/midi_test/README.md: -------------------------------------------------------------------------------- 1 | # midi_test_libretro 2 | A MIDI test core written in C for libretro. 3 | 4 | Demonstrates usage of the MIDI API: 5 | - Input/Output (input to output loopback) 6 | - Output (metronome, one octave keyboard) 7 | 8 | ## Usage 9 | Keyboard keys 0,1,2 and 3 select current test: 10 | 0 None, 1 Metronome, 2 Loopback, 3 Keyboard. 11 | 12 | ## Programming language 13 | C 14 | 15 | ## Building 16 | To compile, you will need a C compiler and assorted toolchain installed. 17 | 18 | make 19 | -------------------------------------------------------------------------------- /midi/midi_test/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=midi_test 2 | include_rules 3 | -------------------------------------------------------------------------------- /midi/midi_test/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | APP_DIR := ../../src 6 | 7 | LOCAL_MODULE := retro 8 | 9 | ifeq ($(TARGET_ARCH),arm) 10 | LOCAL_CFLAGS += -DANDROID_ARM 11 | endif 12 | 13 | ifeq ($(TARGET_ARCH),x86) 14 | LOCAL_CFLAGS += -DANDROID_X86 15 | endif 16 | 17 | ifeq ($(TARGET_ARCH),mips) 18 | LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__ 19 | endif 20 | 21 | LOCAL_SRC_FILES += ../libretro.c 22 | LOCAL_CFLAGS += -O3 -std=gnu99 -ffast-math -funroll-loops 23 | 24 | 25 | include $(BUILD_SHARED_LIBRARY) 26 | -------------------------------------------------------------------------------- /midi/midi_test/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /midi/midi_test/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /tests/cruzes/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2015-2016, Higor Eurípedes 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, this 12 | list of conditions and the following disclaimer in the documentation and/or 13 | other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 22 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/cruzes/Makefile: -------------------------------------------------------------------------------- 1 | 2 | MKDIR ?= mkdir 3 | RM ?= rm 4 | RM_F ?= $(RM) -f 5 | RM_RF ?= $(RM) -rf 6 | MKDIR_P ?= $(MKDIR) -p 7 | 8 | cc := $(CC) 9 | cxx := $(CXX) 10 | soext := so 11 | objdir := obj/ 12 | 13 | ifneq ($(findstring $(config),win32),) 14 | soext := dll 15 | endif 16 | 17 | target := cruzes_libretro.$(soext) 18 | sources := cruzes.c ttf2c.c 19 | generated := font24.h font16.h font10.h 20 | 21 | libs := -lm 22 | ldirs := 23 | lflags := 24 | 25 | idirs := -I. 26 | cflags := -Wall -std=c99 27 | fpic := -fPIC 28 | 29 | cflags_debug := -O0 -g 30 | cflags_release := -O2 31 | 32 | ifeq ($(DEBUG), 1) 33 | cflags += $(cflags_debug) 34 | else 35 | cflags += $(cflags_release) 36 | endif 37 | 38 | ifneq ($(findstring sse2,$(config)),) 39 | cflags += -msse2 40 | endif 41 | 42 | ifneq ($(findstring lto,$(config)),) 43 | cflags += -flto 44 | lflags += -flto 45 | endif 46 | 47 | ifneq ($(findstring ofast,$(config)),) 48 | cflags += -Ofast 49 | endif 50 | 51 | ifneq ($(findstring clang,$(config)),) 52 | cc := clang 53 | endif 54 | 55 | ifneq ($(sanitizer),) 56 | cflags += -fsanitize=$(sanitizer) 57 | lflags += -fsanitize=$(sanitizer) 58 | else 59 | lflags += -Wl,--no-undefined 60 | endif 61 | 62 | objects := $(addprefix $(objdir),$(sources:.c=.o)) 63 | deps := $(objects:.o=.d) 64 | 65 | .PHONY: all clean 66 | 67 | all: $(target) 68 | clean: 69 | -$(RM_F) $(target) $(objects) $(deps) ttf2c{,.exe} 70 | 71 | $(target): $(generated) $(objects) 72 | $(cc) -o $(target) $(ldirs) $(lflags) -shared $(fpic) $(objects) $(libs) 73 | 74 | font24.h: ttf2c $(objdir)Carlito-Regular.ttf 75 | ./ttf2c 24 font24 $(objdir)Carlito-Regular.ttf font24.h 76 | 77 | font16.h: ttf2c $(objdir)Carlito-Regular.ttf 78 | ./ttf2c 16 font16 $(objdir)Carlito-Regular.ttf font16.h 79 | 80 | font10.h: ttf2c $(objdir)Carlito-Regular.ttf 81 | ./ttf2c 10 font10 $(objdir)Carlito-Regular.ttf font10.h 82 | 83 | ttf2c: ttf2c.c Makefile 84 | $(cc) -Wall -g -DTTF2C_MAIN -o $@ $< -lm 85 | 86 | $(objdir)%.o: %.c $(generated) 87 | -@$(MKDIR_P) $(dir $@) 88 | $(cc) $(idirs) $(cflags) $(fpic) -MMD -c -o $@ $< 89 | -@sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ 90 | -e '/^$$/ d' -e 's/$$/ :/' -i'' $(objdir)$*.d 91 | 92 | -include $(deps) 93 | 94 | 95 | -------------------------------------------------------------------------------- /tests/cruzes/README.md: -------------------------------------------------------------------------------- 1 | # cruzes 2 | An unfinished Picross game implemented as a libretro core. Uses TrueType font files. 3 | 4 | ## Programming language 5 | C 6 | 7 | ## Building 8 | To compile, you will need a C compiler and assorted toolchain installed. 9 | 10 | make 11 | -------------------------------------------------------------------------------- /tests/cruzes/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=cruzes 2 | include_rules 3 | -------------------------------------------------------------------------------- /tests/cruzes/obj/Carlito-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-samples/bce193bc1b8c9a3da43b2ead0158a69e28b37ed8/tests/cruzes/obj/Carlito-Bold.ttf -------------------------------------------------------------------------------- /tests/cruzes/obj/Carlito-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-samples/bce193bc1b8c9a3da43b2ead0158a69e28b37ed8/tests/cruzes/obj/Carlito-BoldItalic.ttf -------------------------------------------------------------------------------- /tests/cruzes/obj/Carlito-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-samples/bce193bc1b8c9a3da43b2ead0158a69e28b37ed8/tests/cruzes/obj/Carlito-Italic.ttf -------------------------------------------------------------------------------- /tests/cruzes/obj/Carlito-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-samples/bce193bc1b8c9a3da43b2ead0158a69e28b37ed8/tests/cruzes/obj/Carlito-Regular.ttf -------------------------------------------------------------------------------- /tests/cruzes/ttf2c.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2015-2016, Higor Eurípedes 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without modification, 7 | are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, this 13 | list of conditions and the following disclaimer in the documentation and/or 14 | other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | */ 28 | #ifndef TTF2C_H 29 | #define TTF2C_H 30 | 31 | typedef struct 32 | { 33 | int off_x, off_y; 34 | int adv_x, adv_y; 35 | int width, height; 36 | const uint8_t *bitmap; 37 | } ttf2c_glyph; 38 | 39 | typedef struct 40 | { 41 | int max_width; 42 | int line_height; 43 | int ascent, descent, line_gap; 44 | ttf2c_glyph glyphs[256]; 45 | } ttf2c_font; 46 | 47 | int ttf2c_get_width(const ttf2c_font *font, const char *text); 48 | 49 | /* use negative height for EM-sizes */ 50 | ttf2c_font *ttf2c_create(const uint8_t *data, int index, int height); 51 | 52 | /* only needed for ttf2c_create() created fonts */ 53 | void ttf2c_destroy(ttf2c_font *font); 54 | 55 | #endif // TTF2C_H 56 | 57 | -------------------------------------------------------------------------------- /tests/test/README.md: -------------------------------------------------------------------------------- 1 | # libretro_test 2 | A test core written in C for libretro. 3 | 4 | Demonstrates various features of the libretro API including: 5 | - Input (rumble, analog input, mouse and touch controls) 6 | - Graphics (software rendering, direct-to-VRAM rendering, etc) 7 | - Audio (audio callback and non-callback based, etc.) 8 | - Core options 9 | - Input descriptor support 10 | - Keyboard callback support 11 | 12 | 13 | ## Programming language 14 | C 15 | 16 | ## Building 17 | To compile, you will need a C compiler and assorted toolchain installed. 18 | 19 | make 20 | -------------------------------------------------------------------------------- /tests/test/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=test 2 | include_rules 3 | -------------------------------------------------------------------------------- /tests/test/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | APP_DIR := ../../src 6 | 7 | LOCAL_MODULE := retro 8 | 9 | ifeq ($(TARGET_ARCH),arm) 10 | LOCAL_CFLAGS += -DANDROID_ARM 11 | endif 12 | 13 | ifeq ($(TARGET_ARCH),x86) 14 | LOCAL_CFLAGS += -DANDROID_X86 15 | endif 16 | 17 | ifeq ($(TARGET_ARCH),mips) 18 | LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__ 19 | endif 20 | 21 | LOCAL_SRC_FILES += ../libretro-test.c 22 | LOCAL_CFLAGS += -O3 -std=gnu99 -ffast-math -funroll-loops 23 | 24 | 25 | include $(BUILD_SHARED_LIBRARY) 26 | -------------------------------------------------------------------------------- /tests/test/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /tests/test/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /tests/test_advanced/README.md: -------------------------------------------------------------------------------- 1 | # libretro_test_advanced 2 | An advanced test core written in C for libretro. 3 | 4 | This core has a group of tests which you can cycle between by pressing the 5 | buttons on the gamepad. 6 | 7 | Up and Down will cycle between the test groups. Left and Right will cycle 8 | between the tests in each group. 9 | 10 | 1. Video output 11 | 1a. Color test: A static image, with one red, one green and one blue rectangle, to ensure the channels aren't mixed up. 12 | 1b. Tearing test, horizontal: Vertical lines moving horizontally. In pixel format XRGB8888, the Xs will be 00. 13 | 1c. Tearing test, vertical: Horizontal lines moving vertically. In pixel format XRGB8888, the Xs will be FF. 14 | 1d. vsync test: Flickers between white and black each frame. 15 | 1e. Stretching test: A checkerboard of black and white, to test if each square looks smooth. 16 | 1f. Border test: A white screen, with red and yellow borders. 17 | 18 | 2. Latency and synchronization 19 | 2a. A/V sync test. Will switch between white and silent, and black and noisy, every two seconds. 20 | 2b. Latency test. If any of ABXYLRStSe are held, it's black and noisy; if not, it's white and silent. 21 | 22 | 3. Input 23 | 3a. Press any key to check how fast input_state_cb can be called. Also usable as netplay desync detector; 24 | all players will get different answers. 25 | 26 | 4. Netplay 27 | 4a. Input sync. All button presses are sent to the screen; a hash of that is used as background color 28 | (varies between pixel formats), for easy comparison. 29 | 30 | It will also print two messages to RETRO_ENVIRONMENT_GET_LOG_INTERFACE, which should be identical. 31 | 32 | ## Programming language 33 | C 34 | 35 | ## Building 36 | To compile, you will need a C compiler and associated toolchain installed. 37 | 38 | make 39 | 40 | or 41 | 42 | gcc libretro-test.c -shared -fPIC -lm -o advanced_tests_libretro.so (for Windows, use .dll instead) 43 | -------------------------------------------------------------------------------- /tests/test_advanced/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=advanced_tests 2 | include_rules 3 | -------------------------------------------------------------------------------- /tests/test_advanced/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | APP_DIR := ../../src 6 | 7 | LOCAL_MODULE := retro 8 | 9 | ifeq ($(TARGET_ARCH),arm) 10 | LOCAL_CFLAGS += -DANDROID_ARM 11 | endif 12 | 13 | ifeq ($(TARGET_ARCH),x86) 14 | LOCAL_CFLAGS += -DANDROID_X86 15 | endif 16 | 17 | ifeq ($(TARGET_ARCH),mips) 18 | LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__ 19 | endif 20 | 21 | LOCAL_SRC_FILES += ../libretro-test.c 22 | LOCAL_CFLAGS += -O3 -std=gnu99 -ffast-math -funroll-loops 23 | 24 | 25 | include $(BUILD_SHARED_LIBRARY) 26 | -------------------------------------------------------------------------------- /tests/test_advanced/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /tests/test_advanced/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ifeq ($(platform),) 3 | platform = unix 4 | ifeq ($(shell uname -a),) 5 | platform = win 6 | else ifneq ($(findstring MINGW,$(shell uname -a)),) 7 | platform = win 8 | else ifneq ($(findstring Darwin,$(shell uname -a)),) 9 | platform = osx 10 | else ifneq ($(findstring win,$(shell uname -a)),) 11 | platform = win 12 | endif 13 | endif 14 | 15 | TARGET_NAME := testgl_compute_shaders 16 | 17 | ifeq ($(platform), unix) 18 | TARGET := $(TARGET_NAME)_libretro.so 19 | fpic := -fPIC 20 | SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined 21 | GL_LIB := -lGL 22 | INCFLAGS += -I. -Igl 23 | else ifeq ($(platform), osx) 24 | TARGET := $(TARGET_NAME)_libretro.dylib 25 | fpic := -fPIC 26 | SHARED := -dynamiclib 27 | GL_LIB := -framework OpenGL 28 | INCFLAGS += -I. -Igl 29 | else 30 | TARGET := $(TARGET_NAME)_libretro.dll 31 | SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined 32 | GL_LIB := -lopengl32 33 | INCFLAGS += -I. -Igl -IGLcore 34 | endif 35 | 36 | CXXFLAGS += $(INCFLAGS) 37 | 38 | ifeq ($(DEBUG), 1) 39 | CXXFLAGS += -O0 -g -DGL_DEBUG 40 | CFLAGS += -O0 -g 41 | else 42 | CXXFLAGS += -O3 -DNDEBUG 43 | CFLAGS += -O3 -DNDEBUG 44 | endif 45 | 46 | CXXFLAGS += -std=gnu++11 -Wall $(fpic) -DHAVE_ZIP_DEFLATE 47 | CFLAGS += -std=gnu99 -Wall $(fpic) -DHAVE_ZIP_DEFLATE 48 | 49 | SOURCES := $(wildcard libretro/*.cpp) $(wildcard gl/*.cpp) $(wildcard app/*.cpp) 50 | CSOURCES = $(wildcard rpng/*.c) glsym/rglgen.c 51 | LIBS += $(GL_LIB) 52 | CSOURCES += glsym/glsym_gl.c 53 | 54 | OBJECTS := $(SOURCES:.cpp=.o) $(CSOURCES:.c=.o) 55 | 56 | all: $(TARGET) 57 | 58 | HEADERS := $(wildcard *.hpp) $(wildcard *.h) $(wildcard */*.hpp) $(wildcard */*.h) 59 | 60 | $(TARGET): $(OBJECTS) 61 | $(CXX) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LIBS) -lm -lz 62 | 63 | %.o: %.cpp $(HEADERS) 64 | $(CXX) $(CXXFLAGS) -c -o $@ $< 65 | 66 | %.o: %.c $(HEADERS) 67 | $(CC) $(CFLAGS) -c -o $@ $< 68 | 69 | clean: 70 | rm -f $(OBJECTS) $(TARGET) 71 | 72 | .PHONY: clean 73 | 74 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/README.md: -------------------------------------------------------------------------------- 1 | # libretro_test_gl_compute_shaders 2 | This sample demonstrates a compute shader graphics demo using OpenGL 4.3. It uses tons of instanced geometry, and 3 | targets [libretro](http://libretro.com) GL as a backend. 4 | 5 | Purpose of the compute shader is to do frustum culling, LOD-sorting and some simple physics for fun. 6 | 7 | After compute shader, indirect drawing is used to draw instanced geometry. 8 | The indirect drawing buffer is updated with atomic counters from compute shader. 9 | 10 | The LOD-sorting allows us to instance few but complex meshes when we're close, 11 | and progressively less and less detail per instance. Last LOD is just point sprites. 12 | 13 | The number of blocks in play is ~850k. 14 | With an nVidia GTX760, performance is roughly 300-500 FPS up to 1000 FPS depending on the scene complexity after culling. 15 | 16 | LOD0: Blender monkey (Suzanne) (diffuse + specular lighting)
17 | LOD1: Cube (diffuse lighting)
18 | LOD2: Point sprites
19 | 20 | Video 21 | ====== 22 | [YouTube](https://www.youtube.com/watch?v=MMfvR252RR4) 23 | 24 | ## Requirements 25 | A graphics card driver supporting OpenGL 4.3 and/or higher. 26 | 27 | ## Programming language 28 | C++11 29 | 30 | ## Building 31 | To compile, you will need a C++11 compiler and assorted toolchain installed. 32 | 33 | make 34 | 35 | This targets [libretro](http://libretro.com) GL interface, so you need a libretro frontend supporting this interface, such as [RetroArch](https://github.com/libretro/RetroArch), installed. 36 | 37 | ## Running 38 | After building, this command should run the program: 39 | 40 | retroarch -L boxes_libretro.so 41 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME = testgl_compute_shaders 2 | include_rules 3 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/mesh.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl None 5 | Ns 10.0 6 | Ka 0.200000 0.200000 0.250000 7 | Kd 0.2 0.2 0.2 8 | Ks 20.0 20.0 20.0 9 | d 1 10 | illum 2 11 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/shaders/boxrender.fs: -------------------------------------------------------------------------------- 1 | layout(binding = GLOBAL_FRAGMENT_DATA) uniform GlobalFragmentData 2 | { 3 | vec4 camera_pos; 4 | vec4 camera_vel; 5 | vec4 light_pos; 6 | vec4 light_color; 7 | vec4 light_ambient; 8 | vec2 resolution; 9 | } global_frag; 10 | 11 | layout(binding = MATERIAL) uniform Material 12 | { 13 | vec4 ambient; 14 | vec4 diffuse; 15 | vec4 specular; 16 | float specular_power; 17 | } material; 18 | 19 | in VertexData 20 | { 21 | vec3 normal; 22 | vec3 world; 23 | vec2 tex; 24 | } fin; 25 | 26 | #if DIFFUSE_MAP 27 | layout(binding = 0) uniform sampler2D Diffuse; 28 | #endif 29 | 30 | out vec4 FragColor; 31 | 32 | void main() 33 | { 34 | vec3 vEye = normalize(global_frag.camera_pos.xyz - fin.world); 35 | vec3 light_dist = global_frag.light_pos.xyz - fin.world; 36 | vec3 vLight = normalize(light_dist); 37 | vec3 normal = normalize(fin.normal); 38 | 39 | float ndotl = max(dot(vLight, normal), 0.0); 40 | 41 | float light_mod = 0.5; // Could attenuate, but don't bother. 42 | 43 | vec3 specular = vec3(0.0); 44 | #if LOD == 0 45 | // Avoid pow(0, 0) which is undefined. 46 | vec3 half_vec = normalize(vLight + vEye); 47 | float blinn_phong_mod = max(dot(half_vec, normal), 0.001); 48 | specular = light_mod * global_frag.light_color.rgb * material.specular.xyz * pow(blinn_phong_mod, material.specular_power); 49 | #endif 50 | 51 | #if DIFFUSE_MAP 52 | vec4 diffuse_term = texture(Diffuse, fin.tex); 53 | diffuse_term.rgb *= diffuse_term.rgb; 54 | #else 55 | vec4 diffuse_term = vec4(0.0); 56 | #endif 57 | 58 | vec3 ambient = global_frag.light_ambient.rgb * mix(material.ambient.rgb, diffuse_term.rgb, diffuse_term.a); 59 | vec3 diffuse = light_mod * ndotl * global_frag.light_color.rgb * mix(material.diffuse.rgb, diffuse_term.rgb, diffuse_term.a); 60 | FragColor = sqrt(vec4(ambient + diffuse + specular, 1.0)); 61 | } 62 | 63 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/shaders/boxrender.vs: -------------------------------------------------------------------------------- 1 | layout(binding = GLOBAL_VERTEX_DATA) uniform GlobalVertexData 2 | { 3 | mat4 vp; 4 | mat4 view; 5 | mat4 view_nt; 6 | mat4 proj; 7 | mat4 inv_vp; 8 | mat4 inv_view; 9 | mat4 inv_view_nt; 10 | mat4 inv_proj; 11 | vec4 camera_pos; 12 | } global_vert; 13 | 14 | layout(location = VERTEX) in vec3 aVertex; 15 | layout(location = NORMAL) in vec3 aNormal; 16 | layout(location = TEXCOORD) in vec2 aTexCoord; 17 | layout(location = 3) in vec4 aPos; 18 | 19 | out VertexData 20 | { 21 | vec3 normal; 22 | vec3 world; 23 | vec2 tex; 24 | } vout; 25 | 26 | void main() 27 | { 28 | vec4 world = vec4(aVertex + aPos.xyz, 1.0); 29 | 30 | gl_Position = global_vert.vp * world; 31 | 32 | vout.normal = aNormal; 33 | 34 | vout.world = world.xyz; 35 | vout.tex = vec2(aTexCoord.x, 1.0 - aTexCoord.y); 36 | } 37 | 38 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/shaders/boxrender_point.fs: -------------------------------------------------------------------------------- 1 | in VertexData 2 | { 3 | vec3 color; 4 | } fin; 5 | 6 | out vec4 FragColor; 7 | 8 | void main() 9 | { 10 | FragColor = vec4(fin.color, 1.0); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/shaders/boxrender_point.vs: -------------------------------------------------------------------------------- 1 | layout(binding = GLOBAL_VERTEX_DATA) uniform GlobalVertexData 2 | { 3 | mat4 vp; 4 | mat4 view; 5 | mat4 view_nt; 6 | mat4 proj; 7 | mat4 inv_vp; 8 | mat4 inv_view; 9 | mat4 inv_view_nt; 10 | mat4 inv_proj; 11 | vec4 camera_pos; 12 | vec4 camera_vel; 13 | vec4 resolution; 14 | } global_vert; 15 | 16 | layout(binding = GLOBAL_FRAGMENT_DATA) uniform GlobalFragmentData 17 | { 18 | vec4 camera_pos; 19 | vec4 camera_vel; 20 | vec4 light_pos; 21 | vec4 light_color; 22 | vec4 light_ambient; 23 | vec2 resolution; 24 | } global_frag; 25 | 26 | layout(binding = MATERIAL) uniform Material 27 | { 28 | vec4 ambient; 29 | vec4 diffuse; 30 | vec4 specular; 31 | float specular_power; 32 | } material; 33 | 34 | layout(location = VERTEX) in vec4 aVertex; 35 | 36 | out VertexData 37 | { 38 | vec3 color; 39 | } vout; 40 | 41 | void main() 42 | { 43 | vec4 world = vec4(aVertex.xyz, 1.0); 44 | 45 | vec4 clip_pos = global_vert.vp * world; 46 | gl_Position = clip_pos; 47 | vec2 point_size = 2.2 * global_vert.resolution.zw / clip_pos.w; // Make it slightly bigger than box (2.0 width) to accomodate for rotation. 48 | gl_PointSize = dot(vec2(0.5), point_size); // Average 49 | 50 | // Vertex coloring. 51 | vec3 vEye = normalize(global_frag.camera_pos.xyz - world.xyz); 52 | vec3 vLight = normalize(global_frag.light_pos.xyz - world.xyz); 53 | 54 | float ndotl = max(dot(vLight, vEye), 0.0); 55 | float light_mod = 0.5; // Could attenuate, but don't bother. 56 | vec3 ambient = global_frag.light_ambient.rgb * material.ambient.rgb; 57 | vec3 diffuse = light_mod * ndotl * global_frag.light_color.rgb * material.diffuse.rgb; 58 | vout.color = sqrt(ambient + diffuse); 59 | } 60 | 61 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/shaders/generic.fs: -------------------------------------------------------------------------------- 1 | layout(binding = GLOBAL_FRAGMENT_DATA) uniform GlobalFragmentData 2 | { 3 | vec4 camera_pos; 4 | vec4 camera_vel; 5 | vec4 light_pos; 6 | vec4 light_color; 7 | vec4 light_ambient; 8 | } global_frag; 9 | 10 | layout(binding = MATERIAL) uniform Material 11 | { 12 | vec4 ambient; 13 | vec4 diffuse; 14 | vec4 specular; 15 | float specular_power; 16 | } material; 17 | 18 | in VertexData 19 | { 20 | vec3 normal; 21 | vec3 world; 22 | vec2 tex; 23 | } fin; 24 | 25 | #if DIFFUSE_MAP 26 | layout(binding = 0) uniform sampler2D Diffuse; 27 | #endif 28 | 29 | out vec4 FragColor; 30 | 31 | void main() 32 | { 33 | vec3 vEye = normalize(global_frag.camera_pos.xyz - fin.world); 34 | vec3 light_dist = global_frag.light_pos.xyz - fin.world; 35 | vec3 vLight = normalize(light_dist); 36 | vec3 normal = normalize(fin.normal); 37 | 38 | float ndotl = max(dot(vLight, normal), 0.0); 39 | 40 | float light_mod = 50.0 / (1.0 + 0.25 * dot(light_dist, light_dist)); 41 | 42 | vec3 specular = vec3(0.0); 43 | if (ndotl > 0.0) 44 | { 45 | vec3 half_vec = normalize(vLight + vEye); 46 | float blinn_phong_mod = dot(half_vec, normal); 47 | // Avoid pow(0, 0) which is undefined. 48 | if (blinn_phong_mod > 0.0) 49 | specular = light_mod * global_frag.light_color.rgb * material.specular.xyz * pow(blinn_phong_mod, material.specular_power); 50 | } 51 | 52 | #if DIFFUSE_MAP 53 | vec4 diffuse_term = texture(Diffuse, fin.tex); 54 | diffuse_term.rgb *= diffuse_term.rgb; 55 | #else 56 | vec4 diffuse_term = vec4(0.0); 57 | #endif 58 | 59 | vec3 ambient = global_frag.light_ambient.rgb * mix(material.ambient.rgb, diffuse_term.rgb, diffuse_term.a); 60 | vec3 diffuse = light_mod * ndotl * global_frag.light_color.rgb * mix(material.diffuse.rgb, diffuse_term.rgb, diffuse_term.a); 61 | FragColor = sqrt(vec4(ambient + diffuse + specular, 1.0)); 62 | } 63 | 64 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/shaders/generic.vs: -------------------------------------------------------------------------------- 1 | layout(binding = GLOBAL_VERTEX_DATA) uniform GlobalVertexData 2 | { 3 | mat4 vp; 4 | mat4 view; 5 | mat4 view_nt; 6 | mat4 proj; 7 | mat4 inv_vp; 8 | mat4 inv_view; 9 | mat4 inv_view_nt; 10 | mat4 inv_proj; 11 | vec4 camera_pos; 12 | } global_vert; 13 | 14 | layout(location = VERTEX) in vec3 aVertex; 15 | layout(location = NORMAL) in vec3 aNormal; 16 | layout(location = TEXCOORD) in vec2 aTexCoord; 17 | 18 | #if INSTANCED 19 | layout(location = MODEL_INSTANCED) in mat4 aModel; // Instanced arrays 20 | #else 21 | layout(binding = MODEL_TRANSFORM) uniform ModelTransform 22 | { 23 | mat4 transform; 24 | } model; 25 | #endif 26 | 27 | out VertexData 28 | { 29 | vec3 normal; 30 | vec3 world; 31 | vec2 tex; 32 | } vout; 33 | 34 | void main() 35 | { 36 | #if INSTANCED 37 | vec4 world = aModel * vec4(aVertex, 1.0); 38 | #else 39 | vec4 world = model.transform * vec4(aVertex, 1.0); 40 | #endif 41 | 42 | gl_Position = global_vert.vp * world; 43 | 44 | #if INSTANCED 45 | vout.normal = mat3(aModel) * aNormal; 46 | #else 47 | vout.normal = mat3(model.transform) * aNormal; 48 | #endif 49 | 50 | vout.world = world.xyz; 51 | vout.tex = vec2(aTexCoord.x, 1.0 - aTexCoord.y); 52 | } 53 | 54 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/shaders/skybox.fs: -------------------------------------------------------------------------------- 1 | layout(binding = GLOBAL_FRAGMENT_DATA) uniform GlobalFragmentData 2 | { 3 | vec4 camera_pos; 4 | vec4 camera_vel; 5 | vec4 light_pos; 6 | vec4 light_color; 7 | vec4 light_ambient; 8 | }; 9 | 10 | layout(binding = 0) uniform samplerCube skybox; 11 | 12 | in vec3 vDirection; 13 | out vec4 FragColor; 14 | 15 | void main() 16 | { 17 | vec4 col = texture(skybox, vDirection); 18 | FragColor = col; 19 | } 20 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/shaders/skybox.vs: -------------------------------------------------------------------------------- 1 | layout(binding = 0) uniform GlobalVertexData 2 | { 3 | mat4 vp; 4 | mat4 view; 5 | mat4 view_nt; 6 | mat4 proj; 7 | mat4 inv_vp; 8 | mat4 inv_view; 9 | mat4 inv_view_nt; 10 | mat4 inv_proj; 11 | }; 12 | 13 | layout(location = VERTEX) in vec2 aVertex; 14 | out vec3 vDirection; 15 | 16 | void main() 17 | { 18 | gl_Position = vec4(aVertex, 1.0, 1.0); 19 | 20 | vec4 world_space = inv_view_nt * inv_proj * vec4(aVertex, 1.0, 1.0); 21 | vDirection = world_space.xyz / world_space.w; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-samples/bce193bc1b8c9a3da43b2ead0158a69e28b37ed8/video/opengl/libretro_test_gl_compute_shaders/app/test.png -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/xneg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-samples/bce193bc1b8c9a3da43b2ead0158a69e28b37ed8/video/opengl/libretro_test_gl_compute_shaders/app/xneg.png -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/xpos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-samples/bce193bc1b8c9a3da43b2ead0158a69e28b37ed8/video/opengl/libretro_test_gl_compute_shaders/app/xpos.png -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/yneg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-samples/bce193bc1b8c9a3da43b2ead0158a69e28b37ed8/video/opengl/libretro_test_gl_compute_shaders/app/yneg.png -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/ypos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-samples/bce193bc1b8c9a3da43b2ead0158a69e28b37ed8/video/opengl/libretro_test_gl_compute_shaders/app/ypos.png -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/zneg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-samples/bce193bc1b8c9a3da43b2ead0158a69e28b37ed8/video/opengl/libretro_test_gl_compute_shaders/app/zneg.png -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/app/zpos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-samples/bce193bc1b8c9a3da43b2ead0158a69e28b37ed8/video/opengl/libretro_test_gl_compute_shaders/app/zpos.png -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/gl/aabb.hpp: -------------------------------------------------------------------------------- 1 | #ifndef AABB_HPP__ 2 | #define AABB_HPP__ 3 | 4 | #include "global.hpp" 5 | #include 6 | #include 7 | #include 8 | 9 | namespace GL 10 | { 11 | struct AABB 12 | { 13 | AABB() = default; 14 | AABB(const glm::vec3& minimum, const glm::vec3& maximum); 15 | glm::vec3 base; 16 | glm::vec3 offset; 17 | 18 | glm::vec3 center() const; 19 | AABB transform(const glm::mat4& mat) const; 20 | glm::vec3 corner(unsigned corner) const; 21 | }; 22 | 23 | struct BoundingSphere 24 | { 25 | BoundingSphere() = default; 26 | explicit BoundingSphere(const AABB& aabb); 27 | 28 | glm::vec4 pos_radius; 29 | }; 30 | 31 | struct Frustum 32 | { 33 | Frustum() = default; 34 | Frustum(const glm::mat4& view_proj); 35 | glm::vec4 planes[6]; 36 | 37 | // Used for frustum culling. 38 | bool intersects_with_sphere(const BoundingSphere& sphere) const; 39 | }; 40 | } 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/gl/buffer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BUFFER_HPP__ 2 | #define BUFFER_HPP__ 3 | 4 | #include "global.hpp" 5 | #include 6 | #include 7 | #include 8 | 9 | namespace GL 10 | { 11 | class Buffer : public ContextListener, public ContextResource 12 | { 13 | public: 14 | Buffer() { ContextListener::init(); } 15 | ~Buffer() { deinit(); } 16 | enum Flags 17 | { 18 | None = 0, 19 | WriteOnly = 1, 20 | ReadOnly = 2, 21 | Copy = 3 22 | }; 23 | 24 | void init(GLenum target, GLsizei size, GLuint flags, const void *initial_data = nullptr, GLuint index = 0); 25 | 26 | template 27 | typename std::enable_if::type init(GLenum target, const T& t, GLuint flags, GLuint index = 0) 28 | { 29 | init(target, t.size() * sizeof(typename T::value_type), flags, t.data(), index); 30 | } 31 | 32 | void reset() override; 33 | void destroyed() override; 34 | 35 | template 36 | bool map(T*& data) 37 | { 38 | if (!size || !id || flags == None) 39 | return false; 40 | 41 | glBindBuffer(target, id); 42 | void *ptr = glMapBufferRange(target, 0, size, flags == WriteOnly ? (GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT) : GL_MAP_READ_BIT); 43 | data = reinterpret_cast(ptr); 44 | glBindBuffer(target, 0); 45 | return ptr != nullptr; 46 | } 47 | 48 | void unmap(); 49 | void bind(); 50 | void unbind(); 51 | 52 | void bind_indexed(GLenum target, unsigned index); 53 | void unbind_indexed(GLenum target, unsigned index); 54 | void bind(GLenum target); 55 | void unbind(GLenum target); 56 | 57 | private: 58 | bool alive = false; 59 | GLenum target = 0; 60 | GLuint index = 0; 61 | GLuint flags = 0; 62 | GLuint id = 0; 63 | GLsizei size = 0; 64 | 65 | std::vector temp; 66 | 67 | static GLenum gl_usage_from_flags(GLuint flags); 68 | static bool is_indexed(GLenum type); 69 | void init_buffer(const void *initial_data); 70 | 71 | }; 72 | } 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/gl/mesh.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MESH_HPP__ 2 | #define MESH_HPP__ 3 | 4 | #include "global.hpp" 5 | #include "vertex_array.hpp" 6 | #include "aabb.hpp" 7 | #include 8 | #include 9 | #include 10 | 11 | namespace GL 12 | { 13 | struct Material 14 | { 15 | glm::vec3 ambient = glm::vec3(0.2f); 16 | glm::vec3 diffuse = glm::vec3(0.8f); 17 | glm::vec3 specular = glm::vec3(0.0f); 18 | float specular_power = 0.0f; 19 | 20 | std::string diffuse_map; 21 | }; 22 | 23 | struct MaterialBuffer 24 | { 25 | glm::vec4 ambient; 26 | glm::vec4 diffuse; 27 | glm::vec4 specular; 28 | float specular_power; 29 | 30 | MaterialBuffer& operator=(const Material& mat) 31 | { 32 | ambient = glm::vec4(mat.ambient.x, mat.ambient.y, mat.ambient.z, 0.0f); 33 | diffuse = glm::vec4(mat.diffuse.x, mat.diffuse.y, mat.diffuse.z, 0.0f); 34 | specular = glm::vec4(mat.specular.x, mat.specular.y, mat.specular.z, 0.0f); 35 | specular_power = mat.specular_power; 36 | return *this; 37 | } 38 | 39 | explicit MaterialBuffer(const Material& mat) 40 | { 41 | *this = mat; 42 | } 43 | }; 44 | 45 | struct Mesh 46 | { 47 | std::vector vbo; 48 | std::vector ibo; 49 | std::vector arrays; 50 | AABB aabb; 51 | bool has_vertex = false; 52 | bool has_normal = false; 53 | bool has_texcoord = false; 54 | 55 | Material material; 56 | 57 | void finalize(); 58 | }; 59 | 60 | std::vector load_meshes_obj(const std::string& path); 61 | Mesh create_mesh_box(); 62 | } 63 | 64 | #endif 65 | 66 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/gl/scene.cpp: -------------------------------------------------------------------------------- 1 | #include "scene.hpp" 2 | 3 | using namespace std; 4 | using namespace glm; 5 | 6 | namespace GL 7 | { 8 | void RenderQueue::set_frustum(const Frustum& frustum) 9 | { 10 | this->frustum = frustum; 11 | } 12 | 13 | void RenderQueue::begin() 14 | { 15 | draw_list.clear(); 16 | } 17 | 18 | void RenderQueue::end() 19 | { 20 | // Frustum culling. 21 | draw_list.erase(remove_if(std::begin(draw_list), std::end(draw_list), [this](Renderable* draw) -> bool { 22 | auto aabb = draw->get_aabb(); 23 | 24 | BoundingSphere sphere{aabb}; 25 | draw->set_cache_depth(dot(frustum.planes[0], vec4(sphere.pos_radius.xyz, 1.0f))); 26 | 27 | return !frustum.intersects_with_sphere(sphere); 28 | }), 29 | std::end(draw_list)); 30 | 31 | // Sort based on various criteria. 32 | sort(std::begin(draw_list), std::end(draw_list), 33 | [](Renderable* a, Renderable* b) -> bool { 34 | return a->compare_less(*b); 35 | }); 36 | 37 | //Log::log("%zu draw calls.", draw_list.size()); 38 | } 39 | 40 | const RenderQueue::DrawList& RenderQueue::get_draw_list() const 41 | { 42 | return draw_list; 43 | } 44 | 45 | void RenderQueue::push(Renderable* elem) 46 | { 47 | draw_list.push_back(elem); 48 | } 49 | 50 | void RenderQueue::render() 51 | { 52 | for (auto& elem : draw_list) 53 | elem->render(); 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/gl/scene.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SCENE_HPP__ 2 | #define SCENE_HPP__ 3 | 4 | #include "global.hpp" 5 | #include "mesh.hpp" 6 | #include "aabb.hpp" 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace GL 14 | { 15 | struct Renderable 16 | { 17 | virtual void set_cache_depth(float depth) = 0; 18 | virtual const AABB& get_aabb() const = 0; 19 | virtual bool compare_less(const Renderable& other) const = 0; 20 | virtual void render() = 0; 21 | }; 22 | 23 | class RenderQueue 24 | { 25 | public: 26 | using DrawList = std::vector; 27 | 28 | void set_frustum(const Frustum& frustum); 29 | void begin(); 30 | void end(); 31 | void push(Renderable* elem); 32 | void render(); 33 | const DrawList& get_draw_list() const; 34 | 35 | private: 36 | DrawList draw_list; 37 | Frustum frustum; 38 | }; 39 | } 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/gl/util.cpp: -------------------------------------------------------------------------------- 1 | #include "util.hpp" 2 | 3 | namespace Log 4 | { 5 | static LogFunc logger_cb; 6 | 7 | void set_logger(LogFunc func) { logger_cb = func; } 8 | LogFunc get_logger() { return logger_cb; } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/gl/vertex_array.cpp: -------------------------------------------------------------------------------- 1 | #include "vertex_array.hpp" 2 | 3 | using namespace std; 4 | 5 | namespace GL 6 | { 7 | void VertexArray::setup() 8 | { 9 | bind(); 10 | 11 | if (elem_buffer) 12 | elem_buffer->bind(); 13 | 14 | for (auto& array : arrays) 15 | { 16 | vertex_buffers[array.buffer_index]->bind(); 17 | glEnableVertexAttribArray(array.location); 18 | glVertexAttribPointer(array.location, array.size, array.type, 19 | array.normalized, array.stride, reinterpret_cast(array.offset)); 20 | glVertexAttribDivisor(array.location, array.divisor); 21 | vertex_buffers[array.buffer_index]->unbind(); 22 | } 23 | 24 | unbind(); 25 | 26 | if (elem_buffer) 27 | elem_buffer->unbind(); 28 | } 29 | 30 | void VertexArray::bind() 31 | { 32 | glBindVertexArray(vao); 33 | } 34 | 35 | void VertexArray::unbind() 36 | { 37 | glBindVertexArray(0); 38 | } 39 | 40 | void VertexArray::setup(const vector& arrays, std::vector vertex_buffers, Buffer *elem_buffer) 41 | { 42 | this->arrays = arrays; 43 | for (auto vert : this->vertex_buffers) 44 | unregister_dependency(vert); 45 | if (this->elem_buffer) 46 | unregister_dependency(this->elem_buffer); 47 | 48 | this->vertex_buffers = move(vertex_buffers); 49 | this->elem_buffer = elem_buffer; 50 | 51 | for (auto vert : this->vertex_buffers) 52 | register_dependency(vert); 53 | if (this->elem_buffer) 54 | register_dependency(this->elem_buffer); 55 | 56 | if (alive) 57 | { 58 | destroyed(); 59 | reset(); 60 | if (!arrays.empty()) 61 | setup(); 62 | } 63 | } 64 | 65 | void VertexArray::reset() 66 | { 67 | alive = true; 68 | glGenVertexArrays(1, &vao); 69 | 70 | if (!arrays.empty()) 71 | setup(); 72 | } 73 | 74 | void VertexArray::destroyed() 75 | { 76 | glDeleteVertexArrays(1, &vao); 77 | vao = 0; 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/gl/vertex_array.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VERTEX_ARRAY_HPP__ 2 | #define VERTEX_ARRAY_HPP__ 3 | 4 | #include "global.hpp" 5 | #include "buffer.hpp" 6 | 7 | namespace GL 8 | { 9 | class VertexArray : public ContextListener 10 | { 11 | public: 12 | VertexArray() { init(); } 13 | ~VertexArray() { deinit(); } 14 | struct Array 15 | { 16 | GLuint location; 17 | GLint size; 18 | GLenum type; 19 | GLboolean normalized; 20 | 21 | GLuint stride; 22 | unsigned buffer_index; 23 | unsigned divisor; 24 | GLsizei offset; 25 | }; 26 | 27 | void reset() override; 28 | void destroyed() override; 29 | 30 | void setup(const std::vector& arrays, std::vector vertex_buffers, Buffer *elem_buffer); 31 | 32 | void bind(); 33 | void unbind(); 34 | 35 | private: 36 | GLuint vao = 0; 37 | bool alive = false; 38 | std::vector arrays; 39 | std::vector vertex_buffers; 40 | Buffer* elem_buffer = nullptr; 41 | void setup(); 42 | }; 43 | } 44 | 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/_fixes.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/_fixes.hpp 25 | /// @date 2011-02-21 / 2011-11-22 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #include 30 | 31 | //! Workaround for compatibility with other libraries 32 | #ifdef max 33 | #undef max 34 | #endif 35 | 36 | //! Workaround for compatibility with other libraries 37 | #ifdef min 38 | #undef min 39 | #endif 40 | 41 | //! Workaround for Android 42 | #ifdef isnan 43 | #undef isnan 44 | #endif 45 | 46 | //! Workaround for Android 47 | #ifdef isinf 48 | #undef isinf 49 | #endif 50 | 51 | //! Workaround for Chrone Native Client 52 | #ifdef log2 53 | #undef log2 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/dummy.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/dummy.cpp 25 | /// @date 2011-01-19 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /// 28 | /// GLM is a header only library. There is nothing to compile. 29 | /// dummy.cpp exist only a wordaround for CMake file. 30 | /////////////////////////////////////////////////////////////////////////////////// 31 | 32 | #define GLM_MESSAGES 33 | #include "../glm.hpp" 34 | 35 | //#error "GLM is a header only library" 36 | 37 | int main() 38 | { 39 | 40 | } 41 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/hint.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/hint.hpp 25 | /// @date 2008-08-14 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type 30 | #define glm_core_type 31 | 32 | namespace glm 33 | { 34 | // Use dont_care, nicest and fastest to optimize implementations. 35 | class dont_care {}; 36 | class nicest {}; 37 | class fastest {}; 38 | }//namespace glm 39 | 40 | #endif//glm_core_type 41 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/intrinsic_exponential.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_exponential.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/intrinsic_geometric.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_geometric.hpp 25 | /// @date 2009-05-08 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_intrinsic_geometric 30 | #define glm_core_intrinsic_geometric 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | #include "intrinsic_common.hpp" 39 | 40 | namespace glm{ 41 | namespace detail 42 | { 43 | //length 44 | __m128 sse_len_ps(__m128 x); 45 | 46 | //distance 47 | __m128 sse_dst_ps(__m128 p0, __m128 p1); 48 | 49 | //dot 50 | __m128 sse_dot_ps(__m128 v1, __m128 v2); 51 | 52 | // SSE1 53 | __m128 sse_dot_ss(__m128 v1, __m128 v2); 54 | 55 | //cross 56 | __m128 sse_xpd_ps(__m128 v1, __m128 v2); 57 | 58 | //normalize 59 | __m128 sse_nrm_ps(__m128 v); 60 | 61 | //faceforward 62 | __m128 sse_ffd_ps(__m128 N, __m128 I, __m128 Nref); 63 | 64 | //reflect 65 | __m128 sse_rfe_ps(__m128 I, __m128 N); 66 | 67 | //refract 68 | __m128 sse_rfa_ps(__m128 I, __m128 N, __m128 eta); 69 | 70 | }//namespace detail 71 | }//namespace glm 72 | 73 | #include "intrinsic_geometric.inl" 74 | 75 | #endif//GLM_ARCH 76 | #endif//glm_core_intrinsic_geometric 77 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/intrinsic_matrix.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_common.hpp 25 | /// @date 2009-06-05 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_matrix 30 | #define glm_detail_intrinsic_matrix 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | #include "intrinsic_geometric.hpp" 39 | 40 | namespace glm{ 41 | namespace detail 42 | { 43 | void sse_add_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]); 44 | 45 | void sse_sub_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]); 46 | 47 | __m128 sse_mul_ps(__m128 m[4], __m128 v); 48 | 49 | __m128 sse_mul_ps(__m128 v, __m128 m[4]); 50 | 51 | void sse_mul_ps(__m128 const in1[4], __m128 const in2[4], __m128 out[4]); 52 | 53 | void sse_transpose_ps(__m128 const in[4], __m128 out[4]); 54 | 55 | void sse_inverse_ps(__m128 const in[4], __m128 out[4]); 56 | 57 | void sse_rotate_ps(__m128 const in[4], float Angle, float const v[3], __m128 out[4]); 58 | 59 | __m128 sse_det_ps(__m128 const m[4]); 60 | 61 | __m128 sse_slow_det_ps(__m128 const m[4]); 62 | 63 | }//namespace detail 64 | }//namespace glm 65 | 66 | #include "intrinsic_matrix.inl" 67 | 68 | #endif//GLM_ARCH 69 | #endif//glm_detail_intrinsic_matrix 70 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/intrinsic_trigonometric.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_trigonometric.hpp 25 | /// @date 2009-06-09 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_trigonometric 30 | #define glm_detail_intrinsic_trigonometric 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | 42 | }//namespace detail 43 | }//namespace glm 44 | 45 | #include "intrinsic_trigonometric.inl" 46 | 47 | #endif//GLM_ARCH 48 | #endif//glm_detail_intrinsic_trigonometric 49 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/intrinsic_trigonometric.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_trigonometric.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/intrinsic_vector_relational.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_vector_relational.hpp 25 | /// @date 2009-06-09 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_vector_relational 30 | #define glm_detail_intrinsic_vector_relational 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | 42 | }//namespace detail 43 | }//namespace glm 44 | 45 | #include "intrinsic_vector_relational.inl" 46 | 47 | #endif//GLM_ARCH 48 | #endif//glm_detail_intrinsic_vector_relational 49 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/type_half.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-samples/bce193bc1b8c9a3da43b2ead0158a69e28b37ed8/video/opengl/libretro_test_gl_compute_shaders/glm/core/type_half.inl -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/type_mat.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_mat.hpp 25 | /// @date 2010-01-26 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_mat 30 | #define glm_core_type_mat 31 | 32 | #include "type_gentype.hpp" 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | 38 | }//namespace detail 39 | }//namespace glm 40 | 41 | #endif//glm_core_type_mat 42 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/type_mat.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_mat.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/type_size.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_size.hpp 25 | /// @date 2008-10-05 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_size 30 | #define glm_core_type_size 31 | 32 | #include 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | //typedef std::size_t size_t; 38 | typedef int sizeType; 39 | 40 | }//namespace detail 41 | }//namespace glm 42 | 43 | #endif//glm_core_type_size 44 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/type_vec.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_vec.hpp 25 | /// @date 2010-01-26 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_vec 30 | #define glm_core_type_vec 31 | 32 | #include "type_gentype.hpp" 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | 38 | }//namespace detail 39 | }//namespace glm 40 | 41 | #endif//glm_core_type_vec 42 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/core/type_vec.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_vec.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtc_swizzle 24 | /// @file glm/gtc/swizzle.inl 25 | /// @date 2009-06-14 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | namespace glm 30 | { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/closest_point.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_bit 24 | /// @file glm/gtx/bit.hpp 25 | /// @date 2005-12-30 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_closest_point GLM_GTX_closest_point 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Find the point on a straight line which is the closet of a point. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_closest_point 39 | #define GLM_GTX_closest_point GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_closest_point extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_closest_point 51 | /// @{ 52 | 53 | /// Find the point on a straight line which is the closet of a point. 54 | /// @see gtx_closest_point 55 | template 56 | detail::tvec3 closestPointOnLine( 57 | detail::tvec3 const & point, 58 | detail::tvec3 const & a, 59 | detail::tvec3 const & b); 60 | 61 | /// @} 62 | }// namespace glm 63 | 64 | #include "closest_point.inl" 65 | 66 | #endif//GLM_GTX_closest_point 67 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-30 5 | // Updated : 2008-10-05 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/closest_point.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | #ifndef glm_gtx_closest_point 11 | #define glm_gtx_closest_point 12 | 13 | namespace glm 14 | { 15 | template 16 | GLM_FUNC_QUALIFIER detail::tvec3 closestPointOnLine 17 | ( 18 | detail::tvec3 const & point, 19 | detail::tvec3 const & a, 20 | detail::tvec3 const & b 21 | ) 22 | { 23 | valType LineLength = distance(a, b); 24 | detail::tvec3 Vector = point - a; 25 | detail::tvec3 LineDirection = (b - a) / LineLength; 26 | 27 | // Project Vector to LineDirection to get the distance of point from a 28 | valType Distance = dot(Vector, LineDirection); 29 | 30 | if(Distance <= valType(0)) return a; 31 | if(Distance >= LineLength) return b; 32 | return a + LineDirection * Distance; 33 | } 34 | }//namespace glm 35 | 36 | #endif//glm_gtx_closest_point 37 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/color_space_YCoCg.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-10-28 5 | // Updated : 2008-10-28 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/color_space_YCoCg.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 rgb2YCoCg 14 | ( 15 | detail::tvec3 const & rgbColor 16 | ) 17 | { 18 | detail::tvec3 result; 19 | result.x/*Y */ = rgbColor.r / valType(4) + rgbColor.g / valType(2) + rgbColor.b / valType(4); 20 | result.y/*Co*/ = rgbColor.r / valType(2) + rgbColor.g * valType(0) - rgbColor.b / valType(2); 21 | result.z/*Cg*/ = - rgbColor.r / valType(4) + rgbColor.g / valType(2) - rgbColor.b / valType(4); 22 | return result; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER detail::tvec3 rgb2YCoCgR 27 | ( 28 | detail::tvec3 const & rgbColor 29 | ) 30 | { 31 | detail::tvec3 result; 32 | result.x/*Y */ = rgbColor.g / valType(2) + (rgbColor.r + rgbColor.b) / valType(4); 33 | result.y/*Co*/ = rgbColor.r - rgbColor.b; 34 | result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) / valType(2); 35 | return result; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER detail::tvec3 YCoCg2rgb 40 | ( 41 | detail::tvec3 const & YCoCgColor 42 | ) 43 | { 44 | detail::tvec3 result; 45 | result.r = YCoCgColor.x + YCoCgColor.y - YCoCgColor.z; 46 | result.g = YCoCgColor.x + YCoCgColor.z; 47 | result.b = YCoCgColor.x - YCoCgColor.y - YCoCgColor.z; 48 | return result; 49 | } 50 | 51 | template 52 | GLM_FUNC_QUALIFIER detail::tvec3 YCoCgR2rgb 53 | ( 54 | detail::tvec3 const & YCoCgRColor 55 | ) 56 | { 57 | detail::tvec3 result; 58 | valType tmp = YCoCgRColor.x - (YCoCgRColor.z / valType(2)); 59 | result.g = YCoCgRColor.z + tmp; 60 | result.b = tmp - (YCoCgRColor.y / valType(2)); 61 | result.r = result.b + YCoCgRColor.y; 62 | return result; 63 | } 64 | }//namespace glm 65 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/compatibility.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-03-16 5 | // Updated : 2008-10-24 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/compatibility.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | // isfinite 13 | template 14 | GLM_FUNC_QUALIFIER bool isfinite( 15 | genType const & x) 16 | { 17 | # if(GLM_COMPILER & GLM_COMPILER_VC) 18 | return _finite(x); 19 | # elif(GLM_COMPILER & GLM_COMPILER_GCC) 20 | # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) 21 | return _isfinite(x) != 0; 22 | # else 23 | return std::isfinite(x) != 0; 24 | # endif 25 | # else 26 | return std::isfinite(x) != 0; 27 | # endif 28 | } 29 | 30 | template 31 | GLM_FUNC_QUALIFIER detail::tvec2 isfinite( 32 | detail::tvec2 const & x) 33 | { 34 | return detail::tvec2( 35 | isfinite(x.x), 36 | isfinite(x.y)); 37 | } 38 | 39 | template 40 | GLM_FUNC_QUALIFIER detail::tvec3 isfinite( 41 | detail::tvec3 const & x) 42 | { 43 | return detail::tvec3( 44 | isfinite(x.x), 45 | isfinite(x.y), 46 | isfinite(x.z)); 47 | } 48 | 49 | template 50 | GLM_FUNC_QUALIFIER detail::tvec4 isfinite( 51 | detail::tvec4 const & x) 52 | { 53 | return detail::tvec4( 54 | isfinite(x.x), 55 | isfinite(x.y), 56 | isfinite(x.z), 57 | isfinite(x.w)); 58 | } 59 | 60 | }//namespace glm 61 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/component_wise.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-05-21 5 | // Updated : 2010-02-12 6 | // Licence : This source is under MIT License 7 | // File : gtx_component_wise.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER typename genType::value_type compAdd(genType const & v) 14 | { 15 | typename genType::value_type result = typename genType::value_type(0); 16 | for(typename genType::size_type i = 0; i < v.length(); ++i) 17 | result += v[i]; 18 | return result; 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER typename genType::value_type compMul(genType const & v) 23 | { 24 | typename genType::value_type result = typename genType::value_type(1); 25 | for(typename genType::size_type i = 0; i < v.length(); ++i) 26 | result *= v[i]; 27 | return result; 28 | } 29 | 30 | template 31 | GLM_FUNC_QUALIFIER typename genType::value_type compMin(genType const & v) 32 | { 33 | typename genType::value_type result = typename genType::value_type(v[0]); 34 | for(typename genType::size_type i = 1; i < v.length(); ++i) 35 | result = min(result, v[i]); 36 | return result; 37 | } 38 | 39 | template 40 | GLM_FUNC_QUALIFIER typename genType::value_type compMax(genType const & v) 41 | { 42 | typename genType::value_type result = typename genType::value_type(v[0]); 43 | for(typename genType::size_type i = 1; i < v.length(); ++i) 44 | result = max(result, v[i]); 45 | return result; 46 | } 47 | }//namespace glm 48 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/constants.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #ifndef GLM_GTX_constants 25 | #define GLM_GTX_constants GLM_VERSION 26 | 27 | #include "../gtc/constants.hpp" 28 | 29 | #if(defined(GLM_MESSAGES)) 30 | # pragma message("GLM: GLM_GTX_constants extension is deprecated, include GLM_GTC_constants (glm/gtc/constants.hpp) instead") 31 | #endif 32 | 33 | #endif//GLM_GTX_constants 34 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/epsilon.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_epsilon extension is deprecated, include GLM_GTC_epsilon (glm/gtc/epsilon) instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/epsilon.hpp" 30 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/extend.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_extend 24 | /// @file glm/gtx/extend.hpp 25 | /// @date 2006-01-07 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_extend GLM_GTX_extend 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Extend a position from a source to a position at a defined length. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_extend 39 | #define GLM_GTX_extend GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_extend extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_extend 51 | /// @{ 52 | 53 | /// Extends of Length the Origin position using the (Source - Origin) direction. 54 | /// @see gtx_extend 55 | template 56 | genType extend( 57 | genType const & Origin, 58 | genType const & Source, 59 | typename genType::value_type const Length); 60 | 61 | /// @} 62 | }//namespace glm 63 | 64 | #include "extend.inl" 65 | 66 | #endif//GLM_GTX_extend 67 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-01-07 5 | // Updated : 2008-10-05 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/extend.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | genType extend 14 | ( 15 | genType const & Origin, 16 | genType const & Source, 17 | genType const & Distance 18 | ) 19 | { 20 | return Origin + (Source - Origin) * Distance; 21 | } 22 | 23 | template 24 | detail::tvec2 extend 25 | ( 26 | detail::tvec2 const & Origin, 27 | detail::tvec2 const & Source, 28 | valType const & Distance 29 | ) 30 | { 31 | return Origin + (Source - Origin) * Distance; 32 | } 33 | 34 | template 35 | detail::tvec3 extend 36 | ( 37 | detail::tvec3 const & Origin, 38 | detail::tvec3 const & Source, 39 | valType const & Distance 40 | ) 41 | { 42 | return Origin + (Source - Origin) * Distance; 43 | } 44 | 45 | template 46 | detail::tvec4 extend 47 | ( 48 | detail::tvec4 const & Origin, 49 | detail::tvec4 const & Source, 50 | valType const & Distance 51 | ) 52 | { 53 | return Origin + (Source - Origin) * Distance; 54 | } 55 | }//namespace glm 56 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/fast_trigonometry.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-01-08 5 | // Updated : 2011-10-14 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/fast_trigonometry.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | // sin 13 | template 14 | GLM_FUNC_QUALIFIER T fastSin(T const & x) 15 | { 16 | return x - ((x * x * x) / T(6)) + ((x * x * x * x * x) / T(120)) - ((x * x * x * x * x * x * x) / T(5040)); 17 | } 18 | 19 | VECTORIZE_VEC(fastSin) 20 | 21 | // cos 22 | template 23 | GLM_FUNC_QUALIFIER T fastCos(T const & x) 24 | { 25 | return T(1) - (x * x * T(0.5)) + (x * x * x * x * T(0.041666666666)) - (x * x * x * x * x * x * T(0.00138888888888)); 26 | } 27 | 28 | VECTORIZE_VEC(fastCos) 29 | 30 | // tan 31 | template 32 | GLM_FUNC_QUALIFIER T fastTan(T const & x) 33 | { 34 | return x + (x * x * x * T(0.3333333333)) + (x * x * x * x * x * T(0.1333333333333)) + (x * x * x * x * x * x * x * T(0.0539682539)); 35 | } 36 | 37 | VECTORIZE_VEC(fastTan) 38 | 39 | // asin 40 | template 41 | GLM_FUNC_QUALIFIER T fastAsin(T const & x) 42 | { 43 | return x + (x * x * x * T(0.166666667)) + (x * x * x * x * x * T(0.075)) + (x * x * x * x * x * x * x * T(0.0446428571)) + (x * x * x * x * x * x * x * x * x * T(0.0303819444));// + (x * x * x * x * x * x * x * x * x * x * x * T(0.022372159)); 44 | } 45 | 46 | VECTORIZE_VEC(fastAsin) 47 | 48 | // acos 49 | template 50 | GLM_FUNC_QUALIFIER T fastAcos(T const & x) 51 | { 52 | return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2) 53 | } 54 | 55 | VECTORIZE_VEC(fastAcos) 56 | 57 | // atan 58 | template 59 | GLM_FUNC_QUALIFIER T fastAtan(T const & y, T const & x) 60 | { 61 | T sgn = sign(y) * sign(x); 62 | return abs(fastAtan(y / x)) * sgn; 63 | } 64 | 65 | VECTORIZE_VEC_VEC(fastAtan) 66 | 67 | template 68 | GLM_FUNC_QUALIFIER T fastAtan(T const & x) 69 | { 70 | return x - (x * x * x * T(0.333333333333)) + (x * x * x * x * x * T(0.2)) - (x * x * x * x * x * x * x * T(0.1428571429)) + (x * x * x * x * x * x * x * x * x * T(0.111111111111)) - (x * x * x * x * x * x * x * x * x * x * x * T(0.0909090909)); 71 | } 72 | 73 | VECTORIZE_VEC(fastAtan) 74 | 75 | }//namespace glm 76 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2009-03-06 5 | // Updated : 2009-03-09 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/gradient_paint.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | valType radialGradient 14 | ( 15 | detail::tvec2 const & Center, 16 | valType const & Radius, 17 | detail::tvec2 const & Focal, 18 | detail::tvec2 const & Position 19 | ) 20 | { 21 | detail::tvec2 F = Focal - Center; 22 | detail::tvec2 D = Position - Focal; 23 | valType Radius2 = pow2(Radius); 24 | valType Fx2 = pow2(F.x); 25 | valType Fy2 = pow2(F.y); 26 | 27 | valType Numerator = (D.x * F.x + D.y * F.y) + sqrt(Radius2 * (pow2(D.x) + pow2(D.y)) - pow2(D.x * F.y - D.y * F.x)); 28 | valType Denominator = Radius2 - (Fx2 + Fy2); 29 | return Numerator / Denominator; 30 | } 31 | 32 | template 33 | valType linearGradient 34 | ( 35 | detail::tvec2 const & Point0, 36 | detail::tvec2 const & Point1, 37 | detail::tvec2 const & Position 38 | ) 39 | { 40 | detail::tvec2 Dist = Point1 - Point0; 41 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); 42 | } 43 | }//namespace glm 44 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-02-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/handed_coordinate_space.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER bool rightHanded 14 | ( 15 | detail::tvec3 const & tangent, 16 | detail::tvec3 const & binormal, 17 | detail::tvec3 const & normal 18 | ) 19 | { 20 | return dot(cross(normal, tangent), binormal) > T(0); 21 | } 22 | 23 | template 24 | GLM_FUNC_QUALIFIER bool leftHanded 25 | ( 26 | detail::tvec3 const & tangent, 27 | detail::tvec3 const & binormal, 28 | detail::tvec3 const & normal 29 | ) 30 | { 31 | return dot(cross(normal, tangent), binormal) < T(0); 32 | } 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/int_10_10_10_2.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_int_10_10_10_2 24 | /// @file glm/gtx/int_10_10_10_2.hpp 25 | /// @date 2010-07-07 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_raw_data (dependence) 30 | /// 31 | /// @defgroup gtx_int_10_10_10_2 GLM_GTX_int_10_10_10_2 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Pack vector to 1010102 integers. Storage only. 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_int_10_10_10_2 40 | #define GLM_GTX_int_10_10_10_2 GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | #include "../gtx/raw_data.hpp" 45 | 46 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 47 | # pragma message("GLM: GLM_GTX_int_10_10_10_2 extension included") 48 | #endif 49 | 50 | namespace glm 51 | { 52 | /// @addtogroup gtx_int_10_10_10_2 53 | /// @{ 54 | 55 | //! From GLM_GTX_int_10_10_10_2 extension. 56 | //! Cast a vec4 to an u_10_10_10_2. 57 | dword uint10_10_10_2_cast(glm::vec4 const & v); 58 | 59 | /// @} 60 | }//namespace glm 61 | 62 | #include "int_10_10_10_2.inl" 63 | 64 | #endif//GLM_GTX_int_10_10_10_2 65 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/int_10_10_10_2.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2010-07-07 5 | // Updated : 2010-07-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/int_10_10_10_2.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast 13 | ( 14 | glm::vec4 const & v 15 | ) 16 | { 17 | return dword(uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30); 18 | } 19 | }//namespace glm 20 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/log_base.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_log_base 24 | /// @file glm/gtx/log_base.hpp 25 | /// @date 2008-10-24 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_log_base GLM_GTX_log_base 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Logarithm for any base. base can be a vector or a scalar. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_log_base 39 | #define GLM_GTX_log_base GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_log_base extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_log_base 51 | /// @{ 52 | 53 | //! Logarithm for any base. 54 | //! From GLM_GTX_log_base. 55 | template 56 | genType log( 57 | genType const & x, 58 | genType const & base); 59 | 60 | /// @} 61 | }//namespace glm 62 | 63 | #include "log_base.inl" 64 | 65 | #endif//GLM_GTX_log_base 66 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-10-24 5 | // Updated : 2008-10-24 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/log_base.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType log( 14 | genType const & x, 15 | genType const & base) 16 | { 17 | assert(x != genType(0)); 18 | 19 | return glm::log(x) / glm::log(base); 20 | } 21 | 22 | VECTORIZE_VEC_SCA(log) 23 | VECTORIZE_VEC_VEC(log) 24 | }//namespace glm 25 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-21 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/matrix_cross_product.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat3x3 matrixCross3 14 | ( 15 | detail::tvec3 const & x 16 | ) 17 | { 18 | detail::tmat3x3 Result(T(0)); 19 | Result[0][1] = x.z; 20 | Result[1][0] = -x.z; 21 | Result[0][2] = -x.y; 22 | Result[2][0] = x.y; 23 | Result[1][2] = x.x; 24 | Result[2][1] = -x.x; 25 | return Result; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER detail::tmat4x4 matrixCross4 30 | ( 31 | detail::tvec3 const & x 32 | ) 33 | { 34 | detail::tmat4x4 Result(T(0)); 35 | Result[0][1] = x.z; 36 | Result[1][0] = -x.z; 37 | Result[0][2] = -x.y; 38 | Result[2][0] = x.y; 39 | Result[1][2] = x.x; 40 | Result[2][1] = -x.x; 41 | return Result; 42 | } 43 | 44 | }//namespace glm 45 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/mixed_product.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_mixed_product 24 | /// @file glm/gtx/mixed_product.hpp 25 | /// @date 2007-04-03 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_mixed_product GLM_GTX_mixed_producte 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Mixed product of 3 vectors. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_mixed_product 39 | #define GLM_GTX_mixed_product GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_mixed_product extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_mixed_product 51 | /// @{ 52 | 53 | /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) 54 | template 55 | valType mixedProduct( 56 | detail::tvec3 const & v1, 57 | detail::tvec3 const & v2, 58 | detail::tvec3 const & v3); 59 | 60 | /// @} 61 | }// namespace glm 62 | 63 | #include "mixed_product.inl" 64 | 65 | #endif//GLM_GTX_mixed_product 66 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-04-03 5 | // Updated : 2008-09-17 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/mixed_product.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER valType mixedProduct 14 | ( 15 | detail::tvec3 const & v1, 16 | detail::tvec3 const & v2, 17 | detail::tvec3 const & v3 18 | ) 19 | { 20 | return dot(cross(v1, v2), v3); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/noise.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_random extension is deprecated, include GLM_GTC_random (glm/gtc/noise.hpp) instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/noise.hpp" 30 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/normal.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_normal 24 | /// @file glm/gtx/normal.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_extented_min_max (dependence) 30 | /// 31 | /// @defgroup gtx_normal GLM_GTX_normal 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Compute the normal of a triangle. 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_normal 40 | #define GLM_GTX_normal GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_normal extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_normal 52 | /// @{ 53 | 54 | //! Computes triangle normal from triangle points. 55 | //! From GLM_GTX_normal extension. 56 | template 57 | detail::tvec3 triangleNormal( 58 | detail::tvec3 const & p1, 59 | detail::tvec3 const & p2, 60 | detail::tvec3 const & p3); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "normal.inl" 66 | 67 | #endif//GLM_GTX_normal 68 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2011-06-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/normal.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 triangleNormal 14 | ( 15 | detail::tvec3 const & p1, 16 | detail::tvec3 const & p2, 17 | detail::tvec3 const & p3 18 | ) 19 | { 20 | return normalize(cross(p1 - p2, p1 - p3)); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-05-10 5 | // Updated : 2007-05-10 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/number_precision.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/ocl_type.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_ocl_type 24 | /// @file glm/gtx/ocl_type.inl 25 | /// @date 2013-03-16 / 2013-03-16 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-27 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/optimum_pow.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType pow2(const genType& x) 14 | { 15 | return x * x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType pow3(const genType& x) 20 | { 21 | return x * x * x; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER genType pow4(const genType& x) 26 | { 27 | return x * x * x * x; 28 | } 29 | 30 | GLM_FUNC_QUALIFIER bool powOfTwo(int x) 31 | { 32 | return !(x & (x - 1)); 33 | } 34 | 35 | GLM_FUNC_QUALIFIER detail::tvec2 powOfTwo(const detail::tvec2& x) 36 | { 37 | return detail::tvec2( 38 | powOfTwo(x.x), 39 | powOfTwo(x.y)); 40 | } 41 | 42 | GLM_FUNC_QUALIFIER detail::tvec3 powOfTwo(const detail::tvec3& x) 43 | { 44 | return detail::tvec3( 45 | powOfTwo(x.x), 46 | powOfTwo(x.y), 47 | powOfTwo(x.z)); 48 | } 49 | 50 | GLM_FUNC_QUALIFIER detail::tvec4 powOfTwo(const detail::tvec4& x) 51 | { 52 | return detail::tvec4( 53 | powOfTwo(x.x), 54 | powOfTwo(x.y), 55 | powOfTwo(x.z), 56 | powOfTwo(x.w)); 57 | } 58 | }//namespace glm 59 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-21 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/orthonormalize.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat3x3 orthonormalize 14 | ( 15 | const detail::tmat3x3& m 16 | ) 17 | { 18 | detail::tmat3x3 r = m; 19 | 20 | r[0] = normalize(r[0]); 21 | 22 | float d0 = dot(r[0], r[1]); 23 | r[1] -= r[0] * d0; 24 | r[1] = normalize(r[1]); 25 | 26 | float d1 = dot(r[1], r[2]); 27 | d0 = dot(r[0], r[2]); 28 | r[2] -= r[0] * d0 + r[1] * d1; 29 | r[2] = normalize(r[2]); 30 | 31 | return r; 32 | } 33 | 34 | template 35 | GLM_FUNC_QUALIFIER detail::tvec3 orthonormalize 36 | ( 37 | const detail::tvec3& x, 38 | const detail::tvec3& y 39 | ) 40 | { 41 | return normalize(x - y * dot(y, x)); 42 | } 43 | }//namespace glm 44 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/perpendicular.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_perpendicular 24 | /// @file glm/gtx/perpendicular.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_projection (dependence) 30 | /// 31 | /// @defgroup gtx_perpendicular GLM_GTX_perpendicular 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Perpendicular of a vector from other one 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_perpendicular 40 | #define GLM_GTX_perpendicular GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | #include "../gtx/projection.hpp" 45 | 46 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 47 | # pragma message("GLM: GLM_GTX_perpendicular extension included") 48 | #endif 49 | 50 | namespace glm 51 | { 52 | /// @addtogroup gtx_perpendicular 53 | /// @{ 54 | 55 | //! Projects x a perpendicular axis of Normal. 56 | //! From GLM_GTX_perpendicular extension. 57 | template 58 | vecType perp( 59 | vecType const & x, 60 | vecType const & Normal); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "perpendicular.inl" 66 | 67 | #endif//GLM_GTX_perpendicular 68 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-03-06 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/perpendicular.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER vecType perp 14 | ( 15 | vecType const & x, 16 | vecType const & Normal 17 | ) 18 | { 19 | return x - proj(x, Normal); 20 | } 21 | }//namespace glm 22 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-03-06 5 | // Updated : 2009-05-01 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/polar_coordinates.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 polar 14 | ( 15 | detail::tvec3 const & euclidean 16 | ) 17 | { 18 | T const Length(length(euclidean)); 19 | detail::tvec3 const tmp(euclidean / Length); 20 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 21 | 22 | #ifdef GLM_FORCE_RADIANS 23 | return detail::tvec3( 24 | atan(xz_dist, tmp.y), // latitude 25 | atan(tmp.x, tmp.z), // longitude 26 | xz_dist); // xz distance 27 | #else 28 | return detail::tvec3( 29 | degrees(atan(xz_dist, tmp.y)), // latitude 30 | degrees(atan(tmp.x, tmp.z)), // longitude 31 | xz_dist); // xz distance 32 | #endif 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER detail::tvec3 euclidean 37 | ( 38 | detail::tvec2 const & polar 39 | ) 40 | { 41 | #ifdef GLM_FORCE_RADIANS 42 | T const latitude(polar.x); 43 | T const longitude(polar.y); 44 | #else 45 | T const latitude(radians(polar.x)); 46 | T const longitude(radians(polar.y)); 47 | #endif 48 | 49 | return detail::tvec3( 50 | cos(latitude) * sin(longitude), 51 | sin(latitude), 52 | cos(latitude) * cos(longitude)); 53 | } 54 | 55 | }//namespace glm 56 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/projection.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_projection 24 | /// @file glm/gtx/projection.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_projection GLM_GTX_projection 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Projection of a vector to other one 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_projection 39 | #define GLM_GTX_projection GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_projection extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_projection 51 | /// @{ 52 | 53 | //! Projects x on Normal. 54 | //! From GLM_GTX_projection extension. 55 | template 56 | vecType proj( 57 | vecType const & x, 58 | vecType const & Normal); 59 | 60 | /// @} 61 | }//namespace glm 62 | 63 | #include "projection.inl" 64 | 65 | #endif//GLM_GTX_projection 66 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-03-06 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/projection.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER vecType proj 14 | ( 15 | vecType const & x, 16 | vecType const & Normal 17 | ) 18 | { 19 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 20 | } 21 | }//namespace glm 22 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/random.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_random extension is deprecated, include GLM_GTC_random instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/random.hpp" 30 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-11-19 5 | // Updated : 2008-11-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/raw_data.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | // Dependency: 10 | // - GLM core 11 | /////////////////////////////////////////////////////////////////////////////////////////////////// 12 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/reciprocal.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_reciprocal extension is deprecated, include GLM_GTC_reciprocal instead") 26 | #endif 27 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/spline.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-01-25 5 | // Updated : 2009-02-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/spline.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm{ 11 | 12 | template 13 | GLM_FUNC_QUALIFIER genType catmullRom 14 | ( 15 | genType const & v1, 16 | genType const & v2, 17 | genType const & v3, 18 | genType const & v4, 19 | typename genType::value_type const & s 20 | ) 21 | { 22 | typename genType::value_type s1 = s; 23 | typename genType::value_type s2 = pow2(s); 24 | typename genType::value_type s3 = pow3(s); 25 | 26 | typename genType::value_type f1 = -s3 + typename genType::value_type(2) * s2 - s; 27 | typename genType::value_type f2 = typename genType::value_type(3) * s3 - typename genType::value_type(5) * s2 + typename genType::value_type(2); 28 | typename genType::value_type f3 = typename genType::value_type(-3) * s3 + typename genType::value_type(4) * s2 + s; 29 | typename genType::value_type f4 = s3 - s2; 30 | 31 | return (f1 * v1 + f2 * v2 + f3 * v3 + f4 * v4) / typename genType::value_type(2); 32 | 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER genType hermite 37 | ( 38 | genType const & v1, 39 | genType const & t1, 40 | genType const & v2, 41 | genType const & t2, 42 | typename genType::value_type const & s 43 | ) 44 | { 45 | typename genType::value_type s1 = s; 46 | typename genType::value_type s2 = pow2(s); 47 | typename genType::value_type s3 = pow3(s); 48 | 49 | typename genType::value_type f1 = typename genType::value_type(2) * s3 - typename genType::value_type(3) * s2 + typename genType::value_type(1); 50 | typename genType::value_type f2 = typename genType::value_type(-2) * s3 + typename genType::value_type(3) * s2; 51 | typename genType::value_type f3 = s3 - typename genType::value_type(2) * s2 + s; 52 | typename genType::value_type f4 = s3 - s2; 53 | 54 | return f1 * v1 + f2 * v2 + f3 * t1 + f4 * t2; 55 | } 56 | 57 | template 58 | GLM_FUNC_QUALIFIER genType cubic 59 | ( 60 | genType const & v1, 61 | genType const & v2, 62 | genType const & v3, 63 | genType const & v4, 64 | typename genType::value_type const & s 65 | ) 66 | { 67 | return ((v1 * s + v2) * s + v3) * s + v4; 68 | } 69 | 70 | }//namespace glm 71 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-06-08 5 | // Updated : 2008-06-08 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/std_based_type.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/string_cast.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_string_cast 24 | /// @file glm/gtx/string_cast.hpp 25 | /// @date 2008-04-26 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtc_half_float (dependence) 30 | /// @see gtx_integer (dependence) 31 | /// @see gtx_quaternion (dependence) 32 | /// 33 | /// @defgroup gtx_string_cast GLM_GTX_string_cast 34 | /// @ingroup gtx 35 | /// 36 | /// @brief Setup strings for GLM type values 37 | /// 38 | /// need to be included to use these functionalities. 39 | /////////////////////////////////////////////////////////////////////////////////// 40 | 41 | #ifndef GLM_GTX_string_cast 42 | #define GLM_GTX_string_cast GLM_VERSION 43 | 44 | // Dependency: 45 | #include "../glm.hpp" 46 | #include "../gtc/half_float.hpp" 47 | #include "../gtx/integer.hpp" 48 | #include "../gtx/quaternion.hpp" 49 | #include 50 | 51 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 52 | # pragma message("GLM: GLM_GTX_string_cast extension included") 53 | #endif 54 | 55 | namespace glm 56 | { 57 | /// @addtogroup gtx_string_cast 58 | /// @{ 59 | 60 | /// Create a string from a GLM type value. 61 | /// From GLM_GTX_string_cast extension. 62 | template 63 | std::string to_string(genType const & x); 64 | 65 | /// @} 66 | }//namespace glm 67 | 68 | #include "string_cast.inl" 69 | 70 | #endif//GLM_GTX_string_cast 71 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/transform.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-04-29 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/transform.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat4x4 translate( 14 | T x, T y, T z) 15 | { 16 | return translate( 17 | detail::tmat4x4(1.0f), 18 | detail::tvec3(x, y , z)); 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER detail::tmat4x4 translate( 23 | detail::tmat4x4 const & m, 24 | T x, T y, T z) 25 | { 26 | return translate( 27 | m, detail::tvec3(x, y , z)); 28 | } 29 | 30 | template 31 | GLM_FUNC_QUALIFIER detail::tmat4x4 translate( 32 | detail::tvec3 const & v) 33 | { 34 | return translate( 35 | detail::tmat4x4(1.0f), v); 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER detail::tmat4x4 rotate( 40 | T angle, 41 | T x, T y, T z) 42 | { 43 | return rotate( 44 | detail::tmat4x4(1), angle, detail::tvec3(x, y, z)); 45 | } 46 | 47 | template 48 | GLM_FUNC_QUALIFIER detail::tmat4x4 rotate( 49 | T angle, 50 | detail::tvec3 const & v) 51 | { 52 | return rotate( 53 | detail::tmat4x4(1), angle, v); 54 | } 55 | 56 | template 57 | GLM_FUNC_QUALIFIER detail::tmat4x4 rotate( 58 | detail::tmat4x4 const & m, 59 | T angle, 60 | T x, T y, T z) 61 | { 62 | return rotate( 63 | m, angle, detail::tvec3(x, y, z)); 64 | } 65 | 66 | template 67 | GLM_FUNC_QUALIFIER detail::tmat4x4 scale(T x, T y, T z) 68 | { 69 | return scale( 70 | detail::tmat4x4(1), detail::tvec3(x, y, z)); 71 | } 72 | 73 | template 74 | GLM_FUNC_QUALIFIER detail::tmat4x4 scale( 75 | detail::tmat4x4 const & m, 76 | T x, T y, T z) 77 | { 78 | return scale( 79 | m, detail::tvec3(x, y, z)); 80 | } 81 | 82 | template 83 | GLM_FUNC_QUALIFIER detail::tmat4x4 scale( 84 | detail::tvec3 const & v) 85 | { 86 | return scale( 87 | detail::tmat4x4(1.0f), v); 88 | } 89 | 90 | }//namespace glm 91 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/ulp.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_ulp extension is deprecated, include GLM_GTC_ulp (glm/gtc/ulp.hpp) instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/ulp.hpp" 30 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/unsigned_int.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_unsigned_int extension is deprecated, include GLM_GTX_integer instead") 26 | #endif 27 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/unsigned_int.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-24 5 | // Updated : 2008-10-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/unsigned_int.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | }//namespace glm 14 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/vec1.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_vec1 24 | /// @file glm/gtx/vec1.inl 25 | /// @date 2013-03-16 / 2013-03-16 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/vector_access.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-01-16 5 | // Updated : 2008-10-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/vector_access.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER void set 14 | ( 15 | detail::tvec2& v, 16 | valType const & x, 17 | valType const & y 18 | ) 19 | { 20 | v.x = x; 21 | v.y = y; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER void set 26 | ( 27 | detail::tvec3& v, 28 | valType const & x, 29 | valType const & y, 30 | valType const & z 31 | ) 32 | { 33 | v.x = x; 34 | v.y = y; 35 | v.z = z; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER void set 40 | ( 41 | detail::tvec4& v, 42 | valType const & x, 43 | valType const & y, 44 | valType const & z, 45 | valType const & w 46 | ) 47 | { 48 | v.x = x; 49 | v.y = y; 50 | v.z = z; 51 | v.w = w; 52 | } 53 | }//namespace glm 54 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glm/gtx/vector_angle.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-30 5 | // Updated : 2008-09-29 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/vector_angle.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER typename genType::value_type angle 14 | ( 15 | genType const & x, 16 | genType const & y 17 | ) 18 | { 19 | return degrees(acos(dot(x, y))); 20 | } 21 | 22 | //! \todo epsilon is hard coded to 0.01 23 | template 24 | GLM_FUNC_QUALIFIER valType orientedAngle 25 | ( 26 | detail::tvec2 const & x, 27 | detail::tvec2 const & y 28 | ) 29 | { 30 | #ifdef GLM_FORCE_RADIANS 31 | valType const Angle(acos(dot(x, y))); 32 | #else 33 | valType const Angle(glm::degrees(acos(dot(x, y)))); 34 | #endif 35 | detail::tvec2 const TransformedVector(glm::rotate(x, Angle)); 36 | if(all(epsilonEqual(y, TransformedVector, valType(0.01)))) 37 | return Angle; 38 | else 39 | return -Angle; 40 | } 41 | 42 | template 43 | GLM_FUNC_QUALIFIER valType orientedAngle 44 | ( 45 | detail::tvec3 const & x, 46 | detail::tvec3 const & y, 47 | detail::tvec3 const & ref 48 | ) 49 | { 50 | valType const Angle(glm::degrees(glm::acos(glm::dot(x, y)))); 51 | 52 | if(glm::dot(ref, glm::cross(x, y)) < valType(0)) 53 | return -Angle; 54 | else 55 | return Angle; 56 | } 57 | }//namespace glm 58 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glsym/glsym.h: -------------------------------------------------------------------------------- 1 | #ifndef GLSYM_H__ 2 | #define GLSYM_H__ 3 | 4 | #include "rglgen.h" 5 | 6 | #ifdef HAVE_OPENGLES2 7 | #include "glsym_es2.h" 8 | #else 9 | #include "glsym_gl.h" 10 | #endif 11 | 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glsym/rglgen.c: -------------------------------------------------------------------------------- 1 | #include "rglgen.h" 2 | #include "glsym.h" 3 | #include 4 | 5 | void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, 6 | const struct rglgen_sym_map *map) 7 | { 8 | for (; map->sym; map++) 9 | { 10 | rglgen_func_t func = proc(map->sym); 11 | memcpy(map->ptr, &func, sizeof(func)); 12 | } 13 | } 14 | 15 | void rglgen_resolve_symbols(rglgen_proc_address_t proc) 16 | { 17 | rglgen_resolve_symbols_custom(proc, rglgen_symbol_map); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/glsym/rglgen.h: -------------------------------------------------------------------------------- 1 | #ifndef RGLGEN_H__ 2 | #define RGLGEN_H__ 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include "config.h" 6 | #endif 7 | 8 | #ifdef HAVE_EGL 9 | #include 10 | #include 11 | #endif 12 | 13 | #if defined(IOS) 14 | #include 15 | #include 16 | #elif defined(__APPLE__) 17 | #include 18 | #include 19 | #elif defined(HAVE_PSGL) 20 | #include 21 | #include 22 | #include 23 | #elif defined(HAVE_OPENGL_MODERN) 24 | #include 25 | #include 26 | #elif defined(HAVE_OPENGLES3) 27 | #include 28 | #include 29 | #elif defined(HAVE_OPENGLES2) 30 | #include 31 | #include 32 | #elif defined(HAVE_OPENGLES1) 33 | #include 34 | #include 35 | #else 36 | #include 37 | #include 38 | #endif 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | struct rglgen_sym_map; 45 | 46 | typedef void (*rglgen_func_t)(void); 47 | typedef rglgen_func_t (*rglgen_proc_address_t)(const char*); 48 | void rglgen_resolve_symbols(rglgen_proc_address_t proc); 49 | void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, 50 | const struct rglgen_sym_map *map); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_compute_shaders/rpng/rpng.h: -------------------------------------------------------------------------------- 1 | /* RetroArch - A frontend for libretro. 2 | * Copyright (C) 2010-2013 - Hans-Kristian Arntzen 3 | * 4 | * RetroArch is free software: you can redistribute it and/or modify it under the terms 5 | * of the GNU General Public License as published by the Free Software Found- 6 | * ation, either version 3 of the License, or (at your option) any later version. 7 | * 8 | * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 9 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 10 | * PURPOSE. See the GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along with RetroArch. 13 | * If not, see . 14 | */ 15 | 16 | #ifndef RPNG_H__ 17 | #define RPNG_H__ 18 | 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #else 24 | #include 25 | #endif 26 | 27 | bool rpng_load_image_argb(const char *path, uint32_t **data, unsigned *width, unsigned *height); 28 | 29 | #ifdef HAVE_ZLIB_DEFLATE 30 | bool rpng_save_image_argb(const char *path, const uint32_t *data, 31 | unsigned width, unsigned height, unsigned pitch); 32 | bool rpng_save_image_bgr24(const char *path, const uint8_t *data, 33 | unsigned width, unsigned height, unsigned pitch); 34 | #endif 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_fixedfunction/README.md: -------------------------------------------------------------------------------- 1 | # libretro_test_gl_fixedfunction 2 | This sample demonstrates a libretro core using fixed-function OpenGL (GL 1.4 and later / OpenGL ES 1.x). It should work on both desktop (OpenGL 1.4 and later) and mobile (OpenGL ES 1.x and later) 3 | 4 | ## Requirements 5 | On the desktop - A graphics card driver supporting OpenGL 1.4 and/or higher. 6 | 7 | On mobile - A graphics card driver supporting OpenGLES 1.x and/or higher. 8 | 9 | ## Programming language 10 | C 11 | 12 | ## Building 13 | To compile, you will need a C compiler and assorted toolchain installed. 14 | 15 | make 16 | 17 | This targets [libretro](http://libretro.com) GL interface, so you need a libretro frontend supporting this interface, such as [RetroArch](https://github.com/libretro/RetroArch), installed. 18 | 19 | ## Running 20 | After building, this command should run the program: 21 | 22 | retroarch -L testgl_ff_libretro.so 23 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_fixedfunction/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME = testgl_ff 2 | include_rules 3 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_fixedfunction/glsym/README.md: -------------------------------------------------------------------------------- 1 | # Autogenerate GL extension loaders 2 | 3 | ## OpenGL desktop 4 | 5 | Use Khronos' recent [header](www.opengl.org/registry/api/glext.h). 6 | 7 | ./glgen.py /usr/include/GL/glext.h glsym_gl.h glsym_gl.c 8 | 9 | ## OpenGL ES 10 | 11 | ./glgen.py /usr/include/GLES2/gl2ext.h glsym_es2.h glsym_es2.c 12 | 13 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_fixedfunction/glsym/glsym.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2015 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro SDK code part (glsym). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_GLSYM_H__ 24 | #define __LIBRETRO_SDK_GLSYM_H__ 25 | 26 | #include "rglgen.h" 27 | 28 | #ifndef HAVE_PSGL 29 | #if defined(HAVE_OPENGLES2) 30 | #include "glsym_es2.h" 31 | #elif defined(HAVE_OPENGLES3) 32 | #include "glsym_es3.h" 33 | #else 34 | #include "glsym_gl.h" 35 | #endif 36 | #endif 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_fixedfunction/glsym/rglgen.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2015 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro SDK code part (glsym). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include "rglgen.h" 27 | #include "glsym.h" 28 | 29 | void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, 30 | const struct rglgen_sym_map *map) 31 | { 32 | for (; map->sym; map++) 33 | { 34 | rglgen_func_t func = proc(map->sym); 35 | memcpy(map->ptr, &func, sizeof(func)); 36 | } 37 | } 38 | 39 | void rglgen_resolve_symbols(rglgen_proc_address_t proc) 40 | { 41 | rglgen_resolve_symbols_custom(proc, rglgen_symbol_map); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_fixedfunction/glsym/rglgen.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2015 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro SDK code part (glsym). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef RGLGEN_H__ 24 | #define RGLGEN_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include "config.h" 28 | #endif 29 | 30 | #include "retro_common_api.h" 31 | 32 | #include "rglgen_headers.h" 33 | 34 | RETRO_BEGIN_DECLS 35 | 36 | struct rglgen_sym_map; 37 | 38 | typedef void (*rglgen_func_t)(void); 39 | typedef rglgen_func_t (*rglgen_proc_address_t)(const char*); 40 | void rglgen_resolve_symbols(rglgen_proc_address_t proc); 41 | void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, 42 | const struct rglgen_sym_map *map); 43 | 44 | RETRO_END_DECLS 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_fixedfunction/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := retro-test-gl-ff 6 | 7 | ifeq ($(TARGET_ARCH),arm) 8 | LOCAL_CFLAGS += -DANDROID_ARM 9 | LOCAL_ARM_MODE := arm 10 | endif 11 | 12 | ifeq ($(TARGET_ARCH),x86) 13 | LOCAL_CFLAGS += -DANDROID_X86 14 | endif 15 | 16 | ifeq ($(TARGET_ARCH),mips) 17 | LOCAL_CFLAGS += -DANDROID_MIPS 18 | endif 19 | 20 | GLES_LIB := -lGLESv2 21 | 22 | LOCAL_SRC_FILES += $(addprefix ../,$(wildcard *.c)) ../glsym/rglgen.c ../glsym/glsym_es2.c 23 | LOCAL_CFLAGS += -O2 -Wall -std=gnu99 -ffast-math -DGLES -DHAVE_OPENGLES2 24 | LOCAL_LDLIBS += $(GLES_LIB) 25 | 26 | include $(BUILD_SHARED_LIBRARY) 27 | 28 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_fixedfunction/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | ifeq ($(GLES), 3) 3 | APP_PLATFORM := android-18 4 | else 5 | APP_PLATFORM := android-9 6 | endif 7 | 8 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_fixedfunction/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_shaders/README.md: -------------------------------------------------------------------------------- 1 | # libretro_test_gl_shaders 2 | This sample demonstrates a libretro core using programmable pipeline OpenGL (GL 2.0 and later / OpenGL ES 2.0). It works on both desktop (OpenGL 2.0 and later) and mobile (OpenGL ES 2.0 and later) 3 | 4 | ## Requirements 5 | On the desktop - A graphics card driver supporting OpenGL 2.0 and/or higher. 6 | 7 | On mobile - A graphics card driver supporting OpenGLES 2.0 and/or higher. 8 | 9 | ## Programming language 10 | C 11 | 12 | ## Building 13 | To compile, you will need a C compiler and assorted toolchain installed. 14 | 15 | make 16 | 17 | This targets [libretro](http://libretro.com) GL interface, so you need a libretro frontend supporting this interface, such as [RetroArch](https://github.com/libretro/RetroArch), installed. 18 | 19 | ## Running 20 | After building, this command should run the program: 21 | 22 | retroarch -L testgl_libretro.so 23 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_shaders/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME = testgl 2 | include_rules 3 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_shaders/glsym/README.md: -------------------------------------------------------------------------------- 1 | # Autogenerate GL extension loaders 2 | 3 | ## OpenGL desktop 4 | 5 | Use Khronos' recent [header](www.opengl.org/registry/api/glext.h). 6 | 7 | ./glgen.py /usr/include/GL/glext.h glsym_gl.h glsym_gl.c 8 | 9 | ## OpenGL ES 10 | 11 | ./glgen.py /usr/include/GLES2/gl2ext.h glsym_es2.h glsym_es2.c 12 | 13 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_shaders/glsym/glsym.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2015 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro SDK code part (glsym). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_GLSYM_H__ 24 | #define __LIBRETRO_SDK_GLSYM_H__ 25 | 26 | #include "rglgen.h" 27 | 28 | #ifndef HAVE_PSGL 29 | #if defined(HAVE_OPENGLES2) 30 | #include "glsym_es2.h" 31 | #elif defined(HAVE_OPENGLES3) 32 | #include "glsym_es3.h" 33 | #else 34 | #include "glsym_gl.h" 35 | #endif 36 | #endif 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_shaders/glsym/rglgen.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2015 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro SDK code part (glsym). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include "rglgen.h" 27 | #include "glsym.h" 28 | 29 | void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, 30 | const struct rglgen_sym_map *map) 31 | { 32 | for (; map->sym; map++) 33 | { 34 | rglgen_func_t func = proc(map->sym); 35 | memcpy(map->ptr, &func, sizeof(func)); 36 | } 37 | } 38 | 39 | void rglgen_resolve_symbols(rglgen_proc_address_t proc) 40 | { 41 | rglgen_resolve_symbols_custom(proc, rglgen_symbol_map); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_shaders/glsym/rglgen.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2015 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro SDK code part (glsym). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef RGLGEN_H__ 24 | #define RGLGEN_H__ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include "config.h" 28 | #endif 29 | 30 | #include "retro_common_api.h" 31 | 32 | #include "rglgen_headers.h" 33 | 34 | RETRO_BEGIN_DECLS 35 | 36 | struct rglgen_sym_map; 37 | 38 | typedef void (*rglgen_func_t)(void); 39 | typedef rglgen_func_t (*rglgen_proc_address_t)(const char*); 40 | void rglgen_resolve_symbols(rglgen_proc_address_t proc); 41 | void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, 42 | const struct rglgen_sym_map *map); 43 | 44 | RETRO_END_DECLS 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_shaders/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := retro-test-gl 6 | 7 | ifeq ($(TARGET_ARCH),arm) 8 | LOCAL_CFLAGS += -DANDROID_ARM 9 | LOCAL_ARM_MODE := arm 10 | endif 11 | 12 | ifeq ($(TARGET_ARCH),x86) 13 | LOCAL_CFLAGS += -DANDROID_X86 14 | endif 15 | 16 | ifeq ($(TARGET_ARCH),mips) 17 | LOCAL_CFLAGS += -DANDROID_MIPS 18 | endif 19 | 20 | ifeq ($(GLES), 3) 21 | LOCAL_CFLAGS += -DHAVE_OPENGLES3 -DGLES3 22 | GLES_LIB := -lGLESv3 23 | else 24 | LOCAL_CFLAGS += -DHAVE_OPENGLES2 -DGLES3 25 | GLES_LIB := -lGLESv2 26 | endif 27 | 28 | LOCAL_SRC_FILES += $(addprefix ../,$(wildcard *.c)) ../glsym/rglgen.c ../glsym/glsym_es2.c 29 | LOCAL_CFLAGS += -O2 -Wall -std=gnu99 -ffast-math -DHAVE_OPENGLES 30 | LOCAL_LDLIBS += $(GLES_LIB) 31 | 32 | include $(BUILD_SHARED_LIBRARY) 33 | 34 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_shaders/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | ifeq ($(GLES), 3) 3 | APP_PLATFORM := android-18 4 | else 5 | APP_PLATFORM := android-9 6 | endif 7 | 8 | -------------------------------------------------------------------------------- /video/opengl/libretro_test_gl_shaders/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /video/software/rendering/README.md: -------------------------------------------------------------------------------- 1 | # rendering 2 | This sample demonstrates how to render graphics to the software framebuffer using libretro API. 3 | 4 | ## Programming language 5 | C 6 | 7 | ## Building 8 | To compile, you will need a C compiler and assorted toolchain installed. 9 | 10 | make 11 | -------------------------------------------------------------------------------- /video/software/rendering/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=testsw 2 | include_rules 3 | -------------------------------------------------------------------------------- /video/software/rendering/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | APP_DIR := ../../src 6 | 7 | LOCAL_MODULE := retro 8 | 9 | ifeq ($(TARGET_ARCH),arm) 10 | LOCAL_CFLAGS += -DANDROID_ARM 11 | endif 12 | 13 | ifeq ($(TARGET_ARCH),x86) 14 | LOCAL_CFLAGS += -DANDROID_X86 15 | endif 16 | 17 | ifeq ($(TARGET_ARCH),mips) 18 | LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__ 19 | endif 20 | 21 | LOCAL_SRC_FILES += ../libretro-test.c 22 | LOCAL_CFLAGS += -O3 -std=gnu99 -ffast-math -funroll-loops 23 | 24 | 25 | include $(BUILD_SHARED_LIBRARY) 26 | -------------------------------------------------------------------------------- /video/software/rendering/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /video/software/rendering/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /video/software/rendering_direct_to_vram/README.md: -------------------------------------------------------------------------------- 1 | # rendering 2 | This sample is an extended version of the 'rendering' sample. 3 | 4 | In addition to demonstrating how to render graphics to the software framebuffer, it also 5 | shows you how to use an optional environment callback feature 6 | (RETRO_ENVIRONMENT_GET_CURRENT_SOFTWARE_FRAMEBUFFER) which can avoid a 7 | framebuffer copy and render directly to VRAM, thereby increasing performance. 8 | 9 | This environment callback does not have to be implemented by the libretro frontend's video 10 | driver, therefore you should always provide a fallback path in case it's not available. 11 | 12 | Currently, RetroArch's Vulkan video driver implements this feature. This sample effectively 13 | shows you how to gain better framebuffer blitting performance with a software-rendered core 14 | using Vulkan without having to write any Vulkan code. 15 | 16 | ## Programming language 17 | C 18 | 19 | ## Building 20 | To compile, you will need a C compiler and assorted toolchain installed. 21 | 22 | make 23 | -------------------------------------------------------------------------------- /video/software/rendering_direct_to_vram/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=testsw_vram 2 | include_rules 3 | -------------------------------------------------------------------------------- /video/software/rendering_direct_to_vram/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | APP_DIR := ../../src 6 | 7 | LOCAL_MODULE := retro 8 | 9 | ifeq ($(TARGET_ARCH),arm) 10 | LOCAL_CFLAGS += -DANDROID_ARM 11 | endif 12 | 13 | ifeq ($(TARGET_ARCH),x86) 14 | LOCAL_CFLAGS += -DANDROID_X86 15 | endif 16 | 17 | ifeq ($(TARGET_ARCH),mips) 18 | LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__ 19 | endif 20 | 21 | LOCAL_SRC_FILES += ../libretro-test.c 22 | LOCAL_CFLAGS += -O3 -std=gnu99 -ffast-math -funroll-loops 23 | 24 | 25 | include $(BUILD_SHARED_LIBRARY) 26 | -------------------------------------------------------------------------------- /video/software/rendering_direct_to_vram/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /video/software/rendering_direct_to_vram/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /video/vulkan/vk_async_compute/Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(platform),) 2 | platform = unix 3 | ifeq ($(shell uname -a),) 4 | platform = win 5 | else ifneq ($(findstring MINGW,$(shell uname -a)),) 6 | platform = win 7 | else ifneq ($(findstring Darwin,$(shell uname -a)),) 8 | platform = osx 9 | arch = intel 10 | ifeq ($(shell uname -p),powerpc) 11 | arch = ppc 12 | endif 13 | else ifneq ($(findstring win,$(shell uname -a)),) 14 | platform = win 15 | endif 16 | endif 17 | 18 | # system platform 19 | system_platform = unix 20 | ifeq ($(shell uname -a),) 21 | EXE_EXT = .exe 22 | system_platform = win 23 | else ifneq ($(findstring MINGW,$(shell uname -a)),) 24 | system_platform = win 25 | endif 26 | 27 | TARGET_NAME = testvulkan_async_compute 28 | 29 | ifeq ($(platform), unix) 30 | TARGET := $(TARGET_NAME)_libretro.so 31 | fpic := -fPIC 32 | SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined 33 | else 34 | CC = gcc 35 | TARGET := $(TARGET_NAME)_libretro.dll 36 | SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined 37 | CFLAGS += -I.. 38 | endif 39 | 40 | ifeq ($(DEBUG), 1) 41 | CFLAGS += -O0 -g 42 | else 43 | CFLAGS += -O3 44 | endif 45 | 46 | CFLAGS += -std=gnu99 -Iinclude 47 | OBJECTS := libretro-test.o vulkan_symbol_wrapper.o 48 | CFLAGS += -Wall -pedantic $(fpic) 49 | 50 | all: $(TARGET) 51 | 52 | $(TARGET): $(OBJECTS) 53 | $(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LIBS) -lm 54 | 55 | %.o: %.c 56 | $(CC) -I../../libretro-common/include $(CFLAGS) -c -o $@ $< 57 | 58 | clean: 59 | rm -f $(OBJECTS) $(TARGET) 60 | 61 | .PHONY: clean 62 | 63 | -------------------------------------------------------------------------------- /video/vulkan/vk_async_compute/README.md: -------------------------------------------------------------------------------- 1 | # vk_async_compute 2 | This sample demonstrates a raymarching graphics demo implemented in Vulkan through async compute. 3 | 4 | ## Requirements 5 | A graphics card driver supporting Vulkan API. 6 | 7 | ## Programming language 8 | C 9 | 10 | ## Building 11 | To compile, you will need a C compiler and assorted toolchain installed. 12 | 13 | make 14 | 15 | This targets [libretro](http://libretro.com) Vulkan interface, so you need a libretro frontend supporting this interface, such as [RetroArch](https://github.com/libretro/RetroArch), installed. 16 | -------------------------------------------------------------------------------- /video/vulkan/vk_async_compute/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=testvulkan_async_compute 2 | include_rules 3 | -------------------------------------------------------------------------------- /video/vulkan/vk_async_compute/include/vulkan/vk_sdk_platform.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_sdk_platform.h 3 | // 4 | /* 5 | * Copyright (c) 2015-2016 The Khronos Group Inc. 6 | * Copyright (c) 2015-2016 Valve Corporation 7 | * Copyright (c) 2015-2016 LunarG, Inc. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #ifndef VK_SDK_PLATFORM_H 23 | #define VK_SDK_PLATFORM_H 24 | 25 | #if defined(_WIN32) 26 | #define NOMINMAX 27 | #ifndef __cplusplus 28 | #undef inline 29 | #define inline __inline 30 | #endif // __cplusplus 31 | 32 | #if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) 33 | // C99: 34 | // Microsoft didn't implement C99 in Visual Studio; but started adding it with 35 | // VS2013. However, VS2013 still didn't have snprintf(). The following is a 36 | // work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the 37 | // "CMakeLists.txt" file). 38 | // NOTE: This is fixed in Visual Studio 2015. 39 | #define snprintf _snprintf 40 | #endif 41 | 42 | #define strdup _strdup 43 | 44 | #endif // _WIN32 45 | 46 | #endif // VK_SDK_PLATFORM_H 47 | -------------------------------------------------------------------------------- /video/vulkan/vk_async_compute/include/vulkan/vulkan_intel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Intel Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 | * IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef __VULKAN_INTEL_H__ 25 | #define __VULKAN_INTEL_H__ 26 | 27 | #include "vulkan.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" 31 | { 32 | #endif // __cplusplus 33 | 34 | #define VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL 1024 35 | typedef struct VkDmaBufImageCreateInfo_ 36 | { 37 | VkStructureType sType; // Must be VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL 38 | const void* pNext; // Pointer to next structure. 39 | int fd; 40 | VkFormat format; 41 | VkExtent3D extent; // Depth must be 1 42 | uint32_t strideInBytes; 43 | } VkDmaBufImageCreateInfo; 44 | 45 | typedef VkResult (VKAPI_PTR *PFN_vkCreateDmaBufImageINTEL)(VkDevice device, const VkDmaBufImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMem, VkImage* pImage); 46 | 47 | #ifdef VK_PROTOTYPES 48 | 49 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDmaBufImageINTEL( 50 | VkDevice _device, 51 | const VkDmaBufImageCreateInfo* pCreateInfo, 52 | const VkAllocationCallbacks* pAllocator, 53 | VkDeviceMemory* pMem, 54 | VkImage* pImage); 55 | 56 | #endif 57 | 58 | #ifdef __cplusplus 59 | } // extern "C" 60 | #endif // __cplusplus 61 | 62 | #endif // __VULKAN_INTEL_H__ 63 | -------------------------------------------------------------------------------- /video/vulkan/vk_async_compute/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := retro 6 | 7 | ifeq ($(TARGET_ARCH),arm) 8 | LOCAL_CFLAGS += -DANDROID_ARM 9 | LOCAL_ARM_MODE := arm 10 | endif 11 | 12 | ifeq ($(TARGET_ARCH),x86) 13 | LOCAL_CFLAGS += -DANDROID_X86 14 | endif 15 | 16 | ifeq ($(TARGET_ARCH),mips) 17 | LOCAL_CFLAGS += -DANDROID_MIPS 18 | endif 19 | 20 | LOCAL_SRC_FILES += ../libretro-test.c \ 21 | ../vulkan_symbol_wrapper.c 22 | LOCAL_CFLAGS += -O2 -Wall -std=gnu99 -ffast-math -I.. -I../include 23 | 24 | include $(BUILD_SHARED_LIBRARY) 25 | 26 | -------------------------------------------------------------------------------- /video/vulkan/vk_async_compute/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 mips mips64 2 | APP_PLATFORM := android-9 3 | 4 | -------------------------------------------------------------------------------- /video/vulkan/vk_async_compute/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /video/vulkan/vk_async_compute/shaders/Makefile: -------------------------------------------------------------------------------- 1 | COMP_SHADERS := $(wildcard *.comp) 2 | SPIRV := $(COMP_SHADERS:.comp=.comp.inc) 3 | 4 | GLSLANG := glslc 5 | GLSLFLAGS := -mfmt=c 6 | 7 | all: $(SPIRV) 8 | 9 | %.comp.inc: %.comp 10 | $(GLSLANG) $(GLSLFLAGS) -o $@ $< 11 | 12 | clean: 13 | rm -f $(SPIRV) 14 | 15 | .PHONY: clean 16 | -------------------------------------------------------------------------------- /video/vulkan/vk_async_compute/shaders/raymarch.comp: -------------------------------------------------------------------------------- 1 | #version 310 es 2 | layout(local_size_x = 8, local_size_y = 8) in; 3 | 4 | layout(rgba8, set = 0, binding = 0) uniform writeonly mediump image2D uImage; 5 | 6 | layout(push_constant, std430) uniform PushConstants 7 | { 8 | vec2 inv_resolution; 9 | float frame; 10 | float dummy; 11 | } constants; 12 | 13 | void main() 14 | { 15 | vec2 uv = (vec2(gl_GlobalInvocationID.xy) + 0.5) * constants.inv_resolution; 16 | vec4 color = vec4(sin(uv.x * 50.0 + constants.frame * 0.1) + 0.5, cos(uv.y * 55.0 + constants.frame * 0.2), 0.2, 1.0); 17 | imageStore(uImage, ivec2(gl_GlobalInvocationID.xy), color); 18 | } 19 | -------------------------------------------------------------------------------- /video/vulkan/vk_rendering/Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(platform),) 2 | platform = unix 3 | ifeq ($(shell uname -a),) 4 | platform = win 5 | else ifneq ($(findstring MINGW,$(shell uname -a)),) 6 | platform = win 7 | else ifneq ($(findstring Darwin,$(shell uname -a)),) 8 | platform = osx 9 | arch = intel 10 | ifeq ($(shell uname -p),powerpc) 11 | arch = ppc 12 | endif 13 | else ifneq ($(findstring win,$(shell uname -a)),) 14 | platform = win 15 | endif 16 | endif 17 | 18 | # system platform 19 | system_platform = unix 20 | ifeq ($(shell uname -a),) 21 | EXE_EXT = .exe 22 | system_platform = win 23 | else ifneq ($(findstring MINGW,$(shell uname -a)),) 24 | system_platform = win 25 | endif 26 | 27 | TARGET_NAME = testvulkan 28 | 29 | ifeq ($(platform), unix) 30 | TARGET := $(TARGET_NAME)_libretro.so 31 | fpic := -fPIC 32 | SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined 33 | else 34 | CC = gcc 35 | TARGET := $(TARGET_NAME)_libretro.dll 36 | SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined 37 | CFLAGS += -I.. 38 | endif 39 | 40 | ifeq ($(DEBUG), 1) 41 | CFLAGS += -O0 -g 42 | else 43 | CFLAGS += -O3 44 | endif 45 | 46 | CFLAGS += -std=gnu99 -Iinclude 47 | OBJECTS := libretro-test.o vulkan_symbol_wrapper.o 48 | CFLAGS += -Wall -pedantic $(fpic) 49 | 50 | all: $(TARGET) 51 | 52 | $(TARGET): $(OBJECTS) 53 | $(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LIBS) -lm 54 | 55 | %.o: %.c 56 | $(CC) -I../../libretro-common/include $(CFLAGS) -c -o $@ $< 57 | 58 | clean: 59 | rm -f $(OBJECTS) $(TARGET) 60 | 61 | .PHONY: clean 62 | 63 | -------------------------------------------------------------------------------- /video/vulkan/vk_rendering/README.md: -------------------------------------------------------------------------------- 1 | # vk_async_compute 2 | This sample demonstrates how to render graphics to the default Vulkan framebuffer using libretro API. 3 | 4 | ## Requirements 5 | A graphics card driver supporting Vulkan API. 6 | 7 | ## Programming language 8 | C 9 | 10 | ## Building 11 | To compile, you will need a C compiler and assorted toolchain installed. 12 | 13 | make 14 | 15 | This targets [libretro](http://libretro.com) Vulkan interface, so you need a libretro frontend supporting this interface, such as [RetroArch](https://github.com/libretro/RetroArch), installed. 16 | -------------------------------------------------------------------------------- /video/vulkan/vk_rendering/Tupfile: -------------------------------------------------------------------------------- 1 | TARGET_NAME=testvulkan 2 | include_rules 3 | -------------------------------------------------------------------------------- /video/vulkan/vk_rendering/include/vulkan/vk_sdk_platform.h: -------------------------------------------------------------------------------- 1 | // 2 | // File: vk_sdk_platform.h 3 | // 4 | /* 5 | * Copyright (c) 2015-2016 The Khronos Group Inc. 6 | * Copyright (c) 2015-2016 Valve Corporation 7 | * Copyright (c) 2015-2016 LunarG, Inc. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #ifndef VK_SDK_PLATFORM_H 23 | #define VK_SDK_PLATFORM_H 24 | 25 | #if defined(_WIN32) 26 | #define NOMINMAX 27 | #ifndef __cplusplus 28 | #undef inline 29 | #define inline __inline 30 | #endif // __cplusplus 31 | 32 | #if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) 33 | // C99: 34 | // Microsoft didn't implement C99 in Visual Studio; but started adding it with 35 | // VS2013. However, VS2013 still didn't have snprintf(). The following is a 36 | // work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the 37 | // "CMakeLists.txt" file). 38 | // NOTE: This is fixed in Visual Studio 2015. 39 | #define snprintf _snprintf 40 | #endif 41 | 42 | #define strdup _strdup 43 | 44 | #endif // _WIN32 45 | 46 | #endif // VK_SDK_PLATFORM_H 47 | -------------------------------------------------------------------------------- /video/vulkan/vk_rendering/include/vulkan/vulkan_intel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Intel Corporation 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice (including the next 12 | * paragraph) shall be included in all copies or substantial portions of the 13 | * Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 | * IN THE SOFTWARE. 22 | */ 23 | 24 | #ifndef __VULKAN_INTEL_H__ 25 | #define __VULKAN_INTEL_H__ 26 | 27 | #include "vulkan.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" 31 | { 32 | #endif // __cplusplus 33 | 34 | #define VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL 1024 35 | typedef struct VkDmaBufImageCreateInfo_ 36 | { 37 | VkStructureType sType; // Must be VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL 38 | const void* pNext; // Pointer to next structure. 39 | int fd; 40 | VkFormat format; 41 | VkExtent3D extent; // Depth must be 1 42 | uint32_t strideInBytes; 43 | } VkDmaBufImageCreateInfo; 44 | 45 | typedef VkResult (VKAPI_PTR *PFN_vkCreateDmaBufImageINTEL)(VkDevice device, const VkDmaBufImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMem, VkImage* pImage); 46 | 47 | #ifdef VK_PROTOTYPES 48 | 49 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDmaBufImageINTEL( 50 | VkDevice _device, 51 | const VkDmaBufImageCreateInfo* pCreateInfo, 52 | const VkAllocationCallbacks* pAllocator, 53 | VkDeviceMemory* pMem, 54 | VkImage* pImage); 55 | 56 | #endif 57 | 58 | #ifdef __cplusplus 59 | } // extern "C" 60 | #endif // __cplusplus 61 | 62 | #endif // __VULKAN_INTEL_H__ 63 | -------------------------------------------------------------------------------- /video/vulkan/vk_rendering/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := retro 6 | 7 | ifeq ($(TARGET_ARCH),arm) 8 | LOCAL_CFLAGS += -DANDROID_ARM 9 | LOCAL_ARM_MODE := arm 10 | endif 11 | 12 | ifeq ($(TARGET_ARCH),x86) 13 | LOCAL_CFLAGS += -DANDROID_X86 14 | endif 15 | 16 | ifeq ($(TARGET_ARCH),mips) 17 | LOCAL_CFLAGS += -DANDROID_MIPS 18 | endif 19 | 20 | LOCAL_SRC_FILES += ../libretro-test.c \ 21 | ../vulkan_symbol_wrapper.c 22 | LOCAL_CFLAGS += -O2 -Wall -std=gnu99 -ffast-math -I.. -I../include 23 | 24 | include $(BUILD_SHARED_LIBRARY) 25 | 26 | -------------------------------------------------------------------------------- /video/vulkan/vk_rendering/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 mips mips64 2 | APP_PLATFORM := android-9 3 | 4 | -------------------------------------------------------------------------------- /video/vulkan/vk_rendering/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /video/vulkan/vk_rendering/shaders/Makefile: -------------------------------------------------------------------------------- 1 | VERT_SHADERS := $(wildcard *.vert) 2 | FRAG_SHADERS := $(wildcard *.frag) 3 | SPIRV := $(VERT_SHADERS:.vert=.vert.inc) $(FRAG_SHADERS:.frag=.frag.inc) 4 | 5 | GLSLANG := glslc 6 | GLSLFLAGS := -mfmt=c 7 | 8 | all: $(SPIRV) 9 | 10 | %.frag.inc: %.frag 11 | $(GLSLANG) $(GLSLFLAGS) -o $@ $< 12 | 13 | %.vert.inc: %.vert 14 | $(GLSLANG) $(GLSLFLAGS) -o $@ $< 15 | 16 | clean: 17 | rm -f $(SPIRV) 18 | 19 | .PHONY: clean 20 | -------------------------------------------------------------------------------- /video/vulkan/vk_rendering/shaders/triangle.frag: -------------------------------------------------------------------------------- 1 | #version 310 es 2 | precision mediump float; 3 | layout(location = 0) in vec4 vColor; 4 | layout(location = 0) out vec4 FragColor; 5 | 6 | void main() 7 | { 8 | FragColor = vColor; 9 | } 10 | -------------------------------------------------------------------------------- /video/vulkan/vk_rendering/shaders/triangle.frag.inc: -------------------------------------------------------------------------------- 1 | {0x07230203,0x00010000,0x00080001,0x0000000d, 2 | 0x00000000,0x00020011,0x00000001,0x0006000b, 3 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e, 4 | 0x00000000,0x0003000e,0x00000000,0x00000001, 5 | 0x0007000f,0x00000004,0x00000004,0x6e69616d, 6 | 0x00000000,0x00000009,0x0000000b,0x00030010, 7 | 0x00000004,0x00000007,0x00030003,0x00000001, 8 | 0x00000136,0x000a0004,0x475f4c47,0x4c474f4f, 9 | 0x70635f45,0x74735f70,0x5f656c79,0x656e696c, 10 | 0x7269645f,0x69746365,0x00006576,0x00080004, 11 | 0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63, 12 | 0x69645f65,0x74636572,0x00657669,0x00040005, 13 | 0x00000004,0x6e69616d,0x00000000,0x00050005, 14 | 0x00000009,0x67617246,0x6f6c6f43,0x00000072, 15 | 0x00040005,0x0000000b,0x6c6f4376,0x0000726f, 16 | 0x00030047,0x00000009,0x00000000,0x00040047, 17 | 0x00000009,0x0000001e,0x00000000,0x00030047, 18 | 0x0000000b,0x00000000,0x00040047,0x0000000b, 19 | 0x0000001e,0x00000000,0x00030047,0x0000000c, 20 | 0x00000000,0x00020013,0x00000002,0x00030021, 21 | 0x00000003,0x00000002,0x00030016,0x00000006, 22 | 0x00000020,0x00040017,0x00000007,0x00000006, 23 | 0x00000004,0x00040020,0x00000008,0x00000003, 24 | 0x00000007,0x0004003b,0x00000008,0x00000009, 25 | 0x00000003,0x00040020,0x0000000a,0x00000001, 26 | 0x00000007,0x0004003b,0x0000000a,0x0000000b, 27 | 0x00000001,0x00050036,0x00000002,0x00000004, 28 | 0x00000000,0x00000003,0x000200f8,0x00000005, 29 | 0x0004003d,0x00000007,0x0000000c,0x0000000b, 30 | 0x0003003e,0x00000009,0x0000000c,0x000100fd, 31 | 0x00010038} 32 | -------------------------------------------------------------------------------- /video/vulkan/vk_rendering/shaders/triangle.vert: -------------------------------------------------------------------------------- 1 | #version 310 es 2 | layout(location = 0) in vec4 Position; 3 | layout(location = 1) in vec4 Color; 4 | layout(location = 0) out vec4 vColor; 5 | 6 | layout(std140, set = 0, binding = 0) uniform UBO 7 | { 8 | mat4 MVP; 9 | }; 10 | 11 | void main() 12 | { 13 | gl_Position = MVP * Position; 14 | vColor = Color; 15 | } 16 | --------------------------------------------------------------------------------