All Projects → rustgd → glsl-layout

rustgd / glsl-layout

Licence: Apache-2.0, MIT licenses found Licenses found Apache-2.0 LICENSE-APACHE MIT LICENSE-MIT
No description or website provided.

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to glsl-layout

wasm-raytracer
a performance comparison of a simple raytracer in JavaScript, asm.js, WebAssembly, and GLSL
Stars: ✭ 158 (+558.33%)
Mutual labels:  glsl
ShaderBoy
Simple text editor that lets you write Shadertoy shaders more comfortably, anytime, anywhere.
Stars: ✭ 133 (+454.17%)
Mutual labels:  glsl
glsl-cos-palette
glsl function for making cosine palettes
Stars: ✭ 26 (+8.33%)
Mutual labels:  glsl
raymarching
Code for my raymarching in GLSL workshop series
Stars: ✭ 17 (-29.17%)
Mutual labels:  glsl
MTTransitions
iOS Transitions ports from GL-Transitions.
Stars: ✭ 178 (+641.67%)
Mutual labels:  glsl
sdf-2d
A graphics library to enable the real-time rendering of 2D signed distance fields on the web.
Stars: ✭ 70 (+191.67%)
Mutual labels:  glsl
qml-glsl-coder
live editor of GLSL fragment shaders based on Qt / QML
Stars: ✭ 19 (-20.83%)
Mutual labels:  glsl
GLSL-howto
random code that I use/write
Stars: ✭ 18 (-25%)
Mutual labels:  glsl
PyGraphicsGui
A "CookieCutter" for a Pythonic GUI with custom graphics - clone this to jump-start your project and learn how to integrate between ModernGL and Tkinter on Python3.6.
Stars: ✭ 30 (+25%)
Mutual labels:  glsl
shaping-functions
Visualisation of shaping functions
Stars: ✭ 75 (+212.5%)
Mutual labels:  glsl
nuance
A tool to run your shaders on the gpu. Also a good demo application for wgpu-rs.
Stars: ✭ 26 (+8.33%)
Mutual labels:  glsl
ray-marching-distance-fields
Haskell and GLSL program containing my distance field / ray marching related experiments
Stars: ✭ 32 (+33.33%)
Mutual labels:  glsl
pixi-sdf-text
Signed distance field text implementation for PixiJS
Stars: ✭ 89 (+270.83%)
Mutual labels:  glsl
Unity3D-Plane-Clipping
Plane clipping shaders for Unity3D 5. Extends the Standard shader!
Stars: ✭ 84 (+250%)
Mutual labels:  glsl
minigdx
Minimalist Game Framework using Kotlin Multiplatform
Stars: ✭ 136 (+466.67%)
Mutual labels:  glsl
honkai-starrail-scene
【崩坏:星穹铁道】预约页场景提取
Stars: ✭ 33 (+37.5%)
Mutual labels:  glsl
Messier87
A realtime raytracing blackhole renderer
Stars: ✭ 53 (+120.83%)
Mutual labels:  glsl
AlizaMS
DICOM Viewer
Stars: ✭ 144 (+500%)
Mutual labels:  glsl
DuEngine
An efficient interactive C++ renderer for ShaderToy-alike demos with 2D/3D/CubeMap/Video/Camera/LightField/Volume textures. (Partially used in my I3D 2018 papers)
Stars: ✭ 62 (+158.33%)
Mutual labels:  glsl
vector-math
Shader-math in haxe: library for GLSL vector operations, complete with swizzles and all
Stars: ✭ 30 (+25%)
Mutual labels:  glsl

GLSL-LAYOUT

This crates provides data types and traits to build structures ready to upload into UBO.

Usage

Deriving Uniform with proc-macro will produce associated type Std140 with same data layout as uniform blocks declared with layout(std140). All members of structure that derives Uniform must implement Uniform as well.

Implementing Uniform should be done via deriving. Implementing it manually is possible. It requires to provide associated type Std140 which must implement Std140 trait. But trait Std140 is marked unsafe so be careful.

Trait Uniform also requires Copy.

Typical usage scenario is:

#[derive(Copy, Clone, Uniform)]
struct FragmentArgs {
    pos: vec3,
    dir: vec3,
    count: uint,
}

write_to_buffer(&FragmentArgs {
    pos: [0.0, 1.0, 2.0].into(),
    dir: [3.0, 4.0, 5.0].into(),
    count: 42,
}.std140());

Data types

There are basic data types from glsl:

  • boolean (name bool is already occupied)
  • int
  • uint
  • float
  • double

Also more complex types:

  • vectors - (vec2, vec3, vec4, bvec2, ivec2, uvec2, dvec2 etc)
  • matrices - (mat2x3, dmat4 etc)
  • arrays -

License

glsl-layout is free and open source software distributed under the terms of both the MIT License and the Apache License 2.0.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Known issues

On MacOS

If uniform block contains array of structures and this array accessed with dynamic index (variable instead of literal) it may load wrong bytes for members not aligned to size of vec4 (16 bytes). In this case manual padding can be the fix.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].