├── .github └── workflows │ ├── linux_aarch64.yml │ ├── linux_x86_64.yml │ ├── macos.yml │ ├── win32.yml │ └── win64.yml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── shaders ├── basic.frag ├── basic.vert ├── basic_color_quad.frag ├── basic_color_quad.vert ├── beam.vert ├── d_light.vert ├── model.frag ├── model.vert ├── nullmodel.vert ├── particle.vert ├── point_particle.frag ├── point_particle.vert ├── polygon.vert ├── polygon_lmap.frag ├── polygon_lmap.vert ├── polygon_warp.vert ├── postprocess.frag ├── postprocess.vert ├── shaders.bat ├── shaders.sh ├── shadows.vert ├── skybox.vert ├── sprite.vert ├── world_warp.frag └── world_warp.vert └── src ├── backends ├── hunk_unix.c └── hunk_windows.c ├── common ├── header │ ├── common.h │ ├── crc.h │ ├── files.h │ ├── ref_api.h │ ├── ref_shared.h │ ├── shared.h │ ├── shared_safe.h │ └── vid.h ├── md4.c ├── shared.c └── utils.c ├── constants ├── anorms.h ├── anormtab.h └── warpsin.h ├── files ├── models.c ├── pcx.c ├── pvs.c ├── stb.c ├── stb_image.h ├── stb_image_resize.h ├── surf.c └── wal.c └── vk ├── header ├── local.h ├── model.h ├── qvk.h ├── shaders.h └── util.h ├── spirv ├── basic_color_quad_frag.c ├── basic_color_quad_vert.c ├── basic_frag.c ├── basic_vert.c ├── beam_vert.c ├── d_light_vert.c ├── model_frag.c ├── model_vert.c ├── nullmodel_vert.c ├── particle_vert.c ├── point_particle_frag.c ├── point_particle_vert.c ├── polygon_lmap_frag.c ├── polygon_lmap_vert.c ├── polygon_vert.c ├── polygon_warp_vert.c ├── postprocess_frag.c ├── postprocess_vert.c ├── shadows_vert.c ├── skybox_vert.c ├── sprite_vert.c ├── world_warp_frag.c └── world_warp_vert.c ├── vk_buffer.c ├── vk_cmd.c ├── vk_common.c ├── vk_device.c ├── vk_draw.c ├── vk_image.c ├── vk_light.c ├── vk_main.c ├── vk_mesh.c ├── vk_misc.c ├── vk_model.c ├── vk_pipeline.c ├── vk_shaders.c ├── vk_surf.c ├── vk_swapchain.c ├── vk_util.c ├── vk_validation.c ├── vk_warp.c └── volk ├── volk.c └── volk.h /.github/workflows/linux_aarch64.yml: -------------------------------------------------------------------------------- 1 | name: Testbuild for Linux (aarch64) 2 | run-name: testbuild_linux_aarch64 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | pull_request: 8 | types: 9 | - edited 10 | - opened 11 | - synchronize 12 | concurrency: 13 | # Cancel concurrent workflows for the same PR or commit hash. 14 | group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} 15 | cancel-in-progress: true 16 | jobs: 17 | build_ubuntu_aarch64: 18 | runs-on: ubuntu-22.04-arm 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | include: 23 | - env: ubuntu 24 | steps: 25 | - name: Install build dependencies 26 | run: | 27 | sudo apt update 28 | sudo apt update 29 | sudo apt install libgl1-mesa-dev libsdl2-dev libopenal-dev libcurl4-openssl-dev \ 30 | libavformat-dev libswscale-dev libvulkan-dev build-essential 31 | - name: Check out repository code 32 | uses: actions/checkout@v4 33 | - name: Build 34 | run: | 35 | # Public runners come with 4 CPUs. 36 | make -j4 37 | - name: Create testbuild package 38 | run: | 39 | # Create release directory tree 40 | mkdir -p publish/ref_vk-linux_aarch64-${{github.sha}}/misc/docs 41 | # Copy release assets 42 | cp -r release/* publish/ref_vk-linux_aarch64-${{github.sha}}/ 43 | # Copy misc assets 44 | cp LICENSE publish/ref_vk-linux_aarch64-${{github.sha}}/misc/docs/LICENSE.txt 45 | cp README.md publish/ref_vk-linux_aarch64-${{github.sha}}/misc/docs/README.txt 46 | - name: Upload testbuild package 47 | uses: actions/upload-artifact@v4 48 | with: 49 | name: ref_vk-linux_aarch64-${{github.sha}} 50 | path: publish/ 51 | if-no-files-found: error 52 | -------------------------------------------------------------------------------- /.github/workflows/linux_x86_64.yml: -------------------------------------------------------------------------------- 1 | name: Testbuild for Linux (x86_64) 2 | run-name: testbuild_linux_x86_64 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | pull_request: 8 | types: 9 | - edited 10 | - opened 11 | - synchronize 12 | concurrency: 13 | # Cancel concurrent workflows for the same PR or commit hash. 14 | group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} 15 | cancel-in-progress: true 16 | jobs: 17 | build_ubuntu_x86_64: 18 | runs-on: ubuntu-22.04 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | include: 23 | - env: ubuntu 24 | steps: 25 | - name: Install build dependencies 26 | run: | 27 | sudo apt update 28 | sudo apt install libgl1-mesa-dev libsdl2-dev libopenal-dev libcurl4-openssl-dev \ 29 | libavformat-dev libswscale-dev libvulkan-dev build-essential 30 | - name: Check out repository code 31 | uses: actions/checkout@v4 32 | - name: Build 33 | run: | 34 | # Public runners come with 4 CPUs. 35 | make -j4 36 | - name: Create testbuild package 37 | run: | 38 | # Create release directory tree 39 | mkdir -p publish/ref_vk-linux_x86_64-${{github.sha}}/misc/docs 40 | # Copy release assets 41 | cp -r release/* publish/ref_vk-linux_x86_64-${{github.sha}}/ 42 | # Copy misc assets 43 | cp LICENSE publish/ref_vk-linux_x86_64-${{github.sha}}/misc/docs/LICENSE.txt 44 | cp README.md publish/ref_vk-linux_x86_64-${{github.sha}}/misc/docs/README.txt 45 | - name: Upload testbuild package 46 | uses: actions/upload-artifact@v4 47 | with: 48 | name: ref_vk-linux_x86_64-${{github.sha}} 49 | path: publish/ 50 | if-no-files-found: error 51 | -------------------------------------------------------------------------------- /.github/workflows/macos.yml: -------------------------------------------------------------------------------- 1 | name: Testbuild for MacOS 2 | run-name: testbuild_macos 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | pull_request: 8 | types: 9 | - edited 10 | - opened 11 | - synchronize 12 | concurrency: 13 | # Cancel concurrent workflows for the same PR or commit hash. 14 | group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} 15 | cancel-in-progress: true 16 | jobs: 17 | build_macos_aarch64: 18 | runs-on: macos-latest 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | include: 23 | - env: macos 24 | steps: 25 | - name: Install build dependencies 26 | run: | 27 | brew update 28 | brew install sdl2 openal-soft make molten-vk 29 | - name: Check out repository code 30 | uses: actions/checkout@v4 31 | - name: Build 32 | run: | 33 | # Public runners come with 3 CPUs. 34 | gmake -j3 35 | - name: Create testbuild package 36 | run: | 37 | # Create release directory tree 38 | mkdir -p publish/ref_vk-macos-${{github.sha}}/misc/docs 39 | # Copy release assets 40 | cp -r release/* publish/ref_vk-macos-${{github.sha}}/ 41 | # Copy misc assets 42 | cp LICENSE publish/ref_vk-macos-${{github.sha}}/misc/docs/LICENSE.txt 43 | cp README.md publish/ref_vk-macos-${{github.sha}}/misc/docs/README.txt 44 | - name: Upload testbuild package 45 | uses: actions/upload-artifact@v4 46 | with: 47 | name: ref_vk-macos-${{github.sha}} 48 | path: publish/ 49 | if-no-files-found: error 50 | -------------------------------------------------------------------------------- /.github/workflows/win32.yml: -------------------------------------------------------------------------------- 1 | name: Testbuild for Win32 2 | run-name: testbuild_win32 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | tags: 8 | - "*" 9 | pull_request: 10 | types: 11 | - edited 12 | - opened 13 | - synchronize 14 | concurrency: 15 | # Cancel concurrent workflows for the same PR or commit hash. 16 | group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} 17 | cancel-in-progress: true 18 | jobs: 19 | build_mingw_x86_32: 20 | runs-on: windows-latest 21 | strategy: 22 | fail-fast: false 23 | matrix: 24 | include: 25 | - { sys: mingw32, env: i686 } 26 | steps: 27 | - uses: msys2/setup-msys2@v2 28 | with: 29 | msystem: ${{matrix.sys}} 30 | update: true 31 | install: >- 32 | git 33 | make 34 | zip 35 | unzip 36 | mingw-w64-${{matrix.env}}-gcc 37 | mingw-w64-${{matrix.env}}-make 38 | mingw-w64-${{matrix.env}}-SDL2 39 | mingw-w64-${{matrix.env}}-vulkan-headers 40 | - name: Check out repository code 41 | uses: actions/checkout@v4 42 | - name: Build 43 | shell: msys2 {0} 44 | run: | 45 | # Public runners come with 4 CPUs. 46 | make -j4 47 | - name: Create testbuild package 48 | shell: msys2 {0} 49 | run: | 50 | # Create release directory tree 51 | mkdir -p publish/ref_vk-win32-${{github.sha}}/misc/docs 52 | # Copy release assets 53 | cp -r release/* publish/ref_vk-win32-${{github.sha}}/ 54 | # Copy misc assets 55 | cp LICENSE publish/ref_vk-win32-${{github.sha}}/misc/docs/LICENSE.txt 56 | cp README.md publish/ref_vk-win32-${{github.sha}}/misc/docs/README.txt 57 | - name: Upload testbuild package 58 | uses: actions/upload-artifact@v4 59 | if: ${{ ! startsWith(github.ref, 'refs/tags/') }} 60 | with: 61 | name: ref_vk-win32-${{github.sha}} 62 | path: publish/ 63 | if-no-files-found: error 64 | - name: Create testbuild package 65 | if: ${{ startsWith(github.ref, 'refs/tags/') }} 66 | shell: msys2 {0} 67 | run: | 68 | # create archive 69 | mkdir ref_vk-${{matrix.env}}-${{github.ref_name}} 70 | cp -rv publish/ref_vk-win32-${{github.sha}}/* ref_vk-${{matrix.env}}-${{github.ref_name}} 71 | zip -9r ref_vk-${{matrix.env}}-${{github.ref_name}}.zip ref_vk-${{matrix.env}}-${{github.ref_name}} 72 | - name: Upload Release Asset 73 | uses: softprops/action-gh-release@v2 74 | if: ${{ startsWith(github.ref, 'refs/tags/') }} 75 | with: 76 | files: | 77 | ref_vk-${{matrix.env}}-${{github.ref_name}}.zip 78 | -------------------------------------------------------------------------------- /.github/workflows/win64.yml: -------------------------------------------------------------------------------- 1 | name: Testbuild for Win64 (SDL3) 2 | run-name: testbuild_win64 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | pull_request: 8 | types: 9 | - edited 10 | - opened 11 | - synchronize 12 | concurrency: 13 | # Cancel concurrent workflows for the same PR or commit hash. 14 | group: ${{github.workflow}}-${{github.event_name == 'pull_request' && github.head_ref || github.sha}} 15 | cancel-in-progress: true 16 | jobs: 17 | build_mingw_x86_64: 18 | runs-on: windows-latest 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | include: 23 | - { sys: mingw64, env: x86_64 } 24 | steps: 25 | - uses: msys2/setup-msys2@v2 26 | with: 27 | msystem: ${{matrix.sys}} 28 | update: true 29 | install: >- 30 | git 31 | make 32 | zip 33 | unzip 34 | mingw-w64-${{matrix.env}}-gcc 35 | mingw-w64-${{matrix.env}}-make 36 | mingw-w64-${{matrix.env}}-sdl3 37 | mingw-w64-${{matrix.env}}-vulkan-headers 38 | mingw-w64-${{matrix.env}}-pkgconf 39 | - name: Check out repository code 40 | uses: actions/checkout@v4 41 | - name: Build 42 | shell: msys2 {0} 43 | run: | 44 | sed -i 's|WITH_SDL3:=no|WITH_SDL3:=yes|g' Makefile 45 | # Public runners come with 4 CPUs. 46 | make -j4 47 | - name: Create testbuild package 48 | shell: msys2 {0} 49 | run: | 50 | # Create release directory tree 51 | mkdir -p publish/ref_vk-win64-${{github.sha}}/misc/docs 52 | # Copy release assets 53 | cp -r release/* publish/ref_vk-win64-${{github.sha}}/ 54 | # Copy misc assets 55 | cp LICENSE publish/ref_vk-win64-${{github.sha}}/misc/docs/LICENSE.txt 56 | cp README.md publish/ref_vk-win64-${{github.sha}}/misc/docs/README.txt 57 | - name: Upload testbuild package 58 | uses: actions/upload-artifact@v4 59 | with: 60 | name: ref_vk-win64-${{github.sha}} 61 | path: publish/ 62 | if-no-files-found: error 63 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /release/ 3 | *.orig 4 | *.rej 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vulkan Renderer Library for Yamagi Quake II 2 | 3 | This is the vkQuake2 vulkan renderer library ported to Yamagi Quake II. 4 | 5 | ## Compilation 6 | 7 | You'll need: 8 | 9 | * clang or gcc, 10 | * GNU Make, 11 | * SDL2 with `sdl2-config`, 12 | * vulkan-headers, 13 | * vulkan-validationlayers if you like to debug issues. 14 | 15 | For vulkan-headers on macOS with Homebrew: `brew install molten-vk`. 16 | 17 | Type `make` to compile the library. If the compilation is successfull, 18 | the library can be found under *release/ref_vk.dll* (Windows) or 19 | *release/ref_vk.so* (unixoid systems). 20 | 21 | ## Usage 22 | 23 | Copy the library next to your Yamagi Quake II executable. You can select 24 | Vulkan through the video menu or by cvar with `vid_renderer vk` followed 25 | by a `vid_restart`. 26 | 27 | If you have run into issues, please attach output logs with OS/driver version 28 | and device name to the bug report. [List](https://openbenchmarking.org/test/pts/yquake2) 29 | of currently tested devices for the reference. 30 | 31 | Note: Game saves outputs to `Documents\YamagiQ2\stdout.txt` under Windows. 32 | 33 | On macOS it is necessary to set `DYLD_LIBRARY_PATH` to load the Vulkan Portability library: 34 | 35 | `export DYLD_LIBRARY_PATH=/opt/homebrew/opt/molten-vk/lib` 36 | 37 | ## Console Variables 38 | 39 | * **r_validation**: Toggle validation layers: 40 | * `0` - disabled (default in Release) 41 | * `1` - only errors and warnings, show image load issues 42 | * `2` - best-practices validation 43 | 44 | * **vk_strings**: Print some basic Vulkan/GPU information. 45 | 46 | * **vk_mem**: Print dynamic vertex/index/uniform/triangle fan buffer 47 | memory usage statistics. 48 | 49 | * **vk_device**: Specify index of the preferred Vulkan device on systems 50 | with multiple GPUs: 51 | * `-1` - prefer first DISCRETE\_GPU (default) 52 | * `0..n` - use device #n (full list of devices is returned by 53 | `vk_strings` command) 54 | 55 | * **vk_sampleshading**: Toggle sample shading for MSAA. (default: `1`) 56 | 57 | * **vk_flashblend**: Toggle the blending of lights onto the environment. 58 | (default: `0`) 59 | 60 | * **r_polyblend**: Blend fullscreen effects: blood, powerups etc. 61 | (default: `1`) 62 | 63 | * **vk_skymip**: Toggle the usage of mipmap information for the sky 64 | graphics. (default: `0`) 65 | 66 | * **vk_finish**: Inserts a `vkDeviceWaitIdle()` call on frame render 67 | start (default: `0`). Don't use this, it's there just for the sake of 68 | having a `gl_finish` equivalent! 69 | 70 | * **vk_custom_particles**: Toggle particles type: 71 | * `0` - textured triangles for particle rendering 72 | * `1` - between using POINT\_LIST (default) 73 | * `2` - textured square for particle rendering 74 | 75 | * **vk_particle_size**: Rendered particle size. (default: `40`) 76 | 77 | * **vk_particle_att_a**: Intensity of the particle A attribute. 78 | (default: `0.01`) 79 | 80 | * **vk_particle_att_b**: Intensity of the particle B attribute. 81 | (default: `0`) 82 | 83 | * **vk_particle_att_c**: Intensity of the particle C attribute. 84 | (default: `0.01`) 85 | 86 | * **vk_particle_min_size**: The minimum size of a rendered particle. 87 | (default: `2`) 88 | 89 | * **vk_particle_max_size**: The maximum size of a rendered particle. 90 | (default: `40`) 91 | 92 | * **vk_picmip**: Shrink factor for the textures. (default: `0`) 93 | 94 | * **vk_pixel_size**: Pixel size when rendering the world, used to simulate 95 | lower screen resolutions. The value represents the length, in pixels, of the 96 | side of each pixel block. For example, with size 2 pixels are 2x2 squares, 97 | and at 1600x1200 the image is effectively an upscaled 800x600 image. 98 | (default: `1`) 99 | 100 | * **vk_dynamic**: Use dynamic lighting. (default: `1`) 101 | 102 | * **vk_showtris**: Display mesh triangles. (default: `0`) 103 | 104 | * **r_lightmap**: Display lightmaps. (default: `0`) 105 | 106 | * **vk_postprocess**: Toggle additional color/gamma correction. 107 | (default: `1`) 108 | 109 | * **vk_mip_nearfilter**: Use nearest-neighbor filtering for mipmaps. 110 | (default: `0`) 111 | 112 | * **vk_texturemode**: Change current texture filtering mode: 113 | * `VK_NEAREST` - nearest-neighbor interpolation, no mipmaps 114 | * `VK_LINEAR` - linear interpolation, no mipmaps 115 | * `VK_MIPMAP_NEAREST` - nearest-neighbor interpolation with mipmaps 116 | * `VK_MIPMAP_LINEAR` - linear interpolation with mipmaps (default) 117 | 118 | * **vk_lmaptexturemode**: Same as `vk_texturemode` but applied to 119 | lightmap textures. 120 | 121 | * **vk_underwater**: Warp the scene if underwater. Set to `0` to disable 122 | the effect. Defaults to `1`. 123 | 124 | ## Console Variables (macOS) 125 | 126 | * **vk_molten_metalbuffers**: enable/disable Metal buffers to bind textures 127 | more efficiently (>= Big Sur). (default: `0`) 128 | 129 | * **vk_molten_fastmath**: enable/disable float point op optimisations. 130 | (default: `0`) 131 | 132 | ### Custom model format support 133 | 134 | Render unofficially supports mdl/Quake 1, dkm/Daikatana and fm/Heretic2, 135 | are provided without any warranty of support. The simplest way to check 136 | is renaming the mdl/dkm/fm format file to md2 and place instead the original 137 | tris.md2 file. FM is rendered with all meshes without support of 138 | filtering/selecting the exact part of the model. 139 | 140 | ## Releases 141 | 142 | Our CI builds **unsupported** Linux, MacOS and Windows binaries at every 143 | commit. The artifacts can be found here: 144 | 145 | * [Github Actions](https://github.com/yquake2/ref_vk/actions) 146 | 147 | ### ReRelease Support 148 | 149 | Use [Yamagi Quake II ReRelease](https://github.com/yquake2/yquake2remaster/releases) 150 | version with 2023 Quake ReRelease version. 151 | -------------------------------------------------------------------------------- /shaders/basic.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(push_constant) uniform PushConstant 4 | { 5 | // vertex shader has 'mat4 vpMatrix;' at begin. 6 | layout(offset = 68) float gamma; 7 | } pc; 8 | 9 | layout(set = 0, binding = 0) uniform sampler2D sTexture; 10 | 11 | layout(location = 0) in vec2 texCoord; 12 | layout(location = 1) in vec4 color; 13 | layout(location = 2) in float aTreshold; 14 | 15 | layout(location = 0) out vec4 fragmentColor; 16 | 17 | void main() 18 | { 19 | fragmentColor = texture(sTexture, texCoord) * color; 20 | if(fragmentColor.a < aTreshold) 21 | discard; 22 | 23 | fragmentColor = vec4(pow(fragmentColor.rgb, vec3(pc.gamma)), fragmentColor.a); 24 | } 25 | -------------------------------------------------------------------------------- /shaders/basic.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | // normalized offset and scale 5 | layout(set = 1, binding = 0) uniform imageTransform 6 | { 7 | vec2 offset; 8 | vec2 scale; 9 | vec2 uvOffset; 10 | vec2 uvScale; 11 | } it; 12 | 13 | layout(location = 0) in vec2 inVertex; 14 | layout(location = 1) in vec2 inTexCoord; 15 | 16 | layout(location = 0) out vec2 texCoord; 17 | layout(location = 1) out vec4 color; 18 | layout(location = 2) out float aTreshold; 19 | 20 | out gl_PerVertex { 21 | vec4 gl_Position; 22 | }; 23 | 24 | void main() { 25 | vec2 vPos = inVertex.xy * it.scale - (vec2(1.0) - it.scale); 26 | gl_Position = vec4(vPos + it.offset * 2.0, 0.0, 1.0); 27 | texCoord = inTexCoord.xy * it.uvScale + it.uvOffset; 28 | color = vec4(1.0, 1.0, 1.0, 1.0); 29 | aTreshold = 0.666; 30 | } 31 | -------------------------------------------------------------------------------- /shaders/basic_color_quad.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec4 color; 4 | 5 | layout(location = 0) out vec4 fragmentColor; 6 | 7 | void main() 8 | { 9 | fragmentColor = color; 10 | } 11 | -------------------------------------------------------------------------------- /shaders/basic_color_quad.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | // normalized offset and scale 5 | layout(set = 0, binding = 0) uniform imageTransform 6 | { 7 | vec2 offset; 8 | vec2 scale; 9 | vec4 color; 10 | } it; 11 | 12 | layout(location = 0) in vec2 inVertex; 13 | 14 | layout(location = 0) out vec4 color; 15 | 16 | out gl_PerVertex { 17 | vec4 gl_Position; 18 | }; 19 | 20 | void main() { 21 | vec2 vPos = inVertex.xy * it.scale - (vec2(1.0) - it.scale); 22 | gl_Position = vec4(vPos + it.offset * 2.0, 0.0, 1.0); 23 | color = it.color; 24 | } 25 | -------------------------------------------------------------------------------- /shaders/beam.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 inVertex; 5 | 6 | layout(push_constant) uniform PushConstant 7 | { 8 | mat4 mvpMatrix; 9 | } pc; 10 | 11 | layout(binding = 0) uniform UniformBufferObject 12 | { 13 | vec4 color; 14 | } ubo; 15 | 16 | layout(location = 0) out vec4 color; 17 | 18 | out gl_PerVertex { 19 | vec4 gl_Position; 20 | }; 21 | 22 | void main() { 23 | gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0); 24 | color = ubo.color; 25 | } 26 | -------------------------------------------------------------------------------- /shaders/d_light.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 inVertex; 5 | layout(location = 1) in vec3 inColor; 6 | 7 | layout(binding = 0) uniform UniformBufferObject 8 | { 9 | mat4 mvpMatrix; 10 | } ubo; 11 | 12 | layout(location = 0) out vec4 color; 13 | 14 | out gl_PerVertex { 15 | vec4 gl_Position; 16 | }; 17 | 18 | void main() { 19 | gl_Position = ubo.mvpMatrix * vec4(inVertex, 1.0); 20 | color = vec4(inColor, 1.0); 21 | } 22 | -------------------------------------------------------------------------------- /shaders/model.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(set = 0, binding = 0) uniform sampler2D sTexture; 4 | 5 | layout(location = 0) in vec4 color; 6 | layout(location = 1) in vec2 texCoord; 7 | layout(location = 2) in flat int textured; 8 | 9 | layout(location = 0) out vec4 fragmentColor; 10 | 11 | void main() 12 | { 13 | if(textured != 0) 14 | fragmentColor = texture(sTexture, texCoord) * clamp(color, 0.0, 1.0); 15 | else 16 | fragmentColor = color; 17 | } 18 | -------------------------------------------------------------------------------- /shaders/model.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 inVertex; 5 | layout(location = 1) in vec4 inColor; 6 | layout(location = 2) in vec2 inTexCoord; 7 | 8 | layout(push_constant) uniform PushConstant 9 | { 10 | mat4 vpMatrix; 11 | } pc; 12 | 13 | layout(set = 1, binding = 0) uniform UniformBufferObject 14 | { 15 | mat4 model; 16 | int textured; 17 | } ubo; 18 | 19 | layout(location = 0) out vec4 color; 20 | layout(location = 1) out vec2 texCoord; 21 | layout(location = 2) out int textured; 22 | 23 | out gl_PerVertex { 24 | vec4 gl_Position; 25 | }; 26 | 27 | void main() { 28 | gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0); 29 | color = inColor; 30 | texCoord = inTexCoord; 31 | textured = ubo.textured; 32 | } 33 | -------------------------------------------------------------------------------- /shaders/nullmodel.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 inVertex; 5 | layout(location = 1) in vec3 inColor; 6 | 7 | layout(push_constant) uniform PushConstant 8 | { 9 | mat4 vpMatrix; 10 | } pc; 11 | 12 | layout(binding = 0) uniform UniformBufferObject 13 | { 14 | mat4 model; 15 | } ubo; 16 | 17 | layout(location = 0) out vec4 color; 18 | 19 | out gl_PerVertex { 20 | vec4 gl_Position; 21 | }; 22 | 23 | void main() { 24 | gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0); 25 | color = vec4(inColor, 1.0); 26 | } 27 | -------------------------------------------------------------------------------- /shaders/particle.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 inVertex; 5 | layout(location = 1) in vec4 inColor; 6 | layout(location = 2) in vec2 inTexCoord; 7 | 8 | layout(push_constant) uniform PushConstant 9 | { 10 | mat4 mvpMatrix; 11 | } pc; 12 | 13 | layout(location = 0) out vec2 texCoord; 14 | layout(location = 1) out vec4 color; 15 | layout(location = 2) out float aTreshold; 16 | 17 | out gl_PerVertex { 18 | vec4 gl_Position; 19 | }; 20 | 21 | void main() { 22 | gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0); 23 | texCoord = inTexCoord; 24 | color = inColor; 25 | aTreshold = 0.5; 26 | } 27 | -------------------------------------------------------------------------------- /shaders/point_particle.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(location = 0) in vec4 color; 4 | 5 | layout(location = 0) out vec4 fragmentColor; 6 | 7 | void main() 8 | { 9 | vec2 cxy = 2.0 * gl_PointCoord - 1.0; 10 | if(dot(cxy, cxy) > 1.0) 11 | discard; 12 | 13 | fragmentColor = color; 14 | } 15 | -------------------------------------------------------------------------------- /shaders/point_particle.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 inVertex; 5 | layout(location = 1) in vec4 inColor; 6 | 7 | layout(push_constant) uniform PushConstant 8 | { 9 | mat4 mvpMatrix; 10 | } pc; 11 | 12 | layout(binding = 0) uniform UniformBufferObject 13 | { 14 | float pointSize; 15 | float pointScale; 16 | float minPointSize; 17 | float maxPointSize; 18 | float att_a; 19 | float att_b; 20 | float att_c; 21 | } ubo; 22 | 23 | layout(location = 0) out vec4 color; 24 | 25 | out gl_PerVertex { 26 | vec4 gl_Position; 27 | float gl_PointSize; 28 | }; 29 | 30 | void main() { 31 | gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0); 32 | 33 | float dist_atten = ubo.pointScale / (ubo.att_a + ubo.att_b * gl_Position.w + ubo.att_c * gl_Position.w * gl_Position.w); 34 | gl_PointSize = clamp(ubo.pointScale * ubo.pointSize * sqrt(dist_atten), ubo.minPointSize, ubo.maxPointSize); 35 | 36 | color = inColor; 37 | } 38 | -------------------------------------------------------------------------------- /shaders/polygon.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 inVertex; 5 | layout(location = 1) in vec2 inTexCoord; 6 | 7 | layout(push_constant) uniform PushConstant 8 | { 9 | mat4 mvpMatrix; 10 | } pc; 11 | 12 | layout(set = 1, binding = 0) uniform UniformBufferObject 13 | { 14 | vec4 color; 15 | } ubo; 16 | 17 | layout(location = 0) out vec2 texCoord; 18 | layout(location = 1) out vec4 color; 19 | layout(location = 2) out float aTreshold; 20 | 21 | out gl_PerVertex { 22 | vec4 gl_Position; 23 | }; 24 | 25 | void main() { 26 | gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0); 27 | texCoord = inTexCoord; 28 | color = ubo.color; 29 | aTreshold = 0.0; 30 | } 31 | -------------------------------------------------------------------------------- /shaders/polygon_lmap.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(set = 0, binding = 0) uniform sampler2D sTexture; 4 | layout(set = 2, binding = 0) uniform sampler2D sLightmap; 5 | 6 | layout(location = 0) in vec2 texCoord; 7 | layout(location = 1) in vec2 texCoordLmap; 8 | layout(location = 2) in float viewLightmaps; 9 | 10 | layout(location = 0) out vec4 fragmentColor; 11 | 12 | void main() 13 | { 14 | vec4 color = texture(sTexture, texCoord); 15 | vec4 light = texture(sLightmap, texCoordLmap); 16 | fragmentColor = (1.0 - viewLightmaps) * color * light + viewLightmaps * light; 17 | } 18 | -------------------------------------------------------------------------------- /shaders/polygon_lmap.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 inVertex; 5 | layout(location = 1) in vec2 inTexCoord; 6 | layout(location = 2) in vec2 inTexCoordLmap; 7 | 8 | layout(push_constant) uniform PushConstant 9 | { 10 | mat4 vpMatrix; 11 | } pc; 12 | 13 | layout(set = 1, binding = 0) uniform UniformBufferObject 14 | { 15 | mat4 model; 16 | float viewLightmaps; 17 | } ubo; 18 | 19 | layout(location = 0) out vec2 texCoord; 20 | layout(location = 1) out vec2 texCoordLmap; 21 | layout(location = 2) out float viewLightmaps; 22 | 23 | out gl_PerVertex { 24 | vec4 gl_Position; 25 | }; 26 | 27 | void main() { 28 | gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0); 29 | texCoord = inTexCoord; 30 | texCoordLmap = inTexCoordLmap; 31 | viewLightmaps = ubo.viewLightmaps; 32 | } 33 | -------------------------------------------------------------------------------- /shaders/polygon_warp.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 inVertex; 5 | layout(location = 1) in vec2 inTexCoord; 6 | 7 | layout(push_constant) uniform PushConstant 8 | { 9 | mat4 vpMatrix; 10 | } pc; 11 | 12 | layout(set = 1, binding = 0) uniform UniformBufferObject 13 | { 14 | mat4 model; 15 | vec4 color; 16 | float time; 17 | float scroll; 18 | } ubo; 19 | 20 | layout(location = 0) out vec2 texCoord; 21 | layout(location = 1) out vec4 color; 22 | layout(location = 2) out float aTreshold; 23 | 24 | out gl_PerVertex { 25 | vec4 gl_Position; 26 | }; 27 | 28 | void main() { 29 | gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0); 30 | texCoord = inTexCoord + vec2(sin(2.0 * ubo.time + inTexCoord.y * 3.28), sin(2.0 * ubo.time + inTexCoord.x * 3.28)) * 0.05; 31 | texCoord.x += ubo.scroll; 32 | color = ubo.color; 33 | aTreshold = 0.0; 34 | } 35 | -------------------------------------------------------------------------------- /shaders/postprocess.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(push_constant) uniform PushConstant 5 | { 6 | layout(offset = 68) float postprocess; 7 | layout(offset = 72) float gamma; 8 | layout(offset = 76) float scrWidth; 9 | layout(offset = 80) float scrHeight; 10 | layout(offset = 84) float offsetX; 11 | layout(offset = 88) float offsetY; 12 | } pc; 13 | 14 | layout(set = 0, binding = 0) uniform sampler2D sTexture; 15 | 16 | layout(location = 0) in vec2 texCoord; 17 | layout(location = 0) out vec4 fragmentColor; 18 | 19 | void main() 20 | { 21 | vec2 unnormTexCoord = texCoord * vec2(pc.scrWidth, pc.scrHeight) + vec2(pc.offsetX, pc.offsetY); 22 | 23 | // apply any additional world-only postprocessing effects here (if enabled) 24 | if (pc.postprocess > 0.0) 25 | { 26 | //gamma + color intensity bump 27 | fragmentColor = vec4(pow(textureLod(sTexture, unnormTexCoord, 0.0).rgb * 1.5, vec3(pc.gamma)), 1.0); 28 | } 29 | else 30 | { 31 | fragmentColor = textureLod(sTexture, unnormTexCoord, 0.0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /shaders/postprocess.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | // rendering a fullscreen quad (which is actually just a huge triangle) 5 | // source: https://www.saschawillems.de/blog/2016/08/13/vulkan-tutorial-on-rendering-a-fullscreen-quad-without-buffers/ 6 | 7 | out gl_PerVertex { 8 | vec4 gl_Position; 9 | }; 10 | 11 | layout(location = 0) out vec2 texCoord; 12 | 13 | void main() 14 | { 15 | texCoord = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); 16 | gl_Position = vec4(texCoord * 2.0f + -1.0f, 0.0f, 1.0f); 17 | } 18 | -------------------------------------------------------------------------------- /shaders/shaders.bat: -------------------------------------------------------------------------------- 1 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name basic_vert_spv -V basic.vert -o ../src/vk/spirv/basic_vert.c 2 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name basic_frag_spv -V basic.frag -o ../src/vk/spirv/basic_frag.c 3 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name basic_color_quad_vert_spv -V basic_color_quad.vert -o ../src/vk/spirv/basic_color_quad_vert.c 4 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name basic_color_quad_frag_spv -V basic_color_quad.frag -o ../src/vk/spirv/basic_color_quad_frag.c 5 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name model_vert_spv -V model.vert -o ../src/vk/spirv/model_vert.c 6 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name model_frag_spv -V model.frag -o ../src/vk/spirv/model_frag.c 7 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name nullmodel_vert_spv -V nullmodel.vert -o ../src/vk/spirv/nullmodel_vert.c 8 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name particle_vert_spv -V particle.vert -o ../src/vk/spirv/particle_vert.c 9 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name point_particle_vert_spv -V point_particle.vert -o ../src/vk/spirv/point_particle_vert.c 10 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name point_particle_frag_spv -V point_particle.frag -o ../src/vk/spirv/point_particle_frag.c 11 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name sprite_vert_spv -V sprite.vert -o ../src/vk/spirv/sprite_vert.c 12 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name beam_vert_spv -V beam.vert -o ../src/vk/spirv/beam_vert.c 13 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name skybox_vert_spv -V skybox.vert -o ../src/vk/spirv/skybox_vert.c 14 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name d_light_vert_spv -V d_light.vert -o ../src/vk/spirv/d_light_vert.c 15 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name polygon_vert_spv -V polygon.vert -o ../src/vk/spirv/polygon_vert.c 16 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name polygon_lmap_vert_spv -V polygon_lmap.vert -o ../src/vk/spirv/polygon_lmap_vert.c 17 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name polygon_lmap_frag_spv -V polygon_lmap.frag -o ../src/vk/spirv/polygon_lmap_frag.c 18 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name polygon_warp_vert_spv -V polygon_warp.vert -o ../src/vk/spirv/polygon_warp_vert.c 19 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name shadows_vert_spv -V shadows.vert -o ../src/vk/spirv/shadows_vert.c 20 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name postprocess_vert_spv -V postprocess.vert -o ../src/vk/spirv/postprocess_vert.c 21 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name postprocess_frag_spv -V postprocess.frag -o ../src/vk/spirv/postprocess_frag.c 22 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name world_warp_vert_spv -V world_warp.vert -o ../src/vk/spirv/world_warp_vert.c 23 | %VULKAN_SDK%\bin\glslangValidator.exe --variable-name world_warp_frag_spv -V world_warp.frag -o ../src/vk/spirv/world_warp_frag.c -------------------------------------------------------------------------------- /shaders/shaders.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | glslangValidator --variable-name basic_vert_spv -V basic.vert -o ../src/vk/spirv/basic_vert.c 4 | glslangValidator --variable-name basic_frag_spv -V basic.frag -o ../src/vk/spirv/basic_frag.c 5 | glslangValidator --variable-name basic_color_quad_vert_spv -V basic_color_quad.vert -o ../src/vk/spirv/basic_color_quad_vert.c 6 | glslangValidator --variable-name basic_color_quad_frag_spv -V basic_color_quad.frag -o ../src/vk/spirv/basic_color_quad_frag.c 7 | glslangValidator --variable-name model_vert_spv -V model.vert -o ../src/vk/spirv/model_vert.c 8 | glslangValidator --variable-name model_frag_spv -V model.frag -o ../src/vk/spirv/model_frag.c 9 | glslangValidator --variable-name nullmodel_vert_spv -V nullmodel.vert -o ../src/vk/spirv/nullmodel_vert.c 10 | glslangValidator --variable-name particle_vert_spv -V particle.vert -o ../src/vk/spirv/particle_vert.c 11 | glslangValidator --variable-name point_particle_vert_spv -V point_particle.vert -o ../src/vk/spirv/point_particle_vert.c 12 | glslangValidator --variable-name point_particle_frag_spv -V point_particle.frag -o ../src/vk/spirv/point_particle_frag.c 13 | glslangValidator --variable-name sprite_vert_spv -V sprite.vert -o ../src/vk/spirv/sprite_vert.c 14 | glslangValidator --variable-name beam_vert_spv -V beam.vert -o ../src/vk/spirv/beam_vert.c 15 | glslangValidator --variable-name skybox_vert_spv -V skybox.vert -o ../src/vk/spirv/skybox_vert.c 16 | glslangValidator --variable-name d_light_vert_spv -V d_light.vert -o ../src/vk/spirv/d_light_vert.c 17 | glslangValidator --variable-name polygon_vert_spv -V polygon.vert -o ../src/vk/spirv/polygon_vert.c 18 | glslangValidator --variable-name polygon_lmap_vert_spv -V polygon_lmap.vert -o ../src/vk/spirv/polygon_lmap_vert.c 19 | glslangValidator --variable-name polygon_lmap_frag_spv -V polygon_lmap.frag -o ../src/vk/spirv/polygon_lmap_frag.c 20 | glslangValidator --variable-name polygon_warp_vert_spv -V polygon_warp.vert -o ../src/vk/spirv/polygon_warp_vert.c 21 | glslangValidator --variable-name shadows_vert_spv -V shadows.vert -o ../src/vk/spirv/shadows_vert.c 22 | glslangValidator --variable-name postprocess_vert_spv -V postprocess.vert -o ../src/vk/spirv/postprocess_vert.c 23 | glslangValidator --variable-name postprocess_frag_spv -V postprocess.frag -o ../src/vk/spirv/postprocess_frag.c 24 | glslangValidator --variable-name world_warp_vert_spv -V world_warp.vert -o ../src/vk/spirv/world_warp_vert.c 25 | glslangValidator --variable-name world_warp_frag_spv -V world_warp.frag -o ../src/vk/spirv/world_warp_frag.c 26 | -------------------------------------------------------------------------------- /shaders/shadows.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 inVertex; 5 | layout(location = 0) out vec4 color; 6 | 7 | layout(push_constant) uniform PushConstant 8 | { 9 | mat4 vpMatrix; 10 | } pc; 11 | 12 | layout(binding = 0) uniform UniformBufferObject 13 | { 14 | mat4 model; 15 | } ubo; 16 | 17 | out gl_PerVertex { 18 | vec4 gl_Position; 19 | }; 20 | 21 | void main() { 22 | gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0); 23 | color = vec4(0.0, 0.0, 0.0, 0.5); 24 | } 25 | -------------------------------------------------------------------------------- /shaders/skybox.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 inVertex; 5 | layout(location = 1) in vec2 inTexCoord; 6 | 7 | layout(push_constant) uniform PushConstant 8 | { 9 | mat4 vpMatrix; 10 | } pc; 11 | 12 | layout(set = 1, binding = 0) uniform UniformBufferObject 13 | { 14 | mat4 model; 15 | } ubo; 16 | 17 | layout(location = 0) out vec2 texCoord; 18 | layout(location = 1) out vec4 color; 19 | layout(location = 2) out float aTreshold; 20 | 21 | out gl_PerVertex { 22 | vec4 gl_Position; 23 | }; 24 | 25 | void main() { 26 | gl_Position = pc.vpMatrix * ubo.model * vec4(inVertex, 1.0); 27 | texCoord = inTexCoord; 28 | color = vec4(1.0, 1.0, 1.0, 1.0); 29 | aTreshold = 0.0; 30 | } 31 | -------------------------------------------------------------------------------- /shaders/sprite.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec3 inVertex; 5 | layout(location = 1) in vec2 inTexCoord; 6 | 7 | layout(push_constant) uniform PushConstant 8 | { 9 | mat4 mvpMatrix; 10 | float alpha; 11 | } pc; 12 | 13 | layout(location = 0) out vec2 texCoord; 14 | layout(location = 1) out vec4 color; 15 | layout(location = 2) out float aTreshold; 16 | 17 | out gl_PerVertex { 18 | vec4 gl_Position; 19 | }; 20 | 21 | void main() { 22 | gl_Position = pc.mvpMatrix * vec4(inVertex, 1.0); 23 | texCoord = inTexCoord; 24 | color = vec4(1.0, 1.0, 1.0, pc.alpha); 25 | aTreshold = 0.0666; 26 | } 27 | -------------------------------------------------------------------------------- /shaders/world_warp.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | // Underwater screen warp effect similar to what software renderer provides. 5 | // Pixel size to simulate lower screen resolutions is used to restore world to full screen size. 6 | 7 | layout(push_constant) uniform PushConstant 8 | { 9 | layout(offset = 68) float time; 10 | layout(offset = 72) float scale; 11 | layout(offset = 76) float scrWidth; 12 | layout(offset = 80) float scrHeight; 13 | layout(offset = 84) float offsetX; 14 | layout(offset = 88) float offsetY; 15 | layout(offset = 92) float pixelSize; 16 | layout(offset = 96) float refdefX; 17 | layout(offset = 100) float refdefY; 18 | layout(offset = 104) float refdefWidth; 19 | layout(offset = 108) float refdefHeight; 20 | } pc; 21 | 22 | layout(set = 0, binding = 0) uniform sampler2D sTexture; 23 | 24 | layout(location = 0) out vec4 fragmentColor; 25 | 26 | #define PI 3.1415 27 | 28 | void main() 29 | { 30 | vec2 scrSize = vec2(pc.scrWidth, pc.scrHeight); 31 | vec2 fragCoord = (gl_FragCoord.xy - vec2(pc.offsetX, pc.offsetY)); 32 | vec2 uv = fragCoord / scrSize; 33 | 34 | float xMin = pc.refdefX; 35 | float xMax = pc.refdefX + pc.refdefWidth; 36 | float yMin = pc.refdefY; 37 | float yMax = pc.refdefY + pc.refdefHeight; 38 | 39 | if (pc.time > 0 && fragCoord.x > xMin && fragCoord.x < xMax && fragCoord.y > yMin && fragCoord.y < yMax) 40 | { 41 | float sx = pc.scale - abs(pc.scrWidth / 2.0 - fragCoord.x) * 2.0 / pc.scrWidth; 42 | float sy = pc.scale - abs(pc.scrHeight / 2.0 - fragCoord.y) * 2.0 / pc.scrHeight; 43 | float xShift = 2.0 * pc.time + uv.y * PI * 10; 44 | float yShift = 2.0 * pc.time + uv.x * PI * 10; 45 | vec2 distortion = vec2(sin(xShift) * sx, sin(yShift) * sy) * 0.00666; 46 | 47 | uv += distortion; 48 | } 49 | 50 | uv /= pc.pixelSize; 51 | 52 | uv = clamp(uv * scrSize, vec2(0.0, 0.0), scrSize - vec2(0.5, 0.5)); 53 | 54 | fragmentColor = textureLod(sTexture, uv, 0.0); 55 | } 56 | -------------------------------------------------------------------------------- /shaders/world_warp.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | out gl_PerVertex { 5 | vec4 gl_Position; 6 | }; 7 | 8 | void main() 9 | { 10 | vec4 positions[3] = { 11 | vec4(-1.0f, -1.0f, 0.0f, 1.0f), 12 | vec4(3.0f, -1.0f, 0.0f, 1.0f), 13 | vec4(-1.0f, 3.0f, 0.0f, 1.0f) 14 | }; 15 | 16 | gl_Position = positions[gl_VertexIndex % 3]; 17 | } 18 | -------------------------------------------------------------------------------- /src/backends/hunk_unix.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | * ======================================================================= 21 | * 22 | * This file implements the low level part of the Hunk_* memory system 23 | * 24 | * ======================================================================= 25 | */ 26 | 27 | /* For mremap() - must be before sys/mman.h include! */ 28 | #if defined(__linux__) && !defined(_GNU_SOURCE) 29 | #define _GNU_SOURCE 30 | #endif 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "../common/header/common.h" 38 | 39 | #if defined(__FreeBSD__) || defined(__OpenBSD__) 40 | #include 41 | #define MAP_ANONYMOUS MAP_ANON 42 | #endif 43 | 44 | #if defined(__APPLE__) 45 | #include 46 | #define MAP_ANONYMOUS MAP_ANON 47 | #endif 48 | 49 | byte *membase; 50 | size_t maxhunksize; 51 | size_t curhunksize; 52 | 53 | void * 54 | Hunk_Begin(int maxsize) 55 | { 56 | 57 | /* reserve a huge chunk of memory, but don't commit any yet */ 58 | /* plus 32 bytes for cacheline */ 59 | maxhunksize = maxsize + sizeof(size_t) + 32; 60 | curhunksize = 0; 61 | int flags = MAP_PRIVATE | MAP_ANONYMOUS; 62 | int prot = PROT_READ | PROT_WRITE; 63 | 64 | #if defined(MAP_ALIGNED_SUPER) 65 | const size_t hgpagesize = 1UL<<21; 66 | size_t page_size = sysconf(_SC_PAGESIZE); 67 | 68 | /* Archs supported has 2MB for super pages size */ 69 | if (maxhunksize >= hgpagesize) 70 | { 71 | maxhunksize = (maxhunksize & ~(page_size-1)) + page_size; 72 | flags |= MAP_ALIGNED_SUPER; 73 | } 74 | #endif 75 | 76 | #if defined(PROT_MAX) 77 | /* For now it is FreeBSD exclusif but could possibly be extended 78 | to other like DFBSD for example */ 79 | prot |= PROT_MAX(prot); 80 | #endif 81 | 82 | membase = (byte *)mmap(0, maxhunksize, prot, 83 | flags, -1, 0); 84 | 85 | if ((membase == NULL) || (membase == (byte *)-1)) 86 | { 87 | Sys_Error("unable to virtual allocate %d bytes", maxsize); 88 | } 89 | 90 | *((size_t *)membase) = curhunksize; 91 | 92 | return membase + sizeof(size_t); 93 | } 94 | 95 | void * 96 | Hunk_Alloc(int size) 97 | { 98 | byte *buf; 99 | 100 | /* round to cacheline */ 101 | size = (size + 31) & ~31; 102 | 103 | if (curhunksize + size > maxhunksize) 104 | { 105 | Sys_Error("Hunk_Alloc overflow"); 106 | } 107 | 108 | buf = membase + sizeof(size_t) + curhunksize; 109 | curhunksize += size; 110 | return buf; 111 | } 112 | 113 | int 114 | Hunk_End(void) 115 | { 116 | byte *n = NULL; 117 | 118 | #if defined(__linux__) 119 | n = (byte *)mremap(membase, maxhunksize, curhunksize + sizeof(size_t), 0); 120 | #elif defined(__NetBSD__) 121 | n = (byte *)mremap(membase, maxhunksize, NULL, curhunksize + sizeof(size_t), 0); 122 | #else 123 | #ifndef round_page 124 | size_t page_size = sysconf(_SC_PAGESIZE); 125 | #define round_page(x) ((((size_t)(x)) + page_size-1) & ~(page_size-1)) 126 | #endif 127 | 128 | size_t old_size = round_page(maxhunksize); 129 | size_t new_size = round_page(curhunksize + sizeof(size_t)); 130 | 131 | if (new_size > old_size) 132 | { 133 | /* Can never happen. If it happens something's very wrong. */ 134 | n = 0; 135 | } 136 | else if (new_size < old_size) 137 | { 138 | /* Hunk is to big, we need to shrink it. */ 139 | n = munmap(membase + new_size, old_size - new_size) + membase; 140 | } 141 | else 142 | { 143 | /* No change necessary. */ 144 | n = membase; 145 | } 146 | #endif 147 | 148 | if (n != membase) 149 | { 150 | Sys_Error("Hunk_End: Could not remap virtual block (%d)", errno); 151 | } 152 | 153 | *((size_t *)membase) = curhunksize + sizeof(size_t); 154 | 155 | return curhunksize; 156 | } 157 | 158 | void 159 | Hunk_Free(void *base) 160 | { 161 | if (base) 162 | { 163 | byte *m; 164 | 165 | m = ((byte *)base) - sizeof(size_t); 166 | 167 | if (munmap(m, *((size_t *)m))) 168 | { 169 | Sys_Error("Hunk_Free: munmap failed (%d)", errno); 170 | } 171 | } 172 | } 173 | 174 | -------------------------------------------------------------------------------- /src/backends/hunk_windows.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | * ======================================================================= 21 | * 22 | * Memory handling functions. 23 | * 24 | * ======================================================================= 25 | */ 26 | 27 | #include 28 | 29 | #include "../common/header/common.h" 30 | 31 | byte *membase; 32 | int hunkcount; 33 | size_t hunkmaxsize; 34 | size_t cursize; 35 | 36 | void * 37 | Hunk_Begin(int maxsize) 38 | { 39 | /* reserve a huge chunk of memory, but don't commit any yet */ 40 | /* plus 32 bytes for cacheline */ 41 | hunkmaxsize = maxsize + sizeof(size_t) + 32; 42 | cursize = 0; 43 | 44 | membase = VirtualAlloc(NULL, hunkmaxsize, MEM_RESERVE, PAGE_NOACCESS); 45 | 46 | if (!membase) 47 | { 48 | Sys_Error("VirtualAlloc reserve failed"); 49 | } 50 | 51 | return (void *)membase; 52 | } 53 | 54 | void * 55 | Hunk_Alloc(int size) 56 | { 57 | void *buf; 58 | 59 | /* round to cacheline */ 60 | size = (size + 31) & ~31; 61 | 62 | /* commit pages as needed */ 63 | buf = VirtualAlloc(membase, cursize + size, MEM_COMMIT, PAGE_READWRITE); 64 | 65 | if (!buf) 66 | { 67 | Sys_Error("VirtualAlloc commit failed.\n"); 68 | } 69 | 70 | cursize += size; 71 | 72 | if (cursize > hunkmaxsize) 73 | { 74 | Sys_Error("Hunk_Alloc overflow"); 75 | } 76 | 77 | return (void *)(membase + cursize - size); 78 | } 79 | 80 | int 81 | Hunk_End(void) 82 | { 83 | hunkcount++; 84 | 85 | return cursize; 86 | } 87 | 88 | void 89 | Hunk_Free(void *base) 90 | { 91 | if (base) 92 | { 93 | VirtualFree(base, 0, MEM_RELEASE); 94 | } 95 | 96 | hunkcount--; 97 | } 98 | -------------------------------------------------------------------------------- /src/common/header/crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | * ======================================================================= 21 | * 22 | * Corresponding header for crc.c 23 | * 24 | * ======================================================================= 25 | */ 26 | 27 | #ifndef CO_CRC_H 28 | #define CO_CRC_H 29 | 30 | void CRC_Init(unsigned short *crcvalue); 31 | unsigned short CRC_Block(byte *start, int count); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/common/header/ref_shared.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | * ======================================================================= 21 | * 22 | * Header shared between different refreshers (but not with client) 23 | * 24 | * ======================================================================= 25 | */ 26 | 27 | #ifndef SRC_CLIENT_REFRESH_REF_SHARED_H_ 28 | #define SRC_CLIENT_REFRESH_REF_SHARED_H_ 29 | 30 | #include "ref_api.h" 31 | 32 | #ifdef _MSC_VER 33 | 34 | #include 35 | 36 | #define YQ2_VLA(TYPE, VARNAME, NUMELEMS) \ 37 | TYPE * VARNAME = (TYPE *) _malloca(sizeof(TYPE) * NUMELEMS) 38 | #define YQ2_VLAFREE(VARNAME) \ 39 | _freea(VARNAME); VARNAME=NULL; 40 | 41 | #else // other compilers hopefully support C99 VLAs (gcc/mingw and clang do) 42 | 43 | #define YQ2_VLA(TYPE, VARNAME, NUMELEMS) \ 44 | TYPE VARNAME[NUMELEMS] 45 | #define YQ2_VLAFREE(VARNAME) 46 | 47 | #endif 48 | 49 | /* 50 | * skins will be outline flood filled and mip mapped 51 | * pics and sprites with alpha will be outline flood filled 52 | * pic won't be mip mapped 53 | * 54 | * model skin 55 | * sprite frame 56 | * wall texture 57 | * pic 58 | */ 59 | typedef enum 60 | { 61 | it_skin, 62 | it_sprite, 63 | it_wall, 64 | it_pic, 65 | it_sky 66 | } imagetype_t; 67 | 68 | typedef enum 69 | { 70 | mod_bad, 71 | mod_brush, 72 | mod_sprite, 73 | mod_alias 74 | } modtype_t; 75 | 76 | #define MAX_LBM_HEIGHT 480 77 | #define DEFAULT_NOLERP_LIST "pics/conchars.* pics/ch1.* pics/ch2. pics/ch3.*" 78 | extern void R_Printf(int level, const char* msg, ...) PRINTF_ATTR(2, 3); 79 | 80 | /* Shared images load */ 81 | typedef struct image_s* (*loadimage_t)(const char *name, byte *pic, int width, int realwidth, 82 | int height, int realheight, size_t data_size, imagetype_t type, int bits); 83 | extern struct image_s* LoadWal(const char *origname, imagetype_t type, loadimage_t load_image); 84 | extern struct image_s* LoadM8(const char *origname, imagetype_t type, loadimage_t load_image); 85 | extern struct image_s* LoadM32(const char *origname, imagetype_t type, loadimage_t load_image); 86 | extern void FixFileExt(const char *origname, const char *ext, char *filename, size_t size); 87 | extern void GetPCXPalette(byte **colormap, unsigned *d_8to24table); 88 | extern void GetPCXPalette24to8(byte *d_8to24table, byte** d_16to8table); 89 | extern void LoadPCX(const char *origname, byte **pic, byte **palette, int *width, int *height, 90 | int *bitsPerPixel); 91 | extern void GetPCXInfo(const char *origname, int *width, int *height); 92 | extern void GetWalInfo(const char *name, int *width, int *height); 93 | extern void GetM8Info(const char *name, int *width, int *height); 94 | extern void GetM32Info(const char *name, int *width, int *height); 95 | 96 | extern qboolean ResizeSTB(const byte *input_pixels, int input_width, int input_height, 97 | byte *output_pixels, int output_width, int output_height); 98 | extern void SmoothColorImage(unsigned *dst, size_t size, size_t rstep); 99 | extern void scale2x(const byte *src, byte *dst, int width, int height); 100 | extern void scale3x(const byte *src, byte *dst, int width, int height); 101 | 102 | extern float Mod_RadiusFromBounds(const vec3_t mins, const vec3_t maxs); 103 | extern const byte* Mod_DecompressVis(const byte *in, int row); 104 | 105 | /* Shared models struct */ 106 | 107 | enum { 108 | SIDE_FRONT = 0, 109 | SIDE_BACK = 1, 110 | SIDE_ON = 2 111 | }; 112 | 113 | // FIXME: differentiate from texinfo SURF_ flags 114 | enum { 115 | SURF_PLANEBACK = 0x02, 116 | SURF_DRAWSKY = 0x04, // sky brush face 117 | SURF_DRAWTURB = 0x10, 118 | SURF_DRAWBACKGROUND = 0x40, 119 | SURF_UNDERWATER = 0x80 120 | }; 121 | 122 | typedef struct mvertex_s 123 | { 124 | vec3_t position; 125 | } mvertex_t; 126 | 127 | typedef struct medge_s 128 | { 129 | unsigned short v[2]; 130 | unsigned int cachededgeoffset; 131 | } medge_t; 132 | 133 | typedef struct mtexinfo_s 134 | { 135 | float vecs[2][4]; 136 | int flags; 137 | int numframes; 138 | struct mtexinfo_s *next; /* animation chain */ 139 | struct image_s *image; 140 | } mtexinfo_t; 141 | 142 | #define CONTENTS_NODE -1 143 | typedef struct mnode_s 144 | { 145 | /* common with leaf */ 146 | int contents; /* CONTENTS_NODE, to differentiate from leafs */ 147 | int visframe; /* node needs to be traversed if current */ 148 | 149 | float minmaxs[6]; /* for bounding box culling */ 150 | 151 | struct mnode_s *parent; 152 | 153 | /* node specific */ 154 | cplane_t *plane; 155 | struct mnode_s *children[2]; 156 | 157 | unsigned short firstsurface; 158 | unsigned short numsurfaces; 159 | } mnode_t; 160 | 161 | typedef struct mleaf_s 162 | { 163 | /* common with leaf */ 164 | int contents; /* CONTENTS_NODE, to differentiate from leafs */ 165 | int visframe; /* node needs to be traversed if current */ 166 | 167 | float minmaxs[6]; /* for bounding box culling */ 168 | 169 | struct mnode_s *parent; 170 | 171 | /* leaf specific */ 172 | int cluster; 173 | int area; 174 | 175 | struct msurface_s **firstmarksurface; 176 | int nummarksurfaces; 177 | int key; /* BSP sequence number for leaf's contents */ 178 | } mleaf_t; 179 | 180 | /* BSPX Light octtree */ 181 | #define LGNODE_LEAF (1u<<31) 182 | #define LGNODE_MISSING (1u<<30) 183 | 184 | /* this uses an octtree to trim samples. */ 185 | typedef struct bspxlgnode_s 186 | { 187 | int mid[3]; 188 | unsigned int child[8]; 189 | } bspxlgnode_t; 190 | 191 | typedef struct bspxlglightstyle_s 192 | { 193 | byte style; 194 | byte rgb[3]; 195 | } bspxlglightstyle_t; 196 | 197 | typedef struct bspxlgsamp_s 198 | { 199 | bspxlglightstyle_t map[4]; 200 | } bspxlgsamp_t; 201 | 202 | typedef struct bspxlgleaf_s 203 | { 204 | int mins[3]; 205 | int size[3]; 206 | bspxlgsamp_t *rgbvalues; 207 | } bspxlgleaf_t; 208 | 209 | typedef struct 210 | { 211 | vec3_t gridscale; 212 | unsigned int count[3]; 213 | vec3_t mins; 214 | unsigned int styles; 215 | 216 | unsigned int rootnode; 217 | 218 | unsigned int numnodes; 219 | bspxlgnode_t *nodes; 220 | unsigned int numleafs; 221 | bspxlgleaf_t *leafs; 222 | } bspxlightgrid_t; 223 | 224 | /* Shared models func */ 225 | typedef struct image_s* (*findimage_t)(const char *name, imagetype_t type); 226 | extern void *Mod_LoadAliasModel (const char *mod_name, const void *buffer, int modfilelen, 227 | vec3_t mins, vec3_t maxs, struct image_s **skins, 228 | findimage_t find_image, modtype_t *type); 229 | extern void *Mod_LoadSP2 (const char *mod_name, const void *buffer, int modfilelen, 230 | struct image_s **skins, findimage_t find_image, modtype_t *type); 231 | extern int Mod_ReLoadSkins(struct image_s **skins, findimage_t find_image, 232 | void *extradata, modtype_t type); 233 | extern struct image_s *GetSkyImage(const char *skyname, const char* surfname, 234 | qboolean palettedtexture, findimage_t find_image); 235 | extern struct image_s *GetTexImage(const char *name, findimage_t find_image); 236 | extern struct image_s *R_FindPic(const char *name, findimage_t find_image); 237 | extern struct image_s* R_LoadImage(const char *name, const char* namewe, const char *ext, 238 | imagetype_t type, qboolean r_retexturing, loadimage_t load_image); 239 | extern void Mod_LoadNodes(const char *name, cplane_t *planes, int numplanes, 240 | mleaf_t *leafs, int numleafs, mnode_t **nodes, int *numnodes, 241 | const byte *mod_base, const lump_t *l); 242 | extern void Mod_LoadVertexes(const char *name, mvertex_t **vertexes, int *numvertexes, 243 | const byte *mod_base, const lump_t *l, int extra); 244 | extern void Mod_LoadVisibility(dvis_t **vis, const byte *mod_base, const lump_t *l); 245 | extern void Mod_LoadLighting(byte **lightdata, const byte *mod_base, const lump_t *l); 246 | extern void Mod_LoadTexinfo(const char *name, mtexinfo_t **texinfo, int *numtexinfo, 247 | const byte *mod_base, const lump_t *l, findimage_t find_image, 248 | struct image_s *notexture, int extra); 249 | extern void Mod_LoadEdges(const char *name, medge_t **edges, int *numedges, 250 | const byte *mod_base, const lump_t *l, int extra); 251 | extern void Mod_LoadPlanes (const char *name, cplane_t **planes, int *numplanes, 252 | const byte *mod_base, const lump_t *l, int extra); 253 | extern void Mod_LoadSurfedges (const char *name, int **surfedges, int *numsurfedges, 254 | const byte *mod_base, const lump_t *l, int extra); 255 | extern int Mod_CalcLumpHunkSize(const lump_t *l, int inSize, int outSize, int extra); 256 | extern mleaf_t *Mod_PointInLeaf(const vec3_t p, mnode_t *node); 257 | int Mod_LoadFile(char *name, void **buffer); 258 | 259 | /* Surface logic */ 260 | #define DLIGHT_CUTOFF 64 261 | 262 | typedef void (*marksurfacelights_t)(dlight_t *light, int bit, mnode_t *node, 263 | int lightframecount); 264 | extern void R_MarkLights(dlight_t *light, int bit, mnode_t *node, int lightframecount, 265 | marksurfacelights_t mark_surface_lights); 266 | extern struct image_s *R_TextureAnimation(const entity_t *currententity, 267 | const mtexinfo_t *tex); 268 | extern qboolean R_AreaVisible(const byte *areabits, mleaf_t *pleaf); 269 | extern qboolean R_CullBox(vec3_t mins, vec3_t maxs, cplane_t *frustum); 270 | extern void R_SetFrustum(vec3_t vup, vec3_t vpn, vec3_t vright, vec3_t r_origin, 271 | float fov_x, float fov_y, cplane_t *frustum); 272 | 273 | #endif /* SRC_CLIENT_REFRESH_REF_SHARED_H_ */ 274 | -------------------------------------------------------------------------------- /src/common/header/shared_safe.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | * ======================================================================= 21 | * 22 | * Updated prototypes of shared functions and definitions 23 | * 24 | * ======================================================================= 25 | */ 26 | 27 | #ifndef COMMON_SHARED_SAFE_H 28 | #define COMMON_SHARED_SAFE_H 29 | 30 | #include "shared.h" 31 | 32 | // Not exported by default but not static 33 | float Q_fabs(float f); 34 | int BoxOnPlaneSide2(vec3_t emins, vec3_t emaxs, struct cplane_s *p); 35 | short ShortSwap(short l); 36 | short ShortNoSwap(short l); 37 | int LongSwap(int l); 38 | int LongNoSwap(int l); 39 | float FloatSwap(float f); 40 | float FloatNoSwap(float f); 41 | 42 | /* 43 | * TODO: Sync with yquake 44 | */ 45 | qboolean File_Filtered(const char *name, const char *filter, char sepator); 46 | 47 | #endif // COMMON_SHARED_SAFE_H 48 | -------------------------------------------------------------------------------- /src/common/header/vid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 18 | * USA. 19 | * 20 | * ======================================================================= 21 | * 22 | * API between client and renderer. 23 | * 24 | * ======================================================================= 25 | */ 26 | 27 | #ifndef CL_VID_H 28 | #define CL_VID_H 29 | 30 | #include "common.h" 31 | 32 | // FIXME: Remove it, it's unused. 33 | typedef struct vrect_s { 34 | int x,y,width,height; 35 | } vrect_t; 36 | 37 | // Hold the video state. 38 | typedef struct { 39 | int height; 40 | int width; 41 | } viddef_t; 42 | 43 | // Global video state. 44 | extern viddef_t viddef; 45 | 46 | // Generic stuff. 47 | qboolean VID_HasRenderer(const char *renderer); 48 | void VID_Init(void); 49 | void VID_Shutdown(void); 50 | void VID_CheckChanges(void); 51 | 52 | void VID_MenuInit(void); 53 | void VID_MenuDraw(void); 54 | const char *VID_MenuKey(int); 55 | 56 | // Stuff provided by platform backend. 57 | extern float glimp_refreshRate; 58 | 59 | const char **GLimp_GetDisplayIndices(void); 60 | int GLimp_GetWindowDisplayIndex(void); 61 | int GLimp_GetNumVideoDisplays(void); 62 | qboolean GLimp_Init(void); 63 | void GLimp_Shutdown(void); 64 | qboolean GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight); 65 | void GLimp_ShutdownGraphics(void); 66 | void GLimp_GrabInput(qboolean grab); 67 | float GLimp_GetRefreshRate(void); 68 | qboolean GLimp_GetDesktopMode(int *pwidth, int *pheight); 69 | int GLimp_GetFrameworkVersion(void); 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/common/md4.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Public Domain C source implementation of RFC 1320 3 | * - The MD4 Message-Digest Algorithm - 4 | * 5 | * http://www.faqs.org/rfcs/rfc1320.html 6 | * by Steven Fuller 7 | */ 8 | 9 | #include 10 | #include "header/common.h" 11 | 12 | #define ROTATELEFT32(x, s) (((x) << (s)) | ((x) >> (32 - (s)))) 13 | 14 | #define F(X, Y, Z) (((X)&(Y)) | ((~X) & (Z))) 15 | #define G(X, Y, Z) (((X)&(Y)) | ((X)&(Z)) | ((Y)&(Z))) 16 | #define H(X, Y, Z) ((X) ^ (Y) ^ (Z)) 17 | 18 | #define S(a, b, c, d, k, s) \ 19 | { \ 20 | a += (F((b), (c), (d)) + X[(k)]); \ 21 | a = ROTATELEFT32(a, s); \ 22 | } 23 | #define T(a, b, c, d, k, s) \ 24 | { \ 25 | a += (G((b), (c), (d)) + X[(k)] + 0x5A827999); \ 26 | a = ROTATELEFT32(a, s); \ 27 | } 28 | #define U(a, b, c, d, k, s) \ 29 | { \ 30 | a += (H((b), (c), (d)) + X[(k)] + 0x6ED9EBA1); \ 31 | a = ROTATELEFT32(a, s); \ 32 | } 33 | 34 | static uint32_t X[16]; 35 | static uint32_t A, AA; 36 | static uint32_t B, BB; 37 | static uint32_t C, CC; 38 | static uint32_t D, DD; 39 | 40 | static void 41 | DoMD4() 42 | { 43 | AA = A; 44 | BB = B; 45 | CC = C; 46 | DD = D; 47 | 48 | S(A, B, C, D, 0, 3); 49 | S(D, A, B, C, 1, 7); 50 | S(C, D, A, B, 2, 11); 51 | S(B, C, D, A, 3, 19); 52 | S(A, B, C, D, 4, 3); 53 | S(D, A, B, C, 5, 7); 54 | S(C, D, A, B, 6, 11); 55 | S(B, C, D, A, 7, 19); 56 | S(A, B, C, D, 8, 3); 57 | S(D, A, B, C, 9, 7); 58 | S(C, D, A, B, 10, 11); 59 | S(B, C, D, A, 11, 19); 60 | S(A, B, C, D, 12, 3); 61 | S(D, A, B, C, 13, 7); 62 | S(C, D, A, B, 14, 11); 63 | S(B, C, D, A, 15, 19); 64 | 65 | T(A, B, C, D, 0, 3); 66 | T(D, A, B, C, 4, 5); 67 | T(C, D, A, B, 8, 9); 68 | T(B, C, D, A, 12, 13); 69 | T(A, B, C, D, 1, 3); 70 | T(D, A, B, C, 5, 5); 71 | T(C, D, A, B, 9, 9); 72 | T(B, C, D, A, 13, 13); 73 | T(A, B, C, D, 2, 3); 74 | T(D, A, B, C, 6, 5); 75 | T(C, D, A, B, 10, 9); 76 | T(B, C, D, A, 14, 13); 77 | T(A, B, C, D, 3, 3); 78 | T(D, A, B, C, 7, 5); 79 | T(C, D, A, B, 11, 9); 80 | T(B, C, D, A, 15, 13); 81 | 82 | U(A, B, C, D, 0, 3); 83 | U(D, A, B, C, 8, 9); 84 | U(C, D, A, B, 4, 11); 85 | U(B, C, D, A, 12, 15); 86 | U(A, B, C, D, 2, 3); 87 | U(D, A, B, C, 10, 9); 88 | U(C, D, A, B, 6, 11); 89 | U(B, C, D, A, 14, 15); 90 | U(A, B, C, D, 1, 3); 91 | U(D, A, B, C, 9, 9); 92 | U(C, D, A, B, 5, 11); 93 | U(B, C, D, A, 13, 15); 94 | U(A, B, C, D, 3, 3); 95 | U(D, A, B, C, 11, 9); 96 | U(C, D, A, B, 7, 11); 97 | U(B, C, D, A, 15, 15); 98 | 99 | A += AA; 100 | B += BB; 101 | C += CC; 102 | D += DD; 103 | } 104 | 105 | static void 106 | PerformMD4(const unsigned char *buf, int length, unsigned char *digest) 107 | { 108 | int len = length / 64; /* number of full blocks */ 109 | int rem = length % 64; /* number of left over bytes */ 110 | 111 | int i, j; 112 | const unsigned char *ptr = buf; 113 | 114 | /* initialize the MD buffer */ 115 | A = 0x67452301; 116 | B = 0xEFCDAB89; 117 | C = 0x98BADCFE; 118 | D = 0x10325476; 119 | 120 | for (i = 0; i < len; i++) 121 | { 122 | for (j = 0; j < 16; j++) 123 | { 124 | X[j] = ((ptr[0] << 0) | (ptr[1] << 8) | 125 | (ptr[2] << 16) | (ptr[3] << 24)); 126 | 127 | ptr += 4; 128 | } 129 | 130 | DoMD4(); 131 | } 132 | 133 | i = rem / 4; 134 | 135 | for (j = 0; j < i; j++) 136 | { 137 | X[j] = ((ptr[0] << 0) | (ptr[1] << 8) | 138 | (ptr[2] << 16) | (ptr[3] << 24)); 139 | 140 | ptr += 4; 141 | } 142 | 143 | switch (rem % 4) 144 | { 145 | case 0: 146 | X[j] = 0x80U; 147 | break; 148 | case 1: 149 | X[j] = ((ptr[0] << 0) | ((0x80U) << 8)); 150 | break; 151 | case 2: 152 | X[j] = ((ptr[0] << 0) | (ptr[1] << 8) | ((0x80U) << 16)); 153 | break; 154 | case 3: 155 | X[j] = 156 | ((ptr[0] << 157 | 0) | (ptr[1] << 8) | (ptr[2] << 16) | ((0x80U) << 24)); 158 | break; 159 | } 160 | 161 | j++; 162 | 163 | if (j > 14) 164 | { 165 | for ( ; j < 16; j++) 166 | { 167 | X[j] = 0; 168 | } 169 | 170 | DoMD4(); 171 | 172 | j = 0; 173 | } 174 | 175 | for ( ; j < 14; j++) 176 | { 177 | X[j] = 0; 178 | } 179 | 180 | X[14] = (length & 0x1FFFFFFF) << 3; 181 | X[15] = (length & ~0x1FFFFFFF) >> 29; 182 | 183 | DoMD4(); 184 | 185 | digest[0] = (A & 0x000000FF) >> 0; 186 | digest[1] = (A & 0x0000FF00) >> 8; 187 | digest[2] = (A & 0x00FF0000) >> 16; 188 | digest[3] = (A & 0xFF000000) >> 24; 189 | digest[4] = (B & 0x000000FF) >> 0; 190 | digest[5] = (B & 0x0000FF00) >> 8; 191 | digest[6] = (B & 0x00FF0000) >> 16; 192 | digest[7] = (B & 0xFF000000) >> 24; 193 | digest[8] = (C & 0x000000FF) >> 0; 194 | digest[9] = (C & 0x0000FF00) >> 8; 195 | digest[10] = (C & 0x00FF0000) >> 16; 196 | digest[11] = (C & 0xFF000000) >> 24; 197 | digest[12] = (D & 0x000000FF) >> 0; 198 | digest[13] = (D & 0x0000FF00) >> 8; 199 | digest[14] = (D & 0x00FF0000) >> 16; 200 | digest[15] = (D & 0xFF000000) >> 24; 201 | 202 | A = AA = 0; 203 | B = BB = 0; 204 | C = CC = 0; 205 | D = DD = 0; 206 | 207 | for (j = 0; j < 16; j++) 208 | { 209 | X[j] = 0; 210 | } 211 | } 212 | 213 | unsigned 214 | Com_BlockChecksum(void *buffer, int length) 215 | { 216 | uint32_t digest[4]; 217 | unsigned val; 218 | 219 | PerformMD4((unsigned char *)buffer, length, (unsigned char *)digest); 220 | 221 | val = digest[0] ^ digest[1] ^ digest[2] ^ digest[3]; 222 | 223 | return val; 224 | } 225 | 226 | -------------------------------------------------------------------------------- /src/common/utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | * ======================================================================= 21 | * 22 | * Additional functions shared between client and renders 23 | * 24 | * ======================================================================= 25 | */ 26 | 27 | #include "header/shared.h" 28 | 29 | /* 30 | * name: file name 31 | * filter: file name line rule with '*' 32 | * return false for empty filter 33 | */ 34 | static qboolean 35 | Utils_FilenameFiltered_Line(const char *name, const char *filter) 36 | { 37 | const char *current_filter = filter; 38 | 39 | // skip empty filter 40 | if (!*current_filter) 41 | { 42 | return false; 43 | } 44 | 45 | while (*current_filter) 46 | { 47 | char part_filter[MAX_QPATH]; 48 | const char *name_part; 49 | const char *str_end; 50 | 51 | str_end = strchr(current_filter, '*'); 52 | if (!str_end) 53 | { 54 | if (!strstr(name, current_filter)) 55 | { 56 | // no such part in string 57 | return false; 58 | } 59 | // have such part 60 | break; 61 | } 62 | // copy filter line 63 | if ((str_end - current_filter) >= MAX_QPATH) 64 | { 65 | return false; 66 | } 67 | memcpy(part_filter, current_filter, str_end - current_filter); 68 | part_filter[str_end - current_filter] = 0; 69 | // place part in name 70 | name_part = strstr(name, part_filter); 71 | if (!name_part) 72 | { 73 | // no such part in string 74 | return false; 75 | } 76 | // have such part 77 | name = name_part + strlen(part_filter); 78 | // move to next filter 79 | current_filter = str_end + 1; 80 | } 81 | 82 | return true; 83 | } 84 | 85 | /* 86 | * name: file name 87 | * filter: file names separated by sepator, and '!' for skip file 88 | */ 89 | qboolean 90 | Utils_FilenameFiltered(const char *name, const char *filter, char sepator) 91 | { 92 | const char *current_filter = filter; 93 | 94 | while (*current_filter) 95 | { 96 | char line_filter[MAX_QPATH]; 97 | const char *str_end; 98 | 99 | str_end = strchr(current_filter, sepator); 100 | // its end of filter 101 | if (!str_end) 102 | { 103 | // check rules inside line 104 | if (Utils_FilenameFiltered_Line(name, current_filter)) 105 | { 106 | return true; 107 | } 108 | return false; 109 | } 110 | // copy filter line 111 | if ((str_end - current_filter) >= MAX_QPATH) 112 | { 113 | return false; 114 | } 115 | memcpy(line_filter, current_filter, str_end - current_filter); 116 | line_filter[str_end - current_filter] = 0; 117 | // check rules inside line 118 | if (*line_filter == '!') 119 | { 120 | // has invert rule 121 | if (Utils_FilenameFiltered_Line(name, line_filter + 1)) 122 | { 123 | return false; 124 | } 125 | } 126 | else 127 | { 128 | if (Utils_FilenameFiltered_Line(name, line_filter)) 129 | { 130 | return true; 131 | } 132 | } 133 | // move to next filter 134 | current_filter = str_end + 1; 135 | } 136 | return false; 137 | } 138 | -------------------------------------------------------------------------------- /src/constants/anorms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | * ======================================================================= 21 | * 22 | * Precalculates anormal values 23 | * 24 | * ======================================================================= 25 | */ 26 | 27 | { -0.525731, 0.000000, 0.850651 }, 28 | { -0.442863, 0.238856, 0.864188 }, 29 | { -0.295242, 0.000000, 0.955423 }, 30 | { -0.309017, 0.500000, 0.809017 }, 31 | { -0.162460, 0.262866, 0.951056 }, 32 | { 0.000000, 0.000000, 1.000000 }, 33 | { 0.000000, 0.850651, 0.525731 }, 34 | { -0.147621, 0.716567, 0.681718 }, 35 | { 0.147621, 0.716567, 0.681718 }, 36 | { 0.000000, 0.525731, 0.850651 }, 37 | { 0.309017, 0.500000, 0.809017 }, 38 | { 0.525731, 0.000000, 0.850651 }, 39 | { 0.295242, 0.000000, 0.955423 }, 40 | { 0.442863, 0.238856, 0.864188 }, 41 | { 0.162460, 0.262866, 0.951056 }, 42 | { -0.681718, 0.147621, 0.716567 }, 43 | { -0.809017, 0.309017, 0.500000 }, 44 | { -0.587785, 0.425325, 0.688191 }, 45 | { -0.850651, 0.525731, 0.000000 }, 46 | { -0.864188, 0.442863, 0.238856 }, 47 | { -0.716567, 0.681718, 0.147621 }, 48 | { -0.688191, 0.587785, 0.425325 }, 49 | { -0.500000, 0.809017, 0.309017 }, 50 | { -0.238856, 0.864188, 0.442863 }, 51 | { -0.425325, 0.688191, 0.587785 }, 52 | { -0.716567, 0.681718, -0.147621 }, 53 | { -0.500000, 0.809017, -0.309017 }, 54 | { -0.525731, 0.850651, 0.000000 }, 55 | { 0.000000, 0.850651, -0.525731 }, 56 | { -0.238856, 0.864188, -0.442863 }, 57 | { 0.000000, 0.955423, -0.295242 }, 58 | { -0.262866, 0.951056, -0.162460 }, 59 | { 0.000000, 1.000000, 0.000000 }, 60 | { 0.000000, 0.955423, 0.295242 }, 61 | { -0.262866, 0.951056, 0.162460 }, 62 | { 0.238856, 0.864188, 0.442863 }, 63 | { 0.262866, 0.951056, 0.162460 }, 64 | { 0.500000, 0.809017, 0.309017 }, 65 | { 0.238856, 0.864188, -0.442863 }, 66 | { 0.262866, 0.951056, -0.162460 }, 67 | { 0.500000, 0.809017, -0.309017 }, 68 | { 0.850651, 0.525731, 0.000000 }, 69 | { 0.716567, 0.681718, 0.147621 }, 70 | { 0.716567, 0.681718, -0.147621 }, 71 | { 0.525731, 0.850651, 0.000000 }, 72 | { 0.425325, 0.688191, 0.587785 }, 73 | { 0.864188, 0.442863, 0.238856 }, 74 | { 0.688191, 0.587785, 0.425325 }, 75 | { 0.809017, 0.309017, 0.500000 }, 76 | { 0.681718, 0.147621, 0.716567 }, 77 | { 0.587785, 0.425325, 0.688191 }, 78 | { 0.955423, 0.295242, 0.000000 }, 79 | { 1.000000, 0.000000, 0.000000 }, 80 | { 0.951056, 0.162460, 0.262866 }, 81 | { 0.850651, -0.525731, 0.000000 }, 82 | { 0.955423, -0.295242, 0.000000 }, 83 | { 0.864188, -0.442863, 0.238856 }, 84 | { 0.951056, -0.162460, 0.262866 }, 85 | { 0.809017, -0.309017, 0.500000 }, 86 | { 0.681718, -0.147621, 0.716567 }, 87 | { 0.850651, 0.000000, 0.525731 }, 88 | { 0.864188, 0.442863, -0.238856 }, 89 | { 0.809017, 0.309017, -0.500000 }, 90 | { 0.951056, 0.162460, -0.262866 }, 91 | { 0.525731, 0.000000, -0.850651 }, 92 | { 0.681718, 0.147621, -0.716567 }, 93 | { 0.681718, -0.147621, -0.716567 }, 94 | { 0.850651, 0.000000, -0.525731 }, 95 | { 0.809017, -0.309017, -0.500000 }, 96 | { 0.864188, -0.442863, -0.238856 }, 97 | { 0.951056, -0.162460, -0.262866 }, 98 | { 0.147621, 0.716567, -0.681718 }, 99 | { 0.309017, 0.500000, -0.809017 }, 100 | { 0.425325, 0.688191, -0.587785 }, 101 | { 0.442863, 0.238856, -0.864188 }, 102 | { 0.587785, 0.425325, -0.688191 }, 103 | { 0.688191, 0.587785, -0.425325 }, 104 | { -0.147621, 0.716567, -0.681718 }, 105 | { -0.309017, 0.500000, -0.809017 }, 106 | { 0.000000, 0.525731, -0.850651 }, 107 | { -0.525731, 0.000000, -0.850651 }, 108 | { -0.442863, 0.238856, -0.864188 }, 109 | { -0.295242, 0.000000, -0.955423 }, 110 | { -0.162460, 0.262866, -0.951056 }, 111 | { 0.000000, 0.000000, -1.000000 }, 112 | { 0.295242, 0.000000, -0.955423 }, 113 | { 0.162460, 0.262866, -0.951056 }, 114 | { -0.442863, -0.238856, -0.864188 }, 115 | { -0.309017, -0.500000, -0.809017 }, 116 | { -0.162460, -0.262866, -0.951056 }, 117 | { 0.000000, -0.850651, -0.525731 }, 118 | { -0.147621, -0.716567, -0.681718 }, 119 | { 0.147621, -0.716567, -0.681718 }, 120 | { 0.000000, -0.525731, -0.850651 }, 121 | { 0.309017, -0.500000, -0.809017 }, 122 | { 0.442863, -0.238856, -0.864188 }, 123 | { 0.162460, -0.262866, -0.951056 }, 124 | { 0.238856, -0.864188, -0.442863 }, 125 | { 0.500000, -0.809017, -0.309017 }, 126 | { 0.425325, -0.688191, -0.587785 }, 127 | { 0.716567, -0.681718, -0.147621 }, 128 | { 0.688191, -0.587785, -0.425325 }, 129 | { 0.587785, -0.425325, -0.688191 }, 130 | { 0.000000, -0.955423, -0.295242 }, 131 | { 0.000000, -1.000000, 0.000000 }, 132 | { 0.262866, -0.951056, -0.162460 }, 133 | { 0.000000, -0.850651, 0.525731 }, 134 | { 0.000000, -0.955423, 0.295242 }, 135 | { 0.238856, -0.864188, 0.442863 }, 136 | { 0.262866, -0.951056, 0.162460 }, 137 | { 0.500000, -0.809017, 0.309017 }, 138 | { 0.716567, -0.681718, 0.147621 }, 139 | { 0.525731, -0.850651, 0.000000 }, 140 | { -0.238856, -0.864188, -0.442863 }, 141 | { -0.500000, -0.809017, -0.309017 }, 142 | { -0.262866, -0.951056, -0.162460 }, 143 | { -0.850651, -0.525731, 0.000000 }, 144 | { -0.716567, -0.681718, -0.147621 }, 145 | { -0.716567, -0.681718, 0.147621 }, 146 | { -0.525731, -0.850651, 0.000000 }, 147 | { -0.500000, -0.809017, 0.309017 }, 148 | { -0.238856, -0.864188, 0.442863 }, 149 | { -0.262866, -0.951056, 0.162460 }, 150 | { -0.864188, -0.442863, 0.238856 }, 151 | { -0.809017, -0.309017, 0.500000 }, 152 | { -0.688191, -0.587785, 0.425325 }, 153 | { -0.681718, -0.147621, 0.716567 }, 154 | { -0.442863, -0.238856, 0.864188 }, 155 | { -0.587785, -0.425325, 0.688191 }, 156 | { -0.309017, -0.500000, 0.809017 }, 157 | { -0.147621, -0.716567, 0.681718 }, 158 | { -0.425325, -0.688191, 0.587785 }, 159 | { -0.162460, -0.262866, 0.951056 }, 160 | { 0.442863, -0.238856, 0.864188 }, 161 | { 0.162460, -0.262866, 0.951056 }, 162 | { 0.309017, -0.500000, 0.809017 }, 163 | { 0.147621, -0.716567, 0.681718 }, 164 | { 0.000000, -0.525731, 0.850651 }, 165 | { 0.425325, -0.688191, 0.587785 }, 166 | { 0.587785, -0.425325, 0.688191 }, 167 | { 0.688191, -0.587785, 0.425325 }, 168 | { -0.955423, 0.295242, 0.000000 }, 169 | { -0.951056, 0.162460, 0.262866 }, 170 | { -1.000000, 0.000000, 0.000000 }, 171 | { -0.850651, 0.000000, 0.525731 }, 172 | { -0.955423, -0.295242, 0.000000 }, 173 | { -0.951056, -0.162460, 0.262866 }, 174 | { -0.864188, 0.442863, -0.238856 }, 175 | { -0.951056, 0.162460, -0.262866 }, 176 | { -0.809017, 0.309017, -0.500000 }, 177 | { -0.864188, -0.442863, -0.238856 }, 178 | { -0.951056, -0.162460, -0.262866 }, 179 | { -0.809017, -0.309017, -0.500000 }, 180 | { -0.681718, 0.147621, -0.716567 }, 181 | { -0.681718, -0.147621, -0.716567 }, 182 | { -0.850651, 0.000000, -0.525731 }, 183 | { -0.688191, 0.587785, -0.425325 }, 184 | { -0.587785, 0.425325, -0.688191 }, 185 | { -0.425325, 0.688191, -0.587785 }, 186 | { -0.425325, -0.688191, -0.587785 }, 187 | { -0.587785, -0.425325, -0.688191 }, 188 | { -0.688191, -0.587785, -0.425325 }, 189 | -------------------------------------------------------------------------------- /src/constants/warpsin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | * ======================================================================= 21 | * 22 | * Precalculated sinus warps 23 | * 24 | * ======================================================================= 25 | */ 26 | 27 | #if 0 28 | // In case you wonder how these were generated/what they mean: 29 | for (int i = 0; i < 256; i++) { 30 | r_turbsin[i] = 8.0 * sin( (float)i / TURBSCALE ); // TURBSCALE = 256.0 / (2.0 * M_PI) 31 | } 32 | // so r_turbsin[i] is 8 * sin( i/TURBSCALE ); 33 | // however, the values are multiplied with 0.5 in RI_Init() 34 | // so what's actually used is 4 * sin(i/TURBSCALE) 35 | // in R_EmitWaterPolys() something like 36 | s = os + r_turbsin [ (int) ( ( ot * 0.125 + r_newrefdef.time ) * TURBSCALE ) & 255 ]; 37 | // is used; which should (except for rounding errors from lookup table) be equivalent to 38 | s = os + 4.0*sin( ot*0.125 + r_newrefdef.time ); 39 | #endif // 0 40 | 41 | 0, 0.19633, 0.392541, 0.588517, 0.784137, 0.979285, 1.17384, 1.3677, 42 | 1.56072, 1.75281, 1.94384, 2.1337, 2.32228, 2.50945, 2.69512, 2.87916, 43 | 3.06147, 3.24193, 3.42044, 3.59689, 3.77117, 3.94319, 4.11282, 4.27998, 44 | 4.44456, 4.60647, 4.76559, 4.92185, 5.07515, 5.22538, 5.37247, 5.51632, 45 | 5.65685, 5.79398, 5.92761, 6.05767, 6.18408, 6.30677, 6.42566, 6.54068, 46 | 6.65176, 6.75883, 6.86183, 6.9607, 7.05537, 7.14579, 7.23191, 7.31368, 47 | 7.39104, 7.46394, 7.53235, 7.59623, 7.65552, 7.71021, 7.76025, 7.80562, 48 | 7.84628, 7.88222, 7.91341, 7.93984, 7.96148, 7.97832, 7.99036, 7.99759, 49 | 8, 7.99759, 7.99036, 7.97832, 7.96148, 7.93984, 7.91341, 7.88222, 50 | 7.84628, 7.80562, 7.76025, 7.71021, 7.65552, 7.59623, 7.53235, 7.46394, 51 | 7.39104, 7.31368, 7.23191, 7.14579, 7.05537, 6.9607, 6.86183, 6.75883, 52 | 6.65176, 6.54068, 6.42566, 6.30677, 6.18408, 6.05767, 5.92761, 5.79398, 53 | 5.65685, 5.51632, 5.37247, 5.22538, 5.07515, 4.92185, 4.76559, 4.60647, 54 | 4.44456, 4.27998, 4.11282, 3.94319, 3.77117, 3.59689, 3.42044, 3.24193, 55 | 3.06147, 2.87916, 2.69512, 2.50945, 2.32228, 2.1337, 1.94384, 1.75281, 56 | 1.56072, 1.3677, 1.17384, 0.979285, 0.784137, 0.588517, 0.392541, 0.19633, 57 | 9.79717e-16, -0.19633, -0.392541, -0.588517, -0.784137, -0.979285, -1.17384, -1.3677, 58 | -1.56072, -1.75281, -1.94384, -2.1337, -2.32228, -2.50945, -2.69512, -2.87916, 59 | -3.06147, -3.24193, -3.42044, -3.59689, -3.77117, -3.94319, -4.11282, -4.27998, 60 | -4.44456, -4.60647, -4.76559, -4.92185, -5.07515, -5.22538, -5.37247, -5.51632, 61 | -5.65685, -5.79398, -5.92761, -6.05767, -6.18408, -6.30677, -6.42566, -6.54068, 62 | -6.65176, -6.75883, -6.86183, -6.9607, -7.05537, -7.14579, -7.23191, -7.31368, 63 | -7.39104, -7.46394, -7.53235, -7.59623, -7.65552, -7.71021, -7.76025, -7.80562, 64 | -7.84628, -7.88222, -7.91341, -7.93984, -7.96148, -7.97832, -7.99036, -7.99759, 65 | -8, -7.99759, -7.99036, -7.97832, -7.96148, -7.93984, -7.91341, -7.88222, 66 | -7.84628, -7.80562, -7.76025, -7.71021, -7.65552, -7.59623, -7.53235, -7.46394, 67 | -7.39104, -7.31368, -7.23191, -7.14579, -7.05537, -6.9607, -6.86183, -6.75883, 68 | -6.65176, -6.54068, -6.42566, -6.30677, -6.18408, -6.05767, -5.92761, -5.79398, 69 | -5.65685, -5.51632, -5.37247, -5.22538, -5.07515, -4.92185, -4.76559, -4.60647, 70 | -4.44456, -4.27998, -4.11282, -3.94319, -3.77117, -3.59689, -3.42044, -3.24193, 71 | -3.06147, -2.87916, -2.69512, -2.50945, -2.32228, -2.1337, -1.94384, -1.75281, 72 | -1.56072, -1.3677, -1.17384, -0.979285, -0.784137, -0.588517, -0.392541, -0.19633, 73 | -------------------------------------------------------------------------------- /src/files/pvs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | * ======================================================================= 21 | * 22 | * The PVS Decompress 23 | * 24 | * ======================================================================= 25 | */ 26 | 27 | #include "../common/header/ref_shared.h" 28 | 29 | 30 | /* 31 | =================== 32 | Mod_DecompressVis 33 | =================== 34 | */ 35 | const byte * 36 | Mod_DecompressVis(const byte *in, int row) 37 | { 38 | YQ2_ALIGNAS_TYPE(int) static byte decompressed[MAX_MAP_LEAFS / 8]; 39 | int c; 40 | byte *out; 41 | 42 | out = decompressed; 43 | 44 | if (!in) 45 | { 46 | /* no vis info, so make all visible */ 47 | while (row) 48 | { 49 | *out++ = 0xff; 50 | row--; 51 | } 52 | 53 | return decompressed; 54 | } 55 | 56 | do 57 | { 58 | if (*in) 59 | { 60 | *out++ = *in++; 61 | continue; 62 | } 63 | 64 | c = in[1]; 65 | in += 2; 66 | 67 | while (c) 68 | { 69 | *out++ = 0; 70 | c--; 71 | } 72 | } 73 | while (out - decompressed < row); 74 | 75 | return decompressed; 76 | } 77 | 78 | float 79 | Mod_RadiusFromBounds(const vec3_t mins, const vec3_t maxs) 80 | { 81 | int i; 82 | vec3_t corner; 83 | 84 | for (i = 0; i < 3; i++) 85 | { 86 | corner[i] = fabs(mins[i]) > fabs(maxs[i]) ? fabs(mins[i]) : fabs(maxs[i]); 87 | } 88 | 89 | return VectorLength(corner); 90 | } 91 | -------------------------------------------------------------------------------- /src/files/surf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | * ======================================================================= 21 | * 22 | * Surface logic 23 | * 24 | * ======================================================================= 25 | */ 26 | 27 | #include "../common/header/ref_shared.h" 28 | 29 | /* 30 | =============== 31 | R_TextureAnimation 32 | 33 | Returns the proper texture for a given time and base texture 34 | =============== 35 | */ 36 | struct image_s * 37 | R_TextureAnimation(const entity_t *currententity, const mtexinfo_t *tex) 38 | { 39 | int c; 40 | 41 | if (!tex->next) 42 | return tex->image; 43 | 44 | if (!currententity) 45 | return tex->image; 46 | 47 | c = currententity->frame % tex->numframes; 48 | while (c && tex) 49 | { 50 | tex = tex->next; 51 | c--; 52 | } 53 | 54 | return tex->image; 55 | } 56 | 57 | qboolean 58 | R_AreaVisible(const byte *areabits, mleaf_t *pleaf) 59 | { 60 | int area; 61 | 62 | // check for door connected areas 63 | if (!areabits) 64 | return true; 65 | 66 | area = pleaf->area; 67 | 68 | if ((areabits[area >> 3] & (1 << (area & 7)))) 69 | return true; 70 | 71 | return false; // not visible 72 | } 73 | 74 | /* 75 | ============= 76 | R_MarkLights 77 | 78 | bit: 1 << i for light number i, will be or'ed into msurface_t::dlightbits 79 | if surface is affected by this light 80 | ============= 81 | */ 82 | void 83 | R_MarkLights(dlight_t *light, int bit, mnode_t *node, int lightframecount, 84 | marksurfacelights_t mark_surface_lights) 85 | { 86 | cplane_t *splitplane; 87 | float dist; 88 | int intensity; 89 | 90 | if (node->contents != CONTENTS_NODE) 91 | return; 92 | 93 | splitplane = node->plane; 94 | dist = DotProduct(light->origin, splitplane->normal) - splitplane->dist; 95 | 96 | intensity = light->intensity; 97 | 98 | if (dist > intensity - DLIGHT_CUTOFF) // (dist > light->intensity) 99 | { 100 | R_MarkLights (light, bit, node->children[0], lightframecount, 101 | mark_surface_lights); 102 | return; 103 | } 104 | 105 | if (dist < -intensity + DLIGHT_CUTOFF) // (dist < -light->intensity) 106 | { 107 | R_MarkLights(light, bit, node->children[1], lightframecount, 108 | mark_surface_lights); 109 | return; 110 | } 111 | 112 | mark_surface_lights(light, bit, node, lightframecount); 113 | 114 | R_MarkLights(light, bit, node->children[0], lightframecount, 115 | mark_surface_lights); 116 | R_MarkLights(light, bit, node->children[1], lightframecount, 117 | mark_surface_lights); 118 | } 119 | 120 | /* 121 | * Returns true if the box is completely outside the frustom 122 | */ 123 | qboolean 124 | R_CullBox(vec3_t mins, vec3_t maxs, cplane_t *frustum) 125 | { 126 | int i; 127 | 128 | for (i = 0; i < 4; i++) 129 | { 130 | if (BOX_ON_PLANE_SIDE(mins, maxs, frustum + i) == 2) 131 | { 132 | return true; 133 | } 134 | } 135 | 136 | return false; 137 | } 138 | 139 | static int 140 | R_SignbitsForPlane(cplane_t *out) 141 | { 142 | int bits, j; 143 | 144 | /* for fast box on planeside test */ 145 | bits = 0; 146 | 147 | for (j = 0; j < 3; j++) 148 | { 149 | if (out->normal[j] < 0) 150 | { 151 | bits |= 1 << j; 152 | } 153 | } 154 | 155 | return bits; 156 | } 157 | 158 | void 159 | R_SetFrustum(vec3_t vup, vec3_t vpn, vec3_t vright, vec3_t r_origin, 160 | float fov_x, float fov_y, cplane_t *frustum) 161 | { 162 | int i; 163 | 164 | /* rotate VPN right by FOV_X/2 degrees */ 165 | RotatePointAroundVector(frustum[0].normal, vup, vpn, 166 | -(90 - fov_x / 2)); 167 | /* rotate VPN left by FOV_X/2 degrees */ 168 | RotatePointAroundVector(frustum[1].normal, 169 | vup, vpn, 90 - fov_x / 2); 170 | /* rotate VPN up by FOV_X/2 degrees */ 171 | RotatePointAroundVector(frustum[2].normal, 172 | vright, vpn, 90 - fov_y / 2); 173 | /* rotate VPN down by FOV_X/2 degrees */ 174 | RotatePointAroundVector(frustum[3].normal, vright, vpn, 175 | -(90 - fov_y / 2)); 176 | 177 | #if defined(__GNUC__) 178 | # pragma GCC unroll 4 179 | #endif 180 | for (i = 0; i < 4; i++) 181 | { 182 | frustum[i].type = PLANE_ANYZ; 183 | frustum[i].dist = DotProduct(r_origin, frustum[i].normal); 184 | frustum[i].signbits = R_SignbitsForPlane(&frustum[i]); 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /src/files/wal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | * ======================================================================= 21 | * 22 | * The Wal image format 23 | * 24 | * ======================================================================= 25 | */ 26 | 27 | #include "../common/header/ref_shared.h" 28 | 29 | struct image_s * 30 | LoadWal(const char *origname, imagetype_t type, loadimage_t load_image) 31 | { 32 | int width, height, ofs, size; 33 | struct image_s *image; 34 | char name[256]; 35 | miptex_t *mt; 36 | 37 | FixFileExt(origname, "wal", name, sizeof(name)); 38 | 39 | size = ri.FS_LoadFile(name, (void **)&mt); 40 | 41 | if (!mt) 42 | { 43 | return NULL; 44 | } 45 | 46 | if (size < sizeof(miptex_t)) 47 | { 48 | R_Printf(PRINT_ALL, "%s: can't load %s, small header\n", __func__, name); 49 | ri.FS_FreeFile((void *)mt); 50 | return NULL; 51 | } 52 | 53 | width = LittleLong(mt->width); 54 | height = LittleLong(mt->height); 55 | ofs = LittleLong(mt->offsets[0]); 56 | 57 | if ((ofs <= 0) || (width <= 0) || (height <= 0) || 58 | (((size - ofs) / height) < width)) 59 | { 60 | R_Printf(PRINT_ALL, "%s: can't load %s, small body\n", __func__, name); 61 | ri.FS_FreeFile((void *)mt); 62 | return NULL; 63 | } 64 | 65 | image = load_image(name, (byte *)mt + ofs, 66 | width, 0, 67 | height, 0, 68 | (size - ofs), type, 8); 69 | 70 | ri.FS_FreeFile((void *)mt); 71 | 72 | return image; 73 | } 74 | 75 | struct image_s * 76 | LoadM8(const char *origname, imagetype_t type, loadimage_t load_image) 77 | { 78 | m8tex_t *mt; 79 | int width, height, ofs, size, i; 80 | struct image_s *image; 81 | char name[256]; 82 | unsigned char *image_buffer = NULL; 83 | 84 | FixFileExt(origname, "m8", name, sizeof(name)); 85 | 86 | size = ri.FS_LoadFile(name, (void **)&mt); 87 | 88 | if (!mt) 89 | { 90 | return NULL; 91 | } 92 | 93 | if (size < sizeof(m8tex_t)) 94 | { 95 | R_Printf(PRINT_ALL, "%s: can't load %s, small header\n", __func__, name); 96 | ri.FS_FreeFile((void *)mt); 97 | return NULL; 98 | } 99 | 100 | if (LittleLong (mt->version) != M8_VERSION) 101 | { 102 | R_Printf(PRINT_ALL, "%s: can't load %s, wrong magic value.\n", __func__, name); 103 | ri.FS_FreeFile ((void *)mt); 104 | return NULL; 105 | } 106 | 107 | width = LittleLong(mt->width[0]); 108 | height = LittleLong(mt->height[0]); 109 | ofs = LittleLong(mt->offsets[0]); 110 | 111 | if ((ofs <= 0) || (width <= 0) || (height <= 0) || 112 | (((size - ofs) / height) < width)) 113 | { 114 | R_Printf(PRINT_ALL, "%s: can't load %s, small body\n", __func__, name); 115 | ri.FS_FreeFile((void *)mt); 116 | return NULL; 117 | } 118 | 119 | image_buffer = malloc ((size - ofs) * 4); 120 | for(i=0; i<(size - ofs); i++) 121 | { 122 | unsigned char value = *((byte *)mt + ofs + i); 123 | image_buffer[i * 4 + 0] = mt->palette[value].r; 124 | image_buffer[i * 4 + 1] = mt->palette[value].g; 125 | image_buffer[i * 4 + 2] = mt->palette[value].b; 126 | image_buffer[i * 4 + 3] = value == 255 ? 0 : 255; 127 | } 128 | 129 | image = load_image(name, image_buffer, 130 | width, 0, 131 | height, 0, 132 | (size - ofs), type, 32); 133 | free(image_buffer); 134 | 135 | ri.FS_FreeFile((void *)mt); 136 | 137 | return image; 138 | } 139 | 140 | struct image_s * 141 | LoadM32(const char *origname, imagetype_t type, loadimage_t load_image) 142 | { 143 | m32tex_t *mt; 144 | int width, height, ofs, size; 145 | struct image_s *image; 146 | char name[256]; 147 | 148 | FixFileExt(origname, "m32", name, sizeof(name)); 149 | 150 | size = ri.FS_LoadFile(name, (void **)&mt); 151 | 152 | if (!mt) 153 | { 154 | return NULL; 155 | } 156 | 157 | if (size < sizeof(m32tex_t)) 158 | { 159 | R_Printf(PRINT_ALL, "%s: can't load %s, small header\n", __func__, name); 160 | ri.FS_FreeFile((void *)mt); 161 | return NULL; 162 | } 163 | 164 | if (LittleLong (mt->version) != M32_VERSION) 165 | { 166 | R_Printf(PRINT_ALL, "%s: can't load %s, wrong magic value.\n", __func__, name); 167 | ri.FS_FreeFile ((void *)mt); 168 | return NULL; 169 | } 170 | 171 | width = LittleLong (mt->width[0]); 172 | height = LittleLong (mt->height[0]); 173 | ofs = LittleLong (mt->offsets[0]); 174 | 175 | if ((ofs <= 0) || (width <= 0) || (height <= 0) || 176 | (((size - ofs) / height) < (width * 4))) 177 | { 178 | R_Printf(PRINT_ALL, "%s: can't load %s, small body\n", __func__, name); 179 | ri.FS_FreeFile((void *)mt); 180 | return NULL; 181 | } 182 | 183 | image = load_image(name, (byte *)mt + ofs, 184 | width, 0, 185 | height, 0, 186 | (size - ofs) / 4, type, 32); 187 | ri.FS_FreeFile ((void *)mt); 188 | 189 | return image; 190 | } 191 | 192 | void 193 | GetWalInfo(const char *origname, int *width, int *height) 194 | { 195 | miptex_t *mt; 196 | int size; 197 | char filename[256]; 198 | 199 | FixFileExt(origname, "wal", filename, sizeof(filename)); 200 | 201 | size = ri.FS_LoadFile(filename, (void **)&mt); 202 | 203 | if (!mt) 204 | { 205 | return; 206 | } 207 | 208 | if (size < sizeof(miptex_t)) 209 | { 210 | ri.FS_FreeFile((void *)mt); 211 | return; 212 | } 213 | 214 | *width = LittleLong(mt->width); 215 | *height = LittleLong(mt->height); 216 | 217 | ri.FS_FreeFile((void *)mt); 218 | 219 | return; 220 | } 221 | 222 | void 223 | GetM8Info(const char *origname, int *width, int *height) 224 | { 225 | m8tex_t *mt; 226 | int size; 227 | char filename[256]; 228 | 229 | FixFileExt(origname, "m8", filename, sizeof(filename)); 230 | 231 | size = ri.FS_LoadFile(filename, (void **)&mt); 232 | 233 | if (!mt) 234 | { 235 | return; 236 | } 237 | 238 | if (size < sizeof(m8tex_t) || LittleLong (mt->version) != M8_VERSION) 239 | { 240 | ri.FS_FreeFile((void *)mt); 241 | return; 242 | } 243 | 244 | *width = LittleLong(mt->width[0]); 245 | *height = LittleLong(mt->height[0]); 246 | 247 | ri.FS_FreeFile((void *)mt); 248 | 249 | return; 250 | } 251 | 252 | void 253 | GetM32Info(const char *origname, int *width, int *height) 254 | { 255 | m32tex_t *mt; 256 | int size; 257 | char filename[256]; 258 | 259 | FixFileExt(origname, "m32", filename, sizeof(filename)); 260 | 261 | size = ri.FS_LoadFile(filename, (void **)&mt); 262 | 263 | if (!mt) 264 | { 265 | return; 266 | } 267 | 268 | if (size < sizeof(m32tex_t) || LittleLong (mt->version) != M32_VERSION) 269 | { 270 | ri.FS_FreeFile((void *)mt); 271 | return; 272 | } 273 | 274 | *width = LittleLong(mt->width[0]); 275 | *height = LittleLong(mt->height[0]); 276 | 277 | ri.FS_FreeFile((void *)mt); 278 | 279 | return; 280 | } 281 | -------------------------------------------------------------------------------- /src/vk/header/model.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1997-2001 Id Software, Inc. 3 | * Copyright (C) 2018-2019 Krzysztof Kondrak 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | * 02111-1307, USA. 20 | * 21 | * ======================================================================= 22 | * 23 | * Header for the model stuff. 24 | * 25 | * ======================================================================= 26 | */ 27 | 28 | #ifndef __VK_MODEL_H__ 29 | #define __VK_MODEL_H__ 30 | 31 | /* 32 | 33 | d*_t structures are on-disk representations 34 | m*_t structures are in-memory 35 | 36 | */ 37 | 38 | /* 39 | ============================================================================== 40 | 41 | BRUSH MODELS 42 | 43 | ============================================================================== 44 | */ 45 | 46 | 47 | // 48 | // in memory representation 49 | // 50 | 51 | #define VERTEXSIZE 7 52 | #define DEFAULT_LMSHIFT 4 53 | 54 | typedef struct vkpoly_s 55 | { 56 | struct vkpoly_s *next; 57 | struct vkpoly_s *chain; 58 | int numverts; 59 | int flags; // for SURF_UNDERWATER (not needed anymore?) 60 | float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2) 61 | } vkpoly_t; 62 | 63 | typedef struct msurface_s 64 | { 65 | int visframe; // should be drawn when node is crossed 66 | 67 | cplane_t *plane; 68 | int flags; 69 | 70 | int firstedge; // look up in model->surfedges[], negative numbers 71 | int numedges; // are backwards edges 72 | 73 | short texturemins[2]; 74 | short extents[2]; 75 | short lmshift; 76 | 77 | int light_s, light_t; // gl lightmap coordinates 78 | int dlight_s, dlight_t; // gl lightmap coordinates for dynamic lightmaps 79 | 80 | vkpoly_t *polys; // multiple if warped 81 | struct msurface_s *texturechain; 82 | struct msurface_s *lightmapchain; 83 | 84 | mtexinfo_t *texinfo; 85 | 86 | /* decoupled lm */ 87 | float lmvecs[2][4]; 88 | float lmvlen[2]; 89 | 90 | /* lighting info */ 91 | int dlightframe; 92 | int dlightbits; 93 | 94 | int lightmaptexturenum; 95 | byte styles[MAXLIGHTMAPS]; 96 | float cached_light[MAXLIGHTMAPS]; // values currently used in lightmap 97 | byte *samples; // [numstyles*surfsize] 98 | } msurface_t; 99 | 100 | /* Whole model */ 101 | 102 | typedef struct model_s 103 | { 104 | char name[MAX_QPATH]; 105 | 106 | int registration_sequence; 107 | 108 | modtype_t type; 109 | int numframes; 110 | 111 | int flags; 112 | 113 | // 114 | // volume occupied by the model graphics 115 | // 116 | vec3_t mins, maxs; 117 | float radius; 118 | 119 | // 120 | // solid volume for clipping 121 | // 122 | qboolean clipbox; 123 | vec3_t clipmins, clipmaxs; 124 | 125 | // 126 | // brush model 127 | // 128 | int firstmodelsurface, nummodelsurfaces; 129 | int lightmap; // only for submodels 130 | 131 | int numsubmodels; 132 | struct model_s *submodels; 133 | 134 | int numplanes; 135 | cplane_t *planes; 136 | 137 | int numleafs; // number of visible leafs, not counting 0 138 | mleaf_t *leafs; 139 | 140 | int numvertexes; 141 | mvertex_t *vertexes; 142 | 143 | int numedges; 144 | medge_t *edges; 145 | 146 | int numnodes; 147 | int firstnode; 148 | mnode_t *nodes; 149 | 150 | int numtexinfo; 151 | mtexinfo_t *texinfo; 152 | 153 | int numsurfaces; 154 | msurface_t *surfaces; 155 | 156 | int numsurfedges; 157 | int *surfedges; 158 | 159 | int nummarksurfaces; 160 | msurface_t **marksurfaces; 161 | 162 | dvis_t *vis; 163 | 164 | byte *lightdata; 165 | 166 | // for alias models and skins 167 | image_t *skins[MAX_MD2SKINS]; 168 | 169 | int extradatasize; 170 | void *extradata; 171 | 172 | // submodules 173 | vec3_t origin; // for sounds or lights 174 | 175 | /* octree */ 176 | bspxlightgrid_t *grid; 177 | } model_t; 178 | 179 | void Mod_Init(void); 180 | const byte *Mod_ClusterPVS(int cluster, const model_t *model); 181 | 182 | void Mod_Modellist_f(void); 183 | 184 | void *Hunk_Begin(int maxsize); 185 | void *Hunk_Alloc(int size); 186 | int Hunk_End(void); 187 | void Hunk_Free(void *base); 188 | 189 | void Mod_FreeAll(void); 190 | void Mod_FreeModelsKnown (void); 191 | 192 | #endif 193 | -------------------------------------------------------------------------------- /src/vk/header/shaders.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2019 Krzysztof Kondrak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | */ 21 | 22 | // 23 | // game shaders, compiled offline 24 | // 25 | 26 | #ifndef __VK_SHADERS_H__ 27 | #define __VK_SHADERS_H__ 28 | #include 29 | #include 30 | 31 | // textured quad (alpha) 32 | extern const uint32_t basic_vert_spv[]; 33 | extern const size_t basic_vert_size; 34 | 35 | extern const uint32_t basic_frag_spv[]; 36 | extern const size_t basic_frag_size; 37 | 38 | // colored quad (alpha) 39 | extern const uint32_t basic_color_quad_vert_spv[]; 40 | extern const size_t basic_color_quad_vert_size; 41 | 42 | extern const uint32_t basic_color_quad_frag_spv[]; 43 | extern const size_t basic_color_quad_frag_size; 44 | 45 | // textured model 46 | extern const uint32_t model_vert_spv[]; 47 | extern const size_t model_vert_size; 48 | 49 | extern const uint32_t model_frag_spv[]; 50 | extern const size_t model_frag_size; 51 | 52 | // null model 53 | extern const uint32_t nullmodel_vert_spv[]; 54 | extern const size_t nullmodel_vert_size; 55 | 56 | // particle (texture) 57 | extern const uint32_t particle_vert_spv[]; 58 | extern const size_t particle_vert_size; 59 | 60 | // particle (point) 61 | extern const uint32_t point_particle_vert_spv[]; 62 | extern const size_t point_particle_vert_size; 63 | 64 | extern const uint32_t point_particle_frag_spv[]; 65 | extern const size_t point_particle_frag_size; 66 | 67 | // sprite model 68 | extern const uint32_t sprite_vert_spv[]; 69 | extern const size_t sprite_vert_size; 70 | 71 | // beam 72 | extern const uint32_t beam_vert_spv[]; 73 | extern const size_t beam_vert_size; 74 | 75 | // skybox 76 | extern const uint32_t skybox_vert_spv[]; 77 | extern const size_t skybox_vert_size; 78 | 79 | // dynamic lights 80 | extern const uint32_t d_light_vert_spv[]; 81 | extern const size_t d_light_vert_size; 82 | 83 | // textured, alpha blended polygon 84 | extern const uint32_t polygon_vert_spv[]; 85 | extern const size_t polygon_vert_size; 86 | 87 | // textured, lightmapped polygon 88 | extern const uint32_t polygon_lmap_vert_spv[]; 89 | extern const size_t polygon_lmap_vert_size; 90 | 91 | extern const uint32_t polygon_lmap_frag_spv[]; 92 | extern const size_t polygon_lmap_frag_size; 93 | 94 | // warped polygon (liquids) 95 | extern const uint32_t polygon_warp_vert_spv[]; 96 | extern const size_t polygon_warp_vert_size; 97 | 98 | // entity shadows 99 | extern const uint32_t shadows_vert_spv[]; 100 | extern const size_t shadows_vert_size; 101 | 102 | // postprocess 103 | extern const uint32_t postprocess_vert_spv[]; 104 | extern const size_t postprocess_vert_size; 105 | 106 | extern const uint32_t postprocess_frag_spv[]; 107 | extern const size_t postprocess_frag_size; 108 | 109 | // underwater vision warp 110 | extern const uint32_t world_warp_vert_spv[]; 111 | extern const size_t world_warp_vert_size; 112 | 113 | extern const uint32_t world_warp_frag_spv[]; 114 | extern const size_t world_warp_frag_size; 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /src/vk/header/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Christoph Schied 3 | * Copyright (C) 2020 Denis Pauk 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or (at 8 | * your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | * 02111-1307, USA. 20 | * 21 | */ 22 | 23 | #ifndef __VK_UTIL_H__ 24 | #define __VK_UTIL_H__ 25 | 26 | #include "../volk/volk.h" 27 | 28 | #define ROUNDUP(a, b) (((a) + ((b)-1)) & ~((b)-1)) 29 | 30 | typedef struct BufferResource_s { 31 | VkBuffer buffer; 32 | // shared memory used for buffer 33 | VkDeviceMemory memory; 34 | // image size 35 | VkDeviceSize size; 36 | // posision in shared memory 37 | VkDeviceSize offset; 38 | // is mapped? 39 | VkBool32 is_mapped; 40 | } BufferResource_t; 41 | 42 | typedef struct ImageResource_s { 43 | VkImage image; 44 | // shared memory used for image 45 | VkDeviceMemory memory; 46 | // image size 47 | VkDeviceSize size; 48 | // posision in shared memory 49 | VkDeviceSize offset; 50 | } ImageResource_t; 51 | 52 | VkResult buffer_create(BufferResource_t *buf, 53 | VkBufferCreateInfo buf_create_info, 54 | VkMemoryPropertyFlags mem_properties, 55 | VkMemoryPropertyFlags mem_preferences, 56 | VkMemoryPropertyFlags mem_skip); 57 | 58 | VkResult buffer_destroy(BufferResource_t *buf); 59 | void buffer_unmap(BufferResource_t *buf); 60 | void *buffer_map(BufferResource_t *buf); 61 | VkResult buffer_flush(BufferResource_t *buf); 62 | VkResult buffer_invalidate(BufferResource_t *buf); 63 | 64 | VkResult image_create(ImageResource_t *img, 65 | VkImageCreateInfo img_create_info, 66 | VkMemoryPropertyFlags mem_properties, 67 | VkMemoryPropertyFlags mem_preferences, 68 | VkMemoryPropertyFlags mem_skip); 69 | VkResult image_destroy(ImageResource_t *img); 70 | 71 | void vulkan_memory_init(void); 72 | void vulkan_memory_types_show(void); 73 | void vulkan_memory_free_unused(void); 74 | void vulkan_memory_delete(void); 75 | 76 | #endif /*__VK_UTIL_H__*/ 77 | -------------------------------------------------------------------------------- /src/vk/spirv/basic_color_quad_frag.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t basic_color_quad_frag_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x0000000d,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000009,0x0000000b,0x00030010, 7 | 0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d, 8 | 0x00000000,0x00060005,0x00000009,0x67617266,0x746e656d,0x6f6c6f43,0x00000072,0x00040005, 9 | 0x0000000b,0x6f6c6f63,0x00000072,0x00040047,0x00000009,0x0000001e,0x00000000,0x00040047, 10 | 0x0000000b,0x0000001e,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002, 11 | 0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x00040020, 12 | 0x00000008,0x00000003,0x00000007,0x0004003b,0x00000008,0x00000009,0x00000003,0x00040020, 13 | 0x0000000a,0x00000001,0x00000007,0x0004003b,0x0000000a,0x0000000b,0x00000001,0x00050036, 14 | 0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003d,0x00000007, 15 | 0x0000000c,0x0000000b,0x0003003e,0x00000009,0x0000000c,0x000100fd,0x00010038 16 | }; -------------------------------------------------------------------------------- /src/vk/spirv/basic_color_quad_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t basic_color_quad_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000032,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0008000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000b,0x0000001f,0x0000002d, 7 | 0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,0x5f657461, 8 | 0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,0x00000000, 9 | 0x00040005,0x00000009,0x736f5076,0x00000000,0x00050005,0x0000000b,0x65566e69,0x78657472, 10 | 0x00000000,0x00060005,0x0000000e,0x67616d69,0x61725465,0x6f66736e,0x00006d72,0x00050006, 11 | 0x0000000e,0x00000000,0x7366666f,0x00007465,0x00050006,0x0000000e,0x00000001,0x6c616373, 12 | 0x00000065,0x00050006,0x0000000e,0x00000002,0x6f6c6f63,0x00000072,0x00030005,0x00000010, 13 | 0x00007469,0x00060005,0x0000001d,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006, 14 | 0x0000001d,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x0000001f,0x00000000, 15 | 0x00040005,0x0000002d,0x6f6c6f63,0x00000072,0x00040047,0x0000000b,0x0000001e,0x00000000, 16 | 0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,0x0000000e,0x00000001, 17 | 0x00000023,0x00000008,0x00050048,0x0000000e,0x00000002,0x00000023,0x00000010,0x00030047, 18 | 0x0000000e,0x00000002,0x00040047,0x00000010,0x00000022,0x00000000,0x00040047,0x00000010, 19 | 0x00000021,0x00000000,0x00050048,0x0000001d,0x00000000,0x0000000b,0x00000000,0x00030047, 20 | 0x0000001d,0x00000002,0x00040047,0x0000002d,0x0000001e,0x00000000,0x00020013,0x00000002, 21 | 0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007, 22 | 0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,0x00040020,0x0000000a, 23 | 0x00000001,0x00000007,0x0004003b,0x0000000a,0x0000000b,0x00000001,0x00040017,0x0000000d, 24 | 0x00000006,0x00000004,0x0005001e,0x0000000e,0x00000007,0x00000007,0x0000000d,0x00040020, 25 | 0x0000000f,0x00000002,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000002,0x00040015, 26 | 0x00000011,0x00000020,0x00000001,0x0004002b,0x00000011,0x00000012,0x00000001,0x00040020, 27 | 0x00000013,0x00000002,0x00000007,0x0004002b,0x00000006,0x00000017,0x3f800000,0x0005002c, 28 | 0x00000007,0x00000018,0x00000017,0x00000017,0x0003001e,0x0000001d,0x0000000d,0x00040020, 29 | 0x0000001e,0x00000003,0x0000001d,0x0004003b,0x0000001e,0x0000001f,0x00000003,0x0004002b, 30 | 0x00000011,0x00000020,0x00000000,0x0004002b,0x00000006,0x00000024,0x40000000,0x0004002b, 31 | 0x00000006,0x00000027,0x00000000,0x00040020,0x0000002b,0x00000003,0x0000000d,0x0004003b, 32 | 0x0000002b,0x0000002d,0x00000003,0x0004002b,0x00000011,0x0000002e,0x00000002,0x00040020, 33 | 0x0000002f,0x00000002,0x0000000d,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003, 34 | 0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007,0x0004003d,0x00000007, 35 | 0x0000000c,0x0000000b,0x00050041,0x00000013,0x00000014,0x00000010,0x00000012,0x0004003d, 36 | 0x00000007,0x00000015,0x00000014,0x00050085,0x00000007,0x00000016,0x0000000c,0x00000015, 37 | 0x00050041,0x00000013,0x00000019,0x00000010,0x00000012,0x0004003d,0x00000007,0x0000001a, 38 | 0x00000019,0x00050083,0x00000007,0x0000001b,0x00000018,0x0000001a,0x00050083,0x00000007, 39 | 0x0000001c,0x00000016,0x0000001b,0x0003003e,0x00000009,0x0000001c,0x0004003d,0x00000007, 40 | 0x00000021,0x00000009,0x00050041,0x00000013,0x00000022,0x00000010,0x00000020,0x0004003d, 41 | 0x00000007,0x00000023,0x00000022,0x0005008e,0x00000007,0x00000025,0x00000023,0x00000024, 42 | 0x00050081,0x00000007,0x00000026,0x00000021,0x00000025,0x00050051,0x00000006,0x00000028, 43 | 0x00000026,0x00000000,0x00050051,0x00000006,0x00000029,0x00000026,0x00000001,0x00070050, 44 | 0x0000000d,0x0000002a,0x00000028,0x00000029,0x00000027,0x00000017,0x00050041,0x0000002b, 45 | 0x0000002c,0x0000001f,0x00000020,0x0003003e,0x0000002c,0x0000002a,0x00050041,0x0000002f, 46 | 0x00000030,0x00000010,0x0000002e,0x0004003d,0x0000000d,0x00000031,0x00000030,0x0003003e, 47 | 0x0000002d,0x00000031,0x000100fd,0x00010038 48 | }; -------------------------------------------------------------------------------- /src/vk/spirv/basic_frag.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t basic_frag_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000038,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0009000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000009,0x00000011,0x00000015, 7 | 0x0000001e,0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005, 8 | 0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000009,0x67617266,0x746e656d,0x6f6c6f43, 9 | 0x00000072,0x00050005,0x0000000d,0x78655473,0x65727574,0x00000000,0x00050005,0x00000011, 10 | 0x43786574,0x64726f6f,0x00000000,0x00040005,0x00000015,0x6f6c6f63,0x00000072,0x00050005, 11 | 0x0000001e,0x65725461,0x6c6f6873,0x00000064,0x00060005,0x00000028,0x68737550,0x736e6f43, 12 | 0x746e6174,0x00000000,0x00050006,0x00000028,0x00000000,0x6d6d6167,0x00000061,0x00030005, 13 | 0x0000002a,0x00006370,0x00040047,0x00000009,0x0000001e,0x00000000,0x00040047,0x0000000d, 14 | 0x00000022,0x00000000,0x00040047,0x0000000d,0x00000021,0x00000000,0x00040047,0x00000011, 15 | 0x0000001e,0x00000000,0x00040047,0x00000015,0x0000001e,0x00000001,0x00040047,0x0000001e, 16 | 0x0000001e,0x00000002,0x00050048,0x00000028,0x00000000,0x00000023,0x00000044,0x00030047, 17 | 0x00000028,0x00000002,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016, 18 | 0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x00040020,0x00000008, 19 | 0x00000003,0x00000007,0x0004003b,0x00000008,0x00000009,0x00000003,0x00090019,0x0000000a, 20 | 0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b, 21 | 0x0000000b,0x0000000a,0x00040020,0x0000000c,0x00000000,0x0000000b,0x0004003b,0x0000000c, 22 | 0x0000000d,0x00000000,0x00040017,0x0000000f,0x00000006,0x00000002,0x00040020,0x00000010, 23 | 0x00000001,0x0000000f,0x0004003b,0x00000010,0x00000011,0x00000001,0x00040020,0x00000014, 24 | 0x00000001,0x00000007,0x0004003b,0x00000014,0x00000015,0x00000001,0x00040015,0x00000018, 25 | 0x00000020,0x00000000,0x0004002b,0x00000018,0x00000019,0x00000003,0x00040020,0x0000001a, 26 | 0x00000003,0x00000006,0x00040020,0x0000001d,0x00000001,0x00000006,0x0004003b,0x0000001d, 27 | 0x0000001e,0x00000001,0x00020014,0x00000020,0x00040017,0x00000025,0x00000006,0x00000003, 28 | 0x0003001e,0x00000028,0x00000006,0x00040020,0x00000029,0x00000009,0x00000028,0x0004003b, 29 | 0x00000029,0x0000002a,0x00000009,0x00040015,0x0000002b,0x00000020,0x00000001,0x0004002b, 30 | 0x0000002b,0x0000002c,0x00000000,0x00040020,0x0000002d,0x00000009,0x00000006,0x00050036, 31 | 0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003d,0x0000000b, 32 | 0x0000000e,0x0000000d,0x0004003d,0x0000000f,0x00000012,0x00000011,0x00050057,0x00000007, 33 | 0x00000013,0x0000000e,0x00000012,0x0004003d,0x00000007,0x00000016,0x00000015,0x00050085, 34 | 0x00000007,0x00000017,0x00000013,0x00000016,0x0003003e,0x00000009,0x00000017,0x00050041, 35 | 0x0000001a,0x0000001b,0x00000009,0x00000019,0x0004003d,0x00000006,0x0000001c,0x0000001b, 36 | 0x0004003d,0x00000006,0x0000001f,0x0000001e,0x000500b8,0x00000020,0x00000021,0x0000001c, 37 | 0x0000001f,0x000300f7,0x00000023,0x00000000,0x000400fa,0x00000021,0x00000022,0x00000023, 38 | 0x000200f8,0x00000022,0x000100fc,0x000200f8,0x00000023,0x0004003d,0x00000007,0x00000026, 39 | 0x00000009,0x0008004f,0x00000025,0x00000027,0x00000026,0x00000026,0x00000000,0x00000001, 40 | 0x00000002,0x00050041,0x0000002d,0x0000002e,0x0000002a,0x0000002c,0x0004003d,0x00000006, 41 | 0x0000002f,0x0000002e,0x00060050,0x00000025,0x00000030,0x0000002f,0x0000002f,0x0000002f, 42 | 0x0007000c,0x00000025,0x00000031,0x00000001,0x0000001a,0x00000027,0x00000030,0x00050041, 43 | 0x0000001a,0x00000032,0x00000009,0x00000019,0x0004003d,0x00000006,0x00000033,0x00000032, 44 | 0x00050051,0x00000006,0x00000034,0x00000031,0x00000000,0x00050051,0x00000006,0x00000035, 45 | 0x00000031,0x00000001,0x00050051,0x00000006,0x00000036,0x00000031,0x00000002,0x00070050, 46 | 0x00000007,0x00000037,0x00000034,0x00000035,0x00000036,0x00000033,0x0003003e,0x00000009, 47 | 0x00000037,0x000100fd,0x00010038 48 | }; -------------------------------------------------------------------------------- /src/vk/spirv/basic_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t basic_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x0000003e,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x000b000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000b,0x0000001f,0x0000002e, 7 | 0x0000002f,0x00000039,0x0000003c,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47, 8 | 0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005, 9 | 0x00000004,0x6e69616d,0x00000000,0x00040005,0x00000009,0x736f5076,0x00000000,0x00050005, 10 | 0x0000000b,0x65566e69,0x78657472,0x00000000,0x00060005,0x0000000d,0x67616d69,0x61725465, 11 | 0x6f66736e,0x00006d72,0x00050006,0x0000000d,0x00000000,0x7366666f,0x00007465,0x00050006, 12 | 0x0000000d,0x00000001,0x6c616373,0x00000065,0x00060006,0x0000000d,0x00000002,0x664f7675, 13 | 0x74657366,0x00000000,0x00050006,0x0000000d,0x00000003,0x63537675,0x00656c61,0x00030005, 14 | 0x0000000f,0x00007469,0x00060005,0x0000001d,0x505f6c67,0x65567265,0x78657472,0x00000000, 15 | 0x00060006,0x0000001d,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x0000001f, 16 | 0x00000000,0x00050005,0x0000002e,0x43786574,0x64726f6f,0x00000000,0x00050005,0x0000002f, 17 | 0x65546e69,0x6f6f4378,0x00006472,0x00040005,0x00000039,0x6f6c6f63,0x00000072,0x00050005, 18 | 0x0000003c,0x65725461,0x6c6f6873,0x00000064,0x00040047,0x0000000b,0x0000001e,0x00000000, 19 | 0x00050048,0x0000000d,0x00000000,0x00000023,0x00000000,0x00050048,0x0000000d,0x00000001, 20 | 0x00000023,0x00000008,0x00050048,0x0000000d,0x00000002,0x00000023,0x00000010,0x00050048, 21 | 0x0000000d,0x00000003,0x00000023,0x00000018,0x00030047,0x0000000d,0x00000002,0x00040047, 22 | 0x0000000f,0x00000022,0x00000001,0x00040047,0x0000000f,0x00000021,0x00000000,0x00050048, 23 | 0x0000001d,0x00000000,0x0000000b,0x00000000,0x00030047,0x0000001d,0x00000002,0x00040047, 24 | 0x0000002e,0x0000001e,0x00000000,0x00040047,0x0000002f,0x0000001e,0x00000001,0x00040047, 25 | 0x00000039,0x0000001e,0x00000001,0x00040047,0x0000003c,0x0000001e,0x00000002,0x00020013, 26 | 0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017, 27 | 0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,0x00040020, 28 | 0x0000000a,0x00000001,0x00000007,0x0004003b,0x0000000a,0x0000000b,0x00000001,0x0006001e, 29 | 0x0000000d,0x00000007,0x00000007,0x00000007,0x00000007,0x00040020,0x0000000e,0x00000002, 30 | 0x0000000d,0x0004003b,0x0000000e,0x0000000f,0x00000002,0x00040015,0x00000010,0x00000020, 31 | 0x00000001,0x0004002b,0x00000010,0x00000011,0x00000001,0x00040020,0x00000012,0x00000002, 32 | 0x00000007,0x0004002b,0x00000006,0x00000016,0x3f800000,0x0005002c,0x00000007,0x00000017, 33 | 0x00000016,0x00000016,0x00040017,0x0000001c,0x00000006,0x00000004,0x0003001e,0x0000001d, 34 | 0x0000001c,0x00040020,0x0000001e,0x00000003,0x0000001d,0x0004003b,0x0000001e,0x0000001f, 35 | 0x00000003,0x0004002b,0x00000010,0x00000020,0x00000000,0x0004002b,0x00000006,0x00000024, 36 | 0x40000000,0x0004002b,0x00000006,0x00000027,0x00000000,0x00040020,0x0000002b,0x00000003, 37 | 0x0000001c,0x00040020,0x0000002d,0x00000003,0x00000007,0x0004003b,0x0000002d,0x0000002e, 38 | 0x00000003,0x0004003b,0x0000000a,0x0000002f,0x00000001,0x0004002b,0x00000010,0x00000031, 39 | 0x00000003,0x0004002b,0x00000010,0x00000035,0x00000002,0x0004003b,0x0000002b,0x00000039, 40 | 0x00000003,0x0007002c,0x0000001c,0x0000003a,0x00000016,0x00000016,0x00000016,0x00000016, 41 | 0x00040020,0x0000003b,0x00000003,0x00000006,0x0004003b,0x0000003b,0x0000003c,0x00000003, 42 | 0x0004002b,0x00000006,0x0000003d,0x3f2a7efa,0x00050036,0x00000002,0x00000004,0x00000000, 43 | 0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007,0x0004003d, 44 | 0x00000007,0x0000000c,0x0000000b,0x00050041,0x00000012,0x00000013,0x0000000f,0x00000011, 45 | 0x0004003d,0x00000007,0x00000014,0x00000013,0x00050085,0x00000007,0x00000015,0x0000000c, 46 | 0x00000014,0x00050041,0x00000012,0x00000018,0x0000000f,0x00000011,0x0004003d,0x00000007, 47 | 0x00000019,0x00000018,0x00050083,0x00000007,0x0000001a,0x00000017,0x00000019,0x00050083, 48 | 0x00000007,0x0000001b,0x00000015,0x0000001a,0x0003003e,0x00000009,0x0000001b,0x0004003d, 49 | 0x00000007,0x00000021,0x00000009,0x00050041,0x00000012,0x00000022,0x0000000f,0x00000020, 50 | 0x0004003d,0x00000007,0x00000023,0x00000022,0x0005008e,0x00000007,0x00000025,0x00000023, 51 | 0x00000024,0x00050081,0x00000007,0x00000026,0x00000021,0x00000025,0x00050051,0x00000006, 52 | 0x00000028,0x00000026,0x00000000,0x00050051,0x00000006,0x00000029,0x00000026,0x00000001, 53 | 0x00070050,0x0000001c,0x0000002a,0x00000028,0x00000029,0x00000027,0x00000016,0x00050041, 54 | 0x0000002b,0x0000002c,0x0000001f,0x00000020,0x0003003e,0x0000002c,0x0000002a,0x0004003d, 55 | 0x00000007,0x00000030,0x0000002f,0x00050041,0x00000012,0x00000032,0x0000000f,0x00000031, 56 | 0x0004003d,0x00000007,0x00000033,0x00000032,0x00050085,0x00000007,0x00000034,0x00000030, 57 | 0x00000033,0x00050041,0x00000012,0x00000036,0x0000000f,0x00000035,0x0004003d,0x00000007, 58 | 0x00000037,0x00000036,0x00050081,0x00000007,0x00000038,0x00000034,0x00000037,0x0003003e, 59 | 0x0000002e,0x00000038,0x0003003e,0x00000039,0x0000003a,0x0003003e,0x0000003c,0x0000003d, 60 | 0x000100fd,0x00010038 61 | }; -------------------------------------------------------------------------------- /src/vk/spirv/beam_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t beam_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000027,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0008000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x00000016,0x00000020, 7 | 0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,0x5f657461, 8 | 0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,0x00000000, 9 | 0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006,0x00000008, 10 | 0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x0000000a,0x00000000,0x00060005, 11 | 0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000,0x00060006,0x0000000e,0x00000000, 12 | 0x4d70766d,0x69727461,0x00000078,0x00030005,0x00000010,0x00006370,0x00050005,0x00000016, 13 | 0x65566e69,0x78657472,0x00000000,0x00040005,0x00000020,0x6f6c6f63,0x00000072,0x00070005, 14 | 0x00000021,0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365,0x00050006,0x00000021, 15 | 0x00000000,0x6f6c6f63,0x00000072,0x00030005,0x00000023,0x006f6275,0x00050048,0x00000008, 16 | 0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e, 17 | 0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048, 18 | 0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,0x00000002,0x00040047, 19 | 0x00000016,0x0000001e,0x00000000,0x00040047,0x00000020,0x0000001e,0x00000000,0x00050048, 20 | 0x00000021,0x00000000,0x00000023,0x00000000,0x00030047,0x00000021,0x00000002,0x00040047, 21 | 0x00000023,0x00000022,0x00000000,0x00040047,0x00000023,0x00000021,0x00000000,0x00020013, 22 | 0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017, 23 | 0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020,0x00000009, 24 | 0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b, 25 | 0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d, 26 | 0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009, 27 | 0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020,0x00000011,0x00000009, 28 | 0x0000000d,0x00040017,0x00000014,0x00000006,0x00000003,0x00040020,0x00000015,0x00000001, 29 | 0x00000014,0x0004003b,0x00000015,0x00000016,0x00000001,0x0004002b,0x00000006,0x00000018, 30 | 0x3f800000,0x00040020,0x0000001e,0x00000003,0x00000007,0x0004003b,0x0000001e,0x00000020, 31 | 0x00000003,0x0003001e,0x00000021,0x00000007,0x00040020,0x00000022,0x00000002,0x00000021, 32 | 0x0004003b,0x00000022,0x00000023,0x00000002,0x00040020,0x00000024,0x00000002,0x00000007, 33 | 0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041, 34 | 0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012, 35 | 0x0004003d,0x00000014,0x00000017,0x00000016,0x00050051,0x00000006,0x00000019,0x00000017, 36 | 0x00000000,0x00050051,0x00000006,0x0000001a,0x00000017,0x00000001,0x00050051,0x00000006, 37 | 0x0000001b,0x00000017,0x00000002,0x00070050,0x00000007,0x0000001c,0x00000019,0x0000001a, 38 | 0x0000001b,0x00000018,0x00050091,0x00000007,0x0000001d,0x00000013,0x0000001c,0x00050041, 39 | 0x0000001e,0x0000001f,0x0000000a,0x0000000c,0x0003003e,0x0000001f,0x0000001d,0x00050041, 40 | 0x00000024,0x00000025,0x00000023,0x0000000c,0x0004003d,0x00000007,0x00000026,0x00000025, 41 | 0x0003003e,0x00000020,0x00000026,0x000100fd,0x00010038 42 | }; -------------------------------------------------------------------------------- /src/vk/spirv/d_light_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t d_light_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000027,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0009000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x00000016,0x00000020, 7 | 0x00000021,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065, 8 | 0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d, 9 | 0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006, 10 | 0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x0000000a,0x00000000, 11 | 0x00070005,0x0000000e,0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365,0x00060006, 12 | 0x0000000e,0x00000000,0x4d70766d,0x69727461,0x00000078,0x00030005,0x00000010,0x006f6275, 13 | 0x00050005,0x00000016,0x65566e69,0x78657472,0x00000000,0x00040005,0x00000020,0x6f6c6f63, 14 | 0x00000072,0x00040005,0x00000021,0x6f436e69,0x00726f6c,0x00050048,0x00000008,0x00000000, 15 | 0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e,0x00000000, 16 | 0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,0x0000000e, 17 | 0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,0x00000002,0x00040047,0x00000010, 18 | 0x00000022,0x00000000,0x00040047,0x00000010,0x00000021,0x00000000,0x00040047,0x00000016, 19 | 0x0000001e,0x00000000,0x00040047,0x00000020,0x0000001e,0x00000000,0x00040047,0x00000021, 20 | 0x0000001e,0x00000001,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016, 21 | 0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008, 22 | 0x00000007,0x00040020,0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a, 23 | 0x00000003,0x00040015,0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c, 24 | 0x00000000,0x00040018,0x0000000d,0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d, 25 | 0x00040020,0x0000000f,0x00000002,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000002, 26 | 0x00040020,0x00000011,0x00000002,0x0000000d,0x00040017,0x00000014,0x00000006,0x00000003, 27 | 0x00040020,0x00000015,0x00000001,0x00000014,0x0004003b,0x00000015,0x00000016,0x00000001, 28 | 0x0004002b,0x00000006,0x00000018,0x3f800000,0x00040020,0x0000001e,0x00000003,0x00000007, 29 | 0x0004003b,0x0000001e,0x00000020,0x00000003,0x0004003b,0x00000015,0x00000021,0x00000001, 30 | 0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041, 31 | 0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012, 32 | 0x0004003d,0x00000014,0x00000017,0x00000016,0x00050051,0x00000006,0x00000019,0x00000017, 33 | 0x00000000,0x00050051,0x00000006,0x0000001a,0x00000017,0x00000001,0x00050051,0x00000006, 34 | 0x0000001b,0x00000017,0x00000002,0x00070050,0x00000007,0x0000001c,0x00000019,0x0000001a, 35 | 0x0000001b,0x00000018,0x00050091,0x00000007,0x0000001d,0x00000013,0x0000001c,0x00050041, 36 | 0x0000001e,0x0000001f,0x0000000a,0x0000000c,0x0003003e,0x0000001f,0x0000001d,0x0004003d, 37 | 0x00000014,0x00000022,0x00000021,0x00050051,0x00000006,0x00000023,0x00000022,0x00000000, 38 | 0x00050051,0x00000006,0x00000024,0x00000022,0x00000001,0x00050051,0x00000006,0x00000025, 39 | 0x00000022,0x00000002,0x00070050,0x00000007,0x00000026,0x00000023,0x00000024,0x00000025, 40 | 0x00000018,0x0003003e,0x00000020,0x00000026,0x000100fd,0x00010038 41 | }; -------------------------------------------------------------------------------- /src/vk/spirv/model_frag.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t model_frag_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000028,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0009000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000008,0x00000012,0x0000001a, 7 | 0x0000001e,0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005, 8 | 0x00000004,0x6e69616d,0x00000000,0x00050005,0x00000008,0x74786574,0x64657275,0x00000000, 9 | 0x00060005,0x00000012,0x67617266,0x746e656d,0x6f6c6f43,0x00000072,0x00050005,0x00000016, 10 | 0x78655473,0x65727574,0x00000000,0x00050005,0x0000001a,0x43786574,0x64726f6f,0x00000000, 11 | 0x00040005,0x0000001e,0x6f6c6f63,0x00000072,0x00030047,0x00000008,0x0000000e,0x00040047, 12 | 0x00000008,0x0000001e,0x00000002,0x00040047,0x00000012,0x0000001e,0x00000000,0x00040047, 13 | 0x00000016,0x00000022,0x00000000,0x00040047,0x00000016,0x00000021,0x00000000,0x00040047, 14 | 0x0000001a,0x0000001e,0x00000001,0x00040047,0x0000001e,0x0000001e,0x00000000,0x00020013, 15 | 0x00000002,0x00030021,0x00000003,0x00000002,0x00040015,0x00000006,0x00000020,0x00000001, 16 | 0x00040020,0x00000007,0x00000001,0x00000006,0x0004003b,0x00000007,0x00000008,0x00000001, 17 | 0x0004002b,0x00000006,0x0000000a,0x00000000,0x00020014,0x0000000b,0x00030016,0x0000000f, 18 | 0x00000020,0x00040017,0x00000010,0x0000000f,0x00000004,0x00040020,0x00000011,0x00000003, 19 | 0x00000010,0x0004003b,0x00000011,0x00000012,0x00000003,0x00090019,0x00000013,0x0000000f, 20 | 0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x00000014, 21 | 0x00000013,0x00040020,0x00000015,0x00000000,0x00000014,0x0004003b,0x00000015,0x00000016, 22 | 0x00000000,0x00040017,0x00000018,0x0000000f,0x00000002,0x00040020,0x00000019,0x00000001, 23 | 0x00000018,0x0004003b,0x00000019,0x0000001a,0x00000001,0x00040020,0x0000001d,0x00000001, 24 | 0x00000010,0x0004003b,0x0000001d,0x0000001e,0x00000001,0x0004002b,0x0000000f,0x00000020, 25 | 0x00000000,0x0004002b,0x0000000f,0x00000021,0x3f800000,0x00050036,0x00000002,0x00000004, 26 | 0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003d,0x00000006,0x00000009,0x00000008, 27 | 0x000500ab,0x0000000b,0x0000000c,0x00000009,0x0000000a,0x000300f7,0x0000000e,0x00000000, 28 | 0x000400fa,0x0000000c,0x0000000d,0x00000026,0x000200f8,0x0000000d,0x0004003d,0x00000014, 29 | 0x00000017,0x00000016,0x0004003d,0x00000018,0x0000001b,0x0000001a,0x00050057,0x00000010, 30 | 0x0000001c,0x00000017,0x0000001b,0x0004003d,0x00000010,0x0000001f,0x0000001e,0x00070050, 31 | 0x00000010,0x00000022,0x00000020,0x00000020,0x00000020,0x00000020,0x00070050,0x00000010, 32 | 0x00000023,0x00000021,0x00000021,0x00000021,0x00000021,0x0008000c,0x00000010,0x00000024, 33 | 0x00000001,0x0000002b,0x0000001f,0x00000022,0x00000023,0x00050085,0x00000010,0x00000025, 34 | 0x0000001c,0x00000024,0x0003003e,0x00000012,0x00000025,0x000200f9,0x0000000e,0x000200f8, 35 | 0x00000026,0x0004003d,0x00000010,0x00000027,0x0000001e,0x0003003e,0x00000012,0x00000027, 36 | 0x000200f9,0x0000000e,0x000200f8,0x0000000e,0x000100fd,0x00010038 37 | }; -------------------------------------------------------------------------------- /src/vk/spirv/model_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t model_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000037,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x000c000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000027, 7 | 0x00000029,0x0000002d,0x0000002f,0x00000032,0x00030003,0x00000002,0x000001c2,0x00090004, 8 | 0x415f4c47,0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374, 9 | 0x00040005,0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265, 10 | 0x78657472,0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69, 11 | 0x00030005,0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174, 12 | 0x00000000,0x00060006,0x0000000e,0x00000000,0x614d7076,0x78697274,0x00000000,0x00030005, 13 | 0x00000010,0x00006370,0x00070005,0x00000014,0x66696e55,0x426d726f,0x65666675,0x6a624f72, 14 | 0x00746365,0x00050006,0x00000014,0x00000000,0x65646f6d,0x0000006c,0x00060006,0x00000014, 15 | 0x00000001,0x74786574,0x64657275,0x00000000,0x00030005,0x00000016,0x006f6275,0x00050005, 16 | 0x0000001d,0x65566e69,0x78657472,0x00000000,0x00040005,0x00000027,0x6f6c6f63,0x00000072, 17 | 0x00040005,0x00000029,0x6f436e69,0x00726f6c,0x00050005,0x0000002d,0x43786574,0x64726f6f, 18 | 0x00000000,0x00050005,0x0000002f,0x65546e69,0x6f6f4378,0x00006472,0x00050005,0x00000032, 19 | 0x74786574,0x64657275,0x00000000,0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000, 20 | 0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048, 21 | 0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007, 22 | 0x00000010,0x00030047,0x0000000e,0x00000002,0x00040048,0x00000014,0x00000000,0x00000005, 23 | 0x00050048,0x00000014,0x00000000,0x00000023,0x00000000,0x00050048,0x00000014,0x00000000, 24 | 0x00000007,0x00000010,0x00050048,0x00000014,0x00000001,0x00000023,0x00000040,0x00030047, 25 | 0x00000014,0x00000002,0x00040047,0x00000016,0x00000022,0x00000001,0x00040047,0x00000016, 26 | 0x00000021,0x00000000,0x00040047,0x0000001d,0x0000001e,0x00000000,0x00040047,0x00000027, 27 | 0x0000001e,0x00000000,0x00040047,0x00000029,0x0000001e,0x00000001,0x00040047,0x0000002d, 28 | 0x0000001e,0x00000001,0x00040047,0x0000002f,0x0000001e,0x00000002,0x00040047,0x00000032, 29 | 0x0000001e,0x00000002,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016, 30 | 0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008, 31 | 0x00000007,0x00040020,0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a, 32 | 0x00000003,0x00040015,0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c, 33 | 0x00000000,0x00040018,0x0000000d,0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d, 34 | 0x00040020,0x0000000f,0x00000009,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009, 35 | 0x00040020,0x00000011,0x00000009,0x0000000d,0x0004001e,0x00000014,0x0000000d,0x0000000b, 36 | 0x00040020,0x00000015,0x00000002,0x00000014,0x0004003b,0x00000015,0x00000016,0x00000002, 37 | 0x00040020,0x00000017,0x00000002,0x0000000d,0x00040017,0x0000001b,0x00000006,0x00000003, 38 | 0x00040020,0x0000001c,0x00000001,0x0000001b,0x0004003b,0x0000001c,0x0000001d,0x00000001, 39 | 0x0004002b,0x00000006,0x0000001f,0x3f800000,0x00040020,0x00000025,0x00000003,0x00000007, 40 | 0x0004003b,0x00000025,0x00000027,0x00000003,0x00040020,0x00000028,0x00000001,0x00000007, 41 | 0x0004003b,0x00000028,0x00000029,0x00000001,0x00040017,0x0000002b,0x00000006,0x00000002, 42 | 0x00040020,0x0000002c,0x00000003,0x0000002b,0x0004003b,0x0000002c,0x0000002d,0x00000003, 43 | 0x00040020,0x0000002e,0x00000001,0x0000002b,0x0004003b,0x0000002e,0x0000002f,0x00000001, 44 | 0x00040020,0x00000031,0x00000003,0x0000000b,0x0004003b,0x00000031,0x00000032,0x00000003, 45 | 0x0004002b,0x0000000b,0x00000033,0x00000001,0x00040020,0x00000034,0x00000002,0x0000000b, 46 | 0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041, 47 | 0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012, 48 | 0x00050041,0x00000017,0x00000018,0x00000016,0x0000000c,0x0004003d,0x0000000d,0x00000019, 49 | 0x00000018,0x00050092,0x0000000d,0x0000001a,0x00000013,0x00000019,0x0004003d,0x0000001b, 50 | 0x0000001e,0x0000001d,0x00050051,0x00000006,0x00000020,0x0000001e,0x00000000,0x00050051, 51 | 0x00000006,0x00000021,0x0000001e,0x00000001,0x00050051,0x00000006,0x00000022,0x0000001e, 52 | 0x00000002,0x00070050,0x00000007,0x00000023,0x00000020,0x00000021,0x00000022,0x0000001f, 53 | 0x00050091,0x00000007,0x00000024,0x0000001a,0x00000023,0x00050041,0x00000025,0x00000026, 54 | 0x0000000a,0x0000000c,0x0003003e,0x00000026,0x00000024,0x0004003d,0x00000007,0x0000002a, 55 | 0x00000029,0x0003003e,0x00000027,0x0000002a,0x0004003d,0x0000002b,0x00000030,0x0000002f, 56 | 0x0003003e,0x0000002d,0x00000030,0x00050041,0x00000034,0x00000035,0x00000016,0x00000033, 57 | 0x0004003d,0x0000000b,0x00000036,0x00000035,0x0003003e,0x00000032,0x00000036,0x000100fd, 58 | 0x00010038 59 | }; -------------------------------------------------------------------------------- /src/vk/spirv/nullmodel_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t nullmodel_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x0000002e,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0009000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000027, 7 | 0x00000028,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065, 8 | 0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d, 9 | 0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006, 10 | 0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x0000000a,0x00000000, 11 | 0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000,0x00060006,0x0000000e, 12 | 0x00000000,0x614d7076,0x78697274,0x00000000,0x00030005,0x00000010,0x00006370,0x00070005, 13 | 0x00000014,0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365,0x00050006,0x00000014, 14 | 0x00000000,0x65646f6d,0x0000006c,0x00030005,0x00000016,0x006f6275,0x00050005,0x0000001d, 15 | 0x65566e69,0x78657472,0x00000000,0x00040005,0x00000027,0x6f6c6f63,0x00000072,0x00040005, 16 | 0x00000028,0x6f436e69,0x00726f6c,0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000, 17 | 0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048, 18 | 0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007, 19 | 0x00000010,0x00030047,0x0000000e,0x00000002,0x00040048,0x00000014,0x00000000,0x00000005, 20 | 0x00050048,0x00000014,0x00000000,0x00000023,0x00000000,0x00050048,0x00000014,0x00000000, 21 | 0x00000007,0x00000010,0x00030047,0x00000014,0x00000002,0x00040047,0x00000016,0x00000022, 22 | 0x00000000,0x00040047,0x00000016,0x00000021,0x00000000,0x00040047,0x0000001d,0x0000001e, 23 | 0x00000000,0x00040047,0x00000027,0x0000001e,0x00000000,0x00040047,0x00000028,0x0000001e, 24 | 0x00000001,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006, 25 | 0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007, 26 | 0x00040020,0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003, 27 | 0x00040015,0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000, 28 | 0x00040018,0x0000000d,0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020, 29 | 0x0000000f,0x00000009,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020, 30 | 0x00000011,0x00000009,0x0000000d,0x0003001e,0x00000014,0x0000000d,0x00040020,0x00000015, 31 | 0x00000002,0x00000014,0x0004003b,0x00000015,0x00000016,0x00000002,0x00040020,0x00000017, 32 | 0x00000002,0x0000000d,0x00040017,0x0000001b,0x00000006,0x00000003,0x00040020,0x0000001c, 33 | 0x00000001,0x0000001b,0x0004003b,0x0000001c,0x0000001d,0x00000001,0x0004002b,0x00000006, 34 | 0x0000001f,0x3f800000,0x00040020,0x00000025,0x00000003,0x00000007,0x0004003b,0x00000025, 35 | 0x00000027,0x00000003,0x0004003b,0x0000001c,0x00000028,0x00000001,0x00050036,0x00000002, 36 | 0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,0x00000011,0x00000012, 37 | 0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,0x00050041,0x00000017, 38 | 0x00000018,0x00000016,0x0000000c,0x0004003d,0x0000000d,0x00000019,0x00000018,0x00050092, 39 | 0x0000000d,0x0000001a,0x00000013,0x00000019,0x0004003d,0x0000001b,0x0000001e,0x0000001d, 40 | 0x00050051,0x00000006,0x00000020,0x0000001e,0x00000000,0x00050051,0x00000006,0x00000021, 41 | 0x0000001e,0x00000001,0x00050051,0x00000006,0x00000022,0x0000001e,0x00000002,0x00070050, 42 | 0x00000007,0x00000023,0x00000020,0x00000021,0x00000022,0x0000001f,0x00050091,0x00000007, 43 | 0x00000024,0x0000001a,0x00000023,0x00050041,0x00000025,0x00000026,0x0000000a,0x0000000c, 44 | 0x0003003e,0x00000026,0x00000024,0x0004003d,0x0000001b,0x00000029,0x00000028,0x00050051, 45 | 0x00000006,0x0000002a,0x00000029,0x00000000,0x00050051,0x00000006,0x0000002b,0x00000029, 46 | 0x00000001,0x00050051,0x00000006,0x0000002c,0x00000029,0x00000002,0x00070050,0x00000007, 47 | 0x0000002d,0x0000002a,0x0000002b,0x0000002c,0x0000001f,0x0003003e,0x00000027,0x0000002d, 48 | 0x000100fd,0x00010038 49 | }; -------------------------------------------------------------------------------- /src/vk/spirv/particle_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3743 2 | #pragma once 3 | const uint32_t particle_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x0000002d,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x000c000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x00000016,0x00000022, 7 | 0x00000024,0x00000026,0x00000028,0x0000002b,0x00030003,0x00000002,0x000001c2,0x00090004, 8 | 0x415f4c47,0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374, 9 | 0x00040005,0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265, 10 | 0x78657472,0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69, 11 | 0x00030005,0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174, 12 | 0x00000000,0x00060006,0x0000000e,0x00000000,0x4d70766d,0x69727461,0x00000078,0x00030005, 13 | 0x00000010,0x00006370,0x00050005,0x00000016,0x65566e69,0x78657472,0x00000000,0x00050005, 14 | 0x00000022,0x43786574,0x64726f6f,0x00000000,0x00050005,0x00000024,0x65546e69,0x6f6f4378, 15 | 0x00006472,0x00040005,0x00000026,0x6f6c6f63,0x00000072,0x00040005,0x00000028,0x6f436e69, 16 | 0x00726f6c,0x00050005,0x0000002b,0x65725461,0x6c6f6873,0x00000064,0x00050048,0x00000008, 17 | 0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e, 18 | 0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048, 19 | 0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,0x00000002,0x00040047, 20 | 0x00000016,0x0000001e,0x00000000,0x00040047,0x00000022,0x0000001e,0x00000000,0x00040047, 21 | 0x00000024,0x0000001e,0x00000002,0x00040047,0x00000026,0x0000001e,0x00000001,0x00040047, 22 | 0x00000028,0x0000001e,0x00000001,0x00040047,0x0000002b,0x0000001e,0x00000002,0x00020013, 23 | 0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017, 24 | 0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020,0x00000009, 25 | 0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b, 26 | 0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d, 27 | 0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009, 28 | 0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020,0x00000011,0x00000009, 29 | 0x0000000d,0x00040017,0x00000014,0x00000006,0x00000003,0x00040020,0x00000015,0x00000001, 30 | 0x00000014,0x0004003b,0x00000015,0x00000016,0x00000001,0x0004002b,0x00000006,0x00000018, 31 | 0x3f800000,0x00040020,0x0000001e,0x00000003,0x00000007,0x00040017,0x00000020,0x00000006, 32 | 0x00000002,0x00040020,0x00000021,0x00000003,0x00000020,0x0004003b,0x00000021,0x00000022, 33 | 0x00000003,0x00040020,0x00000023,0x00000001,0x00000020,0x0004003b,0x00000023,0x00000024, 34 | 0x00000001,0x0004003b,0x0000001e,0x00000026,0x00000003,0x00040020,0x00000027,0x00000001, 35 | 0x00000007,0x0004003b,0x00000027,0x00000028,0x00000001,0x00040020,0x0000002a,0x00000003, 36 | 0x00000006,0x0004003b,0x0000002a,0x0000002b,0x00000003,0x0004002b,0x00000006,0x0000002c, 37 | 0x3f000000,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005, 38 | 0x00050041,0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013, 39 | 0x00000012,0x0004003d,0x00000014,0x00000017,0x00000016,0x00050051,0x00000006,0x00000019, 40 | 0x00000017,0x00000000,0x00050051,0x00000006,0x0000001a,0x00000017,0x00000001,0x00050051, 41 | 0x00000006,0x0000001b,0x00000017,0x00000002,0x00070050,0x00000007,0x0000001c,0x00000019, 42 | 0x0000001a,0x0000001b,0x00000018,0x00050091,0x00000007,0x0000001d,0x00000013,0x0000001c, 43 | 0x00050041,0x0000001e,0x0000001f,0x0000000a,0x0000000c,0x0003003e,0x0000001f,0x0000001d, 44 | 0x0004003d,0x00000020,0x00000025,0x00000024,0x0003003e,0x00000022,0x00000025,0x0004003d, 45 | 0x00000007,0x00000029,0x00000028,0x0003003e,0x00000026,0x00000029,0x0003003e,0x0000002b, 46 | 0x0000002c,0x000100fd,0x00010038 47 | }; -------------------------------------------------------------------------------- /src/vk/spirv/point_particle_frag.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t point_particle_frag_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000020,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0008000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000000c,0x0000001c,0x0000001e, 7 | 0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004, 8 | 0x6e69616d,0x00000000,0x00030005,0x00000009,0x00797863,0x00060005,0x0000000c,0x505f6c67, 9 | 0x746e696f,0x726f6f43,0x00000064,0x00060005,0x0000001c,0x67617266,0x746e656d,0x6f6c6f43, 10 | 0x00000072,0x00040005,0x0000001e,0x6f6c6f63,0x00000072,0x00040047,0x0000000c,0x0000000b, 11 | 0x00000010,0x00040047,0x0000001c,0x0000001e,0x00000000,0x00040047,0x0000001e,0x0000001e, 12 | 0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006, 13 | 0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007, 14 | 0x00000007,0x0004002b,0x00000006,0x0000000a,0x40000000,0x00040020,0x0000000b,0x00000001, 15 | 0x00000007,0x0004003b,0x0000000b,0x0000000c,0x00000001,0x0004002b,0x00000006,0x0000000f, 16 | 0x3f800000,0x00020014,0x00000015,0x00040017,0x0000001a,0x00000006,0x00000004,0x00040020, 17 | 0x0000001b,0x00000003,0x0000001a,0x0004003b,0x0000001b,0x0000001c,0x00000003,0x00040020, 18 | 0x0000001d,0x00000001,0x0000001a,0x0004003b,0x0000001d,0x0000001e,0x00000001,0x00050036, 19 | 0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008, 20 | 0x00000009,0x00000007,0x0004003d,0x00000007,0x0000000d,0x0000000c,0x0005008e,0x00000007, 21 | 0x0000000e,0x0000000d,0x0000000a,0x00050050,0x00000007,0x00000010,0x0000000f,0x0000000f, 22 | 0x00050083,0x00000007,0x00000011,0x0000000e,0x00000010,0x0003003e,0x00000009,0x00000011, 23 | 0x0004003d,0x00000007,0x00000012,0x00000009,0x0004003d,0x00000007,0x00000013,0x00000009, 24 | 0x00050094,0x00000006,0x00000014,0x00000012,0x00000013,0x000500ba,0x00000015,0x00000016, 25 | 0x00000014,0x0000000f,0x000300f7,0x00000018,0x00000000,0x000400fa,0x00000016,0x00000017, 26 | 0x00000018,0x000200f8,0x00000017,0x000100fc,0x000200f8,0x00000018,0x0004003d,0x0000001a, 27 | 0x0000001f,0x0000001e,0x0003003e,0x0000001c,0x0000001f,0x000100fd,0x00010038 28 | }; -------------------------------------------------------------------------------- /src/vk/spirv/point_particle_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t point_particle_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000055,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0009000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x00000016,0x00000051, 7 | 0x00000053,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065, 8 | 0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d, 9 | 0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006, 10 | 0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00070006,0x00000008,0x00000001, 11 | 0x505f6c67,0x746e696f,0x657a6953,0x00000000,0x00030005,0x0000000a,0x00000000,0x00060005, 12 | 0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000,0x00060006,0x0000000e,0x00000000, 13 | 0x4d70766d,0x69727461,0x00000078,0x00030005,0x00000010,0x00006370,0x00050005,0x00000016, 14 | 0x65566e69,0x78657472,0x00000000,0x00050005,0x00000021,0x74736964,0x7474615f,0x00006e65, 15 | 0x00070005,0x00000022,0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365,0x00060006, 16 | 0x00000022,0x00000000,0x6e696f70,0x7a695374,0x00000065,0x00060006,0x00000022,0x00000001, 17 | 0x6e696f70,0x61635374,0x0000656c,0x00070006,0x00000022,0x00000002,0x506e696d,0x746e696f, 18 | 0x657a6953,0x00000000,0x00070006,0x00000022,0x00000003,0x5078616d,0x746e696f,0x657a6953, 19 | 0x00000000,0x00050006,0x00000022,0x00000004,0x5f747461,0x00000061,0x00050006,0x00000022, 20 | 0x00000005,0x5f747461,0x00000062,0x00050006,0x00000022,0x00000006,0x5f747461,0x00000063, 21 | 0x00030005,0x00000024,0x006f6275,0x00040005,0x00000051,0x6f6c6f63,0x00000072,0x00040005, 22 | 0x00000053,0x6f436e69,0x00726f6c,0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000, 23 | 0x00050048,0x00000008,0x00000001,0x0000000b,0x00000001,0x00030047,0x00000008,0x00000002, 24 | 0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023, 25 | 0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e, 26 | 0x00000002,0x00040047,0x00000016,0x0000001e,0x00000000,0x00050048,0x00000022,0x00000000, 27 | 0x00000023,0x00000000,0x00050048,0x00000022,0x00000001,0x00000023,0x00000004,0x00050048, 28 | 0x00000022,0x00000002,0x00000023,0x00000008,0x00050048,0x00000022,0x00000003,0x00000023, 29 | 0x0000000c,0x00050048,0x00000022,0x00000004,0x00000023,0x00000010,0x00050048,0x00000022, 30 | 0x00000005,0x00000023,0x00000014,0x00050048,0x00000022,0x00000006,0x00000023,0x00000018, 31 | 0x00030047,0x00000022,0x00000002,0x00040047,0x00000024,0x00000022,0x00000000,0x00040047, 32 | 0x00000024,0x00000021,0x00000000,0x00040047,0x00000051,0x0000001e,0x00000000,0x00040047, 33 | 0x00000053,0x0000001e,0x00000001,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002, 34 | 0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,0x0004001e, 35 | 0x00000008,0x00000007,0x00000006,0x00040020,0x00000009,0x00000003,0x00000008,0x0004003b, 36 | 0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b,0x00000020,0x00000001,0x0004002b, 37 | 0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d,0x00000007,0x00000004,0x0003001e, 38 | 0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009,0x0000000e,0x0004003b,0x0000000f, 39 | 0x00000010,0x00000009,0x00040020,0x00000011,0x00000009,0x0000000d,0x00040017,0x00000014, 40 | 0x00000006,0x00000003,0x00040020,0x00000015,0x00000001,0x00000014,0x0004003b,0x00000015, 41 | 0x00000016,0x00000001,0x0004002b,0x00000006,0x00000018,0x3f800000,0x00040020,0x0000001e, 42 | 0x00000003,0x00000007,0x00040020,0x00000020,0x00000007,0x00000006,0x0009001e,0x00000022, 43 | 0x00000006,0x00000006,0x00000006,0x00000006,0x00000006,0x00000006,0x00000006,0x00040020, 44 | 0x00000023,0x00000002,0x00000022,0x0004003b,0x00000023,0x00000024,0x00000002,0x0004002b, 45 | 0x0000000b,0x00000025,0x00000001,0x00040020,0x00000026,0x00000002,0x00000006,0x0004002b, 46 | 0x0000000b,0x00000029,0x00000004,0x0004002b,0x0000000b,0x0000002c,0x00000005,0x00040015, 47 | 0x0000002f,0x00000020,0x00000000,0x0004002b,0x0000002f,0x00000030,0x00000003,0x00040020, 48 | 0x00000031,0x00000003,0x00000006,0x0004002b,0x0000000b,0x00000036,0x00000006,0x0004002b, 49 | 0x0000000b,0x00000049,0x00000002,0x0004002b,0x0000000b,0x0000004c,0x00000003,0x0004003b, 50 | 0x0000001e,0x00000051,0x00000003,0x00040020,0x00000052,0x00000001,0x00000007,0x0004003b, 51 | 0x00000052,0x00000053,0x00000001,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003, 52 | 0x000200f8,0x00000005,0x0004003b,0x00000020,0x00000021,0x00000007,0x00050041,0x00000011, 53 | 0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,0x0004003d, 54 | 0x00000014,0x00000017,0x00000016,0x00050051,0x00000006,0x00000019,0x00000017,0x00000000, 55 | 0x00050051,0x00000006,0x0000001a,0x00000017,0x00000001,0x00050051,0x00000006,0x0000001b, 56 | 0x00000017,0x00000002,0x00070050,0x00000007,0x0000001c,0x00000019,0x0000001a,0x0000001b, 57 | 0x00000018,0x00050091,0x00000007,0x0000001d,0x00000013,0x0000001c,0x00050041,0x0000001e, 58 | 0x0000001f,0x0000000a,0x0000000c,0x0003003e,0x0000001f,0x0000001d,0x00050041,0x00000026, 59 | 0x00000027,0x00000024,0x00000025,0x0004003d,0x00000006,0x00000028,0x00000027,0x00050041, 60 | 0x00000026,0x0000002a,0x00000024,0x00000029,0x0004003d,0x00000006,0x0000002b,0x0000002a, 61 | 0x00050041,0x00000026,0x0000002d,0x00000024,0x0000002c,0x0004003d,0x00000006,0x0000002e, 62 | 0x0000002d,0x00060041,0x00000031,0x00000032,0x0000000a,0x0000000c,0x00000030,0x0004003d, 63 | 0x00000006,0x00000033,0x00000032,0x00050085,0x00000006,0x00000034,0x0000002e,0x00000033, 64 | 0x00050081,0x00000006,0x00000035,0x0000002b,0x00000034,0x00050041,0x00000026,0x00000037, 65 | 0x00000024,0x00000036,0x0004003d,0x00000006,0x00000038,0x00000037,0x00060041,0x00000031, 66 | 0x00000039,0x0000000a,0x0000000c,0x00000030,0x0004003d,0x00000006,0x0000003a,0x00000039, 67 | 0x00050085,0x00000006,0x0000003b,0x00000038,0x0000003a,0x00060041,0x00000031,0x0000003c, 68 | 0x0000000a,0x0000000c,0x00000030,0x0004003d,0x00000006,0x0000003d,0x0000003c,0x00050085, 69 | 0x00000006,0x0000003e,0x0000003b,0x0000003d,0x00050081,0x00000006,0x0000003f,0x00000035, 70 | 0x0000003e,0x00050088,0x00000006,0x00000040,0x00000028,0x0000003f,0x0003003e,0x00000021, 71 | 0x00000040,0x00050041,0x00000026,0x00000041,0x00000024,0x00000025,0x0004003d,0x00000006, 72 | 0x00000042,0x00000041,0x00050041,0x00000026,0x00000043,0x00000024,0x0000000c,0x0004003d, 73 | 0x00000006,0x00000044,0x00000043,0x00050085,0x00000006,0x00000045,0x00000042,0x00000044, 74 | 0x0004003d,0x00000006,0x00000046,0x00000021,0x0006000c,0x00000006,0x00000047,0x00000001, 75 | 0x0000001f,0x00000046,0x00050085,0x00000006,0x00000048,0x00000045,0x00000047,0x00050041, 76 | 0x00000026,0x0000004a,0x00000024,0x00000049,0x0004003d,0x00000006,0x0000004b,0x0000004a, 77 | 0x00050041,0x00000026,0x0000004d,0x00000024,0x0000004c,0x0004003d,0x00000006,0x0000004e, 78 | 0x0000004d,0x0008000c,0x00000006,0x0000004f,0x00000001,0x0000002b,0x00000048,0x0000004b, 79 | 0x0000004e,0x00050041,0x00000031,0x00000050,0x0000000a,0x00000025,0x0003003e,0x00000050, 80 | 0x0000004f,0x0004003d,0x00000007,0x00000054,0x00000053,0x0003003e,0x00000051,0x00000054, 81 | 0x000100fd,0x00010038 82 | }; -------------------------------------------------------------------------------- /src/vk/spirv/polygon_lmap_frag.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t polygon_lmap_frag_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000029,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0009000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000011,0x00000017,0x0000001b, 7 | 0x0000001e,0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005, 8 | 0x00000004,0x6e69616d,0x00000000,0x00040005,0x00000009,0x6f6c6f63,0x00000072,0x00050005, 9 | 0x0000000d,0x78655473,0x65727574,0x00000000,0x00050005,0x00000011,0x43786574,0x64726f6f, 10 | 0x00000000,0x00040005,0x00000014,0x6867696c,0x00000074,0x00050005,0x00000015,0x67694c73, 11 | 0x616d7468,0x00000070,0x00060005,0x00000017,0x43786574,0x64726f6f,0x70616d4c,0x00000000, 12 | 0x00060005,0x0000001b,0x67617266,0x746e656d,0x6f6c6f43,0x00000072,0x00060005,0x0000001e, 13 | 0x77656976,0x6867694c,0x70616d74,0x00000073,0x00040047,0x0000000d,0x00000022,0x00000000, 14 | 0x00040047,0x0000000d,0x00000021,0x00000000,0x00040047,0x00000011,0x0000001e,0x00000000, 15 | 0x00040047,0x00000015,0x00000022,0x00000002,0x00040047,0x00000015,0x00000021,0x00000000, 16 | 0x00040047,0x00000017,0x0000001e,0x00000001,0x00040047,0x0000001b,0x0000001e,0x00000000, 17 | 0x00040047,0x0000001e,0x0000001e,0x00000002,0x00020013,0x00000002,0x00030021,0x00000003, 18 | 0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004, 19 | 0x00040020,0x00000008,0x00000007,0x00000007,0x00090019,0x0000000a,0x00000006,0x00000001, 20 | 0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x0000000b,0x0000000a, 21 | 0x00040020,0x0000000c,0x00000000,0x0000000b,0x0004003b,0x0000000c,0x0000000d,0x00000000, 22 | 0x00040017,0x0000000f,0x00000006,0x00000002,0x00040020,0x00000010,0x00000001,0x0000000f, 23 | 0x0004003b,0x00000010,0x00000011,0x00000001,0x0004003b,0x0000000c,0x00000015,0x00000000, 24 | 0x0004003b,0x00000010,0x00000017,0x00000001,0x00040020,0x0000001a,0x00000003,0x00000007, 25 | 0x0004003b,0x0000001a,0x0000001b,0x00000003,0x0004002b,0x00000006,0x0000001c,0x3f800000, 26 | 0x00040020,0x0000001d,0x00000001,0x00000006,0x0004003b,0x0000001d,0x0000001e,0x00000001, 27 | 0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b, 28 | 0x00000008,0x00000009,0x00000007,0x0004003b,0x00000008,0x00000014,0x00000007,0x0004003d, 29 | 0x0000000b,0x0000000e,0x0000000d,0x0004003d,0x0000000f,0x00000012,0x00000011,0x00050057, 30 | 0x00000007,0x00000013,0x0000000e,0x00000012,0x0003003e,0x00000009,0x00000013,0x0004003d, 31 | 0x0000000b,0x00000016,0x00000015,0x0004003d,0x0000000f,0x00000018,0x00000017,0x00050057, 32 | 0x00000007,0x00000019,0x00000016,0x00000018,0x0003003e,0x00000014,0x00000019,0x0004003d, 33 | 0x00000006,0x0000001f,0x0000001e,0x00050083,0x00000006,0x00000020,0x0000001c,0x0000001f, 34 | 0x0004003d,0x00000007,0x00000021,0x00000009,0x0005008e,0x00000007,0x00000022,0x00000021, 35 | 0x00000020,0x0004003d,0x00000007,0x00000023,0x00000014,0x00050085,0x00000007,0x00000024, 36 | 0x00000022,0x00000023,0x0004003d,0x00000006,0x00000025,0x0000001e,0x0004003d,0x00000007, 37 | 0x00000026,0x00000014,0x0005008e,0x00000007,0x00000027,0x00000026,0x00000025,0x00050081, 38 | 0x00000007,0x00000028,0x00000024,0x00000027,0x0003003e,0x0000001b,0x00000028,0x000100fd, 39 | 0x00010038 40 | }; -------------------------------------------------------------------------------- /src/vk/spirv/polygon_lmap_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t polygon_lmap_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000036,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x000c000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000029, 7 | 0x0000002b,0x0000002d,0x0000002e,0x00000031,0x00030003,0x00000002,0x000001c2,0x00090004, 8 | 0x415f4c47,0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374, 9 | 0x00040005,0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265, 10 | 0x78657472,0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69, 11 | 0x00030005,0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174, 12 | 0x00000000,0x00060006,0x0000000e,0x00000000,0x614d7076,0x78697274,0x00000000,0x00030005, 13 | 0x00000010,0x00006370,0x00070005,0x00000014,0x66696e55,0x426d726f,0x65666675,0x6a624f72, 14 | 0x00746365,0x00050006,0x00000014,0x00000000,0x65646f6d,0x0000006c,0x00070006,0x00000014, 15 | 0x00000001,0x77656976,0x6867694c,0x70616d74,0x00000073,0x00030005,0x00000016,0x006f6275, 16 | 0x00050005,0x0000001d,0x65566e69,0x78657472,0x00000000,0x00050005,0x00000029,0x43786574, 17 | 0x64726f6f,0x00000000,0x00050005,0x0000002b,0x65546e69,0x6f6f4378,0x00006472,0x00060005, 18 | 0x0000002d,0x43786574,0x64726f6f,0x70616d4c,0x00000000,0x00060005,0x0000002e,0x65546e69, 19 | 0x6f6f4378,0x6d4c6472,0x00007061,0x00060005,0x00000031,0x77656976,0x6867694c,0x70616d74, 20 | 0x00000073,0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008, 21 | 0x00000002,0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000, 22 | 0x00000023,0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047, 23 | 0x0000000e,0x00000002,0x00040048,0x00000014,0x00000000,0x00000005,0x00050048,0x00000014, 24 | 0x00000000,0x00000023,0x00000000,0x00050048,0x00000014,0x00000000,0x00000007,0x00000010, 25 | 0x00050048,0x00000014,0x00000001,0x00000023,0x00000040,0x00030047,0x00000014,0x00000002, 26 | 0x00040047,0x00000016,0x00000022,0x00000001,0x00040047,0x00000016,0x00000021,0x00000000, 27 | 0x00040047,0x0000001d,0x0000001e,0x00000000,0x00040047,0x00000029,0x0000001e,0x00000000, 28 | 0x00040047,0x0000002b,0x0000001e,0x00000001,0x00040047,0x0000002d,0x0000001e,0x00000001, 29 | 0x00040047,0x0000002e,0x0000001e,0x00000002,0x00040047,0x00000031,0x0000001e,0x00000002, 30 | 0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020, 31 | 0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020, 32 | 0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015, 33 | 0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018, 34 | 0x0000000d,0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f, 35 | 0x00000009,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020,0x00000011, 36 | 0x00000009,0x0000000d,0x0004001e,0x00000014,0x0000000d,0x00000006,0x00040020,0x00000015, 37 | 0x00000002,0x00000014,0x0004003b,0x00000015,0x00000016,0x00000002,0x00040020,0x00000017, 38 | 0x00000002,0x0000000d,0x00040017,0x0000001b,0x00000006,0x00000003,0x00040020,0x0000001c, 39 | 0x00000001,0x0000001b,0x0004003b,0x0000001c,0x0000001d,0x00000001,0x0004002b,0x00000006, 40 | 0x0000001f,0x3f800000,0x00040020,0x00000025,0x00000003,0x00000007,0x00040017,0x00000027, 41 | 0x00000006,0x00000002,0x00040020,0x00000028,0x00000003,0x00000027,0x0004003b,0x00000028, 42 | 0x00000029,0x00000003,0x00040020,0x0000002a,0x00000001,0x00000027,0x0004003b,0x0000002a, 43 | 0x0000002b,0x00000001,0x0004003b,0x00000028,0x0000002d,0x00000003,0x0004003b,0x0000002a, 44 | 0x0000002e,0x00000001,0x00040020,0x00000030,0x00000003,0x00000006,0x0004003b,0x00000030, 45 | 0x00000031,0x00000003,0x0004002b,0x0000000b,0x00000032,0x00000001,0x00040020,0x00000033, 46 | 0x00000002,0x00000006,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8, 47 | 0x00000005,0x00050041,0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d, 48 | 0x00000013,0x00000012,0x00050041,0x00000017,0x00000018,0x00000016,0x0000000c,0x0004003d, 49 | 0x0000000d,0x00000019,0x00000018,0x00050092,0x0000000d,0x0000001a,0x00000013,0x00000019, 50 | 0x0004003d,0x0000001b,0x0000001e,0x0000001d,0x00050051,0x00000006,0x00000020,0x0000001e, 51 | 0x00000000,0x00050051,0x00000006,0x00000021,0x0000001e,0x00000001,0x00050051,0x00000006, 52 | 0x00000022,0x0000001e,0x00000002,0x00070050,0x00000007,0x00000023,0x00000020,0x00000021, 53 | 0x00000022,0x0000001f,0x00050091,0x00000007,0x00000024,0x0000001a,0x00000023,0x00050041, 54 | 0x00000025,0x00000026,0x0000000a,0x0000000c,0x0003003e,0x00000026,0x00000024,0x0004003d, 55 | 0x00000027,0x0000002c,0x0000002b,0x0003003e,0x00000029,0x0000002c,0x0004003d,0x00000027, 56 | 0x0000002f,0x0000002e,0x0003003e,0x0000002d,0x0000002f,0x00050041,0x00000033,0x00000034, 57 | 0x00000016,0x00000032,0x0004003d,0x00000006,0x00000035,0x00000034,0x0003003e,0x00000031, 58 | 0x00000035,0x000100fd,0x00010038 59 | }; -------------------------------------------------------------------------------- /src/vk/spirv/polygon_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t polygon_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000030,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x000b000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x00000016,0x00000022, 7 | 0x00000024,0x00000026,0x0000002e,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47, 8 | 0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005, 9 | 0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472, 10 | 0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005, 11 | 0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000, 12 | 0x00060006,0x0000000e,0x00000000,0x4d70766d,0x69727461,0x00000078,0x00030005,0x00000010, 13 | 0x00006370,0x00050005,0x00000016,0x65566e69,0x78657472,0x00000000,0x00050005,0x00000022, 14 | 0x43786574,0x64726f6f,0x00000000,0x00050005,0x00000024,0x65546e69,0x6f6f4378,0x00006472, 15 | 0x00040005,0x00000026,0x6f6c6f63,0x00000072,0x00070005,0x00000027,0x66696e55,0x426d726f, 16 | 0x65666675,0x6a624f72,0x00746365,0x00050006,0x00000027,0x00000000,0x6f6c6f63,0x00000072, 17 | 0x00030005,0x00000029,0x006f6275,0x00050005,0x0000002e,0x65725461,0x6c6f6873,0x00000064, 18 | 0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002, 19 | 0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023, 20 | 0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e, 21 | 0x00000002,0x00040047,0x00000016,0x0000001e,0x00000000,0x00040047,0x00000022,0x0000001e, 22 | 0x00000000,0x00040047,0x00000024,0x0000001e,0x00000001,0x00040047,0x00000026,0x0000001e, 23 | 0x00000001,0x00050048,0x00000027,0x00000000,0x00000023,0x00000000,0x00030047,0x00000027, 24 | 0x00000002,0x00040047,0x00000029,0x00000022,0x00000001,0x00040047,0x00000029,0x00000021, 25 | 0x00000000,0x00040047,0x0000002e,0x0000001e,0x00000002,0x00020013,0x00000002,0x00030021, 26 | 0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006, 27 | 0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020,0x00000009,0x00000003,0x00000008, 28 | 0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b,0x00000020,0x00000001, 29 | 0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d,0x00000007,0x00000004, 30 | 0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009,0x0000000e,0x0004003b, 31 | 0x0000000f,0x00000010,0x00000009,0x00040020,0x00000011,0x00000009,0x0000000d,0x00040017, 32 | 0x00000014,0x00000006,0x00000003,0x00040020,0x00000015,0x00000001,0x00000014,0x0004003b, 33 | 0x00000015,0x00000016,0x00000001,0x0004002b,0x00000006,0x00000018,0x3f800000,0x00040020, 34 | 0x0000001e,0x00000003,0x00000007,0x00040017,0x00000020,0x00000006,0x00000002,0x00040020, 35 | 0x00000021,0x00000003,0x00000020,0x0004003b,0x00000021,0x00000022,0x00000003,0x00040020, 36 | 0x00000023,0x00000001,0x00000020,0x0004003b,0x00000023,0x00000024,0x00000001,0x0004003b, 37 | 0x0000001e,0x00000026,0x00000003,0x0003001e,0x00000027,0x00000007,0x00040020,0x00000028, 38 | 0x00000002,0x00000027,0x0004003b,0x00000028,0x00000029,0x00000002,0x00040020,0x0000002a, 39 | 0x00000002,0x00000007,0x00040020,0x0000002d,0x00000003,0x00000006,0x0004003b,0x0000002d, 40 | 0x0000002e,0x00000003,0x0004002b,0x00000006,0x0000002f,0x00000000,0x00050036,0x00000002, 41 | 0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,0x00000011,0x00000012, 42 | 0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,0x0004003d,0x00000014, 43 | 0x00000017,0x00000016,0x00050051,0x00000006,0x00000019,0x00000017,0x00000000,0x00050051, 44 | 0x00000006,0x0000001a,0x00000017,0x00000001,0x00050051,0x00000006,0x0000001b,0x00000017, 45 | 0x00000002,0x00070050,0x00000007,0x0000001c,0x00000019,0x0000001a,0x0000001b,0x00000018, 46 | 0x00050091,0x00000007,0x0000001d,0x00000013,0x0000001c,0x00050041,0x0000001e,0x0000001f, 47 | 0x0000000a,0x0000000c,0x0003003e,0x0000001f,0x0000001d,0x0004003d,0x00000020,0x00000025, 48 | 0x00000024,0x0003003e,0x00000022,0x00000025,0x00050041,0x0000002a,0x0000002b,0x00000029, 49 | 0x0000000c,0x0004003d,0x00000007,0x0000002c,0x0000002b,0x0003003e,0x00000026,0x0000002c, 50 | 0x0003003e,0x0000002e,0x0000002f,0x000100fd,0x00010038 51 | }; -------------------------------------------------------------------------------- /src/vk/spirv/polygon_warp_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t polygon_warp_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000058,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x000b000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000029, 7 | 0x0000002b,0x00000051,0x00000056,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47, 8 | 0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005, 9 | 0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472, 10 | 0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005, 11 | 0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000, 12 | 0x00060006,0x0000000e,0x00000000,0x614d7076,0x78697274,0x00000000,0x00030005,0x00000010, 13 | 0x00006370,0x00070005,0x00000014,0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365, 14 | 0x00050006,0x00000014,0x00000000,0x65646f6d,0x0000006c,0x00050006,0x00000014,0x00000001, 15 | 0x6f6c6f63,0x00000072,0x00050006,0x00000014,0x00000002,0x656d6974,0x00000000,0x00050006, 16 | 0x00000014,0x00000003,0x6f726373,0x00006c6c,0x00030005,0x00000016,0x006f6275,0x00050005, 17 | 0x0000001d,0x65566e69,0x78657472,0x00000000,0x00050005,0x00000029,0x43786574,0x64726f6f, 18 | 0x00000000,0x00050005,0x0000002b,0x65546e69,0x6f6f4378,0x00006472,0x00040005,0x00000051, 19 | 0x6f6c6f63,0x00000072,0x00050005,0x00000056,0x65725461,0x6c6f6873,0x00000064,0x00050048, 20 | 0x00000008,0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048, 21 | 0x0000000e,0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000, 22 | 0x00050048,0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,0x00000002, 23 | 0x00040048,0x00000014,0x00000000,0x00000005,0x00050048,0x00000014,0x00000000,0x00000023, 24 | 0x00000000,0x00050048,0x00000014,0x00000000,0x00000007,0x00000010,0x00050048,0x00000014, 25 | 0x00000001,0x00000023,0x00000040,0x00050048,0x00000014,0x00000002,0x00000023,0x00000050, 26 | 0x00050048,0x00000014,0x00000003,0x00000023,0x00000054,0x00030047,0x00000014,0x00000002, 27 | 0x00040047,0x00000016,0x00000022,0x00000001,0x00040047,0x00000016,0x00000021,0x00000000, 28 | 0x00040047,0x0000001d,0x0000001e,0x00000000,0x00040047,0x00000029,0x0000001e,0x00000000, 29 | 0x00040047,0x0000002b,0x0000001e,0x00000001,0x00040047,0x00000051,0x0000001e,0x00000001, 30 | 0x00040047,0x00000056,0x0000001e,0x00000002,0x00020013,0x00000002,0x00030021,0x00000003, 31 | 0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004, 32 | 0x0003001e,0x00000008,0x00000007,0x00040020,0x00000009,0x00000003,0x00000008,0x0004003b, 33 | 0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b,0x00000020,0x00000001,0x0004002b, 34 | 0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d,0x00000007,0x00000004,0x0003001e, 35 | 0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009,0x0000000e,0x0004003b,0x0000000f, 36 | 0x00000010,0x00000009,0x00040020,0x00000011,0x00000009,0x0000000d,0x0006001e,0x00000014, 37 | 0x0000000d,0x00000007,0x00000006,0x00000006,0x00040020,0x00000015,0x00000002,0x00000014, 38 | 0x0004003b,0x00000015,0x00000016,0x00000002,0x00040020,0x00000017,0x00000002,0x0000000d, 39 | 0x00040017,0x0000001b,0x00000006,0x00000003,0x00040020,0x0000001c,0x00000001,0x0000001b, 40 | 0x0004003b,0x0000001c,0x0000001d,0x00000001,0x0004002b,0x00000006,0x0000001f,0x3f800000, 41 | 0x00040020,0x00000025,0x00000003,0x00000007,0x00040017,0x00000027,0x00000006,0x00000002, 42 | 0x00040020,0x00000028,0x00000003,0x00000027,0x0004003b,0x00000028,0x00000029,0x00000003, 43 | 0x00040020,0x0000002a,0x00000001,0x00000027,0x0004003b,0x0000002a,0x0000002b,0x00000001, 44 | 0x0004002b,0x00000006,0x0000002d,0x40000000,0x0004002b,0x0000000b,0x0000002e,0x00000002, 45 | 0x00040020,0x0000002f,0x00000002,0x00000006,0x00040015,0x00000033,0x00000020,0x00000000, 46 | 0x0004002b,0x00000033,0x00000034,0x00000001,0x00040020,0x00000035,0x00000001,0x00000006, 47 | 0x0004002b,0x00000006,0x00000038,0x4051eb85,0x0004002b,0x00000033,0x0000003f,0x00000000, 48 | 0x0004002b,0x00000006,0x00000046,0x3d4ccccd,0x0004002b,0x0000000b,0x00000049,0x00000003, 49 | 0x00040020,0x0000004c,0x00000003,0x00000006,0x0004003b,0x00000025,0x00000051,0x00000003, 50 | 0x0004002b,0x0000000b,0x00000052,0x00000001,0x00040020,0x00000053,0x00000002,0x00000007, 51 | 0x0004003b,0x0000004c,0x00000056,0x00000003,0x0004002b,0x00000006,0x00000057,0x00000000, 52 | 0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041, 53 | 0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012, 54 | 0x00050041,0x00000017,0x00000018,0x00000016,0x0000000c,0x0004003d,0x0000000d,0x00000019, 55 | 0x00000018,0x00050092,0x0000000d,0x0000001a,0x00000013,0x00000019,0x0004003d,0x0000001b, 56 | 0x0000001e,0x0000001d,0x00050051,0x00000006,0x00000020,0x0000001e,0x00000000,0x00050051, 57 | 0x00000006,0x00000021,0x0000001e,0x00000001,0x00050051,0x00000006,0x00000022,0x0000001e, 58 | 0x00000002,0x00070050,0x00000007,0x00000023,0x00000020,0x00000021,0x00000022,0x0000001f, 59 | 0x00050091,0x00000007,0x00000024,0x0000001a,0x00000023,0x00050041,0x00000025,0x00000026, 60 | 0x0000000a,0x0000000c,0x0003003e,0x00000026,0x00000024,0x0004003d,0x00000027,0x0000002c, 61 | 0x0000002b,0x00050041,0x0000002f,0x00000030,0x00000016,0x0000002e,0x0004003d,0x00000006, 62 | 0x00000031,0x00000030,0x00050085,0x00000006,0x00000032,0x0000002d,0x00000031,0x00050041, 63 | 0x00000035,0x00000036,0x0000002b,0x00000034,0x0004003d,0x00000006,0x00000037,0x00000036, 64 | 0x00050085,0x00000006,0x00000039,0x00000037,0x00000038,0x00050081,0x00000006,0x0000003a, 65 | 0x00000032,0x00000039,0x0006000c,0x00000006,0x0000003b,0x00000001,0x0000000d,0x0000003a, 66 | 0x00050041,0x0000002f,0x0000003c,0x00000016,0x0000002e,0x0004003d,0x00000006,0x0000003d, 67 | 0x0000003c,0x00050085,0x00000006,0x0000003e,0x0000002d,0x0000003d,0x00050041,0x00000035, 68 | 0x00000040,0x0000002b,0x0000003f,0x0004003d,0x00000006,0x00000041,0x00000040,0x00050085, 69 | 0x00000006,0x00000042,0x00000041,0x00000038,0x00050081,0x00000006,0x00000043,0x0000003e, 70 | 0x00000042,0x0006000c,0x00000006,0x00000044,0x00000001,0x0000000d,0x00000043,0x00050050, 71 | 0x00000027,0x00000045,0x0000003b,0x00000044,0x0005008e,0x00000027,0x00000047,0x00000045, 72 | 0x00000046,0x00050081,0x00000027,0x00000048,0x0000002c,0x00000047,0x0003003e,0x00000029, 73 | 0x00000048,0x00050041,0x0000002f,0x0000004a,0x00000016,0x00000049,0x0004003d,0x00000006, 74 | 0x0000004b,0x0000004a,0x00050041,0x0000004c,0x0000004d,0x00000029,0x0000003f,0x0004003d, 75 | 0x00000006,0x0000004e,0x0000004d,0x00050081,0x00000006,0x0000004f,0x0000004e,0x0000004b, 76 | 0x00050041,0x0000004c,0x00000050,0x00000029,0x0000003f,0x0003003e,0x00000050,0x0000004f, 77 | 0x00050041,0x00000053,0x00000054,0x00000016,0x00000052,0x0004003d,0x00000007,0x00000055, 78 | 0x00000054,0x0003003e,0x00000051,0x00000055,0x0003003e,0x00000056,0x00000057,0x000100fd, 79 | 0x00010038 80 | }; -------------------------------------------------------------------------------- /src/vk/spirv/postprocess_frag.c: -------------------------------------------------------------------------------- 1 | // 1011.0.0 2 | #pragma once 3 | const uint32_t postprocess_frag_spv[] = { 4 | 0x07230203,0x00010000,0x0008000a,0x00000046,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000000b,0x0000002c,0x00030010, 7 | 0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252, 8 | 0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004, 9 | 0x6e69616d,0x00000000,0x00060005,0x00000009,0x6f6e6e75,0x65546d72,0x6f6f4378,0x00006472, 10 | 0x00050005,0x0000000b,0x43786574,0x64726f6f,0x00000000,0x00060005,0x0000000d,0x68737550, 11 | 0x736e6f43,0x746e6174,0x00000000,0x00060006,0x0000000d,0x00000000,0x74736f70,0x636f7270, 12 | 0x00737365,0x00050006,0x0000000d,0x00000001,0x6d6d6167,0x00000061,0x00060006,0x0000000d, 13 | 0x00000002,0x57726373,0x68746469,0x00000000,0x00060006,0x0000000d,0x00000003,0x48726373, 14 | 0x68676965,0x00000074,0x00050006,0x0000000d,0x00000004,0x7366666f,0x00587465,0x00050006, 15 | 0x0000000d,0x00000005,0x7366666f,0x00597465,0x00030005,0x0000000f,0x00006370,0x00060005, 16 | 0x0000002c,0x67617266,0x746e656d,0x6f6c6f43,0x00000072,0x00050005,0x00000030,0x78655473, 17 | 0x65727574,0x00000000,0x00040047,0x0000000b,0x0000001e,0x00000000,0x00050048,0x0000000d, 18 | 0x00000000,0x00000023,0x00000044,0x00050048,0x0000000d,0x00000001,0x00000023,0x00000048, 19 | 0x00050048,0x0000000d,0x00000002,0x00000023,0x0000004c,0x00050048,0x0000000d,0x00000003, 20 | 0x00000023,0x00000050,0x00050048,0x0000000d,0x00000004,0x00000023,0x00000054,0x00050048, 21 | 0x0000000d,0x00000005,0x00000023,0x00000058,0x00030047,0x0000000d,0x00000002,0x00040047, 22 | 0x0000002c,0x0000001e,0x00000000,0x00040047,0x00000030,0x00000022,0x00000000,0x00040047, 23 | 0x00000030,0x00000021,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002, 24 | 0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020, 25 | 0x00000008,0x00000007,0x00000007,0x00040020,0x0000000a,0x00000001,0x00000007,0x0004003b, 26 | 0x0000000a,0x0000000b,0x00000001,0x0008001e,0x0000000d,0x00000006,0x00000006,0x00000006, 27 | 0x00000006,0x00000006,0x00000006,0x00040020,0x0000000e,0x00000009,0x0000000d,0x0004003b, 28 | 0x0000000e,0x0000000f,0x00000009,0x00040015,0x00000010,0x00000020,0x00000001,0x0004002b, 29 | 0x00000010,0x00000011,0x00000002,0x00040020,0x00000012,0x00000009,0x00000006,0x0004002b, 30 | 0x00000010,0x00000015,0x00000003,0x0004002b,0x00000010,0x0000001a,0x00000004,0x0004002b, 31 | 0x00000010,0x0000001d,0x00000005,0x0004002b,0x00000010,0x00000022,0x00000000,0x0004002b, 32 | 0x00000006,0x00000025,0x00000000,0x00020014,0x00000026,0x00040017,0x0000002a,0x00000006, 33 | 0x00000004,0x00040020,0x0000002b,0x00000003,0x0000002a,0x0004003b,0x0000002b,0x0000002c, 34 | 0x00000003,0x00090019,0x0000002d,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000, 35 | 0x00000001,0x00000000,0x0003001b,0x0000002e,0x0000002d,0x00040020,0x0000002f,0x00000000, 36 | 0x0000002e,0x0004003b,0x0000002f,0x00000030,0x00000000,0x00040017,0x00000034,0x00000006, 37 | 0x00000003,0x0004002b,0x00000006,0x00000036,0x3fc00000,0x0004002b,0x00000010,0x00000038, 38 | 0x00000001,0x0004002b,0x00000006,0x0000003d,0x3f800000,0x00050036,0x00000002,0x00000004, 39 | 0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007, 40 | 0x0004003d,0x00000007,0x0000000c,0x0000000b,0x00050041,0x00000012,0x00000013,0x0000000f, 41 | 0x00000011,0x0004003d,0x00000006,0x00000014,0x00000013,0x00050041,0x00000012,0x00000016, 42 | 0x0000000f,0x00000015,0x0004003d,0x00000006,0x00000017,0x00000016,0x00050050,0x00000007, 43 | 0x00000018,0x00000014,0x00000017,0x00050085,0x00000007,0x00000019,0x0000000c,0x00000018, 44 | 0x00050041,0x00000012,0x0000001b,0x0000000f,0x0000001a,0x0004003d,0x00000006,0x0000001c, 45 | 0x0000001b,0x00050041,0x00000012,0x0000001e,0x0000000f,0x0000001d,0x0004003d,0x00000006, 46 | 0x0000001f,0x0000001e,0x00050050,0x00000007,0x00000020,0x0000001c,0x0000001f,0x00050081, 47 | 0x00000007,0x00000021,0x00000019,0x00000020,0x0003003e,0x00000009,0x00000021,0x00050041, 48 | 0x00000012,0x00000023,0x0000000f,0x00000022,0x0004003d,0x00000006,0x00000024,0x00000023, 49 | 0x000500ba,0x00000026,0x00000027,0x00000024,0x00000025,0x000300f7,0x00000029,0x00000000, 50 | 0x000400fa,0x00000027,0x00000028,0x00000042,0x000200f8,0x00000028,0x0004003d,0x0000002e, 51 | 0x00000031,0x00000030,0x0004003d,0x00000007,0x00000032,0x00000009,0x00070058,0x0000002a, 52 | 0x00000033,0x00000031,0x00000032,0x00000002,0x00000025,0x0008004f,0x00000034,0x00000035, 53 | 0x00000033,0x00000033,0x00000000,0x00000001,0x00000002,0x0005008e,0x00000034,0x00000037, 54 | 0x00000035,0x00000036,0x00050041,0x00000012,0x00000039,0x0000000f,0x00000038,0x0004003d, 55 | 0x00000006,0x0000003a,0x00000039,0x00060050,0x00000034,0x0000003b,0x0000003a,0x0000003a, 56 | 0x0000003a,0x0007000c,0x00000034,0x0000003c,0x00000001,0x0000001a,0x00000037,0x0000003b, 57 | 0x00050051,0x00000006,0x0000003e,0x0000003c,0x00000000,0x00050051,0x00000006,0x0000003f, 58 | 0x0000003c,0x00000001,0x00050051,0x00000006,0x00000040,0x0000003c,0x00000002,0x00070050, 59 | 0x0000002a,0x00000041,0x0000003e,0x0000003f,0x00000040,0x0000003d,0x0003003e,0x0000002c, 60 | 0x00000041,0x000200f9,0x00000029,0x000200f8,0x00000042,0x0004003d,0x0000002e,0x00000043, 61 | 0x00000030,0x0004003d,0x00000007,0x00000044,0x00000009,0x00070058,0x0000002a,0x00000045, 62 | 0x00000043,0x00000044,0x00000002,0x00000025,0x0003003e,0x0000002c,0x00000045,0x000200f9, 63 | 0x00000029,0x000200f8,0x00000029,0x000100fd,0x00010038 64 | }; -------------------------------------------------------------------------------- /src/vk/spirv/postprocess_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t postprocess_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000029,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0008000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x00000009,0x0000000c,0x0000001a, 7 | 0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,0x5f657461, 8 | 0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,0x00000000, 9 | 0x00050005,0x00000009,0x43786574,0x64726f6f,0x00000000,0x00060005,0x0000000c,0x565f6c67, 10 | 0x65747265,0x646e4978,0x00007865,0x00060005,0x00000018,0x505f6c67,0x65567265,0x78657472, 11 | 0x00000000,0x00060006,0x00000018,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005, 12 | 0x0000001a,0x00000000,0x00040047,0x00000009,0x0000001e,0x00000000,0x00040047,0x0000000c, 13 | 0x0000000b,0x0000002a,0x00050048,0x00000018,0x00000000,0x0000000b,0x00000000,0x00030047, 14 | 0x00000018,0x00000002,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016, 15 | 0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008, 16 | 0x00000003,0x00000007,0x0004003b,0x00000008,0x00000009,0x00000003,0x00040015,0x0000000a, 17 | 0x00000020,0x00000001,0x00040020,0x0000000b,0x00000001,0x0000000a,0x0004003b,0x0000000b, 18 | 0x0000000c,0x00000001,0x0004002b,0x0000000a,0x0000000e,0x00000001,0x0004002b,0x0000000a, 19 | 0x00000010,0x00000002,0x00040017,0x00000017,0x00000006,0x00000004,0x0003001e,0x00000018, 20 | 0x00000017,0x00040020,0x00000019,0x00000003,0x00000018,0x0004003b,0x00000019,0x0000001a, 21 | 0x00000003,0x0004002b,0x0000000a,0x0000001b,0x00000000,0x0004002b,0x00000006,0x0000001d, 22 | 0x40000000,0x0004002b,0x00000006,0x0000001f,0xbf800000,0x0004002b,0x00000006,0x00000022, 23 | 0x00000000,0x0004002b,0x00000006,0x00000023,0x3f800000,0x00040020,0x00000027,0x00000003, 24 | 0x00000017,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005, 25 | 0x0004003d,0x0000000a,0x0000000d,0x0000000c,0x000500c4,0x0000000a,0x0000000f,0x0000000d, 26 | 0x0000000e,0x000500c7,0x0000000a,0x00000011,0x0000000f,0x00000010,0x0004006f,0x00000006, 27 | 0x00000012,0x00000011,0x0004003d,0x0000000a,0x00000013,0x0000000c,0x000500c7,0x0000000a, 28 | 0x00000014,0x00000013,0x00000010,0x0004006f,0x00000006,0x00000015,0x00000014,0x00050050, 29 | 0x00000007,0x00000016,0x00000012,0x00000015,0x0003003e,0x00000009,0x00000016,0x0004003d, 30 | 0x00000007,0x0000001c,0x00000009,0x0005008e,0x00000007,0x0000001e,0x0000001c,0x0000001d, 31 | 0x00050050,0x00000007,0x00000020,0x0000001f,0x0000001f,0x00050081,0x00000007,0x00000021, 32 | 0x0000001e,0x00000020,0x00050051,0x00000006,0x00000024,0x00000021,0x00000000,0x00050051, 33 | 0x00000006,0x00000025,0x00000021,0x00000001,0x00070050,0x00000017,0x00000026,0x00000024, 34 | 0x00000025,0x00000022,0x00000023,0x00050041,0x00000027,0x00000028,0x0000001a,0x0000001b, 35 | 0x0003003e,0x00000028,0x00000026,0x000100fd,0x00010038 36 | }; -------------------------------------------------------------------------------- /src/vk/spirv/shadows_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t shadows_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x0000002b,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0008000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000027, 7 | 0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,0x5f657461, 8 | 0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,0x00000000, 9 | 0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472,0x00000000,0x00060006,0x00000008, 10 | 0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005,0x0000000a,0x00000000,0x00060005, 11 | 0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000,0x00060006,0x0000000e,0x00000000, 12 | 0x614d7076,0x78697274,0x00000000,0x00030005,0x00000010,0x00006370,0x00070005,0x00000014, 13 | 0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365,0x00050006,0x00000014,0x00000000, 14 | 0x65646f6d,0x0000006c,0x00030005,0x00000016,0x006f6275,0x00050005,0x0000001d,0x65566e69, 15 | 0x78657472,0x00000000,0x00040005,0x00000027,0x6f6c6f63,0x00000072,0x00050048,0x00000008, 16 | 0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e, 17 | 0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048, 18 | 0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e,0x00000002,0x00040048, 19 | 0x00000014,0x00000000,0x00000005,0x00050048,0x00000014,0x00000000,0x00000023,0x00000000, 20 | 0x00050048,0x00000014,0x00000000,0x00000007,0x00000010,0x00030047,0x00000014,0x00000002, 21 | 0x00040047,0x00000016,0x00000022,0x00000000,0x00040047,0x00000016,0x00000021,0x00000000, 22 | 0x00040047,0x0000001d,0x0000001e,0x00000000,0x00040047,0x00000027,0x0000001e,0x00000000, 23 | 0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020, 24 | 0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020, 25 | 0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015, 26 | 0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018, 27 | 0x0000000d,0x00000007,0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f, 28 | 0x00000009,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020,0x00000011, 29 | 0x00000009,0x0000000d,0x0003001e,0x00000014,0x0000000d,0x00040020,0x00000015,0x00000002, 30 | 0x00000014,0x0004003b,0x00000015,0x00000016,0x00000002,0x00040020,0x00000017,0x00000002, 31 | 0x0000000d,0x00040017,0x0000001b,0x00000006,0x00000003,0x00040020,0x0000001c,0x00000001, 32 | 0x0000001b,0x0004003b,0x0000001c,0x0000001d,0x00000001,0x0004002b,0x00000006,0x0000001f, 33 | 0x3f800000,0x00040020,0x00000025,0x00000003,0x00000007,0x0004003b,0x00000025,0x00000027, 34 | 0x00000003,0x0004002b,0x00000006,0x00000028,0x00000000,0x0004002b,0x00000006,0x00000029, 35 | 0x3f000000,0x0007002c,0x00000007,0x0000002a,0x00000028,0x00000028,0x00000028,0x00000029, 36 | 0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041, 37 | 0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012, 38 | 0x00050041,0x00000017,0x00000018,0x00000016,0x0000000c,0x0004003d,0x0000000d,0x00000019, 39 | 0x00000018,0x00050092,0x0000000d,0x0000001a,0x00000013,0x00000019,0x0004003d,0x0000001b, 40 | 0x0000001e,0x0000001d,0x00050051,0x00000006,0x00000020,0x0000001e,0x00000000,0x00050051, 41 | 0x00000006,0x00000021,0x0000001e,0x00000001,0x00050051,0x00000006,0x00000022,0x0000001e, 42 | 0x00000002,0x00070050,0x00000007,0x00000023,0x00000020,0x00000021,0x00000022,0x0000001f, 43 | 0x00050091,0x00000007,0x00000024,0x0000001a,0x00000023,0x00050041,0x00000025,0x00000026, 44 | 0x0000000a,0x0000000c,0x0003003e,0x00000026,0x00000024,0x0003003e,0x00000027,0x0000002a, 45 | 0x000100fd,0x00010038 46 | }; -------------------------------------------------------------------------------- /src/vk/spirv/skybox_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t skybox_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000032,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x000b000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x0000001d,0x00000029, 7 | 0x0000002b,0x0000002d,0x00000030,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47, 8 | 0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005, 9 | 0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472, 10 | 0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005, 11 | 0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000, 12 | 0x00060006,0x0000000e,0x00000000,0x614d7076,0x78697274,0x00000000,0x00030005,0x00000010, 13 | 0x00006370,0x00070005,0x00000014,0x66696e55,0x426d726f,0x65666675,0x6a624f72,0x00746365, 14 | 0x00050006,0x00000014,0x00000000,0x65646f6d,0x0000006c,0x00030005,0x00000016,0x006f6275, 15 | 0x00050005,0x0000001d,0x65566e69,0x78657472,0x00000000,0x00050005,0x00000029,0x43786574, 16 | 0x64726f6f,0x00000000,0x00050005,0x0000002b,0x65546e69,0x6f6f4378,0x00006472,0x00040005, 17 | 0x0000002d,0x6f6c6f63,0x00000072,0x00050005,0x00000030,0x65725461,0x6c6f6873,0x00000064, 18 | 0x00050048,0x00000008,0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002, 19 | 0x00040048,0x0000000e,0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023, 20 | 0x00000000,0x00050048,0x0000000e,0x00000000,0x00000007,0x00000010,0x00030047,0x0000000e, 21 | 0x00000002,0x00040048,0x00000014,0x00000000,0x00000005,0x00050048,0x00000014,0x00000000, 22 | 0x00000023,0x00000000,0x00050048,0x00000014,0x00000000,0x00000007,0x00000010,0x00030047, 23 | 0x00000014,0x00000002,0x00040047,0x00000016,0x00000022,0x00000001,0x00040047,0x00000016, 24 | 0x00000021,0x00000000,0x00040047,0x0000001d,0x0000001e,0x00000000,0x00040047,0x00000029, 25 | 0x0000001e,0x00000000,0x00040047,0x0000002b,0x0000001e,0x00000001,0x00040047,0x0000002d, 26 | 0x0000001e,0x00000001,0x00040047,0x00000030,0x0000001e,0x00000002,0x00020013,0x00000002, 27 | 0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007, 28 | 0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020,0x00000009,0x00000003, 29 | 0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015,0x0000000b,0x00000020, 30 | 0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018,0x0000000d,0x00000007, 31 | 0x00000004,0x0003001e,0x0000000e,0x0000000d,0x00040020,0x0000000f,0x00000009,0x0000000e, 32 | 0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020,0x00000011,0x00000009,0x0000000d, 33 | 0x0003001e,0x00000014,0x0000000d,0x00040020,0x00000015,0x00000002,0x00000014,0x0004003b, 34 | 0x00000015,0x00000016,0x00000002,0x00040020,0x00000017,0x00000002,0x0000000d,0x00040017, 35 | 0x0000001b,0x00000006,0x00000003,0x00040020,0x0000001c,0x00000001,0x0000001b,0x0004003b, 36 | 0x0000001c,0x0000001d,0x00000001,0x0004002b,0x00000006,0x0000001f,0x3f800000,0x00040020, 37 | 0x00000025,0x00000003,0x00000007,0x00040017,0x00000027,0x00000006,0x00000002,0x00040020, 38 | 0x00000028,0x00000003,0x00000027,0x0004003b,0x00000028,0x00000029,0x00000003,0x00040020, 39 | 0x0000002a,0x00000001,0x00000027,0x0004003b,0x0000002a,0x0000002b,0x00000001,0x0004003b, 40 | 0x00000025,0x0000002d,0x00000003,0x0007002c,0x00000007,0x0000002e,0x0000001f,0x0000001f, 41 | 0x0000001f,0x0000001f,0x00040020,0x0000002f,0x00000003,0x00000006,0x0004003b,0x0000002f, 42 | 0x00000030,0x00000003,0x0004002b,0x00000006,0x00000031,0x00000000,0x00050036,0x00000002, 43 | 0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x00050041,0x00000011,0x00000012, 44 | 0x00000010,0x0000000c,0x0004003d,0x0000000d,0x00000013,0x00000012,0x00050041,0x00000017, 45 | 0x00000018,0x00000016,0x0000000c,0x0004003d,0x0000000d,0x00000019,0x00000018,0x00050092, 46 | 0x0000000d,0x0000001a,0x00000013,0x00000019,0x0004003d,0x0000001b,0x0000001e,0x0000001d, 47 | 0x00050051,0x00000006,0x00000020,0x0000001e,0x00000000,0x00050051,0x00000006,0x00000021, 48 | 0x0000001e,0x00000001,0x00050051,0x00000006,0x00000022,0x0000001e,0x00000002,0x00070050, 49 | 0x00000007,0x00000023,0x00000020,0x00000021,0x00000022,0x0000001f,0x00050091,0x00000007, 50 | 0x00000024,0x0000001a,0x00000023,0x00050041,0x00000025,0x00000026,0x0000000a,0x0000000c, 51 | 0x0003003e,0x00000026,0x00000024,0x0004003d,0x00000027,0x0000002c,0x0000002b,0x0003003e, 52 | 0x00000029,0x0000002c,0x0003003e,0x0000002d,0x0000002e,0x0003003e,0x00000030,0x00000031, 53 | 0x000100fd,0x00010038 54 | }; -------------------------------------------------------------------------------- /src/vk/spirv/sprite_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t sprite_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x0000002f,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x000b000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000000a,0x00000016,0x00000022, 7 | 0x00000024,0x00000026,0x0000002d,0x00030003,0x00000002,0x000001c2,0x00090004,0x415f4c47, 8 | 0x735f4252,0x72617065,0x5f657461,0x64616873,0x6f5f7265,0x63656a62,0x00007374,0x00040005, 9 | 0x00000004,0x6e69616d,0x00000000,0x00060005,0x00000008,0x505f6c67,0x65567265,0x78657472, 10 | 0x00000000,0x00060006,0x00000008,0x00000000,0x505f6c67,0x7469736f,0x006e6f69,0x00030005, 11 | 0x0000000a,0x00000000,0x00060005,0x0000000e,0x68737550,0x736e6f43,0x746e6174,0x00000000, 12 | 0x00060006,0x0000000e,0x00000000,0x4d70766d,0x69727461,0x00000078,0x00050006,0x0000000e, 13 | 0x00000001,0x68706c61,0x00000061,0x00030005,0x00000010,0x00006370,0x00050005,0x00000016, 14 | 0x65566e69,0x78657472,0x00000000,0x00050005,0x00000022,0x43786574,0x64726f6f,0x00000000, 15 | 0x00050005,0x00000024,0x65546e69,0x6f6f4378,0x00006472,0x00040005,0x00000026,0x6f6c6f63, 16 | 0x00000072,0x00050005,0x0000002d,0x65725461,0x6c6f6873,0x00000064,0x00050048,0x00000008, 17 | 0x00000000,0x0000000b,0x00000000,0x00030047,0x00000008,0x00000002,0x00040048,0x0000000e, 18 | 0x00000000,0x00000005,0x00050048,0x0000000e,0x00000000,0x00000023,0x00000000,0x00050048, 19 | 0x0000000e,0x00000000,0x00000007,0x00000010,0x00050048,0x0000000e,0x00000001,0x00000023, 20 | 0x00000040,0x00030047,0x0000000e,0x00000002,0x00040047,0x00000016,0x0000001e,0x00000000, 21 | 0x00040047,0x00000022,0x0000001e,0x00000000,0x00040047,0x00000024,0x0000001e,0x00000001, 22 | 0x00040047,0x00000026,0x0000001e,0x00000001,0x00040047,0x0000002d,0x0000001e,0x00000002, 23 | 0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020, 24 | 0x00040017,0x00000007,0x00000006,0x00000004,0x0003001e,0x00000008,0x00000007,0x00040020, 25 | 0x00000009,0x00000003,0x00000008,0x0004003b,0x00000009,0x0000000a,0x00000003,0x00040015, 26 | 0x0000000b,0x00000020,0x00000001,0x0004002b,0x0000000b,0x0000000c,0x00000000,0x00040018, 27 | 0x0000000d,0x00000007,0x00000004,0x0004001e,0x0000000e,0x0000000d,0x00000006,0x00040020, 28 | 0x0000000f,0x00000009,0x0000000e,0x0004003b,0x0000000f,0x00000010,0x00000009,0x00040020, 29 | 0x00000011,0x00000009,0x0000000d,0x00040017,0x00000014,0x00000006,0x00000003,0x00040020, 30 | 0x00000015,0x00000001,0x00000014,0x0004003b,0x00000015,0x00000016,0x00000001,0x0004002b, 31 | 0x00000006,0x00000018,0x3f800000,0x00040020,0x0000001e,0x00000003,0x00000007,0x00040017, 32 | 0x00000020,0x00000006,0x00000002,0x00040020,0x00000021,0x00000003,0x00000020,0x0004003b, 33 | 0x00000021,0x00000022,0x00000003,0x00040020,0x00000023,0x00000001,0x00000020,0x0004003b, 34 | 0x00000023,0x00000024,0x00000001,0x0004003b,0x0000001e,0x00000026,0x00000003,0x0004002b, 35 | 0x0000000b,0x00000027,0x00000001,0x00040020,0x00000028,0x00000009,0x00000006,0x00040020, 36 | 0x0000002c,0x00000003,0x00000006,0x0004003b,0x0000002c,0x0000002d,0x00000003,0x0004002b, 37 | 0x00000006,0x0000002e,0x3d886595,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003, 38 | 0x000200f8,0x00000005,0x00050041,0x00000011,0x00000012,0x00000010,0x0000000c,0x0004003d, 39 | 0x0000000d,0x00000013,0x00000012,0x0004003d,0x00000014,0x00000017,0x00000016,0x00050051, 40 | 0x00000006,0x00000019,0x00000017,0x00000000,0x00050051,0x00000006,0x0000001a,0x00000017, 41 | 0x00000001,0x00050051,0x00000006,0x0000001b,0x00000017,0x00000002,0x00070050,0x00000007, 42 | 0x0000001c,0x00000019,0x0000001a,0x0000001b,0x00000018,0x00050091,0x00000007,0x0000001d, 43 | 0x00000013,0x0000001c,0x00050041,0x0000001e,0x0000001f,0x0000000a,0x0000000c,0x0003003e, 44 | 0x0000001f,0x0000001d,0x0004003d,0x00000020,0x00000025,0x00000024,0x0003003e,0x00000022, 45 | 0x00000025,0x00050041,0x00000028,0x00000029,0x00000010,0x00000027,0x0004003d,0x00000006, 46 | 0x0000002a,0x00000029,0x00070050,0x00000007,0x0000002b,0x00000018,0x00000018,0x00000018, 47 | 0x0000002a,0x0003003e,0x00000026,0x0000002b,0x0003003e,0x0000002d,0x0000002e,0x000100fd, 48 | 0x00010038 49 | }; -------------------------------------------------------------------------------- /src/vk/spirv/world_warp_vert.c: -------------------------------------------------------------------------------- 1 | // 8.13.3559 2 | #pragma once 3 | const uint32_t world_warp_vert_spv[] = { 4 | 0x07230203,0x00010000,0x00080008,0x00000024,0x00000000,0x00020011,0x00000001,0x0006000b, 5 | 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 6 | 0x0007000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x00000017,0x0000001b,0x00030003, 7 | 0x00000002,0x000001c2,0x00090004,0x415f4c47,0x735f4252,0x72617065,0x5f657461,0x64616873, 8 | 0x6f5f7265,0x63656a62,0x00007374,0x00040005,0x00000004,0x6e69616d,0x00000000,0x00050005, 9 | 0x0000000c,0x69736f70,0x6e6f6974,0x00000073,0x00060005,0x00000015,0x505f6c67,0x65567265, 10 | 0x78657472,0x00000000,0x00060006,0x00000015,0x00000000,0x505f6c67,0x7469736f,0x006e6f69, 11 | 0x00030005,0x00000017,0x00000000,0x00060005,0x0000001b,0x565f6c67,0x65747265,0x646e4978, 12 | 0x00007865,0x00050048,0x00000015,0x00000000,0x0000000b,0x00000000,0x00030047,0x00000015, 13 | 0x00000002,0x00040047,0x0000001b,0x0000000b,0x0000002a,0x00020013,0x00000002,0x00030021, 14 | 0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006, 15 | 0x00000004,0x00040015,0x00000008,0x00000020,0x00000000,0x0004002b,0x00000008,0x00000009, 16 | 0x00000003,0x0004001c,0x0000000a,0x00000007,0x00000009,0x00040020,0x0000000b,0x00000007, 17 | 0x0000000a,0x0004002b,0x00000006,0x0000000d,0xbf800000,0x0004002b,0x00000006,0x0000000e, 18 | 0x00000000,0x0004002b,0x00000006,0x0000000f,0x3f800000,0x0007002c,0x00000007,0x00000010, 19 | 0x0000000d,0x0000000d,0x0000000e,0x0000000f,0x0004002b,0x00000006,0x00000011,0x40400000, 20 | 0x0007002c,0x00000007,0x00000012,0x00000011,0x0000000d,0x0000000e,0x0000000f,0x0007002c, 21 | 0x00000007,0x00000013,0x0000000d,0x00000011,0x0000000e,0x0000000f,0x0006002c,0x0000000a, 22 | 0x00000014,0x00000010,0x00000012,0x00000013,0x0003001e,0x00000015,0x00000007,0x00040020, 23 | 0x00000016,0x00000003,0x00000015,0x0004003b,0x00000016,0x00000017,0x00000003,0x00040015, 24 | 0x00000018,0x00000020,0x00000001,0x0004002b,0x00000018,0x00000019,0x00000000,0x00040020, 25 | 0x0000001a,0x00000001,0x00000018,0x0004003b,0x0000001a,0x0000001b,0x00000001,0x0004002b, 26 | 0x00000018,0x0000001d,0x00000003,0x00040020,0x0000001f,0x00000007,0x00000007,0x00040020, 27 | 0x00000022,0x00000003,0x00000007,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003, 28 | 0x000200f8,0x00000005,0x0004003b,0x0000000b,0x0000000c,0x00000007,0x0003003e,0x0000000c, 29 | 0x00000014,0x0004003d,0x00000018,0x0000001c,0x0000001b,0x0005008b,0x00000018,0x0000001e, 30 | 0x0000001c,0x0000001d,0x00050041,0x0000001f,0x00000020,0x0000000c,0x0000001e,0x0004003d, 31 | 0x00000007,0x00000021,0x00000020,0x00050041,0x00000022,0x00000023,0x00000017,0x00000019, 32 | 0x0003003e,0x00000023,0x00000021,0x000100fd,0x00010038 33 | }; -------------------------------------------------------------------------------- /src/vk/vk_buffer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2019 Krzysztof Kondrak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | */ 21 | 22 | #include "header/local.h" 23 | 24 | // internal helper 25 | static void 26 | copyBuffer(const VkBuffer * src, VkBuffer * dst, VkDeviceSize size) 27 | { 28 | VkCommandBuffer commandBuffer = QVk_CreateCommandBuffer(&vk_transferCommandPool, 29 | VK_COMMAND_BUFFER_LEVEL_PRIMARY); 30 | QVk_BeginCommand(&commandBuffer); 31 | 32 | VkBufferCopy copyRegion = { 33 | .srcOffset = 0, 34 | .dstOffset = 0, 35 | .size = size 36 | }; 37 | vkCmdCopyBuffer(commandBuffer, *src, *dst, 1, ©Region); 38 | 39 | QVk_SubmitCommand(&commandBuffer, &vk_device.transferQueue); 40 | vkFreeCommandBuffers(vk_device.logical, vk_transferCommandPool, 1, 41 | &commandBuffer); 42 | } 43 | 44 | // internal helper 45 | static void 46 | createStagedBuffer(const void *data, VkDeviceSize size, qvkbuffer_t * dstBuffer, 47 | qvkbufferopts_t bufferOpts) 48 | { 49 | qvkstagingbuffer_t *stgBuffer; 50 | stgBuffer = (qvkstagingbuffer_t *) malloc(sizeof(qvkstagingbuffer_t)); 51 | VK_VERIFY(QVk_CreateStagingBuffer(size, stgBuffer, 52 | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | 53 | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 54 | VK_MEMORY_PROPERTY_HOST_CACHED_BIT)); 55 | 56 | if (data) 57 | { 58 | void *dst; 59 | // staging buffers in vkQuake2 are required to be host coherent, 60 | // so no flushing/invalidation is involved 61 | dst = buffer_map(&stgBuffer->resource); 62 | memcpy(dst, data, (size_t) size); 63 | buffer_unmap(&stgBuffer->resource); 64 | } 65 | 66 | VK_VERIFY(QVk_CreateBuffer(size, dstBuffer, bufferOpts)); 67 | copyBuffer(&stgBuffer->resource.buffer, &dstBuffer->resource.buffer, size); 68 | 69 | QVk_FreeStagingBuffer(stgBuffer); 70 | free(stgBuffer); 71 | } 72 | 73 | VkResult 74 | QVk_CreateBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, 75 | const qvkbufferopts_t options) 76 | { 77 | VkBufferCreateInfo bcInfo = { 78 | .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, 79 | .pNext = NULL, 80 | .flags = 0, 81 | .size = size, 82 | .usage = options.usage, 83 | .sharingMode = VK_SHARING_MODE_EXCLUSIVE, 84 | .queueFamilyIndexCount = 0, 85 | .pQueueFamilyIndices = NULL, 86 | }; 87 | 88 | // separate transfer queue makes sense only if the buffer is targetted 89 | // for being transfered to GPU, so ignore it if it's CPU-only 90 | uint32_t queueFamilies[] = { 91 | (uint32_t)vk_device.gfxFamilyIndex, 92 | (uint32_t)vk_device.transferFamilyIndex 93 | }; 94 | 95 | if (vk_device.gfxFamilyIndex != vk_device.transferFamilyIndex) 96 | { 97 | bcInfo.sharingMode = VK_SHARING_MODE_CONCURRENT; 98 | bcInfo.queueFamilyIndexCount = 2; 99 | bcInfo.pQueueFamilyIndices = queueFamilies; 100 | } 101 | 102 | dstBuffer->currentOffset = 0; 103 | return buffer_create(&dstBuffer->resource, bcInfo, 104 | options.reqMemFlags, options.prefMemFlags, 105 | /*skip memory*/ 0); 106 | } 107 | 108 | void 109 | QVk_FreeBuffer(qvkbuffer_t *buffer) 110 | { 111 | buffer_destroy(&buffer->resource); 112 | buffer->currentOffset = 0; 113 | } 114 | 115 | void 116 | QVk_FreeStagingBuffer(qvkstagingbuffer_t *buffer) 117 | { 118 | buffer_destroy(&buffer->resource); 119 | buffer->currentOffset = 0; 120 | } 121 | 122 | VkResult 123 | QVk_CreateStagingBuffer(VkDeviceSize size, qvkstagingbuffer_t *dstBuffer, 124 | VkMemoryPropertyFlags reqMemFlags, 125 | VkMemoryPropertyFlags prefMemFlags) 126 | { 127 | VkBufferCreateInfo bcInfo = { 128 | .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, 129 | .pNext = NULL, 130 | .flags = 0, 131 | .size = ROUNDUP(size, 1024), 132 | .usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT, 133 | .sharingMode = VK_SHARING_MODE_EXCLUSIVE, 134 | .queueFamilyIndexCount = 0, 135 | .pQueueFamilyIndices = NULL, 136 | }; 137 | 138 | reqMemFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; 139 | 140 | dstBuffer->currentOffset = 0; 141 | return buffer_create(&dstBuffer->resource, bcInfo, reqMemFlags, 142 | prefMemFlags, /*skip memory*/ 0); 143 | } 144 | 145 | VkResult 146 | QVk_CreateUniformBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, 147 | VkMemoryPropertyFlags reqMemFlags, 148 | VkMemoryPropertyFlags prefMemFlags) 149 | { 150 | qvkbufferopts_t dstOpts = { 151 | .usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 152 | .reqMemFlags = reqMemFlags, 153 | .prefMemFlags = prefMemFlags, 154 | }; 155 | 156 | dstOpts.reqMemFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; 157 | 158 | if((vk_device.properties.deviceType != VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) || 159 | (dstOpts.prefMemFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0) 160 | { 161 | dstOpts.prefMemFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; 162 | } 163 | 164 | return QVk_CreateBuffer(size, dstBuffer, dstOpts); 165 | } 166 | 167 | void 168 | QVk_CreateVertexBuffer(const void *data, VkDeviceSize size, 169 | qvkbuffer_t *dstBuffer, 170 | VkMemoryPropertyFlags reqMemFlags, 171 | VkMemoryPropertyFlags prefMemFlags) 172 | { 173 | qvkbufferopts_t dstOpts = { 174 | .usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT | 175 | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, 176 | .reqMemFlags = reqMemFlags, 177 | .prefMemFlags = prefMemFlags, 178 | }; 179 | 180 | if((vk_device.properties.deviceType != VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) || 181 | (dstOpts.prefMemFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0) 182 | { 183 | dstOpts.prefMemFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; 184 | } 185 | 186 | createStagedBuffer(data, size, dstBuffer, dstOpts); 187 | } 188 | 189 | void 190 | QVk_CreateIndexBuffer(const void *data, VkDeviceSize size, 191 | qvkbuffer_t *dstBuffer, 192 | VkMemoryPropertyFlags reqMemFlags, 193 | VkMemoryPropertyFlags prefMemFlags) 194 | { 195 | qvkbufferopts_t dstOpts = { 196 | .usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT, 197 | .reqMemFlags = reqMemFlags, 198 | .prefMemFlags = prefMemFlags, 199 | }; 200 | 201 | if((vk_device.properties.deviceType != VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) || 202 | (dstOpts.prefMemFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0) 203 | { 204 | dstOpts.prefMemFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; 205 | } 206 | 207 | createStagedBuffer(data, size, dstBuffer, dstOpts); 208 | } 209 | -------------------------------------------------------------------------------- /src/vk/vk_cmd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2019 Krzysztof Kondrak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | */ 21 | 22 | #include "header/local.h" 23 | 24 | VkResult QVk_BeginCommand(const VkCommandBuffer *commandBuffer) 25 | { 26 | VkCommandBufferBeginInfo cmdInfo = { 27 | .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, 28 | .pNext = NULL, 29 | .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, 30 | .pInheritanceInfo = NULL 31 | }; 32 | 33 | return vkBeginCommandBuffer(*commandBuffer, &cmdInfo); 34 | } 35 | 36 | void QVk_SubmitCommand(const VkCommandBuffer *commandBuffer, const VkQueue *queue) 37 | { 38 | VK_VERIFY(vkEndCommandBuffer(*commandBuffer)); 39 | 40 | VkSubmitInfo submitInfo = { 41 | .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, 42 | .pNext = NULL, 43 | .waitSemaphoreCount = 0, 44 | .pWaitSemaphores = NULL, 45 | .pWaitDstStageMask = NULL, 46 | .commandBufferCount = 1, 47 | .pCommandBuffers = commandBuffer, 48 | .signalSemaphoreCount = 0, 49 | .pSignalSemaphores = NULL 50 | }; 51 | 52 | VkFenceCreateInfo fCreateInfo = { 53 | .sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, 54 | .pNext = NULL, 55 | .flags = 0 56 | }; 57 | 58 | VkFence queueFence; 59 | VK_VERIFY(vkCreateFence(vk_device.logical, &fCreateInfo, NULL, &queueFence)); 60 | VK_VERIFY(vkQueueSubmit(*queue, 1, &submitInfo, queueFence)); 61 | VK_VERIFY(vkWaitForFences(vk_device.logical, 1, &queueFence, VK_TRUE, UINT64_MAX)); 62 | 63 | vkDestroyFence(vk_device.logical, queueFence, NULL); 64 | } 65 | 66 | VkResult QVk_CreateCommandPool(VkCommandPool *commandPool, uint32_t queueFamilyIndex) 67 | { 68 | VkCommandPoolCreateInfo cpCreateInfo = { 69 | .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, 70 | .pNext = NULL, 71 | // allow the command pool to be explicitly reset without reallocating it manually during recording each frame 72 | .flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, 73 | .queueFamilyIndex = queueFamilyIndex 74 | }; 75 | 76 | return vkCreateCommandPool(vk_device.logical, &cpCreateInfo, NULL, commandPool); 77 | } 78 | 79 | VkCommandBuffer QVk_CreateCommandBuffer(const VkCommandPool *commandPool, VkCommandBufferLevel level) 80 | { 81 | VkCommandBuffer commandBuffer = VK_NULL_HANDLE; 82 | VkCommandBufferAllocateInfo allocInfo = { 83 | .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, 84 | .pNext = NULL, 85 | .commandPool = *commandPool, 86 | .level = level, 87 | .commandBufferCount = 1 88 | }; 89 | 90 | VK_VERIFY(vkAllocateCommandBuffers(vk_device.logical, &allocInfo, &commandBuffer)); 91 | return commandBuffer; 92 | } 93 | -------------------------------------------------------------------------------- /src/vk/vk_pipeline.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2019 Krzysztof Kondrak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | */ 21 | 22 | #include "header/local.h" 23 | 24 | qvkshader_t QVk_CreateShader(const uint32_t *shaderSrc, size_t shaderCodeSize, VkShaderStageFlagBits shaderStage) 25 | { 26 | qvkshader_t shader; 27 | VkShaderModuleCreateInfo smCreateInfo = { 28 | .sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, 29 | .pNext = NULL, 30 | .flags = 0, 31 | .codeSize = shaderCodeSize, 32 | .pCode = shaderSrc 33 | }; 34 | 35 | VK_VERIFY(vkCreateShaderModule(vk_device.logical, &smCreateInfo, NULL, &shader.module)); 36 | 37 | VkPipelineShaderStageCreateInfo vssCreateInfo = { 38 | .sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, 39 | .pNext = NULL, 40 | .flags = 0, 41 | .stage = shaderStage, 42 | .module = shader.module, 43 | .pName = "main", 44 | .pSpecializationInfo = NULL 45 | }; 46 | 47 | shader.createInfo = vssCreateInfo; 48 | 49 | return shader; 50 | } 51 | 52 | void QVk_CreatePipeline(const VkDescriptorSetLayout *descriptorLayout, 53 | const uint32_t descLayoutCount, const VkPipelineVertexInputStateCreateInfo *vertexInputInfo, 54 | qvkpipeline_t *pipeline, const qvkrenderpass_t *renderpass, 55 | const qvkshader_t *shaders, uint32_t shaderCount) 56 | { 57 | VkPipelineShaderStageCreateInfo *ssCreateInfos = (VkPipelineShaderStageCreateInfo *)malloc(shaderCount * sizeof(VkPipelineShaderStageCreateInfo)); 58 | for (int i = 0; i < shaderCount; i++) 59 | { 60 | ssCreateInfos[i] = shaders[i].createInfo; 61 | } 62 | 63 | VkPipelineInputAssemblyStateCreateInfo iaCreateInfo = { 64 | .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, 65 | .pNext = NULL, 66 | .flags = 0, 67 | .topology = pipeline->topology, 68 | .primitiveRestartEnable = VK_FALSE 69 | }; 70 | 71 | VkViewport viewport = { 72 | .x = 0.f, 73 | .y = 0.f, 74 | .width = (float)vid.width, 75 | .height = (float)vid.height, 76 | .minDepth = 0.f, 77 | .maxDepth = 1.f, 78 | }; 79 | 80 | VkRect2D scissor = { 81 | .offset.x = 0, 82 | .offset.y = 0, 83 | .extent = vk_swapchain.extent 84 | }; 85 | 86 | VkPipelineViewportStateCreateInfo vpCreateInfo = { 87 | .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, 88 | .pNext = NULL, 89 | .flags = 0, 90 | .viewportCount = 1, 91 | .pViewports = &viewport, 92 | .scissorCount = 1, 93 | .pScissors = &scissor 94 | }; 95 | 96 | VkPipelineRasterizationStateCreateInfo rCreateInfo = { 97 | .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, 98 | .pNext = NULL, 99 | .flags = 0, 100 | .depthClampEnable = VK_FALSE, 101 | .rasterizerDiscardEnable = VK_FALSE, 102 | .polygonMode = VK_POLYGON_MODE_FILL, 103 | .cullMode = pipeline->cullMode, 104 | .frontFace = VK_FRONT_FACE_CLOCKWISE, 105 | .depthBiasEnable = VK_FALSE, 106 | .depthBiasConstantFactor = 0.f, 107 | .depthBiasClamp = 0.f, 108 | .depthBiasSlopeFactor = 0.f, 109 | .lineWidth = 1.f 110 | }; 111 | 112 | VkPipelineMultisampleStateCreateInfo msCreateInfo = { 113 | .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, 114 | .pNext = NULL, 115 | .flags = 0, 116 | .rasterizationSamples = renderpass->sampleCount, 117 | .sampleShadingEnable = (vk_sampleshading->value > 0 && vk_device.features.sampleRateShading) ? VK_TRUE : VK_FALSE, 118 | .minSampleShading = (vk_sampleshading->value > 0 && vk_device.features.sampleRateShading) ? 1.f : 0.f, 119 | .pSampleMask = NULL, 120 | .alphaToCoverageEnable = VK_FALSE, 121 | .alphaToOneEnable = VK_FALSE 122 | }; 123 | 124 | VkPipelineDepthStencilStateCreateInfo dCreateInfo = { 125 | .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, 126 | .pNext = NULL, 127 | .flags = 0, 128 | .depthTestEnable = pipeline->depthTestEnable, 129 | .depthWriteEnable = pipeline->depthTestEnable == VK_TRUE ? pipeline->depthWriteEnable : VK_FALSE, // there should be NO depth writes if depthTestEnable is false but Intel seems to not follow the specs fully... 130 | .depthCompareOp = VK_COMPARE_OP_LESS, 131 | .depthBoundsTestEnable = VK_FALSE, 132 | .stencilTestEnable = VK_FALSE, 133 | .front = { VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_COMPARE_OP_NEVER, 0, 0, 0 }, 134 | .back = { VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP, VK_COMPARE_OP_NEVER, 0, 0, 0 }, 135 | .minDepthBounds = 0.f, 136 | .maxDepthBounds = 1.f 137 | }; 138 | 139 | VkPipelineColorBlendStateCreateInfo cbsCreateInfo = { 140 | .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, 141 | .pNext = NULL, 142 | .flags = 0, 143 | .logicOpEnable = VK_FALSE, 144 | .logicOp = VK_LOGIC_OP_COPY, 145 | .attachmentCount = 1, 146 | .pAttachments = &pipeline->blendOpts, 147 | .blendConstants[0] = 0.f, 148 | .blendConstants[1] = 0.f, 149 | .blendConstants[2] = 0.f, 150 | .blendConstants[3] = 0.f 151 | }; 152 | 153 | VkDynamicState dynamicStates[] = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR }; 154 | VkPipelineDynamicStateCreateInfo dsCreateInfo = { 155 | .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, 156 | .pNext = NULL, 157 | .flags = 0, 158 | .dynamicStateCount = 2, 159 | .pDynamicStates = dynamicStates 160 | }; 161 | 162 | // push constant sizes accomodate for maximum number of uploaded elements (should probably be checked against the hardware's maximum supported value) 163 | VkPushConstantRange pushConstantRange[] = { 164 | { 165 | .stageFlags = VK_SHADER_STAGE_VERTEX_BIT, 166 | .offset = 0, 167 | .size = 17 * sizeof(float) 168 | }, 169 | { 170 | .stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT, 171 | .offset = 17 * sizeof(float), 172 | .size = 11 * sizeof(float) 173 | }}; 174 | 175 | VkPipelineLayoutCreateInfo plCreateInfo = { 176 | .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, 177 | .pNext = NULL, 178 | .flags = 0, 179 | .setLayoutCount = descLayoutCount, 180 | .pSetLayouts = descriptorLayout, 181 | // for simplicity assume only two push constant range is passed, 182 | // so it's not the most flexible approach 183 | .pushConstantRangeCount = 2, 184 | .pPushConstantRanges = pushConstantRange 185 | }; 186 | 187 | VK_VERIFY(vkCreatePipelineLayout(vk_device.logical, &plCreateInfo, NULL, &pipeline->layout)); 188 | 189 | // create THE pipeline 190 | VkGraphicsPipelineCreateInfo pCreateInfo = { 191 | .sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, 192 | .pNext = NULL, 193 | .flags = pipeline->flags, 194 | .stageCount = shaderCount, 195 | .pStages = ssCreateInfos, 196 | .pVertexInputState = vertexInputInfo, 197 | .pInputAssemblyState = &iaCreateInfo, 198 | .pTessellationState = NULL, 199 | .pViewportState = &vpCreateInfo, 200 | .pRasterizationState = &rCreateInfo, 201 | .pMultisampleState = &msCreateInfo, 202 | .pDepthStencilState = &dCreateInfo, 203 | .pColorBlendState = &cbsCreateInfo, 204 | .pDynamicState = &dsCreateInfo, 205 | .layout = pipeline->layout, 206 | .renderPass = renderpass->rp, 207 | .subpass = 0, 208 | .basePipelineHandle = VK_NULL_HANDLE, 209 | .basePipelineIndex = -1 210 | }; 211 | 212 | VK_VERIFY(vkCreateGraphicsPipelines(vk_device.logical, VK_NULL_HANDLE, 1, &pCreateInfo, NULL, &pipeline->pl)); 213 | free(ssCreateInfos); 214 | } 215 | 216 | void QVk_DestroyPipeline(qvkpipeline_t *pipeline) 217 | { 218 | if (pipeline->layout != VK_NULL_HANDLE) 219 | vkDestroyPipelineLayout(vk_device.logical, pipeline->layout, NULL); 220 | if (pipeline->pl != VK_NULL_HANDLE) 221 | vkDestroyPipeline(vk_device.logical, pipeline->pl, NULL); 222 | 223 | pipeline->layout = VK_NULL_HANDLE; 224 | pipeline->pl = VK_NULL_HANDLE; 225 | } 226 | -------------------------------------------------------------------------------- /src/vk/vk_shaders.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2019 Krzysztof Kondrak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | */ 21 | 22 | #include "header/shaders.h" 23 | 24 | // ingame shaders stored as uint32_t arrays (autogenerated by glslangValidator) 25 | #include "spirv/basic_vert.c" 26 | #include "spirv/basic_frag.c" 27 | #include "spirv/basic_color_quad_vert.c" 28 | #include "spirv/basic_color_quad_frag.c" 29 | #include "spirv/model_vert.c" 30 | #include "spirv/model_frag.c" 31 | #include "spirv/nullmodel_vert.c" 32 | #include "spirv/particle_vert.c" 33 | #include "spirv/point_particle_vert.c" 34 | #include "spirv/point_particle_frag.c" 35 | #include "spirv/sprite_vert.c" 36 | #include "spirv/beam_vert.c" 37 | #include "spirv/skybox_vert.c" 38 | #include "spirv/d_light_vert.c" 39 | #include "spirv/polygon_vert.c" 40 | #include "spirv/polygon_lmap_vert.c" 41 | #include "spirv/polygon_lmap_frag.c" 42 | #include "spirv/polygon_warp_vert.c" 43 | #include "spirv/shadows_vert.c" 44 | #include "spirv/postprocess_vert.c" 45 | #include "spirv/postprocess_frag.c" 46 | #include "spirv/world_warp_vert.c" 47 | #include "spirv/world_warp_frag.c" 48 | 49 | const size_t basic_vert_size = sizeof(basic_vert_spv); 50 | const size_t basic_frag_size = sizeof(basic_frag_spv); 51 | 52 | const size_t basic_color_quad_vert_size = sizeof(basic_color_quad_vert_spv); 53 | const size_t basic_color_quad_frag_size = sizeof(basic_color_quad_frag_spv); 54 | 55 | const size_t model_vert_size = sizeof(model_vert_spv); 56 | const size_t model_frag_size = sizeof(model_frag_spv); 57 | 58 | const size_t nullmodel_vert_size = sizeof(nullmodel_vert_spv); 59 | 60 | const size_t particle_vert_size = sizeof(particle_vert_spv); 61 | 62 | const size_t point_particle_vert_size = sizeof(point_particle_vert_spv); 63 | const size_t point_particle_frag_size = sizeof(point_particle_frag_spv); 64 | 65 | const size_t sprite_vert_size = sizeof(sprite_vert_spv); 66 | 67 | const size_t beam_vert_size = sizeof(beam_vert_spv); 68 | 69 | const size_t skybox_vert_size = sizeof(skybox_vert_spv); 70 | 71 | const size_t d_light_vert_size = sizeof(d_light_vert_spv); 72 | 73 | const size_t polygon_vert_size = sizeof(polygon_vert_spv); 74 | 75 | const size_t polygon_lmap_vert_size = sizeof(polygon_lmap_vert_spv); 76 | const size_t polygon_lmap_frag_size = sizeof(polygon_lmap_frag_spv); 77 | 78 | const size_t polygon_warp_vert_size = sizeof(polygon_warp_vert_spv); 79 | 80 | const size_t shadows_vert_size = sizeof(shadows_vert_spv); 81 | 82 | const size_t postprocess_vert_size = sizeof(postprocess_vert_spv); 83 | const size_t postprocess_frag_size = sizeof(postprocess_frag_spv); 84 | 85 | const size_t world_warp_vert_size = sizeof(world_warp_vert_spv); 86 | const size_t world_warp_frag_size = sizeof(world_warp_frag_spv); 87 | -------------------------------------------------------------------------------- /src/vk/vk_validation.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2019 Krzysztof Kondrak 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at 7 | * your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | * 13 | * See the GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 18 | * 02111-1307, USA. 19 | * 20 | */ 21 | 22 | #include "header/local.h" 23 | 24 | static VkDebugUtilsMessengerEXT validationMessenger = VK_NULL_HANDLE; 25 | 26 | // layer message to string 27 | static const char* msgToString(VkDebugUtilsMessageTypeFlagsEXT type) 28 | { 29 | int g = (type & VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT) != 0 ? 1 : 0; 30 | int p = (type & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) != 0 ? 1 : 0; 31 | int v = (type & VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT) != 0 ? 1 : 0; 32 | 33 | if (g) return ""; 34 | if (p && !v) return "(performance)"; 35 | if (p && v) return "(performance and validation)"; 36 | if (v) return "(validation)"; 37 | 38 | return "?"; 39 | } 40 | 41 | // validation layer callback function (VK_EXT_debug_utils) 42 | static VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsCallback(VkDebugUtilsMessageSeverityFlagBitsEXT msgSeverity, 43 | VkDebugUtilsMessageTypeFlagsEXT msgType, 44 | const VkDebugUtilsMessengerCallbackDataEXT *callbackData, 45 | void* userData) 46 | { 47 | switch (msgSeverity) 48 | { 49 | case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT: 50 | R_Printf(PRINT_ALL, "VK_INFO: %s %s\n", callbackData->pMessage, msgToString(msgType)); 51 | break; 52 | case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT: 53 | R_Printf(PRINT_ALL, "VK_VERBOSE: %s %s\n", callbackData->pMessage, msgToString(msgType)); 54 | break; 55 | case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT: 56 | R_Printf(PRINT_ALL, "VK_WARNING: %s %s\n", callbackData->pMessage, msgToString(msgType)); 57 | break; 58 | default: 59 | R_Printf(PRINT_ALL, "VK_ERROR: %s %s\n", callbackData->pMessage, msgToString(msgType)); 60 | assert(!"Vulkan error occured!"); 61 | } 62 | return VK_FALSE; 63 | } 64 | 65 | static VkDebugReportCallbackEXT validationLayerCallback = VK_NULL_HANDLE; 66 | 67 | // validation layer callback function (VK_EXT_debug_report) 68 | static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallbackReport(VkDebugReportFlagsEXT flags, 69 | VkDebugReportObjectTypeEXT objType, 70 | uint64_t obj, size_t location, int32_t code, 71 | const char *layerPrefix, const char *msg, 72 | void* userData) 73 | { 74 | switch (flags) 75 | { 76 | case VK_DEBUG_REPORT_INFORMATION_BIT_EXT: 77 | R_Printf(PRINT_ALL, "VK_INFO: %s %s\n", layerPrefix, msg); 78 | break; 79 | case VK_DEBUG_REPORT_DEBUG_BIT_EXT: 80 | R_Printf(PRINT_ALL, "VK_DEBUG: %s %s\n", layerPrefix, msg); 81 | break; 82 | case VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT: 83 | R_Printf(PRINT_ALL, "VK_PERFORMANCE: %s %s\n", layerPrefix, msg); 84 | break; 85 | case VK_DEBUG_REPORT_WARNING_BIT_EXT: 86 | R_Printf(PRINT_ALL, "VK_WARNING: %s %s\n", layerPrefix, msg); 87 | break; 88 | default: 89 | R_Printf(PRINT_ALL, "VK_ERROR: %s %s\n", layerPrefix, msg); 90 | break; 91 | } 92 | return VK_FALSE; 93 | } 94 | 95 | void QVk_CreateValidationLayers() 96 | { 97 | VkDebugUtilsMessengerCreateInfoEXT callbackInfo = { 98 | .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT, 99 | .pNext = NULL, 100 | .flags = 0, 101 | .messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | 102 | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT, 103 | .messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | 104 | VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT | 105 | VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT, 106 | .pfnUserCallback = debugUtilsCallback, 107 | .pUserData = NULL 108 | }; 109 | 110 | VkDebugReportCallbackCreateInfoEXT callbackReport = { 111 | .sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, 112 | .pNext = NULL, 113 | .flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT | 114 | VK_DEBUG_REPORT_DEBUG_BIT_EXT | VK_DEBUG_REPORT_INFORMATION_BIT_EXT | 115 | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, 116 | .pfnCallback = debugCallbackReport, 117 | .pUserData = NULL 118 | }; 119 | 120 | if (r_validation->value > 1) 121 | { 122 | callbackInfo.messageSeverity |= VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT | 123 | VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT; 124 | } 125 | 126 | if (qvkCreateDebugUtilsMessengerEXT) 127 | { 128 | VK_VERIFY(qvkCreateDebugUtilsMessengerEXT(vk_instance, &callbackInfo, NULL, &validationMessenger)); 129 | } 130 | 131 | if (qvkCreateDebugReportCallbackEXT) 132 | { 133 | VK_VERIFY(qvkCreateDebugReportCallbackEXT(vk_instance, &callbackReport, NULL, &validationLayerCallback)); 134 | R_Printf(PRINT_ALL, "...Vulkan validation layers enabled\n"); 135 | } 136 | } 137 | 138 | void QVk_DestroyValidationLayers() 139 | { 140 | if( validationMessenger != VK_NULL_HANDLE && qvkDestroyDebugUtilsMessengerEXT) 141 | { 142 | qvkDestroyDebugUtilsMessengerEXT( vk_instance, validationMessenger, NULL ); 143 | validationMessenger = VK_NULL_HANDLE; 144 | } 145 | 146 | if ( validationLayerCallback != VK_NULL_HANDLE && qvkDestroyDebugReportCallbackEXT) 147 | { 148 | qvkDestroyDebugReportCallbackEXT( vk_instance, validationLayerCallback, NULL ); 149 | validationLayerCallback = VK_NULL_HANDLE; 150 | } 151 | } 152 | --------------------------------------------------------------------------------