Skip to content

Instantly share code, notes, and snippets.

@tomaka
Last active February 15, 2020 06:24
Show Gist options
  • Select an option

  • Save tomaka/623781c5af6ebbc5dcfe to your computer and use it in GitHub Desktop.

Select an option

Save tomaka/623781c5af6ebbc5dcfe to your computer and use it in GitHub Desktop.

Revisions

  1. tomaka revised this gist Feb 22, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@ Supports multiple render targets | Yes
    Supports geometry shaders | Yes (untested) | Yes
    Supports uniform blocks | Yes | Yes
    Supports tessellation shading | Not yet | Yes
    Supports instancing | Yes, with attributes on vertex attributes | Yes, with strong typing
    Supports instancing | Yes | Yes
    Supports commands batches | Yes for APIs that support them, emulated for OpenGL | No (and not until OpenGL supports them with an ARB or EXT extension)
    Supports buffer persistent mapping | Not yet | Yes
    Supports bindless textures | Not yet | Not yet (troubles with API design)
  2. tomaka revised this gist Feb 22, 2015. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -9,11 +9,11 @@ History | Papers since Oct 2013. Really started in
    Supported backends | OpenGL 2.0 to 4.5, maybe OpenGL ES 3 (untested) | OpenGL 1.0 (with the right extensions) to 4.5, maybe OpenGL ES 3 (untested)
    Potential support for other backends | All: DirectX, Mantle, Metal, OpenGL NG, OpenGL ES 2, etc. | OpenGL ES 2, maybe OpenGL NG depending on what it looks like
    Level of abstraction | API oriented around modern rendering techniques ("zero driver overhead"). | Maps OpenGL concepts. Uses GLSL. Not everything is exposed for safety purposes.
    Stateless API | Yes | Yes
    Stateless API[2] | Yes | Yes
    Learning curve | A bit more difficult than glium | A bit easier than gfx
    Context creation library | Independent of the backend (glutin, SDL, GLFW, ... all work) | Tightly coupled with glutin (aims to provide an alternative unsafe API)
    Context management safety | Partially unsafe because of OpenGL, but it's hard to screw up | Totally safe
    Compile-time checks | Offsets and types of vertex attributes and uniforms | Offsets and types of vertex attributes and uniforms. Strong texture typing to avoid invalid operations. Uses `&` and `&mut` to avoid invalid operations[2].
    Compile-time checks | Offsets and types of vertex attributes and uniforms | Offsets and types of vertex attributes and uniforms. Strong texture typing to avoid invalid operations. Uses `&` and `&mut` to avoid invalid operations[3].
    Runtime checks | Detects common errors ahead of the rendering process | Aims to detect 100% of OpenGL errors or undefined behaviors, even the most obscure ones, some of them during the rendering process
    Resource destruction | Still work in progress, currently manually destructed, potentially will use linear types when they are available | RAII
    Test suit | None | 174 headless OpenGL tests that can run on travis
    @@ -36,13 +36,12 @@ Total contributors | 43
    Pulse in the last month | 43 active pull requests, 41 active issues | 117 active pull requests, 92 active issues

    Misc:
    - "Stateless API" means that the same function calls will always produce the same result. OpenGL is often criticized for its stateful API.
    - Both libraries have a steep learning curve if you have never done graphics programming.
    - Nobody has written benchmarks that compare gfx and glium yet.
    - A list of projects that use gfx/glium would be hard to write. Piston works with both but the glium backend is only two weeks old. Gfx has [Snowmew](https://github.com/csherratt/snowmew).
    - Glium safely supports changing the context's attributes (for example switching windowed/fullscreen). This is out of scope of Gfx.

    Notes:
    [1]: Even though glium was announced shortly after gfx, it was not started as a reaction to it.
    [2]: OpenGL doesn't permit operating on objects while they are in a certain state (for example, when a buffer is mapped). Glium uses mutable borrows when an object is in these states (for example, mapping a buffer), and immutable borrows for other operations.

    [2]: "Stateless API" means that the same function calls will always produce the same result. OpenGL is often criticized for its stateful API.
    [3]: OpenGL doesn't permit operating on objects while they are in a certain state (for example, when a buffer is mapped). Glium uses mutable borrows when an object is in these states (for example, mapping a buffer), and immutable borrows for other operations.
  3. tomaka revised this gist Feb 22, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -44,4 +44,5 @@ Misc:

    Notes:
    [1]: Even though glium was announced shortly after gfx, it was not started as a reaction to it.
    [2]: OpenGL doesn't permit operating on objects while they are in a certain state (for example, when a buffer is mapped). Glium uses mutably borrows when an object is in these states (for example, mapping a buffer), and immutable borrows for other operations.
    [2]: OpenGL doesn't permit operating on objects while they are in a certain state (for example, when a buffer is mapped). Glium uses mutable borrows when an object is in these states (for example, mapping a buffer), and immutable borrows for other operations.

  4. tomaka revised this gist Feb 22, 2015. 1 changed file with 12 additions and 7 deletions.
    19 changes: 12 additions & 7 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -5,25 +5,26 @@ Both may look similar, and one of the questions that gets asked frequently on IR
    | Gfx | Glium
    -------------------------------------|-------------------------------------------------------------------------------------------------------------------|--------------------------------
    URL | <https://github.com/gfx-rs/gfx-rs> | <https://github.com/tomaka/glium>
    History | Papers since Oct 2013. Really started in June 2014. | Private/confidential from Feb 2014 to July 2014. Announced and made public in July 2014.
    History | Papers since Oct 2013. Really started in June 2014. | Private/confidential from Feb 2014 to July 2014. Announced and made public in July 2014[1].
    Supported backends | OpenGL 2.0 to 4.5, maybe OpenGL ES 3 (untested) | OpenGL 1.0 (with the right extensions) to 4.5, maybe OpenGL ES 3 (untested)
    Potential support for other backends | All: DirectX, Mantle, Metal, OpenGL NG, OpenGL ES 2, etc. | OpenGL ES 2, maybe OpenGL NG depending on what it looks like
    Level of abstraction | API oriented around modern rendering techniques ("zero driver overhead"). | Maps OpenGL concepts. Uses GLSL. Not everything is exposed for safety purposes.
    Stateless API | Yes | Yes
    Learning curve | A bit more difficult than glium | A bit easier than gfx
    Context creation library | Independent of the backend (glutin, SDL, GLFW, ... all work) | Tightly coupled with glutin (aims to provide an alternative unsafe API)
    Context management safety | Partially unsafe because of OpenGL, but it's hard to screw up | Totally safe
    Compile-time checks | Offsets and types of vertex attributes and uniforms | Offsets and types of vertex attributes and uniforms. Strong texture typing to avoid invalid operations. Uses `&` and `&mut` to avoid invalid operations.
    Runtime checks | Detects common errors ahead of the rendering process | Aims to detect 100% of OpenGL errors or undefined behaviors, even the most obscure ones
    Resource destruction | Linear types (not yet implemented, manual destruction for now) | RAII
    Compile-time checks | Offsets and types of vertex attributes and uniforms | Offsets and types of vertex attributes and uniforms. Strong texture typing to avoid invalid operations. Uses `&` and `&mut` to avoid invalid operations[2].
    Runtime checks | Detects common errors ahead of the rendering process | Aims to detect 100% of OpenGL errors or undefined behaviors, even the most obscure ones, some of them during the rendering process
    Resource destruction | Still work in progress, currently manually destructed, potentially will use linear types when they are available | RAII
    Test suit | None | 174 headless OpenGL tests that can run on travis
    CPU overhead (compared to raw GL) | Safety checks outside of the rendering process. Very minor. | Hearvier safety checks than gfx. Uses a background thread for OpenGL context safety (could be changed in the future). Lot of unoptimized code.
    CPU overhead (compared to raw GL) | Safety checks outside of the rendering process. Very minor. | Heavier safety checks than gfx. Uses a background thread for OpenGL context safety (could be changed in the future). Drawing involves more CPU operations than gfx. Lot of unoptimized code with many avoidable allocations.
    GPU overhead (compared to raw GL) | Minor unoptimized state changes. Redundant uniform uploads. Doesn't use DSA or immutable storage. | Redundant uniform uploads
    Multithreaded rendering | Draw operations can be prepared (as if they were compiled) from multiple threads ahead of the drawing | Allows safe multithreaded drawing at any time, but for best performances users are encouraged to implement themselves something similar to what gfx enforces
    Supports render-to-texture | Yes | Yes
    Supports multiple render targets | Yes | Yes
    Supports geometry shaders | Yes NOT SURE | Yes
    Supports geometry shaders | Yes (untested) | Yes
    Supports uniform blocks | Yes | Yes
    Supports tessellation shading | Yes NOT SURE | Yes
    Supports tessellation shading | Not yet | Yes
    Supports instancing | Yes, with attributes on vertex attributes | Yes, with strong typing
    Supports commands batches | Yes for APIs that support them, emulated for OpenGL | No (and not until OpenGL supports them with an ARB or EXT extension)
    Supports buffer persistent mapping | Not yet | Yes
    @@ -40,3 +41,7 @@ Misc:
    - Nobody has written benchmarks that compare gfx and glium yet.
    - A list of projects that use gfx/glium would be hard to write. Piston works with both but the glium backend is only two weeks old. Gfx has [Snowmew](https://github.com/csherratt/snowmew).
    - Glium safely supports changing the context's attributes (for example switching windowed/fullscreen). This is out of scope of Gfx.

    Notes:
    [1]: Even though glium was announced shortly after gfx, it was not started as a reaction to it.
    [2]: OpenGL doesn't permit operating on objects while they are in a certain state (for example, when a buffer is mapped). Glium uses mutably borrows when an object is in these states (for example, mapping a buffer), and immutable borrows for other operations.
  5. tomaka created this gist Feb 21, 2015.
    42 changes: 42 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    Gfx and glium are Rust libraries that aim to provide a "rusty" abstraction over graphics programming APIs.
    Both may look similar, and one of the questions that gets asked frequently on IRC is "what are the differences between gfx and glium?". Here is a comparison table:


    | Gfx | Glium
    -------------------------------------|-------------------------------------------------------------------------------------------------------------------|--------------------------------
    URL | <https://github.com/gfx-rs/gfx-rs> | <https://github.com/tomaka/glium>
    History | Papers since Oct 2013. Really started in June 2014. | Private/confidential from Feb 2014 to July 2014. Announced and made public in July 2014.
    Supported backends | OpenGL 2.0 to 4.5, maybe OpenGL ES 3 (untested) | OpenGL 1.0 (with the right extensions) to 4.5, maybe OpenGL ES 3 (untested)
    Potential support for other backends | All: DirectX, Mantle, Metal, OpenGL NG, OpenGL ES 2, etc. | OpenGL ES 2, maybe OpenGL NG depending on what it looks like
    Level of abstraction | API oriented around modern rendering techniques ("zero driver overhead"). | Maps OpenGL concepts. Uses GLSL. Not everything is exposed for safety purposes.
    Stateless API | Yes | Yes
    Learning curve | A bit more difficult than glium | A bit easier than gfx
    Context creation library | Independent of the backend (glutin, SDL, GLFW, ... all work) | Tightly coupled with glutin (aims to provide an alternative unsafe API)
    Context management safety | Partially unsafe because of OpenGL, but it's hard to screw up | Totally safe
    Compile-time checks | Offsets and types of vertex attributes and uniforms | Offsets and types of vertex attributes and uniforms. Strong texture typing to avoid invalid operations. Uses `&` and `&mut` to avoid invalid operations.
    Runtime checks | Detects common errors ahead of the rendering process | Aims to detect 100% of OpenGL errors or undefined behaviors, even the most obscure ones
    Resource destruction | Linear types (not yet implemented, manual destruction for now) | RAII
    Test suit | None | 174 headless OpenGL tests that can run on travis
    CPU overhead (compared to raw GL) | Safety checks outside of the rendering process. Very minor. | Hearvier safety checks than gfx. Uses a background thread for OpenGL context safety (could be changed in the future). Lot of unoptimized code.
    GPU overhead (compared to raw GL) | Minor unoptimized state changes. Redundant uniform uploads. Doesn't use DSA or immutable storage. | Redundant uniform uploads
    Supports render-to-texture | Yes | Yes
    Supports multiple render targets | Yes | Yes
    Supports geometry shaders | Yes NOT SURE | Yes
    Supports uniform blocks | Yes | Yes
    Supports tessellation shading | Yes NOT SURE | Yes
    Supports instancing | Yes, with attributes on vertex attributes | Yes, with strong typing
    Supports commands batches | Yes for APIs that support them, emulated for OpenGL | No (and not until OpenGL supports them with an ARB or EXT extension)
    Supports buffer persistent mapping | Not yet | Yes
    Supports bindless textures | Not yet | Not yet (troubles with API design)
    Supports transform feedback | Not yet | Not yet
    Supports occlusion queries | Not yet | Not yet
    Github stars | 294 | 143
    Total contributors | 43 | 11
    Pulse in the last month | 43 active pull requests, 41 active issues | 117 active pull requests, 92 active issues

    Misc:
    - "Stateless API" means that the same function calls will always produce the same result. OpenGL is often criticized for its stateful API.
    - Both libraries have a steep learning curve if you have never done graphics programming.
    - Nobody has written benchmarks that compare gfx and glium yet.
    - A list of projects that use gfx/glium would be hard to write. Piston works with both but the glium backend is only two weeks old. Gfx has [Snowmew](https://github.com/csherratt/snowmew).
    - Glium safely supports changing the context's attributes (for example switching windowed/fullscreen). This is out of scope of Gfx.