#Andromeda - Terrain/Landscape editor using Vulkan and Rust

1 messages · Page 6 of 1

shadow trench
#

at least here

#

we did do something kinda new, at least I havent found anything like it

#

assembly-like html

#

also as for the topic we got to pick our top choices from a list and then one was assigned

young oar
#

Never heard of it for sure lol

#

It is very interesting though

hot yarrow
#

yeah thats the whole point i find strange

shadow trench
#

the original task was to write an efficient web browser for a low power embedded device

hot yarrow
#

"universities" dont encourage you to conduct actual research to figure out new shit

shadow trench
#

i came up with this thing as a solution

hot yarrow
#

im also still generally speaking not saying that the thesises you wrote suck or make no sense

shadow trench
#

Yeah I realize

#

It was said at the beginning of the course

#

that this was sort of like a thing to make you go through the steps of doing actual research

#

but not actually doing anything new

#

which is kinda lame imo

hot yarrow
#

ive read so many papers of students who i interviewed over the years 😄

shadow trench
#

heh, nice of you to read them at least

hot yarrow
#

outside of computer science its a little different for some weird reason

shadow trench
#

I have a friend who does biomedical stuff

#

For their thesis they just had to conduct some predefined set of experiments and write a report

hot yarrow
#

yeah exactly

#

and compare it to existing shit or explain why this an that will be new or simply breathtaking

#

computer science people write a generic engine, lets say 70-80% of the ones i read so far

#

anyway, i have no right to judge them 🙂

shadow trench
#

kek yeah says the one who is writing a generic engine

young oar
#

Lol

coarse yoke
#

for a bachelor's thesis in rendering, i wouldn't expect anything but generic

young oar
#

Yea I guess

coarse yoke
#

i guess that was said

#

but like, idk how you can do anything relevantly new without understanding what exists first

#

at least with any efficient use of time

potent quest
#

God damnti I missed a conservation that is extremely relevant to me

#

So I gotta guess for my Bachelor’s thesis I ain’t going do something groundbreaking

#

Which is obvious I’m confused on the “new” part of it

#

Cuz like some people said I’m gonna do stuff that has been done before?

#

Is that like through the same method or a different one but ends up essentially in the same spot

mild flower
#

aren't you currently in hs

#

I don't think a bachelor's thesis is something you need to think about until maybe the last year or two of your degree

potent quest
#

Yeah but I’m gonna graduate this year and go to uni 💀

#

And yeah I probably don’t. Considering the course that is for the thesis is 4th year

shrewd lynx
#

Yes, we even need to patent-search our crap

#

it has to be novel

#

thats why sometimes i get weirded out reading bachelor's papers of overseas students, why is it like 5 pages whereas ours is 60/70 already and counting

mild flower
#

I didn't even have to write a thesis for my bachelor's

#

quite epic

shrewd lynx
#

our bachelor's right now involves creating a novel device that will be deployed to the sea so for immersion, i have to go to a ship, go down, and check oceanographic conditions

#

fucking hell

mild flower
#

uh

#

what field are you studying

shrewd lynx
#

Computer Engineering

mild flower
#

I guess they gotta put computers in the ocean sometimes

#

for science

shrewd lynx
#

well yeah i guess i brought this down to myself choosing this project

mild flower
#

sounds really cool though

#

just not what I would initially expect from such a degree 😄

shrewd lynx
#

yep lol

#

anyway, other peoples bachelor's (published) involve having a device that sorts between good and bad produce using cv

#

having some app that reads money for the blind, etc

mild flower
#

those are some nutty theses

shrewd lynx
#

indeed lol

shadow trench
#

Sounds cool but a lot of work lmao

shrewd lynx
#

it takes a whole year to finish

#

so your 4th year at uni is solely dedicated to that + Internship

mild flower
#

ah

#

I had to take a full load of classes in my 4th year

shadow trench
#

Ah here it’s also an entire year except it’s stuffed between other classes

mild flower
#

at my college we had year-long game team projects though

shrewd lynx
#

1st semester has some classes with the thesis too, because the 1st sem is dedicated to problem validation, writeups, patent search
but 2nd semester is full on just making the damn project

shadow trench
#

I see

#

The course here is 9 credits, where you usually take 60/year

#

(For comparison the master thesis is worth 24)

shrewd lynx
#

yeah actually i wonder if its worth to pursue masters here, because bachelor's is hard, but then you get to masters, it gets kind of red-tapey

#

masters is required to teach, so people who usually flock there are the ones not really working on the field (just want to teach instead of in the industry)

mild flower
#

on one hand, I like teaching. on the other, I don't like teaching people who have zero interest in the topic

shrewd lynx
#

yes

mild flower
#

master's students probably care more than undergrads though

#

oh wait but you wouldn't be teaching master level classes bleakekw

shrewd lynx
#

yes, you need phd 😄

mild flower
#

honestly quite horrible

shrewd lynx
#

all this hard work on papers, and what happens to them? dusting on the shelves because our govt didnt bother having good scitech department

#

Anyway if it's not too bother here is me on the sea doing research

#

while totally not checking out the specgloss of the water

mild flower
#

you look like a boat

#

(no offense)

hot yarrow
#

thats cool

young oar
shadow trench
#

Pog I got the username change

coarse yoke
wispy ore
potent quest
#

I'm so confused by rust lifetimes man

livid geode
#

its mostly theory

#

trying to understand it by practice leaves a lot of edge cases

young oar
#

@shadow trench Sorry for pinging but are you ever going to add terrain "details" into your engine/terrain?

#

Like trees, rocks, stuff like that

shadow trench
#

oh yeah i probably will

young oar
#

Awesome

shadow trench
#

Just came across this in a Reddit post

#

Shit has 500 upvotes somehow

mild flower
#

Simplified API surface: No more 1000 LOC to draw a triangle (takes about 300-500).
bleakekw

coarse yoke
#

ok to be fair

#

their definition of what a "line" is, is extremely encompassing

#

e.g.:


        //This should start being self-explanatory.
        render_graph_builder.add(Task {
            resources: vec![
                //Now we copy from this buffer.
                Resource::Buffer(
                    Box::new(|render_info| render_info.staging_buffer),
                    BufferAccess::TransferWrite,
                ),
                //To this buffer
                Resource::Buffer(
                    Box::new(|render_info| render_info.time_buffer),
                    BufferAccess::TransferRead,
                ),
            ],
            task: |render_info, commands| {
                commands.copy_buffer_to_buffer(BufferCopy {
                    //Index of the buffer in the resource vector
                    from: 0,
                    //Index of the buffer in the resource vector
                    to: 1,
                    //Source (from parameter) buffer offset.
                    src: 0,
                    //Destination (to parameter) buffer offset.
                    dst: 0,
                    size: std::mem::size_of::<f32>(),
                })
            },
        });
#

this is like 100 real SLOC

young oar
#

But also... why Box::new()??

#

For functions/callbacks ig but that's... odd

livid geode
#

cause they probably want to erase the lambda type

#

makes sense to me

shadow trench
#

I don’t like the api kek

wise viper
#

i also dont think an api like that could ever be judged by looking at a triangle program alone\

#

no clue how extensive the rendergraph is for example

#
                Resource::Image(
                    //This acquires the next image from the swapchain, essentially the image we can draw to
                    //and it is also the image which is drawn to the screen.
                    Box::new(|render_info| {
                        render_info
                            .device
                            .acquire_next_image(Acquire {
                                swapchain: render_info.swapchain,
                                semaphore: Some(render_info.acquire_semaphore),
                            })
                            .expect("failed to acquire next image")
                    }),
                    ImageAccess::ColorAttachment,
                    //This is the image aspect. It defaults to color images.
                    //If you are using a depth image, you will want `ImageAspect::DEPTH`
                    //and if you use the stencil buffer you will want to add `ImageAspect::STENCIL`
                    Default::default(),
                ),

tho the image3 attachment description is gigantic

#

i wouldnt want to write that

#

i guess it includes the aquite op but i would still want that to be a single line

shadow trench
#

Yeah a triangle program isn’t much to look at

#

It seems a bit verbose for something that claims to simplify vulkan

wise viper
#

i would only change the rendergraph api

#

its surface is too large

shadow trench
#

            //By default, boson will inject `#define the_shader_type_in_lowercase`
            //for example, the first shader will have `#define vertex` added to the top of the file before compilation
            //and the second shader will have `#define fragment`

#

Yeah

#

This looks fishy too

wise viper
#

i guess also the swapchain api is pretty big

#

i wouldnt care about that, id make that smaller as well

shadow trench
#

I don’t understand why you’re expected to create semaphores yourself and then pass them in unmodified

#

Kinda weird imo

wise viper
#

yea

#

the rendergraph should do all sync

#

dont know why that is needed, its unnessecary

shadow trench
#

Though it’s interesting to see another approach to essentially what I’m doing

wise viper
#

how old is this?

#

i think a few months

#

🤓 let me see phobos now

#

hmhmhm

#

immediately sussy on the gpu selector

#

can the requirements have a scale or rating? Or will it just pick the first in the list with all requirements set?

shadow trench
#

Picks the first right now

#

Im actually interested to see how the boson thing handles descriptor sets and resource lifetimes

#

Does it expect you to do that yourself

wise viper
#
 // Bind some physical resources to the render graph.
            let mut bindings = PhysicalResourceBindings::new();
            bindings.bind_image("swapchain", &ifc.swapchain_image.as_ref().unwrap());
            let cmd = exec.on_domain::<domain::Graphics, DefaultAllocator>(None, None)?;
            // Record render graph to our command buffer
            graph.record(cmd, &bindings, &mut ifc, None, &mut ()).finish()

Do you have to set all bindings here?

#

every time you call the graph? Also record? Does it re record or just set the resources + validate and runs the graph?

wise viper
#

i helped her with that

#

first impression on phobos good. I like how short the readme program is

shadow trench
shadow trench
#

Right now reusing graphs is kinda not great

wise viper
#

🫡 making rendergraphs is a lot of trial and error

#

i had this exact api in daxa before

shadow trench
#

Yeah, and rust lifetime rules don’t make it easier kek

#

Storing callbacks is hard

wise viper
#

bleakekw Arc

#

nah tbf i spamm my own ref counted ptr in daxa for these things as they are not in high numbers or copied ever

#

automatic renderpass creation, does it merge nodes into single render passes?

shadow trench
#

No, it’s kinda braindead kek

#

The whole rendergraph code is such a mess tbh

wise viper
#

🚨 BUFFER USES 🚨

#

insert nano quote on buffer uses beeing useless (except for descriptor buffer)

mild flower
#

boofer

shadow trench
#

Is it

#

That would simplify things

#

A lot actually

wise viper
#

huuuuh

#

what does it simplify

shadow trench
#

Not having to specify the usage flags, also unifying all the scratch allocators into one

#

Right now you get a scratch allocator for each "common" usage

#

uniform buffer, storage buffer, vertex and index

wise viper
#

the biggest tradeoff i see so far with phobos is abstracting the window

shadow trench
#

but itd be nice if that was just one allocator for scratch mem

wise viper
#

that is nice for getting going and some usability but it serve limits you in the end

shadow trench
#

hmm wdym

wise viper
#

do you support any multi window?

wise viper
shadow trench
#

not atm no, its been somewhere on my radar but i havent investigated it enough

wise viper
#

for all buffs

shadow trench
#

yeh thats a lot easier

wise viper
shadow trench
#

hmm yeah thats true

wise viper
#

but you will definetly have higher adoption if you have a simple path

shadow trench
#

the simple path could probably be an abstraction over the explicit one

wise viper
#

yea

shadow trench
#

i will ponder the windowing issue

#

thanks for the insight froge

wise viper
#

i mean it doesnt really matter tho

#

the windowing

#

99% of cases you wont need it

#

just some randome thing i saw

#

accidental bikeshed induction is my greatest strength

shadow trench
#

it doesnt until i suddenly want multi window support in my own programs :P

wise viper
#

👍

#

geneerallyi would only ever support things that is actually needed

#

otherwise you will impl things that wont be used

#

thats dummmm

shadow trench
#

yeah thats true

#

i mostly add features as I need them myself right now anyway

#

A lot of random vk commands are just not implemented because i havent used them yet

wise viper
#

based

#

👹 i still need to implement rt pipelines in daxa i am putting that off for nearly a year now

shadow trench
#

rt pipelines are somewhat annoying because they are ever so slightly different from normal ones

wise viper
#

i need to convince people of bindless

#

i am on a cruisade

shadow trench
wise viper
#

but gl like bindings that phobos has a rea also super ez to use

#

so nothing against that

#

btw cods rendergraph team made a presentation rescently

shadow trench
#

oooh i should watch that

shadow trench
#

its just not the default

wispy ore
wise viper
#

frog_think '

wispy ore
#

4 uints of pushconstant mapping into two bindsets (descriptor index and array offset) which map into up to 16 other descriptors (or inline parameters) is what I do

#

D3D12, so no BDA

#

think this is the closest thing to BDA you can get

wise viper
#

that is just normal bindless

#

which map into up to 16 other descriptors (or inline parameters)

#

idk what that means

#

d3d12 ah, no clue about that

#

i thought you can just index the heap there

shadow trench
#

do you not have unbounded descriptor arrays

#

in d3d12

wispy ore
#

It's more like a restriction I made to make allocation free

#

we have better things than unbounded descriptor arrays lol

shadow trench
#

ah lol

wispy ore
#

You can just

#

cast descriptors essentially in hlsl sm6.6

#

directly indexing the descriptor heap

wispy ore
#

You have pushconstants

wise viper
wispy ore
#

I use them to index into an indirection table which has 16 uints of size

#

they are freely chosen

#

templated

wise viper
#

in vulkan i only need 4

shadow trench
wise viper
#

yea it is

#

vulkan nearly got that as well btw

#

but nooo glsl must stay garbage

shadow trench
#

😔

wispy ore
#
    template<typename T>
    T load(uint index)
    {
        ByteAddressBuffer buffer = ResourceDescriptorHeap[NonUniformResourceIndex(handle.read_index())];
        return buffer.Load<T>(index * sizeof(T));
    }
wise viper
#

that cant do atomics tho

#

or fine grained stores

wispy ore
#

and handle.read_index() is just returning the index (I have write index as well for RW access)

wise viper
#

honestly hlsl is less usable then glsl

#

its buffers are unacceptable

#

when hlsl gets buffer pointer tho

#

uuuuuuuh that will be the day

wispy ore
#

but my answer to that some time last year was "they can't share anything about it" KEKW

shadow trench
#

was devsh not working on something related to that

wise viper
#

yes

wispy ore
wise viper
#

devsh hired someone from khronos to implement it in hlsl

wispy ore
#

well

#

you can use spv intrinsics in hlsl

#

so with enough abstraction or some macros you can get BDA-like interfaces

wise viper
#

because you must load and store

wise viper
#

so you have to do
byteaddressBuffer.Store<FieldT>(structaddr + fieldoffset, value);

#

in effect you must hardcode struct offsets

#

which is insane

wise viper
#

it wont ever be nice to use

#

because hlsl doesnt have references yet

#

(that will come as well tho)

wispy ore
#

It'd be nice to have offsetof in hlsl

#

then it'd not be as bad with atomics

wispy ore
shadow trench
#

that looks quite nice

wispy ore
#

yeah although I did have to implement all the texture and buffer load/store/sample/gather functions KEKW

hot yarrow
#

reminds me of gltf

potent quest
#

one must understand what falling into the depths must feel like before they rise like a pheonix

wispy ore
potent quest
#

now i felt the depths

#

now i can rise to rust

#

the vulkan -> vuk -> valorant -> phobos-rs pipeline is wild

coarse yoke
#

apparently i will be using phobos soon?

#

i have the first three requirements met

potent quest
#

join the pipeline

shadow trench
#

Time to rewrite it in rust

wispy ore
#

I will never give in KEKW

shadow trench
#

One day

potent quest
#

With how the foundation going implode might be right bleakekw

potent quest
#

Not giving in to rewriting it in rust

#

It’s joever at the foundation

young oar
#

Lol true

#

Other than that rust is pretty cool ngl

potent quest
#

Yo penguin

#

Dont feel rushed but when is the drop of nightly rust?

#

like vaguest of in progress

shadow trench
#

you mean phobos without nightly?

#

i kinda have exams rn but i can try to push a fix today

mild flower
#

you can probably skip an exam and still pass

shadow trench
#

its only software design how hard can be it

mild flower
#

lol I was just standing and a spider dropped in front of my face while searching for the perfect gif

shadow trench
mild flower
#

Live spider reaction

shadow trench
#

interesting looking spooder

mild flower
#

It's floating like 15cm from my phone

shadow trench
#

🕷️

mild flower
wise viper
#

floor + door leak

shadow trench
coarse yoke
#

this is true

#

if you're writing foo bar functions on repeat

young oar
#

"Terrain Generation Using Procedural Models Based on Hydrology"

shadow trench
#

👀

#

Definitely

coarse yoke
#

ctrl+f time, see first result

The overall time necessary
to create the input slope maps was less than five minutes.

#

uh oh 😃

#

actually i'm not sure what that's referring to, the execution times seem shorter

young oar
#

I don't think they mentioned anything bout realtime

#

Pretty slow-ish though

#

The rivers in their system look pretty good though so it's alr

coarse yoke
#

but artist tolerable is

young oar
#

Yea you right you right

#

I've been so into proc gen these past few years that I forgot that's how it usually is lol

coarse yoke
#

my procgen stuff at work aims at roughly like under a second per square km, but that's completely arbitrary

#

seems to be a good requirement to hit

young oar
#

Mine is under 2ms for a volume of 64x64x64 (GPU compute)

#

And to think that I thought my old Unity terrain (which took 300ms per 32x32x32 chunk) was good

#

🥲 good times

#

Unfortunately most of the time is spent generating chunks that are empty anyways

#

So if I somehow figure out how to early exit for those it should significantly boost performance

shadow trench
#

That’s not too bad for editor stuff

shadow trench
#

@livid geode @potent quest without fsr2 phobos no longer requires nightly

#

use 0.9.2

potent quest
#

bet

#

would i be fine using the latest commit?

shadow trench
#

yeah, thats the same

#

you should probably fix the commit though to make sure it doesnt break until youre ready to update

#

git = ..., rev = ...

coarse yoke
#

terrain when 🙂

shadow trench
#

some time after exams ill do more work again

coarse yoke
#

ah fair

shadow trench
#

but i also go on holiday for 2 weeks so i wont have access to my pc for a bit

#

i can definitely do shader graph stuff on my laptop though

coarse yoke
#

the school cycle no longer exists to me now that i am not in it 🙂

shadow trench
#

(if i find my charger)

potent quest
#

school ends on thursday
trust me ill ray trace then (i will proceed to procastinate on levels never seen before)

shadow trench
hot yarrow
#

havent posted a screenshot lately pengu 🙂

#

any progress?

shadow trench
#

havent done anything lately 😔

hot yarrow
#

trapped in factorio/satisfactory?

shadow trench
#

a mix of studying and ori and the will of the wisps

#

mostly studying sadly

nimble solar
#

Last year exam season was pretty chill

#

This year it's hell

#

9th circle of hell

shadow trench
#

quite relatable

nimble solar
#

It's not even the difficulty, it's the sheer nerve of the professors to go on random trips, abandoning us to our fate

#

And letting us know exam dates the day before

shadow trench
#

wtf

nimble solar
#

The exam itself is in quantum superposition, we know the probability of it happening on each day of the month, we can't pinpoint it

shadow trench
shadow trench
#

I also fixed the shader thing in the egui integration

#

It just ships the compiled ones now

livid geode
#

ill try to compile the rex editor tomorrow

shadow trench
#

epic

#

lmk if theres any issues

livid geode
#

i forgor

polar muralBOT
#

Alright aleok, I'll remind you about compile rex in 1 day. ID: 58288669

#

Successfully removed reminder.

#

Alright aleok, I'll remind you about compile rex editor in 13 hours, 33 minutes and 52 seconds. ID: 58288704

livid geode
#

there

hot yarrow
#

would have been funny if it was 13 hrs 13 mins and 13 secs

shadow trench
#

lol

young oar
#

If you ever will implement procedural gen

#

I found a nice height function that will create some dunes

shadow trench
#

looks quite nice yeah

#

procedulal gen is somewhere on the radar

young oar
#

Compute proc gen is sooo much fun

shadow trench
#

unfortunately the radar is obscured by exams bleakekw

young oar
#

Hs exams though so much less important but still

shadow trench
#

also much easier kek

#

but yeah

hot yarrow
#

that looks neat

coarse yoke
# young oar

-abs(perlin(coord)) + perlin(coord * vec2(1,20))? 🙂

young oar
#

Well yea that's the main part lol

#

Here I'll send full source code

#
float spikey = snoise(position.xz * 0.001) * 0.5 + 0.5;
spikey = clamp((spikey - 0.5) * 1 + 0.5, 0, 1); 

biome1 = (1 - spikey) * snoise(position.xz * 0.001 + vec2(snoise(position.xz * 0.0002)) * vec2(1.3, 0.2)) * 60;
biome1 += (1 - spikey) * sin(dot(position.xz, vec2(1, 1)) * 0.01) * 60;
biome1 += (1 - spikey) * cos(dot(position.xz, vec2(0.2, 2)) * 0.001) * 45;

biome1 += spikey * abs(snoise(position.xz * vec2(2.1, 1.0) * 0.002)) * 60 * cellular(position.xz * 0.001).x;
biome1 += position.y;
#

The oriented sine waves really make it look interesting

shadow trench
#

i remember seeing something like this in #wip

#

not too long ago

young oar
#

I wrote the function under 20 mins so it wouldn't be surprising if it was implemented before lul

shadow trench
#

Lmao

coarse yoke
#

good dunes are hard to do without simulation

young oar
#

For sure yea

coarse yoke
#

imo you can take the -sin(coord.x) and do some domain distortion on it, but you need the max slope/erosion step as a post process

young oar
#

Right

#

I'm thinking of using a rotated -abs(snoise()) so it aligns with the "wind" dir

#

Cause atm all the ridges are uniform and they're going in all directions

#

Also there's a sphere at 0, 0

#

Probably due to unshifted cos / sin lol

shadow trench
#

Lmfao

#

Ominous floating ball

young oar
#

Implemented terrain CSG operations without actually implementing them GG ez

#

Wait no I'm just extremely dumb and I forgor to remove debug sphere

coarse yoke
#

rotating perlin will just rotate the artifacts

coarse yoke
#

perlin is meant to be direction agnostic, it's not because of artifacts

#

but they're not a good thing to use because you don't have much control over them

young oar
#

Ohh sorry mb I didn't mean direction as in perlin direction

#

I just mean I literally take the input point and rotate it

#

Which makes the noise aligned with a specific angle

coarse yoke
#

ah with the stretch

young oar
#

Yepp

coarse yoke
#

that doesn't work sometimes because many noise inputs take a scale value, so to do that effect you'd have to rotate outside of the noise, and it'd end up being rotate->scale

#

but i guess it works if you can scale->rotate 🙂

young oar
#

Makes sense yea

nimble solar
#

hi

#

Mr. NotAPenguin, can I observe your descriptor set / descriptor pool api

shadow trench
#

cmd_buf.bind_uniform_buffer(0, 0, buffer) kek

#

Literally OpenGL

nimble solar
#

Yes but the behind the scenes

shadow trench
#

Right

#

Check out descriptor/builder.rs and descriptor/cache.rs

#

Once I get on pc I can do some more in detail explaining

#

I just need to unbed myself

nimble solar
shadow trench
#

Truly

#

The hardest escape room

mild flower
shadow trench
#

okay

#

@nimble solar

nimble solar
#

I am here

shadow trench
#

So I have a DescriptorBuilder

#

Which just stores bindings in a hashmap or something

#

When you call bind_xxx it just adds a binding to the list

#

On draw() or dispatch(), those bindings are flushed and you get back a struct with all bindings

#

I then have a fancy HashMap<DescriptorSetBinding, DescriptorSet> where thats looked up

#

if it doesnt exist, make a new set and update it immediately

#

If it does, use that one

nimble solar
#

I don't see how per frame descriptors are handled

#

How can you guarantee 2 equal descriptor bindings will result in different descriptor sets based on the frame index

shadow trench
#

Why should they have to

#

descriptor sets are never updated

#

Only recreated with new contents

nimble solar
#

🤔

shadow trench
#

Either they point to a different resource (for this frame), so they are different

#

Or they point to the same resource thats synchronized across frames

nimble solar
#
// assume the bindings are the exact same
frame 0 => no desc set: make new one
frame 1 => no desc set: make new one
frame 0 => desc set found, use that (??)```
wise viper
#

bruh

shadow trench
#

In this case it would be

frame 0 => no set, make new one
frame 1 => use previous
frame 0 => use previous
nimble solar
#

Hmmmm

shadow trench
#

As long as you dont vkUpdateDescriptorSets and the resource is synchronized, this should be fine

nimble solar
#

Ah I see

#

yes

#

You hash VkWriteDescriptorBufferInfo as well right?

#

Or whatever the hell its called KEKW

shadow trench
#

Yeah but its a custom struct because vk structs are not nice to work with

#

its translated into that though

nimble solar
#

very gud

#

I understand now

shadow trench
#
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub(crate) struct DescriptorImageInfo {
    pub sampler: vk::Sampler,
    pub view: ImageView,
    pub layout: vk::ImageLayout,
}

#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub(crate) struct DescriptorBufferInfo {
    pub buffer: BufferView,
}

mild flower
shadow trench
#

One thing to note is that the set layout and pool used are hashed with the create info

nimble solar
#

Why?

#

I thought I could get away with

HashMap<layout, pool>
HashMap<Vec<bindings>, desc_set>```
shadow trench
#

Because sets created from different pools are different

#

Same with the set layout

nimble solar
#

Ah

#

yes indeed

shadow trench
#

The pool is kinda weird

nimble solar
#

This means I need one more layer of "hidden shit"

shadow trench
#

The cache holds one descriptor pool it allocates all descriptors from

#

And when it runs out it creates a new bigger one where all new descriptors will be created from

#

Also itll set the pool field of all requested descriptors to this new pool

#

So old descriptor sets wont be caught by the lookup anymore and will be "moved over" to the new pool

nimble solar
#

What does moved over mean exactly

#

recreated and oldies are pushed into the oblivion queue?

shadow trench
#

Yes

#

That way I can get rid of the old pool after some frames

nimble solar
#

Why not just make new pool and let the old ones live

#

poor things

shadow trench
#

Because then you end up with potentially many pools

nimble solar
#

Hmm

#

I was thinking of allocating pools in pages (assuming non-bindless layout)

shadow trench
#

you only really need one pool though

#

as long as its big enough

#

so this approach just converges to the needed pool size over time

nimble solar
#

It degenerates if I allocate only storage buffers or only uniform buffers though

#

I mean

#

I will only allocate, realistically

#

2 descriptor sets

shadow trench
#

no because it only grows for the type it ran out of

nimble solar
#

maybe 3

nimble solar
shadow trench
#

so suppose the current size is
UNIFORM_BUFFER, 1
STORAGE_BUFFER, 2
and you allocate 3 storage buffers, it grows to
UNIFORM_BUFFER, 1
STORAGE_BUFFER, 4

nimble solar
#

regarding cmd_buf.bind_uniform_buffer(0, 0, buffer)

#

Does this add an entry to the descriptor builder

shadow trench
#

yea

nimble solar
#

when do you build()

shadow trench
#

draw() or dispatch() (but only if there are unflushed changes)

#

(or trace_rays)

nimble solar
#

I don't see draw_mesh_tasks_ext, disappointed

shadow trench
#

one day

nimble solar
#

what does "unflushed changes" mean thonk

shadow trench
#

no calls to bind_xxx since the last draw

nimble solar
#

how many hashmaps do you have

#

fucks sake

shadow trench
#

many

#

let me check

#

could be worse

#

though there are a coupl instances of the last one (every "create if not exists" cache uses that)

nimble solar
#

mfw vulkan needs a relational database

shadow trench
#

vulkan backed by sql

nimble solar
#
create table if not exists DescriptorSet (
    pool,
    layout,
    bindings,
    foreign key (bindings)
)```
wispy ore
#

oh god

#

and it's lowercase as well

mild flower
#

I took one SQL class and simultaneously passed while not knowing wtf I was doing

shadow trench
#

yeah i had one databases class last year

mild flower
#

that was the moment I learned I was not destined to be anywhere near a web backend

#

well tbf, I barely passed my first graphics class and didn't know what I was doing in that either

shadow trench
#

i have my first graphics class next year

#

im kinda excited

nimble solar
#

"ok students today we will be learning OpenGL 1.1"

shadow trench
#

no i think it focuses on raytracing theory

mild flower
#

if you haven't done ray tracing yet, it should still be interesting

#

but if it touches on graphics APIs then I'm certain you'll be utterly bored

shadow trench
#
  • intro to raytracing
  • camera and perspective
  • transformations and scene graph
  • shading
  • rendering equation
  • shadowing and direct lighting
  • acceleration structures
  • advanced visual effects
  • texture mapping
  • production context (?)
mild flower
#

u're gonna wreck that class fr

shadow trench
#

probably

#

but should be fun still

nimble solar
shadow trench
#

theres also computer graphics 2, which has

  • advanced GI algorithms
  • shape and shape analysis in computer graphics
  • perception in computer graphics
  • alternative evaluations of visibility calculations
#

the only thing i recognize is GI

#

lol

#

theres also a project class for actual implementation

mild flower
#

the third one could be anything

shadow trench
#

looks like its focused on raytracing

#

might try to convince my professor to let me do it in vk kek

nimble solar
#

you had your acceleration structures and ray trasversal functions to help you

#

I did my balls in GL

#

with only the power of god and anime on my side

shadow trench
#

GL more like Giant L

#

maybe my master thesis can be some cool graphics project

nimble solar
#

look at my balls

shadow trench
#

where denoiser

nimble solar
#

No temporal accumulation because it broke

mild flower
#

nice balls

shadow trench
#

oh

#

i member my temporal shadow accumulation painting my entire scene red

#

and making transparent shadows

#

somehow

nimble solar
shadow trench
#

it was very broken

mild flower
shadow trench
#

most annoying part of the masters programme is i have to pick some nonsense classes to take

mild flower
#

do you have to do the master's program

shadow trench
#

I mean I can also just call it here I guess but eh

mild flower
#

don't want to become a corporate wage slave just yet, huh

shadow trench
#

exactly

#

"history of computer science" seems easy enough

#

"AI ethics" too

#

adds up to the min amount of nonsense I have to take

mild flower
#

AI ethics? just have them do whatever the law says dummy

warped beacon
#

Just watch some Robert Miles

shadow trench
warped beacon
#

Easy

nimble solar
#

The only masters in my uni is AI

#

😦

shadow trench
#

we have 6 main options

#

distributed systems, safe software, AI, software engineering, human-computer interaction (big pog), computational cs

nimble solar
#

human-computer interaction is just permament bikeshed over how to handle glfw input

shadow trench
#

it has graphics, image processing, visualization, etc

livid geode
mild flower
#

mine only has a masters in computer science 💀

nimble solar
#

I kinda want to move and go to a bigger uni

#

only problem is that I'm broke 💀

shadow trench
#

are you stuck in the us of a

nimble solar
#

good old EU

nimble solar
shadow trench
#

real

nimble solar
#

and the only masters here is AI

livid geode
shadow trench
#

truly

mild flower
#

I went to a gamedev college so fortunately 90% of my classes were relevant to things I'm interested in

wispy ore
shadow trench
#

my cousin went to a gamedev college

nimble solar
#

btw the "I'm broke" problem is just cause moving costs money

shadow trench
#

but not for coding

#

he did art stuff

nimble solar
#

University costs 0€ (actually 160€ but they give it back if you are an exellent student KEKW )

livid geode
#

i ended up not going to cs because i was kinda predicting it was all going to be terrible java and c

shadow trench
#

now hes working for some game studio in berlin

mild flower
#

Bsc

wispy ore
#

nice

#

most gamedev schools I've found were ba

mild flower
#

I specifically avoided the art and game design departments lol

wispy ore
#

yeah

#

understandable. game design degrees are somewhat memeable

mild flower
#

Yeah

shadow trench
#

yeah just make a good game bro

mild flower
#

Plus the one at my school overworks students to hell

wispy ore
#

think university of breda or some other dutch uni had a gametech degree

shadow trench
#

take voxels

wispy ore
#

there's also digipen ofc.

shadow trench
#

add battlepass

#

add hyperrealistic graphics

#

you have game

wispy ore
#

but both of those are private-ish or fully private unis

#

so they are expensive (for european standards) KEKW

mild flower
#

I went to a school that is notorious for overworking students, but fortunately through the power of friendship I passed

shadow trench
#

the power of copying each others work?

nimble solar
wispy ore
#

Overwork how?

nimble solar
#

I have a team of 2 other boys, we share basically everything KEKW

nimble solar
#

Like it's happening to me right now

wispy ore
#

just don't take that many courses

#

easy

shadow trench
#

i share a lot of stuff within my friend group but we also have large wikis with material from previous years

nimble solar
shadow trench
#

old exams, solutions, notes, etc

mild flower
#

certain classes that assign an absurdly high workload (particularly our project classes, where we're expected to pump out 1-2 complete games a year)

wispy ore
#

where are you again?

mild flower
#

who, me

wispy ore
#

In Europe finishing STEM degrees in "Regelstudienzeit" (3 years, 6 semesters) is a meme

nimble solar
#

That is correct

wispy ore
#

@nimble solar I meant

nimble solar
#

I think nobody ever finished the degree in 3 years + 1 semester

#

Even so I want to believe KEKW

wise viper
#

my uni had stats on it for compsci

#

median was 9 semesters

#

only 10% made the 6

wispy ore
#

I know some people who did but they either had previous working experience or already had some other degree or they were "super intelligent" so to speak

shadow trench
#

if i pass the exams i have to retake ill get there in 3 years

#

but

#

algebra

wispy ore
#

none of those represented an average student

shadow trench
#

analysis

nimble solar
#

Algebra is fine

shadow trench
#

is it really

wispy ore
#

algebra is completely fine

#

yeah

nimble solar
#

Complex Analysis is the real problem

wise viper
#

math is the best part by far

shadow trench
#

i only have to take real analysis luckily

wispy ore
#

From all courses I've taken, the math heavy ones are the ones that sticked the most

shadow trench
#

tbf the math courses are quite fun

#

but also hard

nimble solar
#

||I'm actually below average||

shadow trench
#

im taking optional extra math

#

(as opposed to business nonsense)

wispy ore
shadow trench
#

i mean there are the unis that have like 75% programming in their cs programme

wispy ore
#

Mine is very maths heavy

#

like very KEKW

nimble solar
#

I somehow managed to get 36 credits in one semester, I did Calc 1,2 and Real analysis

#

btw calc 1 also includes algebra, geometry & stuff

shadow trench
#

im taking 36 each semester too this year

mild flower
#

44% of students graduated within 4 years at my skool

nimble solar
#

Even weirder, I passed with nearly full marks on each of them KEKW

wispy ore
#

Okay just for clarification

#

when we talk algebra do we mean abstract algebra

shadow trench
#

abstract algebra

nimble solar
#

ah

shadow trench
#

i also have a whole 6 credit geometry class but thats really fun

nimble solar
#

I thought the easy algebra

shadow trench
#

projective geometry is kinda cool

wispy ore
mild flower
#

Oops

wispy ore
mild flower
#

You're the third person to tell me that

#

1 2 tie a shoe

nimble solar
#

text rendering is hard

wispy ore
mild flower
#

inshallah Arabic script will be rendered properly

wispy ore
#

and linear algebra

nimble solar
#

easy algebra is linear algebra ye

shadow trench
#

we had a separate linear algebra class

#

and then an optional abstract algebra one

wispy ore
#

yeah we had linalg and quite a bit of abstract algebra

mild flower
#

I wish I got into graphics before taking (and nearly failing) my linear algebra class

livid geode
mild flower
#

I would have cared so much more about my math classes

wispy ore
# shadow trench abstract algebra

Given an epimorphism phi: R->F, R being a ring and F being a field, prove or disprove that the existence of phi implies that R must also be a field

#

stuff like that KEKW

shadow trench
#

yes

#

that could definitely be an exam question

#

its kinda cool but the exam was just words words words

wispy ore
nimble solar
#

deccer would love lin and abstract algebra

#

lots of "isms"

shadow trench
#

true

mild flower
nimble solar
#

homeomorphisms, endomorphism, monomorphism

wispy ore
shadow trench
#

sounds like an exam i would fail

#

(i did)

#

i have to retake it in august

mild flower
wispy ore
shadow trench
#

gonna spend my summer studying algebra

#

i just really want to pass this geometry class

wispy ore
#

from now on it's only downhill KEKW

nimble solar
#

real

#

I'm 21 and falling apart already

wispy ore
#

imagine being 21 bleakekw

shadow trench
#

im only 20 NanaStare

#

21 soon ish though

#

3 more months until old age

wispy ore
#

I don't even have my b.sc yet and I'm 25 bleakekw

nimble solar
#

if I don't die first, I am expected to graduate next year

#

emphasis on the "if I don't die first"

#

Third year is going to be absolutely brutal

wispy ore
#

objective: survive

#

I mean at the very least you don't have to look for work whilst studying

#

I assume

nimble solar
#

fortunately

shadow trench
#

welp time to head to uni to study, i require ac

#

my room is on the 4th floor its a death trap in here

nimble solar
#

ye we bikeshedded too much, it's time to do the boring study

wispy ore
#

wdym it's only 36°C or so in the middle of my room as example, perfect to die slowly

shadow trench
nimble solar
#

one human, cooked medium rare

wispy ore
#

Like what do you mean the power of the real numbers to the real numbers in a cartesian product?

mild flower
#

I'm glad I never progressed to abstract math of any sort

#

linear algebra was already pushing it bleakekw

wispy ore
#

Honestly

#

I wanted to take this course

#

I think topology is very interesting

#

but I don't think I would pass this course any time

#

Because just looking at the script/notes looks like you need a maths degree to understand it in the first place

wispy ore
#

(it's a maths undergrad course to be fair and I'm doing SWE which is 90% CS KEKW )

shadow trench
#

What does that even mean

wispy ore
#

I think

#

it is supposed to be a topological space

#

but I am not sure KEKW

#

oh

#

So apparently it's the topological space of real valued functions

shadow trench
#

Ooh

#

Hmm

#

Nope not doing it for me

wispy ore
#

actualy not a topological space but apparently the set of real valued functions

#

but probably with some special property?

#

idk, looking into those 1000+ page "notes" without being able to search for that definition is a bit tricky KEKW

shadow trench
#

Yeah lol

#

Wait I think I sort of understand where it’s coming from

#

Alright

young oar
#

Much faster compared to the default STD one as long as you don't mind not having DOS protection iirc

shadow trench
#

Yeah I’ll do that eventually probably

young oar
#

Don't you love it when activating shadowmaps increases your frame timings from 4ms to 8.5ms

shadow trench
shrewd lynx
#

Wavyyy

#

@young oar btw did you try implementing hex tiling

young oar
#

Never heard of it. I presume it's a method to reduce tiling?

#

If that's the case then I will definitely implement it when my exams are over

shrewd lynx
#

Hex tiling then rotate the uvs

young oar
#

Sweet yea I'll implement it

#

Unfortunately my terrain frag shader isn't really modular atm (just one frag file) so it's a bit of a pain to implement custom materials and such

coarse yoke
#

i do not understand

#

what do you use hex tiling for

shrewd lynx
coarse yoke
#

how does hex tiling remove texture repititions

shrewd lynx
#

I didn't really implement it yet

#

But here it is

#

There is also schotastic texturing

#

Here it is on gtasa

wispy ore
coarse yoke
wispy ore
coarse yoke
#

i guess the borders aren't straight

#

but still it feels unfair to compare basic UV tiling with this when you're calling it hex tiling

#

ah nvm the heitz paper has more

wispy ore
#

I think you could do this with a square grid

#

but then you would require an additional sample?

coarse yoke
#

ye

#

so the hex tiling gives you properties that make it easier to blend random sub-sections from your surface

young oar
#

I'm already at 27 texture samples worst case scenario and 9 in best case scenario, I should probably optimize that before implementing hex tiling and making it worse lol

shrewd lynx
#

Why do you have 27

#

Are you using blended textures?

young oar
#

Exactly

shrewd lynx
#

Classic

young oar
#

And with triplanar mapping (which samples it 3 times already)

shrewd lynx
#

I ditched triplanar for that reason

young oar
#

I really should too lol

#

I could use something like biplanar

#

Seems like it doesn't have that many artifacts

nimble solar
#

sir penguin

#

how exactly is self.deferred_pool_delete.push(new_pool); safe?

#

The pool has no way of knowing whether it still has descriptor sets allocated from it does it?

#

In my case it should work? I think?

#

Because the pool is ref-counted, so when I swap it out with the new one, only the descriptor sets previously allocated hold a reference to the pool

#

So eventually, after enough frames pass, the cache releases all descriptor sets with the old pool, deleting the thing safely

shadow trench
#

so the descriptors get deleted first

nimble solar
#

I see

#
while is_open {
    set = device.make_set() // this grows the pool, all previous sets are unreachable, TTL: N
    // N frames pass, descriptor sets are freed
    // N + 2 frames pass, the descriptor pool is freed
}```
#

makes sense I think

shadow trench
#

Something like that yeah

nimble solar
#

By the way

#
pub fn with_descriptor_set<F: FnOnce(&DescriptorSet) -> Result<()>>(
    &self,
    bindings: DescriptorSetBinding,
    f: F,
) -> Result<()>```
#

There's no way this isn't a syntax error, is there?
nervous

#

This is harder to read than C++ wtf KEKW

#

Oh wait, I got it

#

jeez, < and > were a mistake

shadow trench
#

Oh yeah the reason that’s a thing at all is because you can’t return something that references a locked mutex owned by your struct

#

Even if you wanted you can’t make that safe sadly

nimble solar
#

You gotta love Type 0 languages, where Result<()>> somehow is a valid sequence KEKW

shadow trench
nimble solar
shadow trench
#

If you don’t return the lock it’s obviously not safe

#

If you return the lock + value referencing it you get a self referencing type which is a nightmare in rust and generally not possible

#

(You can’t move them)

#

(Which means you can’t return them either)

nimble solar
#

Hm

#

sounds like a rust thing

shadow trench
#

It is

#

The solution is to just pass a callback that does something with the value behind the lock

coarse yoke
#

@young oar #wip message
fyi good materials are a large part of making terrains look especially good

#

i dont mean good assets even necessarily

#

just height + slope based with good noises

shadow trench
#

it could yeah

#

i try to catch OOM before allocating though

#

but it could also fail due to device lost or other random bugs/errors

#

so I tend to propagate that result upwards

nimble solar
#

github search is garbage, I can't seem to find your OOM detection

shadow trench
#

actually

#

yeah it does just catch the oom lol

#

guess i was lazy

shadow trench
#

much easier to navigate in intellij

nimble solar
#

I might KEKW

#

I'd have to install rust

shadow trench
#

its easy

#

(and you should anyway) kekw

nimble solar
#

I don't really understand how descriptor pools work tbh

shadow trench
#

in vulkan in general or in phobos

nimble solar
#

Allocating a descriptor set with a descriptor layout means reserving pool memory for all descriptors in the layout?

shadow trench
#

only for that set, not the whole layout

#

a descriptor set is just a blob of memory

#

descriptor pools are an abstraction for an allocator for that memory

nimble solar
#

So does vkUpdateDescriptorSet reserve memory

shadow trench
#

no

#

vkAllocateDescriptorSets takes memory from the descriptor pool

#

vkUpdateDescriptorSet just writes to it

nimble solar
#

Hm

#

The spec says this:

the allocation may fail due to lack of space if the call to vkAllocateDescriptorSets would cause the number of any given descriptor type to exceed the sum of all the descriptorCount members of each element of VkDescriptorPoolCreateInfo::pPoolSizes with a type equal to that type.
#

How does vkAllocateDescriptorSets know how many descriptors I'm going to be binding

shadow trench
#

you give it the set layout

#

the set layout describes how many descriptors can possibly be inside the descriptor set

nimble solar
#

Hm

#

Does this go boom?

#

Actually scratch that

#

I think this should work

auto set = device.allocate_set();
auto new_sizes = hash_map();
if !set { // OOM
    for each binding in bindings {
        for each size in device.pool().sizes() {
            if binding.type == size.type {
                new_sizes[size.type] = std::max(size.count * 2, size.count + binding.count);
            }
        }
    }
}```?
shadow trench
#

thats pretty much what I do yeah

#

execpt I dont bother with max, I just multiply by 2 and retry if it fails again kekw

#

max would probably be smarter

#

i think thats pretty much grow_pool_size

#

yk you could also switch to rust and use phobos and not have to figure this out Troll

nimble solar
#

After I get tired of writing my own thing who knows

#

If this was in C++ you might've had a better chance

shadow trench
#

it used to be

#

but it was worse

young oar
#

I haven't implemented a "post-process" step for my voxel generator yet so it can't switch materials based on normals yet

#

I'll have to implement my CPU graph representation and an interpreter that will convert it to GLSL to be able to have custom voxel "passes"

potent quest
#

Penguin

#

I was going through your C++ handles

#

How do you handle invalidating them?

potent quest
#

Ohh none

#

ig you have it so it manages itself and you don't have a need for a HandleManager

#

Also within your phobos-rs code

#

I'm so confused

#

How are you able to create Result<Type> without specifying the Error type?

hot yarrow
#

do you need a specific error type?

#

or usually just a string, with the error message

potent quest
#

Ohh looks like pengiun is using a library anyhow which overrides Result

#

I'm confused what it does? ?

#

It looks like an equivalent of Box<dyn Error>

shadow trench
#

Yeah thats a fancy Box<dyn Error>

#

Ill eventually phase it out for phobos::Error, Im just lazy

potent quest
young oar
#

I use thiserror

potent quest
#

Alright thank you

young oar
#

It helps so much for creating custom Error types

shadow trench
#

anyhow is just so convenient

#

yeah thiserror is nice

potent quest
#

But why not use Box<dyn Error> instead?

shadow trench
#

anyhow has more fancy utilities

#

like anyhow!("Some formatted error {}", i);

#

or ensure!(x <= y, "fuck it we ball {}", x);

young oar
#

Ooh that is pretty convenient yea

#

Unfortunately when unwrapping Result<_, T> where T: Error implemented from thiserror it doesn't return the custom error message

#

Which sucks

potent quest
#

Ohhh anyhow provides debug and traceback formatting

#

that makes sense

#

Me when lib.rs declares all the methods at a global level and I have no clue where they come from KEKW
Its very unfortunate that both phobos::Window and winit::Window exist

shadow trench
potent quest
#

bleakekw look im trying

#

Does C++ have like a rust equivalent of Result<T, E>?

nimble solar
#

Safest C++ code

potent quest
#

or am i gonna have to do a very dumb down implemenrtation

nimble solar
#

of course not KEKW

mild flower
potent quest
#

only jaker can write safe c++

nimble solar
#

No one implements std::expected, it's C++23

potent quest
#

oh KEKW

mild flower
#

You can implement your own. That's the beauty of see pee pee

potent quest
#

i see see

shadow trench
#

I mean

young oar
#

see sharp

shadow trench
#

Id argue a good standard library impl is better than dozens of result types from different libraries incompatible with each other kek

nimble solar
#

Just use asserts and use out params + enum return type

shadow trench
#

the C way

potent quest
#

real i'm trying to do both my c++ ray tracer and the rust ray tracer at the same time
One i feel pain and the other im confused

nimble solar
#

the easiest way

shadow trench
#

the confusion will fade

#

clarity of mind will be achieved

#

enlightenment is within reach now

potent quest
#

Coping that i do attain it

wise viper
potent quest
wise viper
#

the rust way is the best usually

#

and aa easy

nimble solar
#

I agree, but do not have rust in C++

shadow trench
#

I really really like rust's error handling

#

Probably one of my favorite parts

potent quest
#

time to rewrite it again KEKW

nimble solar
#

I mean try it

#

I did write a couple std::expected's

#

I never enjoyed how it worked, because C++ is garbage

young oar
nimble solar
#

You can't really do anything rust does with errors

shadow trench
#

The annoying part is you need some sort of language support to have rust's try operator (?)

nimble solar
#

Yes

#

You can't really emulate Rust's Result

#

std::expected is but a mere imitation

potent quest
#

ya i just want the bare bones of it

#

i literally just wanted a way to know if something worked or failed and some methods that could handle it nicely like .expect or .unwrap

Safety is KEKW

nimble solar
#
bool func() {
}```
#

my brother in CPP

potent quest
#

oh yeah i did overengineer it

#

i mean just a struct with a template of a type and an error type

#

What is futures

#

ahh so many crates

hot yarrow
#

hehe