Giter Club home page Giter Club logo

sk_gpu's Introduction

sk_gpu.h

sk_gpu.h is a mid-level cross-platform graphics library focused on Mixed Reality rendering, in an amalgamated single file header! It currently uses D3D11 on Windows, GLES on Android, and WebGL on the Web, and works very well with OpenXR.

Consuming

To use this project as a dependency, it's recommended use the amalgamated header file and pre-compiled skshaderc executables from the releases hosted here. The release files come with a useful cmake wrapper that makes this pretty straightforward to use in a cmake project:

cmake_minimum_required(VERSION 3.14)
project(sk_gpu_test VERSION "0.1.0" LANGUAGES CXX C)

include(FetchContent)
FetchContent_Declare(
  sk_gpu
  URL https://github.com/StereoKit/sk_gpu/releases/download/v2024.3.31/sk_gpu.v2024.3.31.zip )
FetchContent_MakeAvailable(sk_gpu)

add_executable(sk_gpu_test
  src/main.cpp )

skshaderc_compile_headers(sk_gpu_test
  ${CMAKE_BINARY_DIR}/shaders
  "-O3 -t xge"
  src/test.hlsl
  src/test2.hlsl )

target_link_libraries(sk_gpu_test
  PRIVATE sk_gpu )

Building

sk_gpu uses a cmake based workflow, so standard cmake builds will work. This repository also comes with a number of cmake presets to make this process a bit easier!

cmake --preset test_Win32_x64
cmake --build --preset test_Win32_x64_Debug

bin/intermediate/Win32_x64/Debug/skg_flatscreen.exe

VSCode with the cmake plugin works well as an IDE for this project.

Prerequisites

Python is used for header amalgamation on all platforms. Ninja is used by the presets for Linux and Mac

Repository

There are 3 major sections to this repository!

These files are the core of the project, and they get squished into a single file at the root directory by a Python script! The sk_gpu_flat project in the examples folder is set up to squish these files automatically every time it's built.

This is a shader compiler that uses glslang and Spirv-Cross and SPIRV-Tools to compile and optimize real HLSL shader code into a single file containing HLSL bytecode, SPIRV, GLSL, GLSL ES, and GLSL Web, along with some metadata about buffer layout and uniforms. sk_gpu.h loads these files and picks the right chunk to use on the right platform :)

These are maybe more my tests or development environments, but these are a set of project I use to test out sk_gpu's features on different platforms! There's an OpenXR powered Oculus Quest project, an OpenXR powered Windows project, and a flatscreen project that will also compile to WASM.

License

License is MIT! Have fun :)

sk_gpu's People

Contributors

maluoi avatar moshimeow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sk_gpu's Issues

Custom Vertex Format

Currently locked to skr_vertex_t, but it would be really great to have a more flexible format the user can set.

Evaluate glslang for HLSL->SPIR-V

Glslang theoretically can also compile HLSL to SPIR-V. It claims to be a partial implementation, but the list looks pretty complete to me!

Glslang also happens to be smaller, and significantly easier to build/use as a dependency. If the output it generates is usable by StereoKit, I'd take it in a heartbeat!

NV-12 support

For this header library, can we just add another skg_tex_fmt_ for DXGI_FORMAT_NV12 (and all relevant calls), or do there need to be further additions here? Likewise for adding NV-12 as a TexFormat in StereoKit.

I'll be testing it out today with something like this shader today and can report back here

`write_file` will only create parent level folder

If the new file is in a nested directory of folders that don't exist, it fails to create the directory, and then skips making the file! Would be good to also surface an error when this happens.

Read from texture

For screenshot feature, and equirectangular->cubemap conversion in StereoKit.

Render to Texture test

Test code should be able to render to a target texture! It's an important feature, and needs to work for StereoKit.

Vulkan Renderer tasks

When starting work on a full Vulkan renderer, lets start a pile of smaller tasks for it.

Also, does OpenGL stick around for WASM support, or does it get entirely replaced by the Vulkan renderer?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.