#Andromeda - Terrain/Landscape editor using Vulkan and Rust

1 messages · Page 2 of 1

shadow trench
#

that color map was bad i got rid of it

#

next up ill get some shadows going mayhaps

shadow trench
#

its time for another round of refactors

#

because this is just evil

hot yarrow
#

needs more self

shadow trench
#

needs less parameters being passed around everywhere

hot yarrow
#

yeah 🙂

shadow trench
#

I am cooking up a new abstraction

#

This should answer one problem ive been having

#

I had a World and FutureWorld before but it was honestly not great

shadow trench
livid geode
#

backend developers avoiding refactors for 3 commits challenge (impossible)

wispy ore
#

But yes refactoring is some kind of drug KEKW

livid geode
#

just one more... i swear i can stop whenever i want...

shadow trench
#

shush kekw

shadow trench
#

just fixed like 200 clippy warnings

livid geode
shadow trench
#

a lot of it was &thing where thing is already a reference

hot yarrow
#

#showcase message

shadow trench
#

👀

#

that looks like egui

#

another rust user spotted

hot yarrow
#

potentially more people you could join forces with

shadow trench
hot yarrow
#

to exchange brainworms or else

shadow trench
#

That is true

#

brainworm exchange is always good

hot yarrow
#

GL > VK

#

always has been

shadow trench
hot yarrow
#

😄

shadow trench
#

did they change the discord background?

#

that used to be seamless

#

wtf

hot yarrow
#

no idea tbh

#

im using themes preview

shadow trench
#

using some extension I presume 😄

hot yarrow
#

no

#

its built in, in beta am

shadow trench
#

oh wait right

#

there are people who pay for expensive nitro

#

i stick to the cheap one

hot yarrow
shadow trench
#

I saw the preview but they locked it behind the expensive plan sadly

hot yarrow
#

i didnt know there were multiple "plans" of nitro now

shadow trench
#

at some point they split it into "classic" and just regular nitro

#

with regular nitro getting all the cool stuff

hot yarrow
#

hmm

shadow trench
#

and then not too long ago they deprecated classic and replaced it with basic

#

which is just emotes and stickers

hot yarrow
#

i have the full thing, whatever its called

shadow trench
#

and uploads i guess

hot yarrow
#

ah

shadow trench
#

emotes and bigger file uploads for 3 eur/month i can live with, but 10 is a bit much for me rn

hot yarrow
#

maybe i should also just let it run out and not extend

shadow trench
#

i got too used to emotes to go without tbh lol

hot yarrow
#

: )

hot yarrow
#

mayhaps helpful for you(r) terrain builder builders

shadow trench
#

That looks very useful frogapprove

#

Thank froge

wispy ore
#

multiple types of erosion

#

it was already starred by me lmfao

hot yarrow
#

: )

livid geode
#

@shadow trench You forgot to make version v0.6.0 latest on gh releases

shadow trench
#

I forgot to merge some changes

shadow trench
#

ill change the tag to 0.6.1

livid geode
#

you can jank 0.6.0

shadow trench
#

yeah i should do that

shadow trench
#

im thinking of just yeeting netcdf support for loading heightmap data

#

its what some real world data uses but loading it uses a library which takes literally 5 minutes to build somehow

shadow trench
#

might look into that

#

that said real world data is ass KEKW

#

the resolution is kinda bad

wispy ore
#

It's hard to find good DEMs

#

The netherlands have good ones

#

0.5m res of the entire nation

shadow trench
#

damn

#

thats good

wispy ore
#

iirc. even free

#

but would need to find them again

shadow trench
#

too bad its almost flat kek

wispy ore
#

think 1-2m for most of norway

#

arctic regions suffer a bit tho lmao

shadow trench
#

yeah the one i found of iceland was 200m dread_cat

shadow trench
#

hmm yeah

#

ill see

#

the focus is creating your own terrain anyway

wispy ore
#

using real terrain as a base is neat tho

shadow trench
#

True

#

Id like to support it somehow

wispy ore
#

then erode, add some noise etc. erode again

shadow trench
#

Yeah

#

Combine with some brush tools

wispy ore
#

exactly

#

coastlines are hard with real data

#

you lack depth info

shadow trench
#

some datasets have depth

#

but not all

wispy ore
#

due to differences in how it's measured

shadow trench
#

the one i found from iceland had depth data, was kinda cool

#

but bad resolution so eh

wispy ore
#

ocean data gets measured with sonar and similar mostly

#

which.. doesn't work anywhere else KEKW

shadow trench
#

yeah fair enough KEKW

#

I guess they stitched it together somehow

wispy ore
#

yeah

#

I need to ask my uni for access to geospatial data lmao

shadow trench
#

would be cool if you got it

wispy ore
#

aktschually

#

I have access to ArcGIS with my uni

wispy ore
#

WHY the fuck are geotiff files completely white when you open them in gimp KEKW

#

Do I really need to use a dedicated GIS program just to load and convert them

shadow trench
#

i installed a random 15 year old java app to load netcdf files

shadow trench
#

time to work through some of these

shadow trench
#

tf

#

I implemented pipeline query support in my vk abstraction

#
// Record some commands, then obtain a finished command buffer to submit
let cmd = cmd
    .write_timestamp(&mut timestamps, PipelineStage::TOP_OF_PIPE)?
    .begin_query(&stats, query)
    .bind_compute_pipeline("compute")?
    .bind_storage_buffer(0, 0, &self.buffer.view_full())?
    .push_constant(vk::ShaderStageFlags::COMPUTE, 0, &multiplier)
    .dispatch(1024, 1, 1)?
    .end_query(&stats, query)
    .write_timestamp(&mut timestamps, PipelineStage::COMPUTE_SHADER)?
    .finish()?;

this little command buffer takes ~4k nanoseconds without pipeline queries and ~10k with

#

weird

shadow trench
#

thats not where i put that breakpoint

hot yarrow
#

without reading what the actual code is, but just seeing all the rustisms is odd

#

its basically just "self" "mut" and "pub fn" what i see 😄

shadow trench
#

yeah it is a weird lang if u never wrote it KEKW

#

a bit like kotlin for me

hot yarrow
#

kotlin is super neat, thats what java should have been from the start

#

hehe dont mean to start a language war 🙂

shadow trench
#

its cool but when I see private inline operator suspend fun <reified T> nervous

hot yarrow
#

xD

shadow trench
#

but yeah, 10x better than java for sure

#

Im doing a group assignment in kotlin right now, its neat

hot yarrow
#

that "self" thing riggers me the most i think

#

are those methods extensions/mixins of some kind?

shadow trench
#

its just this in C++

hot yarrow
#

yeah

#

but why

shadow trench
#

methods without self are like static, with is a member function

hot yarrow
#

ah

#

aaah

#

like a hacky oopified c basically

shadow trench
#

kind of :P

hot yarrow
#

oki im quiet again

shadow trench
#

its so you can more expressively add mutability and lifetimes to it

hot yarrow
#

to answer your question though, does that happen if you have out of date builds?

shadow trench
#

not too sure

#

i cleaned my build and it was fixed

#

🤷

hot yarrow
#

ah

wispy ore
#

meanwhile new C++ convention: KEKW

template <class Self>
auto foo(this Self&& self) {
  // ...
}
hot yarrow
#

dead skellingtons in the basemend

shadow trench
#

no idea why it didnt rebuild in the first place 🤷

#

All working nicely finally

#

Using timestamp queries every 60th frame to get some timing data

#

Wireframe is about 5 times slower NanaStare

shadow trench
#

ok i have a problem

hot yarrow
#

: o

shadow trench
#

could just be a rust debug perf moment

hot yarrow
#

mayhaps build as release and check if it makes any difference?

shadow trench
#

truly a rust debug performance moment indeed

#

ill do a quick profile in debug and see whats so slow though

hot yarrow
#

ah hehe, mayhaps collect samples over time

#

or how do you collect this kind of data?

shadow trench
#

frametime is just the classic this_frame - last_frame every frame

hot yarrow
#

ah

shadow trench
#

the others are collected using timestamp VkQueryPools every N frames

#

(because they add some perf overhead so I dont do it every frame)

hot yarrow
#

so, normal stuf

shadow trench
#

Yeah

#

actually debug perf isnt that bad without a debugger attached

#

like 5ms

#

except the occasional spike for some reason

#

kek i only profiled for 20s thats an interesting number

#

i guess it added the times for each thread or something

#

ok i should only profile the main thread for this

#

That is not fun to look at

#

I assume vkNegotiateLoaderLayerInterfaceVersion is because of the validation layers

#

But memcpy CatStare

#

not that bad though

#

what is going on

#

ok well i wont bother looking too much at windowing stuff

short surge
#

what are you using to profile in Rust?

shadow trench
#

very sleepy

hot yarrow
#

erminds me of ProcessExplorer for some reason

shadow trench
#

its a very simple profiler that should work for any compiled lang

#

if it has debug symbols

hot yarrow
#

ah this one

short surge
#

cool, thank you 🙂

shadow trench
#

cargo flamegraph is also good but doesnt seem to work for me for some reason

short surge
#

ill check them both out

shadow trench
#

rendering the gui is the most intensive pass on the cpu nervous

#

thats fine tbh

hot yarrow
#

an open world mmo dragon jrpg fps doesnt need no gui anyway

shadow trench
#

who even makes games smh

shadow trench
#

yeah

#

i could do some optimizations instead of trying to bind a new descriptor set for every draw and going through the whole cache lookup

#

but its not a big deal yet

wispy ore
#

could do mixed retained/immediate mode

shadow trench
#

whats that

wispy ore
#

First of all are you using some gui library you have little control over

shadow trench
#

unfortunately yes :P

#

imgui but rust

wispy ore
#

well this settles the question KEKW

shadow trench
#

fair enough

wispy ore
#

basically imagine a mix of imgui and the retained paradigm for some things

shadow trench
#

i see

wispy ore
#

it would make stuff like layouting much easier

#

you would be able to do "right align element" etc.

shadow trench
#

yeah

#

i have a hacky right align

#

but it requires pushing elements in the opposite order

wispy ore
#

yeah

#

stuff like that wouldn't be needed in mixed or pure retained KEKW

shadow trench
#

yeah

wispy ore
#

could call it "deferred" lol

shadow trench
livid geode
#

maybe its just the sheer number of debug symbols and functions called in debug

#

e.g. all iterators

shadow trench
#

Yeah probably

#

Its still usable so it’s fine

shadow trench
#

wrote my first higher ranked trait bound

#
pub trait PassExecutor<D: ExecutionDomain, U, A: Allocator> {
    fn execute<'q>(&mut self, cmd: IncompleteCommandBuffer<'q, D>, ifc: &mut InFlightContext<A>, bindings: &PhysicalResourceBindings, user_data: &mut U) -> PassFnResult<'q, D>;
}

impl<D, U, A, F> PassExecutor<D, U, A> for F
    where
        D: ExecutionDomain,
        A: Allocator,
        F: for <'q> FnMut(IncompleteCommandBuffer<'q, D>, &mut InFlightContext<A>, &PhysicalResourceBindings, &mut U) -> PassFnResult<'q, D> {

    fn execute<'q>(&mut self, cmd: IncompleteCommandBuffer<'q, D>, ifc: &mut InFlightContext<A>, bindings: &PhysicalResourceBindings, user_data: &mut U) -> PassFnResult<'q, D> {
        self.call_mut((cmd, ifc, bindings, user_data))
    }
}

#

for <'q>

livid geode
#

awww

#

everything ive had to use higher ranked trait bounds for ive had to rewrite out at some point

shadow trench
#

in this case it actually simplifies things a little

#

because now 'q is no longer a lifetime parameter of the pass callback

livid geode
#

true

shadow trench
potent quest
#

bro sneaked in a classic phobos banger

shadow trench
potent quest
#

wow phobos is

#

like vuk

#

but rust

#

instant banger

shadow trench
#

thats the goal

#

its a bit less fancy

#

im using it in my terrain project and its been working nicely so far

potent quest
#

nah kinda like it when there's less

#

means when i code the stuff i need i can at least understand it KEKW

#

why i waned from unreal since it was so much

shadow trench
#

Yeah game engines are overwhelming kek

#

Hm if I add rt support I’ll have to work on adding it to the rust spirv-cross too

#

Oh well I had to do that anyway

#

Shouldn’t be too hard

potent quest
#

Moments caught before disaster

shadow trench
#

Its just editing the bindgen config I think

potent quest
#

bindgen?

shadow trench
#

Its a rust library that automatically generates rust bindings for c/c++ libraries

potent quest
#

ohh

#

wait what

#

i thought ash did that

shadow trench
#

ash is a little different

#

ash just has vulkan bindings for rust

#

It actually loads the function pointers itself and doesn’t interface with the SDK headers

potent quest
#

oh

shadow trench
#

its generated from vk.xml directly

potent quest
#

so its up to you to interface with the sdk?

shadow trench
#

Also adds some builders for convenience but they’re all optional

#

you don’t need to include the SDK directly using rust

#

Depends though, if you choose the linked feature it links to vulkan.lib, otherwise it dynamically loads the pointers

#

(With LoadLibrary etc)

potent quest
#

ohh i see

shadow trench
#

Its a bit like a replacement for vulkan.h

potent quest
#

ohh winit is the glfw

shadow trench
#

Yep

#

Its a bit more invasive but works reasonably well

potent quest
#

i forgor that rust has no classes

shadow trench
#

structs are basically classes though

potent quest
#

ohh impl

shadow trench
#

Yeah

potent quest
#

i guess that gives methods

shadow trench
#

Yep

#

And there’s also impl Trait for Struct

potent quest
#

Trait?

shadow trench
#

Traits are epic

#

Concepts on steroids

potent quest
#

uhh concepts?

#

ohh C++20

shadow trench
#

Yep

potent quest
#

ive had a brief skim through concepts

#

i dont really get why

#

but that is a skim

shadow trench
#

Traits define some methods but don’t implement them

#

Then each struct can provide implementations for those traits in an impl block

#

And you can constrain generic things on a trait

potent quest
#

OHHHH so like templates but for classes

#

scaffolding?

shadow trench
#
trait Bar {
    fn bar(&self);
}

fn foo<T: Bar>(value: T) {
    value.bar();
}
#

foo() takes any T that implements Bar, and calls its implementation of that function

potent quest
#

ohhh

#

thats cool

#

ill get to rust one day

shadow trench
#

Aye

potent quest
#

Yo pengiun if you ever add ray tracing support lmk

shadow trench
#

Ill work on it

#

Gotta do it anyway

#

Do you need rt pipelines too

potent quest
#

Waiaia don’t feel pressured to do it

#

I haven’t even started rust yet 🗿

shadow trench
#

lmao

#

I was planning to add it anyway

#

Current version is just a very thin wrapper anyway so it’s not a lot of work

spare bay
#

do you plan to add easter egg about gregtech in the code ?

hot yarrow
#

gr-egg-tech

shadow trench
#

ill make it just as tedious

#

Every object needs to be created using circuit objects

potent quest
#

I tried running from Gregtech but once again I stare at it’s endless pit

shadow trench
#

There is no escape

potent quest
#

So rt is pretty much the vulkan api

shadow trench
#

Yeah until I figure out a good way to flexibly wrap it

#

But I need to actually use it for a bit to know

#

Obviously it’ll integrate with the rest of the lib

shadow trench
#

found a gem in my old code

potent quest
#

probably agood idea

#

to remove it

#

or add warning of some sort upon usage

shadow trench
#

Well I would do that if I still maintained this

shadow trench
#

That is an acceleration structure

#

API could still be cleaned up a little tbh

shadow trench
#

you sure get long type names with raytracing

#

QueryPool<AccelerationStructureCompactedSizeQuery>

#

AccelerationStructureGeometryTrianglesData

shadow trench
#
pub fn alignment() -> u64 {
    256
}

easy

#

thats a big difference lol

potent quest
#

oml you reminded me i need to add compacting for my blas

shadow trench
#

I found on average it uses about 40-50% less memory

potent quest
#

i looked through it

#

seems way nicer to use

#

god i cannot wait to use this

#

seems like command buffer is handled at a lower level compared to vuk?

shadow trench
#

there are some quality of life abstractions of course

#

but in general theres no full dynamic state like in vuk

potent quest
#

nono its fine

#

i like it

shadow trench
#

Yeah it is intentional 😄

#

I have no plans of going that far

potent quest
#

also wdym dynamic state?

#

im not getitng what that means

shadow trench
#

like setting the vertex format in the command buffer and all that

#

iirc vuks pipelines are very minimal and all other state can be set through the command buffer

shadow trench
#

i got the sample to create a BLAS with a single triangle and a TLAS with one instance

#

solid progress for now

#

I still have to add rt pipelines but apart from shader binding table nonsense that should be easy

potent quest
#

oh yeah how tf did you get nsight to profile the as?

shadow trench
#

It just shows it in the resources tab

potent quest
#

oh no i am doing something wrong with mines then 💀

shadow trench
#

then you can double click to show details

shadow trench
#

raytracing going well

#

im confused where this is coming from

#

since i really am adding the corresponding feature struct to my pnext chain

#

ok thats fixed i was missing an extension

#

still good old device lost though

#

aaaand i completely crashed my driver

#

oops

shadow trench
#
// walmart raygen shader
void main() {
    // Apply inverse of view and projection to find camera direction
    // This gives us the origin and direction of the ray
    vec4 origin = inverse(pc.view) * vec4(0, 0, 0, 1);
    vec4 target = inverse(pc.projection) * vec4(UV.x, UV.y, 1, 1);
    vec4 direction = inverse(pc.view) * vec4(normalize(target.xyz), 0);
    FragColor = vec4(intersect(direction.xyz));
}

good first comment yes?

livid geode
#

lmfao

shadow trench
#

i am bringing down my entire graphics driver

potent quest
#

bros bringing his graphics driver down with him

#

the captain sinks with his ship

shadow trench
#

o7

livid geode
#

🫡

potent quest
#

@shadow trench Sorry for pinging, when you looked into your second AS did it also have the same mesh?

#

I'm running into an issue which it seems like my TLAS? isn't showing anything in nsight

shadow trench
#

I have a big bug somewhere but I don’t know where yet

#

My driver crashes when calling rayQueryProceedEXT lol

shadow trench
#

it doesnt crash if i enable aftermath

wispy ore
#

my first thought was TDR but aftermath shouldn't disable those

shadow trench
#

yeah i considered that too

#

but it crashes pretty much instantly

#

like i hear a buzzing sound in my headphones even kekw

shadow trench
#

it is fixed

#

missing barrier moment

livid geode
shadow trench
shadow trench
#

I dont get it

#
float intersect(vec3 origin, vec3 direction) {
    rayQueryEXT ray;
    origin = vec3(0, 0, 0);
    direction = vec3(0, 0, 1);

    rayQueryInitializeEXT(ray, as, gl_RayFlagsTerminateOnFirstHitEXT, 0xFF, origin, 0.001, direction, 10.0);

    rayQueryProceedEXT(ray);

    if (rayQueryGetIntersectionTypeEXT(ray, true) != gl_RayQueryCommittedIntersectionNoneEXT) {
        return 1.0;
    }
    else return 0.0;
}

I have an AS with a triangle at z = 1

#

How is this not hitting

livid geode
#

skill issue

shadow trench
#

probably

shadow trench
#

segfault in the driver after 10 ish frames with no feedback

#

what in satans name is my program doing

shadow trench
#

runs sample without vkconfig on

shadow trench
#

rerun with vkconfig

potent quest
#

what is vkconfig

shadow trench
#

vulkan configurator

#

to enable a buttload of validation layers and stuff

potent quest
#

code without the validation layer 😎

shadow trench
#

MOTHER FUCKER

#

how long has that been in here

#

and of course it still crashes randomly inside the driver

shadow trench
#

btw @potent quest if you want a stable rust api youre too early kek

potent quest
#

NOOOOO

shadow trench
#

things are somewhat settling but im still breaking stuff every now and then

#

its not too bad anymore I think

#

But no stability guarantees yet

potent quest
shadow trench
#

its setting both the build and update scratch size to the update size

#

idk how this ever showed up right in nsight

#

because im allocating like 128 bytes of scratch memory when 1500 are needed

#

im wondering how this hasnt blown up all this time

potent quest
#

OH

#

lmaooo

shadow trench
#

but yeah stability is somewhat better now but ill definitely still be breaking some stuff

potent quest
#

bro ive tried some very basic rust

#

holy shit

#

borrow checker

#

is saving my ass

shadow trench
#

it is really nice

#

also a pain in the ass sometimes kek

#

but generally a great tool

potent quest
#

yeah but you won't be able to leak 9.5tb of ram because you forgot to do some case checking

shadow trench
#

or blow up your program by reading from a moved-from struct

#

At this point I’ll just go to bed and hope it fixes itself tomorrow

potent quest
#

💀

#

I thought game dev debugging was bad

#

that was when i met GPU debugging

#

Program crashes
Boy oh boy do I sure hope useful indicators are gi-
here is this random ahh memory address LMAOOOO have fun in the debugger doing "work"

shadow trench
#

Yeahh

#

I don’t have much hope for this being a driver issue sadly

#

I ran it on gfs pc and it crashed too, and she’s obviously not using vk beta drivers but stable ones

#

Its not even crashing on the first frame but on like frame 10 or so

potent quest
#

bro wtf

#

nah those bugs are wacked

shadow trench
#

oh ffs

#

its not happening if i run outside clion

potent quest
#

🗿

#

bro wtf is that bug?

#

might be a clion config?

shadow trench
#

nah

#

its just weird

#

probably some UB

livid geode
#

valgrind moment

shadow trench
#

except valgrind doesnt run on windows but my program doesnt run on my linux laptop because no rt kekw

livid geode
#

might interest you

shadow trench
#

huh thats kinda cool

wispy ore
#

what exactly is the difference between KaTeX and LaTeX

#

also why does this docpage taunt me with the Fourier transform

#

Also @shadow trench you are hijacking your own thread with a different project? KEKW

shadow trench
#

in a way kekw

#

the different project is my vk abstraction lib

#

but i also use that for the terrain thing

#

so it works together

wispy ore
#

fair enough

livid geode
#

kinda like mathjax

shadow trench
#

ok ifs just not happening at all if i run it outside my debugger now

shadow trench
#

God dammit I had an idea of what I could fix in a dream

#

But I forgot what it was

shadow trench
#

i remember

#

i thought my u24 struct could be borked

#

but i wrote some tests and i think its fine

livid geode
#

U24?

#

What do you need that for?

shadow trench
#
// Provided by VK_KHR_acceleration_structure
typedef struct VkAccelerationStructureInstanceKHR {
    VkTransformMatrixKHR          transform;
    uint32_t                      instanceCustomIndex:24;
    uint32_t                      mask:8;
    uint32_t                      instanceShaderBindingTableRecordOffset:24;
    VkGeometryInstanceFlagsKHR    flags:8;
    uint64_t                      accelerationStructureReference;
} VkAccelerationStructureInstanceKHR;

this vk struct

livid geode
#

oof

shadow trench
#
#[derive(Default, Copy, Clone, Debug)]
#[allow(non_camel_case_types)]
#[repr(transparent)]
pub struct u24([u8; 3]);

impl u24 {
    const MIN: Self = Self::from_ne_bytes([0, 0, 0]);
    const MAX: Self = Self::from_ne_bytes([255, 255, 255]);

    pub const fn from_ne_bytes(bytes: [u8; 3]) -> Self {
        Self(bytes)
    }

    pub fn into_bytes(self) -> [u8; 3] {
        self.0
    }
}

impl From<u24> for u32 {
    fn from(value: u24) -> Self {
        let u24([a, b, c]) = value;
        #[cfg(target_endian = "little")]
        return u32::from_le_bytes([a, b, c, 0]);
        #[cfg(target_endian = "big")]
        return u32::from_be_bytes([0, a, b, c]);
    }
}

impl TryFrom<u32> for u24 {
    type Error = anyhow::Error;

    fn try_from(value: u32) -> Result<Self> {
        let [a, b, c, d] = value.to_ne_bytes();
        #[cfg(target_endian = "little")]
        return if d == 0 { Ok(u24([a, b, c])) } else { Err(anyhow!("u32 did not fit in u24")) };
        #[cfg(target_endian = "big")]
        return if a == 0 { Ok(u24([b, c, d])) } else { Err(anyhow!("u32 did not fit in u24")) };
    }
}

not too hard to write tho

livid geode
#

but why should you need to worry about that, aren't you using ash

shadow trench
#

ash defines it too actually I forgot about that

livid geode
#

bruh

shadow trench
#

it does this instead

livid geode
#

i would rely on ash

#

instead of doing your own structs

shadow trench
#

yeah this seems somewhat better

livid geode
#

cause that layout is 999% for sure wrong

shadow trench
#

shows up fine in nsight but who knows yeah

#

ill try the ash one

shadow trench
#

still crashes sadly

shadow trench
#

okay back to debugging

#

time to dig through apitrace

#

a 900 line trace of the acceleration structure creation

#

i will inspect every line

shadow trench
#

this is some serious crazy work

#

im going over every line in the trace and crossreferencing with the spec for possible invalid api usage

hot yarrow
#

mayhaps write a tool which can analyse the stuff somehow?

shadow trench
#

i was actually thinking about that

hot yarrow
#

900isms sounds like a lot

shadow trench
#

a small gui tool to examine the output of the vulkan api dump

#

its pretty readable luckily

hot yarrow
#

oof

shadow trench
#

but stuff to easily collapse it, filter commands, maybe name addresses, etc

#

thatd be nice

#

something for my side projects list

hot yarrow
#

is that written in some yml/yaml/toml variant?

shadow trench
#

just plaintext

#

i think it can output json too

hot yarrow
#

: (

#

ah

#

if json then its easier to access elements

shadow trench
#

yeah true

#

i might write something like that

#

could be useful

#

like a baby renderdoc kek

hot yarrow
#

would be kewl if renderdoc could replay apitrace trace files too

#

apitrace's ui is ass

shadow trench
#

yeah mayhaps

#

heh I didnt know this

#

When writing my old rt stuff I just immediately used a big scratch buffer and suballocated it for every AS build

#

Turns out thats required

shadow trench
#

TIL vkGetAccelerationStructureDeviceAddressKHR just returns the device address of the underlying buffer on my gpu

shadow trench
#

im forwarding this to nvidia dev forums

#

it be not happening on amd

shadow trench
#

it got restored luckily

#

but uh, this exception im getting is usually associated with missing dlls

#

the fuck is going on

shadow trench
#

i have no validation layers

#

what

#

where did it go

#

ok reinstalling the sdk worked

#

unfortunately still silently crashing in the driver

shadow trench
#

@potent quest ill rewrite the sample to see if i didnt miss anything, if it still happens ill add rt pipeline support and assume driver bug for now

#

until i get a reply from nv

shadow trench
#

another AMD gpu runs it fine, I think ill just assume driver bug

potent quest
#

Rewriting oh god

#

🫡

shadow trench
#

just the sample code

#

i fixed one bug in it but with no success

shadow trench
#

wtf was i smoking

#

why is it called closest hit shader

shadow trench
#

ok the same code for building AS does not crash when using RT pipelines

#

theres definitely something wrong in the driver when using ray queries

#

Anyway @potent quest check it out

#

RT pipelines more or less done

#

I just have to fix the sample to actually face the camera the right way

#

ladies and gentlemen

#

a raytraced quad

livid geode
#

what was wrong then?

shadow trench
#

nothing on my end I suspect

#

ray queries crash the driver, rt pipelines work fine with exactly the same code for creating the acceleration structure

#

also works fine on amd

livid geode
shadow trench
#

true

#

my next gpu is probably amd

livid geode
#

i have an amd gpu and have never had to worry about driver issues

shadow trench
#

this is the second time for me

livid geode
#

idk why people say that nvidia drivers are much better

shadow trench
#

first time was confirmed a bug, this probably is but im not totally sure

shadow trench
#

Every time I fix a sync bug in my render graph I wonder how it worked before

potent quest
#

the urge to switch

shadow trench
#

Would be good to have a user beside myself KEKW

shadow trench
#

(Also API feedback is obviously welcome)

potent quest
#

Ok()?

shadow trench
#

Its one of the values of Result<T, E>

#

Basically a result either is Ok(value) or Err(error)

#

(Like a union)

#

Its the standard way of error handling in rust

#

If you have a function that returns a Result, and you have a x_result which is a value inside a Result, you can write ```rs
let value = x_result?;

#

To grab the value inside if it’s Ok(), and return the Err() case otherwise

potent quest
#

ohh ok?

#

this does make sense

#

Confused on alignment however

#

How is it ensuring that the buffer is aligned 256 bytes?

shadow trench
#

The allocator does that

#

It knows the required alignment for given usage flags

shadow trench
#

If you are storing multiple ASes in one buffer, you do need to manually align each size to 256 bytes, but get_build_sizes() already does this so it shouldnt be an issue

shadow trench
#

I pushed some fixes to a 0.7.1 release

#

Next up is adding missing docs for everything that i added since the last round

potent quest
#

Ohhh i see

#

See I wanna learn rust so I can use this, but I’m also worried that:

  • this project may just fizzle out since no one else is using it
  • I should probably understand cpp first so I can have a better grasp of the basics rather than throwing it to rust
shadow trench
#

Im also using this library myself so it’s not like I’ll stop working on it

#

Rust has different things to learn than cpp, but the compiler helps you a bit more

livid geode
#

yup and instead you will fight it instead of fighting yourself

shadow trench
#

imo rust is considerably easier to learn than c++

short surge
#

and you get an easier to work with ecosystem 🙂 no more linking errors, libraries are super easy to grab

wispy ore
#

I'd never recommend anyone to learn Rust as their first language

shadow trench
#

it might be related

#

still though, the compiler is much more helpful in fixing your errors and theres a lot less basic things to worry about

wispy ore
#

definitely

#

but the concepts that rust introduces are probably a bit harsh for beginners KEKW

shadow trench
#

yeah but if you have some c++ experience they should be fairly easy to pick up

shadow trench
#

@potent quest how do you feel about create info struct vs different constructors with different parameters

#

Im currently considering switching some over to create infos, especially buffers and images since they have many combinations of input parameters

potent quest
#

wdym?

#

ohh create info structs

#

like how vulkan does it

#

or a function that has multiple parameter

shadow trench
#

Yeah

potent quest
#

hmm. personally, i like multiple parameters, but doing raytracing i've come to like structs more

shadow trench
#

Mostly also many different constructor functions like new_with_alignment etc

#

Remember rust has no overloads so they all need unique names

potent quest
#

honestly i think structs are better?

#

but it really depends

shadow trench
#

Yeah for this they probably are

potent quest
#

in rt, they def are

shadow trench
#

for few parameters I can keep it as a function

potent quest
#

i think some yeah are better off as functions

shadow trench
#

All rt input data is structs that match the vk ones almost 1:1

#

with some convenience builders and stuff

potent quest
#

tbh worse case, you can just do

func({

});
shadow trench
#

Yeah

potent quest
#

yeah create info structs sound a lot better

shadow trench
#

Ill do this for buffers and images at least

#

Because it’s a bit problematic there

#

In rust you can write ```rs
let x = Foo {
bar: 0,
baz: "hi",
..Default::default()
};

#

To initialise only bar and baz and give all other fields a default value

#

So you can kinda optional parameters this way

potent quest
#

ohhh

#

i see

short surge
#

i like CreateInfo structs too, like you say having default fields is akin to having default parameters

#

so it depends if you want them or not

shadow trench
#

so when are you switching over kek

shadow trench
#

i promise your vulkan backend will be 10x more compact :)

short surge
#

if I ever get too frustrated I’ll see 😉

shadow trench
#

ill take it :)

shadow trench
short surge
#

i know but I want to do all that 😄

shadow trench
#

thats entirely fair yeah lmao

#

im like that too

#

thats why i wrote this instead of using vulkano or something

short surge
#

yeah, it's really cool but I'm enjoying NIH at the moment

shadow trench
#

the GP curse is real

short surge
#

yep, took me a year of messing around with Vulkan to start actually progressing a bit more with it recently

shadow trench
#

yeah ive been through a ton of refactors and iterations kek

#

i think i started learning vk like 3 years ago now

short surge
#

it is nice when you look back and see how you have progressed. little do you know there's a mountain to climb right in front of you

#

nice, did you do much GP beforehand

shadow trench
#

I wrote a small opengl engine

#

shadows, basic lighting, etc

short surge
#

that's about how far I got with OpenGL too. then I decided to become a masochist

shadow trench
#

good choice

#

i actually think opengl is more masochistic

#

its painful to use and debug and makes no sense

short surge
#

yeah, i tried starting a project with it myself and I hated interfacing with it, especially after I had tried Vulkan

#

in university our lecturer had an OpenGL framework/engine so I never made anything with it completely from scratch

shadow trench
#

most opengl frameworks also suffer from the same issues as opengl sadly

#

fwog is nice but its still opengl

short surge
#

it was still raw opengl tbh but he just abstracted EVERYTHING into classes

shadow trench
#

eh thats not great imo

short surge
#

so we only really had to think about the actual draw calls and stuff, he had done all the setup

shadow trench
#

the problem with classes in opengl imo comes from a lot of implicit behaviour

short surge
#

yeah, looking back at the repo is painful

shadow trench
#

e.g. constructing a Texture class might change some global state

#

without you knowing about it

#

A while ago I tried solving this problem with a bind_guard that would glBind... in the constructor and glBind...(previous_object) in the destructor but it really didnt work well

short surge
#

yep, my friend says he thinks it made it easier to learn(having everything in classes) but i think it led me to stupid designs that ignore what's actually happening

shadow trench
#

yeah

short surge
#

he did send me a version of his framework that was in Vulkan but he wasn't sure whether to teach it yet or not

#

that was also all in classes

shadow trench
#

in vk it works a bit better but theres still a lot of issues with "just use classes for every vk object lol"

short surge
#

yeah, it just ended up being a really brittle design

#

when are you gunna post more updates on the terrain editor

shadow trench
#

im going to finish off the docs for the current version of my vk thingy, add the create infos we talked about and then go back to work on it

short surge
#

i'm interested to see, i've done some erosion simulation in the past

#

nice, can't wait for the updates

shadow trench
#

erosion is definitely on the list frogapprove

haughty valley
#

@shadow trench i take it this one is the fred?

shadow trench
#

this is the fred yes

#

ive ran my code on some amd gpus and it worked fine there

#

but for some reason its crashing in a driver thread on nvidia

haughty valley
#

if I had to guess I'd say compiler bug

shadow trench
#

oh i havent considered that

haughty valley
#

this is probably also why it doesn't crash with aftermath

#

aftermath adding shader instrumentation -> something is different in shader -> no crash

shadow trench
#

i used glslc to compile the shader, maybe its bogus when compiling ray queries

#

makes sense

haughty valley
#

not necessarily

#

if you want to be sure run spirv-val on it

#

if no output then you're good and you can bonk nvidia compiler people

shadow trench
#

gotcha

#

spriv-val is giving me nothing

haughty valley
#

bonk it is then

shadow trench
#

ah wait i have to make sure it has the rayquery enabled

#

yeh it is

haughty valley
#

as for why it does the compile in a bg thread, no idea, maybe a remnant from the OGLder days

shadow trench
#

possibly

#

ive made a fred on nvidia forums, i can wait a bit for a reply there

#

its a bit weird to me that it doesnt crash on frame 0

#

usually after like 7-8 frames

haughty valley
#

yeah, maybe they do some opts after the shader has run for a bit or similar cursed stuff

shadow trench
#

thats possible

haughty valley
#

you'd need to ask apache if there's anything like that in the driver codebase :^)

shadow trench
#

another person to go bother :)

haughty valley
#

wasn't really serious, apache has a leaked version of the driver code so not sure if you'll want to have anything to do with that

shadow trench
#

oh kekw

#

Yeah maybe not

#

thank for the info though, this is useful insight to have 🙏

shadow trench
#

@potent quest docs for 0.7 are finished i think

potent quest
#

time to rust (soon i should study for exams)

#

but who needs exams. my midterms are through and unis only look at that KEKW

shadow trench
#

kekw i wish it was that way here

#

if you have any questions you can always ping me here

shadow trench
#

ok now i should have 100% doc coverage if i did it right

#

i added a compiler check that will yell if a public item isnt documented

livid geode
#

ye thats good

#

i have that set for rs-tiled as well

shadow trench
#

easy to miss things

livid geode
#

ggez has it set so that it fails compilation lmao

shadow trench
#

120 crates in queue

livid geode
#

wtf

#

why

shadow trench
#

idk lol

#

friday evening i guess

livid geode
#

ppl jumping into the rust bandwagon after seeing the funny release number

shadow trench
#

True

short surge
#

out of curiosity, how much do you use interior mutability with things like RefCell

shadow trench
#

I don’t use refcell at all

#

Only RwLock and Mutex

#

I need my lib to be thread safe my default

livid geode
#

then you have my chad renderer which uses a global to keep track of the device and context

shadow trench
#

💀

livid geode
#

in my defense it's threadsafe and caters to my needs also simplifies things a lot

shadow trench
#

Tbf for a regular application it’s fine

short surge
#

cool, just curious. i'm not sure if I'm fighting using interior mutability too much, but some of the stuff I'm doing at the moment is frustrating to design around taking exclusive references. had a look at wgpu and it seems it has a lot of just &self references when using the device

shadow trench
#

Same for the device for me

#

The thing is

#

The device is cloneable

#

pub struct Device(Arc<DeviceInner>) or Arc<Mutex<XXXInner>> where applicable is what I do

short surge
#

yeah, that's what I think would be handy for me to do. but my device does have a bit of state, so I think I need to make it interior mutable to be able to use it in an Arc as I won't be able to acces &mut references

#

have you had any problems with having it wrapped up like that>

shadow trench
#

I think its better

#

I used to return an Arc<Device> from new and pass that around but thats kind of not done usually

#

So I moved the arc and/or mutex inside and its much cleaner now

short surge
#

Cool, I might give something like that a go. Cheers 🙂

shadow trench
#

Its pretty nice :)

#

I think the stuff thats done like that for me is uh

#

Device, Allocator (but this is a bit different, the allocator trait just requires Clone), PipelineCache, DescriptorCache and ExecutionManager

shadow trench
#

@young oar engine dev is busy but

#

it works

#

and its incredibly cursed

young oar
#

Normally you won't even need unsafe on line 35

#

Just do .as_any().downcast_ref::<R>()

#

Or well

#

That's how it's possible using normal boxes

#

First time hearing about thinbox

shadow trench
#

Doesnt work with regular boxes I think

#

Because the size of Box<T> depends on T

#

I tried but I couldn’t find a way to get a Box<dyn Any> from a Box<T> without UB or compiler error

#

ThinBox always has the same size so this isn’t a problem

#

And you can transmute

#

But it’s unstable

young oar
#
// assuming "value" implements "Any" (aka it's sized and 'static)
let boxed: Box<dyn Any> = Box::new(value);
#

That should work

shadow trench
#

Oh hm yeah maybe that’s doable

young oar
#

Yea it works

shadow trench
#

Ah but I think casting that to dyn Foo is UB

young oar
#

As long as T is 'static (Any is automatically implemented for all types that are 'static)

shadow trench
#

Because different vtable stuff

young oar
#

Most probably lul

#

Yea no it is

shadow trench
#

I ran something like that through miri

shadow trench
#
struct Registry {
    dyn_items: HashMap<TypeId, ThinBox<dyn Any>>,
    items: HashMap<TypeId, Box<dyn Any>>,
}

impl Registry {
    pub fn new() -> Self {
        Self {
            dyn_items: HashMap::default(),
            items: HashMap::default(),
        }
    }
    
    fn put_dyn_boxed<T: ?Sized + 'static>(&mut self, item: ThinBox<T>) {
        // SAFETY: ThinBox always has the same size regardless of the type inside, 
        // so we can transmute this to a different pointer until we cast it back to
        // T in get()
        let any = unsafe { std::mem::transmute::<_, ThinBox<dyn Any>>(item) };
        self.dyn_items.insert(TypeId::of::<T>(), any);
    }
    
    pub fn put<T: 'static>(&mut self, item: T) {
        self.items.insert(TypeId::of::<T>(), Box::new(item));
    }

    pub fn put_dyn<T: ?Sized + 'static>(&mut self, item: impl Unsize<T> + 'static) {
        self.put_dyn_boxed::<T>(ThinBox::new_unsize(item));
    }
    
    pub fn get<T: 'static>(&self) -> Option<&T> {
        let any = self.items.get(&TypeId::of::<T>());
        any.map(|value| value.downcast_ref::<T>().unwrap())
    }
    
    pub fn get_dyn<T: ?Sized + 'static>(&self) -> Option<&T> {
        let any = self.dyn_items.get(&TypeId::of::<T>());
        any.map(|any| unsafe { std::mem::transmute::<_, &ThinBox<T>>(any) }.deref() )
    }
}

alright this is kinda getting somewhere actually lmao

#

usage:

trait MyTrait {
    fn call(&self);
}

struct Foo;

struct Bar {
    pub value: String,
}

impl MyTrait for Foo {
    fn call(&self) {
        println!("meow");
    }
}

impl MyTrait for Bar {
    fn call(&self) {
        println!("woof: {}", self.value);
    }
}

fn main() {
    let mut reg = Registry::new();
    // Register an instance of Foo as our implementation of MyTrait
    reg.put_dyn::<dyn MyTrait>(Foo);
    // We can also put Sized types in the registry
    
    reg.put(Bar { value: "Bar".to_owned() }); 
    // Will call Foo::call()
    reg.get_dyn::<dyn MyTrait>().unwrap().call();
    // Will call Bar::call()
    reg.get::<Bar>().unwrap().call();
    // We did not explicitly register Foo, so this will be None
    // even though there is a Foo in the registry (this is only known as dyn MyTrait)
    assert!(reg.get::<Foo>().is_none())
}
#

would be nice to make get and get_dyn both be the same function but its tricky

#

Putting Sized types inside a ThinBox<dyn Any> is UB as I found out so that doesnt work

#

specialization could fix this

young oar
#

Other than the *_dyn methods since I never used/needed to use ThinBox

shadow trench
#

I might use this

shadow trench
#
struct MySystem {
    pub value: i32,
}

struct MyEvent;
struct OtherEvent;

impl Event for MyEvent {}
impl Event for OtherEvent {}

fn handle(state: &mut MySystem, _event: &MyEvent) -> Result<()> {
    println!("Hello {}", state.value);
    Ok(())
}

fn handle_other(state: &mut MySystem, _event: &OtherEvent) -> Result<()> {
    println!("Other event!");
    Ok(())
}

impl System for MySystem {
    fn register_handlers(registry: &mut SystemRegistry, system: &StoredSystem<Self>) {
        registry.register_handler(system, handle);
        registry.register_handler(system, handle_other);
    }
}

#[test]
fn test_system_registry() -> Result<()> {
    let mut registry = SystemRegistry::new();
    registry.register_system(MySystem { value: 5 });
    registry.trigger(&OtherEvent)?;
    registry.trigger(&MyEvent)?;
    Ok(())
}

we gaming

#

that took a while to figure out

#

i really didnt want to have a fixed set of event types

#

Strictly speaking the event trait is not needed but for completeness I added it in

hot yarrow
#

registry is the wrong name

#

but thats just me 🙂

shadow trench
#

i am open to suggestions :)

hot yarrow
#

EventBus or MessageBus you Subscribe to

shadow trench
#

hmm yeah that may be a better name

hot yarrow
#

and EventBus/MessageBus also has Publish where you send the messages

shadow trench
#

I was considering splitting off the EventBus part to a different struct

hot yarrow
#

or you split it into Subscriber and Publisher

shadow trench
#

I do like subscribe though

hot yarrow
#

yeah

shadow trench
#

a lot better than register_handler

hot yarrow
#

otherwise Mediator is an alternative

#

but thats the pattern behind all that and not really a good name for the thing

shadow trench
#

yeah

#

How would you call the method that does all the subscribing on init

#
impl System for MySystem {
    fn register_handlers(registry: &mut EventBus, system: &StoredSystem<Self>) {
        registry.subscribe(system, handle);
        registry.subscribe(system, handle_other);
    }
}

this one

#

initialize is fine

hot yarrow
#

hmm it depends

#

if you inject the eventbus into where it needs to register, you can do that in the ctor already

#

no need to call initialize somewhere in some specific order possibly

#

lets say your Window class

#

where you use glfw

shadow trench
#

the problem is that the current system only allows subscribing from a StoredSystem<S>

hot yarrow
#
// window
public Window(EventBus eventBus)
{
    glfwInit
    glfwSetXXXCallback(_window, handleXXX);
    glfwSetYYYCallback...
}

private void handleXXX()
{
    eventBus.Publish(WindowMovedEvent(x, y));
}
// somewhere else
public SomethingReactingToWindowResize(EventBus eventBus)
{
    eventBus.Subscribe(WindowSizedEvent, OnWindowSized);
}

private void OnWindowSized(x, y)
{
}
shadow trench
#

Registry is just some Vec<Any> but wrapped

#

I might need a better name for it

hot yarrow
#

hmm

#

name does not tell me anything

#

therefore this type is not necessary

#

but mayhaps its the way you code in rust

shadow trench
#

this registry thing isnt part of the public api

#

but i use it in a few places so its still useful

#

it basically allows me to do type erasure in rust

hot yarrow
#

registry is a bad name

shadow trench
#

probably

hot yarrow
#

name it what it is

#

eventbus/messagebus/PublishSubscriberIsm/PubSubThing/Mediator

shadow trench
#

Registry something equivalent to ArrayList<Object> in java

hot yarrow
#

from best to worst

shadow trench
#

but with some utilities to get<T> and put<T>

hot yarrow
#

yeah in essence its just a list of callbacks

shadow trench
#

yeah but the generic case isnt necessarily a list of callbacks

hot yarrow
#

or a dictionary<Message, List<callback>>

#

the generic case is a bus

shadow trench
#

well the event bus is already EventBus

hot yarrow
#

or EventHandlerRegistry at least

shadow trench
#

this registry has nothing to do with the event system thingy

hot yarrow
#

ah

#

its a different registry now?

shadow trench
#

its even in a different repo :P

hot yarrow
#

thought we talk about te same thing 😛

shadow trench
#
pub struct Registry {
    items: HashMap<TypeId, Box<dyn Any>>,
}

impl Registry {

    pub fn put<T>(&mut self, item: T) {
        
    }

pub fn get<T>(&self) -> Option<&T> {

    }
}
#

simplified the rust isms

#

but its just a way to store any type and retrieve it later

hot yarrow
#

im still confused

#

is Registry the callback holder or not

#

or something different now

shadow trench
#

it stores the callbacks but it doesnt have to

#

it also stores the event buses for each event type

hot yarrow
#

make a distinct type for the event nonsense

#

there is most likely no other use case for Registry in this instance

shadow trench
#

I do use it in one other place

hot yarrow
#

like?

shadow trench
#
pub struct EventBus {
    buses: Registry,
}
hot yarrow
#

buses is wrong

shadow trench
#

Because I need a list of ```rs
pub struct TypedEventBus<E: Event> {
systems: Vec<Box<dyn Caller<E>>>,
}

#

type erasure in rust is tricky :P

hot yarrow
#

sounds like a shit language 😛

shadow trench
#

Well this isnt something its great at admittedly

hot yarrow
#

obviously i do not know any rust, and im just talking out of my salty ass

shadow trench
#

naming is somewhat universal though

#

Registry is not a great name though

hot yarrow
#

hehe

#

well mayhaps naming is not so important

#

make the thing work first

shadow trench
#

yeah true, renaming is easy

hot yarrow
#

☟☟ Upcoming Conference Workshops (Swag, links and more) ☟☟

C++ Best Practices Workshop, Sept 18, 19, Norway: https://ndctechtown.com/workshops/c-best-practices/abf61aa1ff65

T-SHIRTS AVAILABLE!

► The best C++ T-Shirts anywhere! https://my-store-d16a2f.creator-spring.com/

WANT MORE JASON?

► My Training Classes: http://emptycrate.com/training...

▶ Play video
shadow trench
#

ooo

shadow trench
#

@young oar does splitting your source up into multiple crates have any noticable impact on build times

#

i checked out your repo to figure out the events thing

shadow trench
#

probably worth doing then

young oar
#

Well if you edit the source code for like, the asset manager (a crate used by many more crates) its still pretty slow

shadow trench
#

link time is getting pretty bad for me kek

#

Yeah

young oar
shadow trench
#

lemme try

#

ah wait

#

a clean build takes a couple minutes

young oar
#

Yeaaa that's pretty long

shadow trench
#

because its compiling netcdf-sys and hdf5 which are both giant C libraries apparently

#

thats the biggest time sink

#

I should probably just yeet support for netcdf

young oar
#

Tf is netcdf?

#

Never heard of it

shadow trench
#

some format

#

for uh

#

its some structured data format

young oar
#

Ahh I see

shadow trench
#

real world heightmap data sometimes uses it

young oar
#

Ohhh yea

#

Fair fair

shadow trench
#

but its not great to compile those giant crates

young oar
#

Yeaa

shadow trench
#

maybe i should write a very lightweight parser instead

young oar
#

I mean that's per clean run

shadow trench
#

Yeah true

#

im running cargo build --timings rn so we will see

young oar
#

Ouchhh

shadow trench
#

i think ill spend some time writing that parser soon

#

should be easy, i think the format is quite simple

young oar
#

Yep

#

Good luck

shadow trench
#

yeah lol this is ridiculous

livid geode
#

mold pls

young oar
#

Yea that too

#

Or lld if you're on windows

#

Sux that mold isn't on windows

shadow trench
#

Im already using lld I think

#

But that won’t help with compiling hundreds of C files

#

Might just yeet netcdf support altogether

#

I can’t find a clear spec

#

Just “use our c bindings lol”

shadow trench
#

I have introduced an easy way to deadlock my app

#

But its probably fine

#
fn handle(system: &mut MySystem, event: &Event, context: &mut EventContext) {
  context.publish(event);
}
hot yarrow
#

features: deprecated

shadow trench
#

always fun

shadow trench
#

yeah its silly but itll deadlock lol

#

just publishing the same event type recursively

#
fn handle_input_event(
    camera: &mut Camera,
    event: &InputEvent,
    ctx: &mut EventContext<DI>,
) -> Result<()> {
    let mut state = camera.write().unwrap();
    let input = ctx.read().unwrap().get::<Input>().unwrap();
    state.handle_event(event, input)
}

refactoring progress

#

I can live with this for event handlers I think

young oar
#

One problem that comes with passing resources as arguments is that you can request for reading/writing to a resource afterwards

shadow trench
#

is that an issue

young oar
#

So material systems might be a bitch to implement since they require modular resources

shadow trench
#

my engine has a very fixed renderer because i only render terrains

young oar
#

Ah then you're good

shadow trench
#

so it doesnt need to be extremely flexible when it comes to material systems

potent quest
#

wtf

#
16 as vk::DeviceSize
#

is this seriously how you type cast in rust

#

no way

livid geode
#

yes

#

and thats just for primitives

#

so unless that devicesize is an alias, that will not compile

shadow trench
#

its u64

#

you can just write 16u64 too

wise viper
#

i love rust syntax

shadow trench
#

it has some quirks :P

#

I dont really like the foo::<T>() syntax

wise viper
#

true

potent quest
#
use std::io;

fn main() {
    println!("Guess the number!");
    println!("Please input your guess.");

    let mut guess = String::new();
    io::stdin()
        .read_line(&mut guess)
        .expect("Failed to read line");

    println!("You guessed: {guess}");
}

rust is so much cleaner wtf

#

also im learning rust now

#

im gonna phobo'ing soon

short surge
#

welcome 😈

potent quest
#

LMAOO

#

there's no going back* (i have exams and should study but it's only 1 exam)

#

WHAT

#

rust has in-built documentation

#

bruh

shadow trench
shadow trench
#

i recommend intellij with the rust plugin if youre not using that already

hot yarrow
#

lol

#

you guys sound like cavemen coming out of the cave in 2023

shadow trench
#

kekw thats what its like leaving C++

hot yarrow
#

c# had all that 20 years ago 😄

#

ok lets be fair, 13 years ago

shadow trench
#

13 years ago c++ didnt have move semantics

potent quest
#

matching is so clean

#

oml

potent quest
shadow trench
#

aye

#

its great

potent quest
#

i love that rust complains if you don't handle results given

shadow trench
#

yep

potent quest
#

shadowing is weird though to me feels wrong

#

also sheesh clion has a cleaner look

#

more vscodified KEKW

shadow trench
#

its nice

#

i use it too

potent quest
#

yea feels more approachable

#

oh teag