Comments (5)
Hello. Consider adding an API to use your shaders.
Without a doubt, this feature will be for experienced developers and will open the way to the world of shaders. Naga, wgsl and other community tools. I like Kage, but it's good to have an alternative..
from ebiten.
I'm afraid this suggestion is not for enabling other languages than Kage
from ebiten.
To minimize an impact of the existing APIs, I suggest this API:
// AddPrecompiledShader adds a pair of a shader source and a shader binary.
// When a new shader is created by NewShader,
// Ebitengine tries to seek the pair that has the same shader source.
// If there is such a pair, Ebitengine uses a registered shader binary for the same shader source instead of compiling it.
//
// AddPrecompiledShader is useful to shoten the shader compile time, or even necessary in an environment
// where you cannot compile a shader on the fly.
func AddPrecompiledShader(kageShaderSource []byte, nativeShaderBinary []byte, graphicsLibrary GraphicsLibrary) error
EDIT: Hmm, how can we treat vertex shader?
from ebiten.
OpenGL: It is impossible to precompile shaders. AddPrecompiledShader
should always return an error.
DirectX: A native shader binary is the result of D3DCompile
. This function returns ID3DBlob
, and this can be converted to a byte slice, and be created via D3DCreateBlob
. A vertex shader and a pixel shader are separated.
Metal: A native shader binary is a .metallib format. This can be used at makeLibrary
for NSData
. See also https://developer.apple.com/documentation/metal/shader_libraries/building_a_shader_library_by_precompiling_source_files. A vertex shader and a fragment shader are NOT separated. So, Ebitengine would have to expose the binary for a vertex shader? Hmm.
from ebiten.
Instead of exposing the the vertex shader, would this work?
func CompileShaderToNativeSource(kageShaderSource []byte, graphicsLibrary GraphicsLibrary) ([]byte, error)
// Compiling a native source to a native binary is a developer's responsibility.
func AddPrecompiledShader(kageShaderSource []byte, nativeShaderBinary []byte, graphicsLibrary GraphicsLibrary) error
from ebiten.
Related Issues (20)
- internal/shader: kage considers variable unused when it's used for assigning value to array HOT 5
- text/v2: Mongolian scripts are not rendered correctly HOT 1
- Internal log gets dumped in fullscreen mode (entering and leaving) HOT 3
- text/v2: proposal: `NotoFace` using Noto font faces automatically HOT 4
- Wasm not working with librewolf HOT 12
- audio: hiss with 44.1kHz audio HOT 9
- .builds: test is failing HOT 1
- text/v2: enable to specify unicode ranges for MultiFace
- add an option to prevent tearing even when vsync is off on Windows HOT 4
- crash on macOS 13.6.1 (22G313) on M1 with panic: purego: fn is nil HOT 5
- ebiten: test fails with Go 1.22 on 32bit Windows HOT 2
- an option to specify color space for macOS and iOS HOT 9
- ebiten: add `type GamepadAxis int` for consistency with `GamepadButton` HOT 2
- ebiten: allow to kill the process when the game ends in RunGame
- wasm: handle onblur event to clear pressed keys set HOT 4
- GetWindowPosition reports incorrect position on X11 Gnome HOT 3
- ebiten.Monitor() doesn't allow accessing the Bounds so we can't work with custom screen layouts HOT 1
- does not contain package github.com/hajimehoshi/ebiten/v2/text/v2 HOT 1
- examples/windowsize: FPS is too low on fullscreen on macOS HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ebiten.