Skip to content

Instantly share code, notes, and snippets.

@kvark
kvark / zed-on-blade.md
Created February 3, 2024 22:20
Zed on Blade
View zed-on-blade.md

Zed on Blade

See Zed editor: https://github.com/zed-industries/zed

  • currently MacOS-only, using Metal directly for rendering in GPUI component See Blade engine: https://github.com/kvark/blade
  • specifically the blade-graphics crate providing GPU abstraction

Motivation

I love Zed! It's lightning fast and has great UX. I want it to run as well on all major platforms. I'm currently using Linux most actively.

View art-of-debugging.md

Art of Debugging

Obligatory disclaimer, this is all opinion and cannot possibly generalize to all problems, workflows, environments, etc. This is meant primarily as a launching point for an open-ended discussion on best practices in debugging code. This is a sketch of what may be a brief book that covers each point below with anecdotes, examples, and techniques.

Hypothesis 0

The ultimate goal of a debugging session is to rule out possibilities until only one remains. All applications of best practices, techniques, and tools should be pointed at this purpose (contextualize all points below against this statement). Debugging is first and foremost a critical thinking problem, and presence of mind is your most critical asset. Establish a mental model but do not be afraid to invalidate it as the investigation unfolds.

sherlock

Hypothesis 1

@kvark
kvark / rust-graphics.md
Created September 9, 2017 02:58
Rust Graphics Libraries Navigator
View rust-graphics.md

What sort of graphics do you need?

  • 2D only. All you need is...
  • 3D for sure. Do you like making your hands dirty?
  • Sometimes: amethyst
View game_world.rs
use cgmath::{Vector3};
use slog::{Logger};
use cobalt_rendering::{Target, Texture, TextureFormat};
use cobalt_rendering_world3d::{World, Model, Entity, Light, EntityId, LightId, Material};
use input::{InputState, FrameInput};
use player::{Player};
pub struct GameWorld {
pub player: Player,
@kvark
kvark / forest-exe.tgz
Last active August 29, 2015 14:20
gfx_scene slides
View forest-exe.tgz
This file has been truncated, but you can view the full file.
View gist:130019f80fa4dd263532
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 201
@kvark
kvark / links.md
Last active August 29, 2015 14:03
Useful links to read
View links.md
@kvark
kvark / clustered.md
Last active November 23, 2019 02:17
Clustered pipeline description
View clustered.md
@kvark
kvark / RustVsC++.md
Last active August 10, 2018 01:56
Rust >> C++ #research
View RustVsC++.md

Reasons why Rust can be faster than C++:

  • aliasing information available to compiler (automatic __restrict)
  • one less jump on virtual functions due to traits (Runtime polymorphism)
  • undefined struct layout
  • reference counting (Rc<T>) is lock-free because of being task-local
  • allocator model: rust provides hints and could inline calls to jemalloc (issue, RFC)

It's worth noting that since Rust restricts pointers more than C does, the ordering restrictions on pointers could be relaxed. This hasn't been implemented in LLVM yet since most of the optimization work is based on leveraging the rules of C and C-family languages. Even if they did implement relaxations on the reordering rules, however, storing data in registers will still be easier to optimize.