#Phobos - Vulkan abstraction library in Rust

1 messages Ā· Page 2 of 1

iron shadow
#

LMAOO

#

IT FIXED ITSELF

#

IDK WHAT I DID

#

BUT I DID SOMETHING

#

🄳

#

WOOOOH

#

SPONZA NEVER HAVE I BEEN EVER HAPPY TO SEE YOU

#

i am crying rn i figured it out. i set the # of instances for my build_info's range but didn't do it for querying the build size 😭

night charm
#

Ahhh

#

Lmao

#

That’ll do it

languid fern
#

My laptop 1050 starts slowing down at around 3m triangles which is pretty amazing of itself

#

So if a desktop 2080 ti is getting bottlenecked by a single 1m tris then something must be very wrong

iron shadow
#

oh no it loads fast now

#

idk if i should multithread it and make it concurrent

#

eh premature optimization is bad

limber rapids
#

I can reach nanite level of performance with a single thread, you're good

iron shadow
#

KEKW UE5

limber rapids
#

Strictly in terms of triangles/s KEKW

iron shadow
#

fellas

#

im proud to announce

#

after years, decades, centuries

#

monke

#

i think i did the rotation wrong however ;kek

iron shadow
#

so how would define

#

the .transform

#

I'm so confused

#

.transform seems to take in a TransformMatrix type

#

but I cannot find on it's documentation how I would input my floats + vecs

#
let transform = vk::TransformMatrixKHR {
  matrix: [...}
}
phobos::TransformMatrix(transform);

Is not possible as it is a private constructor

#

bro what is there not a way to create a transform matrix with your own transforms. there is literally only identity

#

desperate times call for desperate measures im gonna make a pr

iron shadow
#

uh penguin is texture loading not supported?

#
let image = images.get(gltf_image.index()).unwrap();
            let image_data = &image.pixels;
            let image_phobos = phobos::image::Image::new(
                ctx.device.clone(),
                &mut ctx.allocator,
                image.width,
                image.height,
                vk::ImageUsageFlags::SAMPLED | vk::ImageUsageFlags::TRANSFER_DST,
                get_image_type(image.format),
                vk::SampleCountFlags::TYPE_1,
            )
            .unwrap();

the format is R8G8B8A8_SRGB

iron shadow
#

It keeps saying I need to specify a depth?

night charm
#

You can’t actually construct it with things yet

night charm
#

Image loading should work

iron shadow
iron shadow
#

I simply want to create images for my gltf asset. I also create a buffer to store the image itself, but iirc you don’t need to do anything prior to get images to work, yeah?

night charm
iron shadow
#

Eh i can make a pr tbh if you can’t

night charm
#

The image manages its memory

iron shadow
#

Wait I think I’m screwing up then šŸ’€

#

Where would you specify that actual data of the image

night charm
#

You create a command buffer and upload the data

#

Probably through a buffer-image copy yeah

iron shadow
#

Ohh ok cuz I’m trying to get textures

#

Ah that might be why then KEKW
I was just making an image without doing the copy

night charm
#

Yeah it’s gonna be empty then lol

iron shadow
#

But that shouldn’t be causing any errors thonk

night charm
#

Idk what your full code is

iron shadow
#

Ill share it when i wake up tomorrow

night charm
#

Alright

iron shadow
#

Huh I realized. I should be moving my buffers onto my gpu

#

All of my buffers have been CpuToGpu bleakekw

#

Iirc i make a staging buffer which is cputogpu then add to the command buffers cmds to copy that gpu information over

night charm
#

Yep that’s pretty much it

iron shadow
#

I guess I should also merge all my vertices together into one monolithic one while I’m at it. Wasn;t this called bindless or something?

#

Ah wait nvm it means not making binds (referring to buffers by their bda) im stupid lmaooo

iron shadow
#

Wait there’s no cpu only memory option?

limber rapids
#

HOST_VISIBLE | HOST_COHERENT | HOST_CACHED is CPU_ONLY

iron shadow
#

Ohh it’s been moved into flags I gotcha

iron shadow
#

Penguin

#

here is the exact error:

 ERROR phobos::core::debug             > [VALIDATION]: VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 (-1094930823): Validation Error: [ VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 ] Object 0: handle = 0x1b9bf6ba320, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xbebcae79 | vkCreateImage(): Format VK_FORMAT_R8G8B8_SRGB is not supported for this combination of parameters and VkGetPhysicalDeviceImageFormatProperties returned back VK_ERROR_FORMAT_NOT_SUPPORTED. The Vulkan spec states: Each of the following values (as described in Image Creation Limits) must not be undefined : imageCreateMaxMipLevels, imageCreateMaxArrayLayers, imageCreateMaxExtent, and imageCreateSampleCounts (https://vulkan.lunarg.com/doc/view/1.3.243.0/windows/1.3-extensions/vkspec.html#VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251)
error: process didn't exit successfully: `target\debug\DARE.exe` 
hybrid pilot
#

How DARE.exe you

iron shadow
#

KEKW Danny's Awesome Rendering Engine

hybrid pilot
#

Lol

iron shadow
#

oh shoot

#

mayube srgb is it

hybrid pilot
iron shadow
#

Oh im loading from a file

#

i dont think i can

#

wait nvm

#

i can im a dumbass

#

R32G32B32A32_SFLOAT works idfk why everything else doesn't

#

RGBA seems to only be supported

#

wtf

#

@hybrid pilot yeah that fixed it...? But how tf am I supposed to conform my textures which im loading from gltf to it

limber rapids
#

Are you trying to create an image on HOST_VISIBLE memory

iron shadow
#

My only flags rn are SAMPLED and TRANSFER_DST so I doubt so

limber rapids
#

Show me the create info

#

VmaCreateInfo for the image

iron shadow
#

this is phobos

#
let image_phobos = phobos::image::Image::new(
                ctx.device.clone(),
                &mut ctx.allocator,
                image.width,
                image.height,
                vk::ImageUsageFlags::SAMPLED | vk::ImageUsageFlags::TRANSFER_DST,
                vk::Format::R8G8B8_SRGB,
                //get_image_type(image.format),
                vk::SampleCountFlags::TYPE_1,
            )
            .unwrap();
#

i don't really have access to the vmaCreateInfo cuz:

  1. this is rust
  2. phobo'ing time
limber rapids
#

Huh

#

it's basically always device local

#

You can just look at the source you know

#

Anyways looks like some values are undefined for some reason

iron shadow
#

oh it is but that really shouldn't be causing any issues?

limber rapids
#

Yeah

iron shadow
#

🫔 ethereal bug

#

ill run it through the debugger and see what is causing it

#

thats odd, everything it is complaining about is valid

hybrid pilot
iron shadow
#

seems like a massive waste of gpu memory though

#

ahh ill dig more into it

#

well seems like my gpu only supports r8g8b8a8

#

sadge

limber rapids
#

Wait you were trying to create a r8g8b8 image?

#

bruh

#

Quite literally no GPU in the world supports that format for color KEKW

iron shadow
#

LMAOOO i didn't realize it's not supported whatsoever i was so fixated on the vulkan specs šŸ’€ saying stuff was null

limber rapids
#

Check on GPU info for support

iron shadow
#

yeah thats what i did i was coping maybe gpu didnt support it and my code wasnt broken as my copium came true. the real question is how to convert it all to rgba bleakekw

limber rapids
#

If you are using stb image you can ask it to load all 4 channels regardless

iron shadow
#

i wish froge_sad i'm using the in-built crate loader. doesn't seem like they offer a way to force it all rgba

limber rapids
#

Otherwise you can just do a shrimple conversion

#

I can only speak C++ though so my example will be C++

#
// assume it is a 3-channel texture
auto texture = load_texture();
const unsigned char* data = texture.data;
auto rgba = std::vector<uint32>(texture.width * texture.height);
for (auto i = 0; i < rgba.size(): ++i) {
    texel =
        (data[i * 3 + 0] << 24) | 
        (data[i * 3 + 1] << 16) | 
        (data[i * 3 + 2] << 8) | 
        255;
}
iron shadow
#

its been so long c++ KEKW

#

oh wtf iterating through the array by ptr

limber rapids
#

Less raw version

#

Perhaps more readable to a Rust apostle

iron shadow
#

oh no i havent gotten close to bit stuff yet thats why it's indecipherable

limber rapids
#

It's easy, r8g8b8a8 means 8 bits per channel

iron shadow
#

yeah that makes sense, im just confused about <<

limber rapids
#

You want to convert r8g8b8 to r8g8b8a8, so what you do is shift everything 8 bits to the left, and add 255 or 0xff to the end

iron shadow
#

ohh this makes sense

#

should i ask chatgpt KEKW

limber rapids
#

no

limber rapids
#

written by a human for a human (I assume)

iron shadow
#

big assumptions we're making

#

rust has no way to bit offset

limber rapids
#

wat

iron shadow
#

i think ill have to do that manually then sadge

limber rapids
#

You have no << in rust

iron shadow
#

no

#

afaik

limber rapids
iron shadow
#

wtf

#

i couldn't find it šŸ’€

#

oh wait there is a better way so i can also support multiple component counts

hybrid pilot
#

like you have your u8 vec and you do .chunks(3).flat_map(|p| [p[0], p[1], p[2], 255])

iron shadow
#

im trying to figure out a way to have it work across all the possible types
thonk

limber rapids
#

Do you see the i * 3

#

change 3 to component_count

#

and then switch on component count, with fallthrough bitwise shifts

#

multiplied by the component count

hybrid pilot
iron shadow
#

nono like 8, 16, 32 bits

hybrid pilot
#

Mmm

#

Not sure what you mean

limber rapids
#

Don't think about that

iron shadow
#

AHHHH i realize

#

yeah i shouldn't

limber rapids
#

You won't have to deal with those textures

iron shadow
iron shadow
#

what do yall think the chances of me running into a r8 texture gonna be

iron shadow
limber rapids
#

cast to u32

#

C++ integer promotion rules are fucked and Rust decided to not deal with any of that and making you do everything

iron shadow
#

oh it works

#

seems uhh

#

very hacky? im probably not used to it

limber rapids
#

what do you think you've been programming up until now

#

programming itself is a bunch of hacks piled up on top of each other

#

we hacked sand and tricked it into thinking, what's one more hack

iron shadow
#

that's the most real advice i have heard

#

thank you frogapprove

hybrid pilot
iron shadow
#

heightmaps bleakekw

#

ah it doesn't work nvm

#

seems like ill have to do what pac85 does cuz rust is throwing a fit about how i shouldn't be going over my array

limber rapids
#

I have no idea about idiomatic ways in rust

#

I have no idea about Rust in general KEKW

iron shadow
#

me neither KEKW

#

i just get a happiness hit when i see
vec.iter().map().collect() it feels so nice pretty sure cpp has its own way

limber rapids
#

Yeah it's called: no we don't have anything

#

you use for like god intended

iron shadow
#

istg you guys have a map function

iron shadow
limber rapids
#

Probably std::ranges has something

iron shadow
#

well for is functional but shhh

limber rapids
#

But ranges are trash so nobody uses them

iron shadow
#

LMAOO

#

ill go back to cpp when they finally get modules to work (they will never)

#

oh shoot i could technically make your way work, it's just that i need to allow arithmetic overflow

limber rapids
#

Just do what pac did if it works

iron shadow
#

yeah but i wanna use this learn more about bitwise operators

#

eh pac is probably better as it would be "safer" idfk know though i'm assuming as there is a possibility you read outside of the intended data

limber rapids
#

I am only capable of writing unsafe code

iron shadow
#

KEKW this is what c++ does to you

iron shadow
#
data.chunks(component_size * component_count)
        .flat_map(|p| {
            vec![
                p.get(0..component_size).unwrap_or(&[0]).to_vec(),
                p.get((component_size)..(2 * component_size))
                    .unwrap_or(&[0])
                    .to_vec(),
                p.get((component_size * 2)..(3 * component_size))
                    .unwrap_or(&[0])
                    .to_vec(),
                match component_size {
                    2 => (65025u16).to_be_bytes().to_vec(),
                    4 => (4228250625f32).to_be_bytes().to_vec(),
                    _ => vec![255u8],
                },
            ]
            .into_iter()
            .flatten()
        })
        .collect::<Vec<u8>>()

bleakekw

night charm
#

I have returned from the glacier

#

I can take a look in a few hours

night charm
#

@iron shadow i added methods to the transform matrix

#

the plan is to finish up 0.10 tomorrow and release it

night charm
night charm
#

wait thats not the max u16 value

#

is it supposed to be

torn kettle
#

indeed

night charm
#

tbh i have no idea what the code above does

iron shadow
iron shadow
night charm
#

guh

#

magick

#

alright then

#

well the transform matrix stuff is added

#

a little different from your (now closed) pr but simpler I think

#

btw the old commits are added because i squashed yours when merging

iron shadow
#

ohh i see

#

how would i get those commits ommited cuz if i did pr again, it would be annoying to have those prs still merged again

night charm
#

overwrite the branch with origin/master

#

simplest non git fuckery way is probably just to delete the fork and make a new one, better is to make each pr on a "patch" branch and sync master periodically to the main repo

iron shadow
#

ahh alright will do that later

#

hmm penguin

night charm
#

aye

iron shadow
#

how would you chain a bunch of commands together? I got something like this

let mut image_commands = ctx
            .execution_manager
            .on_domain::<phobos::domain::Compute>()
            .unwrap();

for image in images {
  image_commands = image_commands
                .copy_buffer_to_image(
                    &staging_buffer.view_full(),
                    &image_phobos.view(vk::ImageAspectFlags::NONE_KHR).unwrap(),
                )
                .unwrap();
}

But i have no clue if this would be considered best practice KEKW and also seems like it does f up everything else as if i wanted to use ctx, it would block it due to it to the top line

#

could i really just make a bunch of commands then do a batch submission? iirc seeing that on the execution manager

night charm
#

what youre doing now is also what i do

#

ImageAspectFlags::NONE is suspicious

#

use COLOR

#

also avoid unwrapping as a general best practice, using the ? operator is much nicer

iron shadow
#

ah i should probably return a result

night charm
#

yeh

#

also seems like it does f up everything else as if i wanted to use ctx, it would block it due to it to the top line
If this is an actual issue you can clone the exec manager and use that, its refcounted internally

torn kettle
#

? succinctly tells the reader that you have no idea what is happening in the given code and that the prayerbook should be kept close

iron shadow
#

i see it more of a procasination tool : im too lazy to deal with this error, go deal with it later KEKW

#

oh god my image is a black screen bleakekw it isn't copying over correctly

night charm
night charm
iron shadow
#

nono i fixed that

night charm
#

oh alright

iron shadow
#

i think i fixed it? now it realized i should probably keep my buffers alive as they're dropping before the command buffer has a chance to submit it

night charm
#

that is not good yeah

iron shadow
#

yooo images finally work

iron shadow
#

so when i submit all those commands, is it doing in parallel or 1 by 1? or is that depends on how the gpu is feeling on that day

night charm
#

depends on the weather

iron shadow
#

i see i see ill tell god to make it snowy for the gpu

night charm
#

if the gpu likes snow sure

#

but you can count on a certain bandwidth of copy being parallel id expect

hybrid pilot
#

Buffer copies are compute shaders on some GPUs (amd)

iron shadow
#

that's weirdd

#

oh well seems like nvidia is fine with me putting it on the compute as well

hybrid pilot
#

What is weird?

iron shadow
#

how it is compute instead of transfer unless im tripping

hybrid pilot
#

What I mean is that copies are done by a compute shader by the driver lol

#

But you can run different compute workloads in parallel

night charm
#

Most big gpus do have a separate async copy unit

hybrid pilot
#

So you can expect transfers to happen in parallel with other stuff

hybrid pilot
night charm
#

Not anymore?

hybrid pilot
#

I think not

night charm
#

Hmm

limber rapids
#

Wat

#

AMD does have a DMA queue

#

since probably ATI

night charm
#

Well anyway, compute implies transfer support

#

Thats why the compute domain also exposes transfer commands in phobos

hybrid pilot
# limber rapids since probably ATI

Well I can't tell for sure what the hw has but I can tell for sure that radv does copies with a compute shader for anything newer than southern islands~ no that was bullshit, I misunderstood stuff. The actually code to chose between cp_dma and cs is more involved

#

Some legacy hw lingers on

#

Could still be there dunno

torn kettle
#

it does some copies with a compute shader, but amd has dedicated dma hw

#

called sdma

hybrid pilot
#

Mmm

torn kettle
#

there is also dma hw in the CP

#

and then finally you can use shaders

#

cornucopia of options

hybrid pilot
#

Yeah that's what is used in the si path

#

In any case it was just an example

#

To say that just because something looks like dedicated hw in vulkan it might not be

night charm
#

Yeah even different queue families don’t necessarily map to different hw

torn kettle
#

do you mean queues

iron shadow
#

uh dumb question, i'm a bit confused as to how the gltf sampler maps to vulkan?

#

OHH NVM im being brain dead

#

i thought the values represented like pixels but they represent enums

night charm
#

Most of them probably map to vk sampler settings

iron shadow
#
let phobos_sampler = phobos::Sampler::new(
                    ctx.device.clone(),
                    vk::SamplerCreateInfo {
                        mag_filter: translate_filter(
                            gltf_sampler
                                .mag_filter()
                                .unwrap_or(gltf::texture::MagFilter::Linear),
                        ),
                        min_filter: translate_filter(
                            gltf_sampler
                                .mag_filter()
                                .unwrap_or(gltf::texture::MagFilter::Linear),
                        ),
                        mipmap_mode: vk::SamplerMipmapMode::LINEAR,
                        address_mode_u: translate_wrap_mode(gltf_sampler.wrap_s()),
                        address_mode_v: translate_wrap_mode(gltf_sampler.wrap_t()),
                        address_mode_w: vk::SamplerAddressMode::REPEAT,
                        mip_lod_bias: 0.0,
                        anisotropy_enable: vk::FALSE,
                        max_anisotropy: 0.0,
                        compare_enable: vk::FALSE,
                        compare_op: vk::CompareOp::ALWAYS,
                        min_lod: 0.0,
                        max_lod: 0.0,
                        border_color: vk::BorderColor::INT_OPAQUE_BLACK,
                        unnormalized_coordinates: vk::FALSE,
                        ..Default::default()
                    },
                );

I geniunely have no clue if these are good defaults

night charm
#

Make max_lod VK_LOD_CLAMP_NONE I think is what it’s called

#

Enabling anisotropic filtering is probably also a good idea

hybrid pilot
iron shadow
#

oh wtf what is the gltf default sampler

hybrid pilot
#

I was gonna send you my code to handle the gltf sampler but it looks like I just ignore it

#

Guess you can take inspiration from that :p

iron shadow
#

KEKW ill rummage around in the gltf spec to see if they defined it

limber rapids
#

Just define your own

#

You most likely want linear filtering and linear mip transitions with anisotropy enabled and repeat wrap mode

languid fern
#

Yep that's what I do if not defined

iron shadow
#

ah how do you convert a gltf transform to a vulkan one again

#

also how tf do you do textures šŸ’€

#

i want it so i can just refer to textures by their bda

limber rapids
#

descriptor indexing

limber rapids
iron shadow
#

wil look into it

#

I;m a bit confused,..

#

What is the purpose…?

#

So is it a way to bind multiple resources and refer to them as an index in an array?

iron shadow
#

hmm how would i do this in phobos

iron shadow
#

phobose seems like it can support it, but like i'm not 100% sure if:

  1. im meant to touch those functions
  2. allocation callback (???)
iron shadow
#

ahh im so confused on descriptor indexing

hybrid pilot
iron shadow
#

hmm pretty sure phobos doesn't want me to accesss that

#

i wanna see if penguin added an impl

night charm
#

What do you need allocation callbacks for thonk

iron shadow
#

im trying to do descriptor indexing and its leading me down a path of making a descriptor pool + sets

night charm
#

You can do descriptor indexing I just need to add some internal code to set the proper flags

iron shadow
#

oh

night charm
#

Ill try to add it today

iron shadow
#

ill wait then. hmmmm what other things i should do. oh a camera

iron shadow
night charm
#

Nah it’s fine lol

iron shadow
#

i should probably also relearn vulkan KEKW
ill do both vkguide using vulkan-hpp then vulkan-tutorial on rust copium that prevents me from going brain dead and ctrl+c + ctrl+v my way through

#

oh my god i spent over 60+ hours in the ide in the past week bleakekw. the addiction cannot be stopped

hybrid pilot
#

Wtf that's like 9h a day

iron shadow
#

granted a lot of is me afk

#

but also bleakekw

night charm
iron shadow
#

my friends all normal talking about elden ring and im frothing at the renderdoc of it KEKW

night charm
#

time to remove buffer usage flags

iron shadow
#

breakage 3000 incoming

night charm
#

it does break but easy to fix

iron shadow
#

How would do you plan on supporting descriptor indexing? I’m so comfused by the process šŸ’€

night charm
#

Pretty easy

#

An unbounded array in the shader is seen as a descriptor indexed array using reflection

#

Then there’s just a bind_sampled_image_array function to bind all your images

#

And done

limber rapids
#

As long as you non-uniformly index it KEKW

iron shadow
#

Ohh so that’s what you plan on adding

#

Oh yeah csn you do the same to buffers or not?

#

Or is this an image exclusive thing?

night charm
#

For buffers just use the device address

iron shadow
#

Ohh ok wait what?

night charm
#

Just send device address and use it in the shader

hybrid pilot
night charm
#

That would involve updating descriptor sets which isnt being done atm

#

Might be worth looking into though

hybrid pilot
#

Mmm

iron shadow
hybrid pilot
#

Wonder how other rendegraphs do it

limber rapids
hybrid pilot
#

Maybe by making bindless a "first class citizen"

limber rapids
#

Bindless in my thing is the only citizen bleakekw

hybrid pilot
#

Lol

iron shadow
#

Wait only bindless is really bad?

limber rapids
#

The exact opposite, it's ridiculously good

hybrid pilot
iron shadow
#

That’s what I thought, but it also means graphics programmers can get a bit diabolical with vram

hybrid pilot
#

It means you don't have to pretend the hw can't di stuff it can do

iron shadow
#

OHHHH

hybrid pilot
#

Which means you can make better use of it

#

Imho

night charm
#

Yeah basically you just get to throw pointers at the gpu and dereference them

limber rapids
#

I wish I had access to the whole GPU memory subsystem

#

That way I wouldn't have to readback marked pages and make them resident/evict them

#

I could manage memory directly on the GPU 🄲

iron shadow
#

I wish I could write rust on the gpu

hybrid pilot
limber rapids
#

Through the GAPI yes

#

It's called sparse

night charm
#

There is a thing for rust shaders

#

But meh

hybrid pilot
limber rapids
#

yeah

hybrid pilot
#

Yeah I'm aware of that

#

I was talking of managing memory from the GPU

#

Lol

limber rapids
#

Ah

#

no way KEKW

hybrid pilot
#

Yeah

#

It would be a security hole I guess

limber rapids
#

I do not care

#

I will throw away all security for 2% more convenience

hybrid pilot
#

But maybe in principle the GPU could write it'sn own page table?

limber rapids
#

yes

hybrid pilot
#

As long as you map it

#

But you would have to hack the kernel driver to do that I guess

#

Like maybe map it to an hardcoded address then access it from a shader

#

So you don't have to touch the rest of the stack

night charm
#

Reminds me of gpu exceptions

#

from martty’s blog

iron shadow
#

That looks cool, is it any good?

hybrid pilot
#

We where discussing it

#

Outside of here

#

Seems like it lacks essential featured for compute shaders

#

(Barriers)

#

But it is promising at least

limber rapids
night charm
#

Yeah I personally wouldn’t use it

hybrid pilot
limber rapids
#

me when
me when no GL_KHR_shader_subgroup_ballot

hybrid pilot
#

Lol

limber rapids
#

third class language

#

smh

hybrid pilot
#

Should have it eventually

#

No idea why it doesn't have then yet

night charm
#

Seems pretty essential yeah

#

I assume BDA is also not implemented

limber rapids
#

I don't understand why features like these aren't given absolute maximum priority

#

BDA is literally necessary to move on from the garbage "bind and use" model

iron shadow
#

Petition to deprecate bin-

night charm
#

One day

torn kettle
iron shadow
#

LMAOOO is nvidia that adamant on bind and use

hybrid pilot
#

I wanted to look into how descriptor sets work on nvk and never got around to it

torn kettle
#

i was just doing a meme, but nv descriptors are a bit more convoluted than amd ones

iron shadow
#

nvk bleakekw

#

All I can remember was jerry rigging that to work so I could submit my raytracing cs project

hybrid pilot
#

I don't think nvk does rt

iron shadow
#

It doesnt i thik that was nvh

#

But iirc nvk is also used in their tutorial

#

Which was what i built off

torn kettle
#

nvk doesn't really work yet

#

you are talking about something else

iron shadow
#

Ohh i think it was nvvk then

#

Ah it was nvh

night charm
iron shadow
#

Poggies

night charm
#

ill upgrade the egui integration later today

iron shadow
#

So can I do

#

Descriptor indexing?

night charm
#

thats next on the list

#

but i wanted to get this release out already

iron shadow
#

Fair

iron shadow
#

Hey Pengiun, you got an idea why ash and phobos' ash includes it exposes just are never detected by my IDE?

#

Do I need to do static linking?

hybrid pilot
#

? It is like the default in rust.
What do you mean they aren't detected?

night charm
#

huh

#

I re-export ash as phobos::vk

#

you can just use phobos::vk and use that

iron shadow
#

Yeah, but it's really weird as there is like no autocomplete whatsoever

#

like it won't recognize classes exist

#

i tried importing regular ash too

#

and the issue persisit which is weird

night charm
#

thats weird

#

it works for me

#

takes some time to index sometimes but it works eventually

iron shadow
#

bleakekw time to do a hard ide reset

iron shadow
#

like it's not detecting types like vk::Bool32

#

is there a way to force clion to index it?

hybrid pilot
#

Use vim

night charm
iron shadow
#

ping me when support for descriptor indexing and giving shaders buffers via bda is added to phobos

limber rapids
#

All you need for bda is GL_EXT_buffer_reference

night charm
#

you can do bda already

limber rapids
#

And vkGetBufferDeviceAddress

night charm
#

a bda is just a uint

#

just send it through a push constant or something

#

or in a ubo if you have lots of them

#

but you can literally just write the return value of address() to some memory visible in the shader and use it like you would in glsl

iron shadow
#

oh šŸ’€ so im just realistically waiting for the descriptor indexing for textures

night charm
#

Pretty much

#

Hopefully I get around to it tomorrow

iron shadow
#

wait hm how would I synchronize all those buffers?

#

like "No one else is allowed to write to this until X is finished reading" like a RwLock

night charm
#

Inside the shader with a barrier(), outside you have to add barriers yourself

iron shadow
#

OHH memory_barrier that makes sense

limber rapids
#

Disclaimer: barrier only synchronizes a workgroup

iron shadow
#

workgroup?

#

ohh compute? I think the ray tracing shaders still are covered

#

unless I'm wrong

night charm
#

Probably ub

limber rapids
#

you can use subgroup vote to synchronize in shaders other than compute (or mesh/task)

#
if (subgroupElect()) {
    write();
}
subgroupBarrier();
iron shadow
#

shader code I assume?

#

hmmm okok

limber rapids
#

Yes

#

You can't effectively synchronize all threads

#

You can only synchronize within a subgroup, so be careful

iron shadow
#

im so confused by these words 😭 I havent done any compute

limber rapids
#

Don't worry about it until you need it

iron shadow
#

wait so when doing bda for my buffers, does this bind my buffers?

#

or is the shader seriously just reading it from gpu memory using that address

limber rapids
#

it is a pointer

#

to god knows where in the GPU

iron shadow
limber rapids
#

There is no binding

iron shadow
#

huh okay so all this descriptor binding stuff ive been doing was mainly to just make a pointer?

#

sorry for asking such basic questions šŸ’€

limber rapids
#

Let me give you a basic rundown on how BDA actually works

#

The classic binding model involves the following

vkCreateDescriptorSetLayout(&set_layout);
// you allocate a descriptor set to *bind* to the GPU, a descriptor set is a fancy pointer to resources which right now is nullptr
vkAllocateDescriptorSets(&set, &set_layout);
// Now you *write* to the descriptor set with your resources
vkUpdateDescriptorSets(&set, 1, &write);
// Then you finally *bind* the set
vkCmdBindDescriptorSets(1, &set);```
#

We call this bindful because we need to bind descriptor sets

#

BDA works like this:

// In the shader
layout (buffer_reference) buffer X {
    LotsOfStuff[] data;
};

layout (push_constant) {
    uint64_t address;
};

void main() {
    X ptr = X(address);
}```
#

And in your vulkan app you just do a shrimple

auto address = buffer.address();
vkCmdPushConstants(1, &address);```
#

There is no vkCmdBind anything

limber rapids
iron shadow
#

what if you wanted to push an arbitrary array of them? You simply just change it to?

layout (push_constant) {
    uint64_t[] addresses;
};

?

limber rapids
#

no

#

if you need a lot of addresses you should first consider your life choices and then you make a UBO

iron shadow
#

KEKW but my rt shaders can't know which vertex buffer is gonna actually be used

limber rapids
#

Make only one vertex buffer

#

If not, have an object list with each object having a uint64 address to its vertex buffer

limber rapids
hybrid pilot
#

Or can you explicitly say "I'm gonna need this buffer but don't bind it cuz I'll just send the address"

iron shadow
#

oh real

hybrid pilot
#

Though you'd probably use buffer address for persistent stuff where sync is not necessarily a concern

iron shadow
#

yeah but what if my scene changes and stuff

#

add, removing, idfk about culling as i have no clue how that works exactly

limber rapids
#

If you make incoherent read/writes that could even change from subgroup to subgroup, you need atomics/locks

#

But this scenario is never going to happen tbh

#

If you have a specific example I might give you more details/realistic approach

iron shadow
#

Rn it's mainly jsut to ray trace a scene that is gonna be static for a bit

#

but I wanna do physics simulations with gravity where many objects are gonna be transformed as a result of it

iron shadow
#

but idfk like if I removed an object from my scene, I should remove it from the device buffer as well

#

but I'm just unsure if that wouldn't be optimal as I think I would need to more or less restream the data from the cpu back to the gpu but now slightly changed

#

Hold on the neurons are firing what if I did an "inverted slice" of the removed memory, copy all data to the left and right of it into one massive new buffer I have allocated for the new size? My worry then is mainly sync issue as what if I have an AS or some other object that is referencing my buffer, but now that information is old?

hybrid pilot
#

So if you use a buffer bound that way across passes you can get it synced for you

#

Really nice

night charm
#

Yep

night charm
#

Look up some algorithms for that

hybrid pilot
#

Sparse bindings make allocation so much easier

night charm
#

It’ll give some inspiration

#

Yeah that’s true

limber rapids
#

There are complex ways of solving this

hybrid pilot
#

Yeah not a trivial problem

limber rapids
#

But really this is so much easier than you think

#
dispatch(); //physics shader, writes to many buffers
barrier();
build_tlas();
barrier();
trace_rays();```
#

That's it

#

This is all host side btw

#

If you write from the host to a buffer used by the gpu it's even easier

night charm
#

Yeah rebuild your tlas every frame

#

Its pretty cheap

limber rapids
#

all you have to do is allocate some HOST_COHERENT memory

#

Yeah, you could implement caching, virtual memory allocators, sparse resources, write to and from a page table from the GPU, request and mark pages asynchronously and all the ridiculously complicated stuff you want

#

But just, don't? KEKW

night charm
#

Probably no updates for a week or so

#

My laptop decided to delete its own kernel

#

And I didn’t bring my installer usb

hybrid pilot
night charm
#

bleakekw right

#

ill try that

#

Maybe I can buy one here but shits expensive here and I already bought a new phone charger

hybrid pilot
#

Phobs needs more founding

#

BTW how did it happen?

#

Update?

night charm
#

And it failed and decided to take the kernel with it

hybrid pilot
night charm
#

I have a nvidia card in there but it doesn’t work with my compositor so I generally use the igpu

#

The driver was also for the igpu

hybrid pilot
#

Mmm

iron shadow
iron shadow
#

ah wait I realized

#

how would I even identfiy the BLAS in my shader so I would know which buffer it refers to

limber rapids
#

The TLAS identifies the BLAS

iron shadow
#

gl_InstanceCustomIndexEXT ?

limber rapids
#

no

#

the TLAS takes a BLAS as an argument

iron shadow
#

oh wait it is gl_InstanceCustomIndexEXT

#

I literally just needed a way to determine which BLAS i was hitting in my shader

limber rapids
#

why

#

You could use gl_InstanceCustomIndexEXT but why do you need to do that

iron shadow
#

Because if I'm passing my vertex buffers into my shader, I need to be able to

#

determine which vertex buffer corresponds to which blas

night charm
#

Yes you can use that value to identify mesh/object properties

#

The nvidia rt sample does this

iron shadow
#

idk im generally following what NVIDIA is doing for their shaders

#

yeah nvidia's rt sample

limber rapids
#

I still don't get why you need the BLAS

#

why can't you use gl_InstanceCustomIndexEXT to identify an object, which has the address to your vertex and index buffers

night charm
#

That’s exactly the idea

#

Just poor wording of it KEKW

iron shadow
limber rapids
#

epic

iron shadow
#

step 2) camera

night charm
#

Are you using rt pipelines or ray queries btw

limber rapids
#

I will personally uninstall ray queries from the driver if anyone is using them

iron shadow
#

raytracing pipelines

night charm
#

They’re great wdym

limber rapids
#

no

iron shadow
#

iirc whatever the example is

night charm
#

Ray query is epic

limber rapids
#

CPU readback is cringe

night charm
# iron shadow raytracing pipelines

Right, quick note about that. SBT is currently fully generated because I don’t know of any reason not to. If you come across any limitation with this lmk and I’ll rework a little

night charm
#

Just ray query in the fragment shader for shadows and stuff

#

Its great

#

Works nicely

limber rapids
#

You see I can't read

night charm
iron shadow
#

me neither dw bro

limber rapids
#

For some reason I thought you meant occlusion queries

#

I have no idea why

night charm
#

Ah

#

nono

#

Ray query good

limber rapids
#

The compute rasterizer brain worm ate my brain

#

Only 5% remains

night charm
#

It did crash my driver for some inexplicable reason but that aside

#

Nvidia shader compiler nonsense

iron shadow
#

so like any articles on how to do flying camera. learn opengl is fien but i can't go upside down :(

limber rapids
#

Ah yes, I have crashed NVIDIA's internal compiler countless times

limber rapids
iron shadow
limber rapids
#

you now have a fps camera

night charm
#

This is just speculation but it seems like it starts optimizing the shader after a few frames on a background thread, and just crashing inside that somewhere

night charm
#

Truly

limber rapids
#

deferred optimization

#

truly a sentence I had hoped to never utter

night charm
#

Its not unheard of apparently

#

You profile it for some frames and optimize based on that data

limber rapids
#

Perhaps I'm too small brained

#

I don't know what kind of heuristics you can get from on the fly profiling KEKW

#

Perhaps instruction or branch reordering idk

night charm
#

Not sure either

#

But I can imagine the big brain compiler engineers know

limber rapids
#

yeah

night charm
#

I got some pointers from pixelduck on what could cause this but haven’t found a fix

iron shadow
#

fellas we have a problem

#

which direction should i make up

limber rapids
#

0,1,0

#

no discussions are allowed

iron shadow
#

KEKW the greatest debate of time

limber rapids
#

Maybe if you do physics you can do 0,0,1

#

Anything else is forbidden by international law

iron shadow
#

nah bro wtdym

#

z-buffering šŸ’€ why tf would you also make that up

#

hmm

limber rapids
#

z-up is quite common

iron shadow
#

0,1,0 we do

limber rapids
#

Blender does z-up, Unreal too

iron shadow
#

iirc there was a nice image explaining all that stuff

#

where tf was it

#

KEKW cant find it

#

which system does godot use? lhs? whatever ill pick opengl and do rhs

limber rapids
#

Do whatever is convention for the API you are using

#

which is right handed, y up, -z forward and x right

iron shadow
#

i still think the potential of (1,0,0) to mean up is still there KEKW

night charm
#

y up or I make more breaking changes in Phobos

iron shadow
#

oh shoot i need to update phobos

iron shadow
#

oh no

languid fern
#

ohno.png

iron shadow
#

ohno+panic.png

#

i uh

#

oh no

night charm
#

I even wrote some instructions in the release notes

iron shadow
#

i fixed the issue šŸ˜Ž

#

camera working now

#

i can now view suzanne

night charm
#

Epic

night charm
#

usb acquired

#

I can fix my laptop later today

iron shadow
#

Yoo pog

night charm
#

ladies and gentlemen i once again have a kernel

iron shadow
#

This is big

#

All you have to do is rewrite the rest of it

night charm
iron shadow
#

i have not been able to go cg in the past all day bleakekw i'm not even in my uni yet and a club got me to code a discord bot for them KEKW

#

how am i busy with uni already and i havent even started my first year its actually joever how do i phobo now

night charm
#

My laptop died again

#

New chapter in the penguin laptop saga begins

#

laptop refuses to start at all for a whole night

iron shadow
#

oh shoot i need one too for university

night charm
#

The next morning grub has disappeared

#

okay

iron shadow
night charm
#

4 years or so

iron shadow
#

🫔 4 years

#

which one do you plan on getting?

night charm
#

I can fix this

iron shadow
#

oh?

night charm
#

I can get into boot options now

#

So I can boot my arch usb again and reinstall grub

#

I should just give up on getting factorio to run

iron shadow
#

so is this hardware or software

#

cuz if it is failing this much

#

i doubt it's software then

night charm
#

No idea

iron shadow
#

Good luck then 🫔 idk if it keeps happening im pretty its hardware at that point

#

or some really f'd up driver

night charm
#

probably the latter

#

Im stuck using my igpu because wayland doesn’t like nvidia

iron shadow
#

OHH

#

Linux + NVIDIA KEKW

#

Yeah good luck

#

Literally the only reason why I probably can't go over to linux rn:

  1. i game a lot
  2. nvidia
#

Wait so if I am doing BDA, how would indicate to phobos that I tend to use these buffers so it can generate the necessary fences/barriers

night charm
#

Same as any buffer

#

you just add it to the pass

#

But you don’t need to do any sync if they’re readonly

#

Since there are no buffer layouts or whatever

iron shadow
#

Ah alright

#

so I would be fine by just not even binding it?

#

so anything that would modify that buffer, would sync'd

night charm
#

Yeah the resource sync and declaration is completely separate from binding

iron shadow
#

wait so what is the point of declaring your bindings then?

night charm
#

Its declaring resource usages

iron shadow
#

oh like from vulkan prespective

night charm
#

Not bindings specifically

#

But declaring what and how you will use a resource allows the system to sync it

#

Its up to you how you ā€œbindā€/access the resource, as long as it’s within the declared usage

#

Yeah

iron shadow
#

ohh that makes sense

iron shadow
#

hey penguin how much effort would it take for me to implement descriptor indexing

iron shadow
#

oh i realized this was so much easier.I was gonna make a system where i had an object struct which described the index of the bda ubos, but then i realized

#

i could just place my bdas in place of those indices bleakekw

night charm
#

Might try to implement descriptor indexing today

#

Or tomorrow

#

It’s not a lot of work but needs some annoying things

limber rapids
#

You need to VkDescriptorBindingFlags~~ VARIABLE_DESCRIPTOR_COUNT~~ and PARTIALLY_BOUND when creating the descriptor layout and VkDescriptorSetVariableDescriptorCountAllocateInfo when allocating the set

torn kettle
#

you don't need variable count

limber rapids
#

my bad

iron shadow
torn kettle
#

you in fact don't even need partially bound either KEKW, but that does make things a bit nicer

iron shadow
#

oh no

night charm
#

I was pinged

iron shadow
#

false information

#

i was asking a question then i realized it was stupid and deleted it

night charm
#

I see

hybrid pilot
#

What will descriptor indexing look like in phobos?

#

Like what kind of api will it expose for it?

iron shadow
#

Yeah that ^

#

also I'm gonna evangelize my university to use phobos KEKW

#

should i convince the guy who is making a vercel physics engine to join phobos

iron shadow
#

Hmm how would I enable an extension in phobos

#

I need specifically: GL_EXT_scalar_block_layout

limber rapids
#

You enable them in the shader

#
#extension NAME : enable/require```
iron shadow
#

huh yeah

#

i don't need

#

OHH

#

IT WAS FOR SHADER INT 64

#

#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require

#

I'm so confused

#
let mut settings = phobos::AppBuilder::new()
            .version((1, 0, 0))
            .name(name)
            .validation(true)
            .present_mode(phobos::vk::PresentModeKHR::MAILBOX)
            .scratch_size(1 * 1024u64)
            .gpu(phobos::GPURequirements {
                dedicated: false,
                min_video_memory: 1 * 1024 * 1024 * 1024, // 1 GiB
                min_dedicated_video_memory: 1 * 1024 * 1024 * 1024,
                queues: vec![
                    phobos::QueueRequest {
                        dedicated: false,
                        queue_type: phobos::QueueType::Graphics,
                    },
                    phobos::QueueRequest {
                        dedicated: true,
                        queue_type: phobos::QueueType::Transfer,
                    },
                    phobos::QueueRequest {
                        dedicated: true,
                        queue_type: phobos::QueueType::Compute,
                    },
                ],
                features: vk::PhysicalDeviceFeatures::builder().shader_int64,
                ..Default::default()
            });

Doesn't work for obvious reasons

#

shader_int64 returns bool32

limber rapids
#

You need to set that to true

iron shadow
#

yeah for soem reason

limber rapids
#

Sorry, wrong question mark lol

iron shadow
#

i solved it lmaoo

#

now i have a descriptor type error bleakekw

#

also can soemone explain to me

#

why the fuck does it take like 90 good seconds

#

to the vulkan docs to load

torn kettle
#

gnomes

limber rapids
iron shadow
#

Hey uh penguin

#

so if I were to set the extensions variable in the gpu settings

#

would it like mess up everything i.e. rt extension loading, validation, etc.

#

since i would be overriding the default values?

night charm
#

I think you just want to .push() values into it

night charm
#

Whether a binding is using descriptor indexing or not is checked using reflection

hybrid pilot
#

Nice

#

When I'll rewrite my renderer it will be bindless from the start

night charm
#

Bindless is great

#

You do need to set a max value for the amount of descriptors in such an unbounded array but I’m thinking to just provide that on init

#

And default to like 4k

limber rapids
#

mr HLSL enthusiast

iron shadow
#

oh no

#

my condolenseces 🫔 epic games

night charm
#

my laptop be back

limber rapids
#

ye but I mean

#

What does vecN ? x : y mean

#

all(vecN) ? x : y?

#

Or any?

night charm
#

ah

#

Probably all

#

I think the zero is casted to float3(0,0,0)

languid fern
#

Ok so I might be using phobos in the near future...

#

Is it stable/usable for rasterization/compute yet?

iron shadow
#

We're mainly waiting for descriptor indexing for images

#

other than that, Penguin is using phobos in his terrain project iirc

#

so it should be?

#

It's ready for ray tracing 100%

languid fern
#

Oh nice

#

I dont even have an RT card lol so I'm mostly going to be using it for game engine dev

#

Are you one of the maintainers or just using it?

#

If the code isn't too complex (like wgpu's imo) I might be able to help out if I find bugs / issues with it
As long as I can rasterize / compute stuff like I can in wgpu I'll definitely use it

iron shadow
#

I'm just using it rn

night charm
#

Definitely stable-ish yeah

iron shadow
#

Oh yeah penguin is very open and chill about you contributing to the project
it'd be cool if we made this project community developed than solely penguin developed KEKW i'm relearning vulkan so i can help out more meaningfully

night charm
#

heh im always open to take prs

night charm
#

I might rewrite that part at some point in time, it truly is a beast

iron shadow
#

i wanna learn how a render graph works KEKW

night charm
#

Me too

iron shadow
#

all i understand is that it's a nice way to abstract resource bindings

night charm
#

Mine only abstracts sync

#

It doesn’t do any binding or resource management/aliasing

iron shadow
#

ohh i see

#

i'm mainly waiting for vulkan to add the task graph from dx12

#

as it looks insane

torn kettle
#

.. to debug

languid fern
languid fern
iron shadow
languid fern
#

I already have a good front-end API rn that uses WGPU as a back end so if I could just swap out the backend for phobos it should be pretty easy

languid fern
#

Ohh wait phobos allows you to do uploads using a transfer only queue? That's amazing

night charm
#

yep

#

well, its a "transfer domain", which maps to a transfer only queue if possible

#

If thats not possible it shares a queue

languid fern
#

Awesome

#

There are a few missing things that I'm gonna need like vkCmdDrawIndexedIndirectCount but they shouldn't be hard to implement

#

I could just make a PR

#

Also I love how you actually made use of the trait system for "Domains"

#

Really refreshing to see a vulkan API actually make use of traits properly

night charm
#

yeah some commands are missing still

#

easy enough to add

limber rapids
#

Penguin is just encouraging you to use vkCmdDispatch for everything bleakekw

night charm
#

when i add mesh shaders ill convert you too

limber rapids
#

It's difficult enough without learning a new language thank you

night charm
#

fair enough

#

one day

#

inshallah you will learn rust

languid fern
night charm
#

šŸ¦€

languid fern
#

Mesh/Task/Accel Structures seem so fun

night charm
#

what card do you have

limber rapids
#

they are not

night charm
limber rapids
#

do not be fooled

languid fern
#

Lol

night charm
#

1060+ has compute emulation for rt

limber rapids
#

I am currently struggling, meshoptimizer prefers good mesh topology to good spatial locality

#

Which is eating my brain

languid fern
night charm
#

ah

#

just barely not bleakekw

languid fern
#

Yep which makes it even more painful tbh

#

Anyways as long as I can do some compute shenanigans and rasterization I am ver happy

night charm
#

definitely possible

limber rapids
#

I wish we had access to the vertex pipeline in compute

#

mesh shaders kinda solve this but they are meh

#

NVIDIA also puts absurd limits on workgroup sizes

#

"it must be 32 or else"

night charm
#

is it not a multiple of 32

#

instead of just 32

limber rapids
#

With VK_EXT_mesh_shader it can be whatever

#

but if you use anything other than 32, occupancy dies (on NVIDIA)

night charm
#

rip

limber rapids
#

VK_NV_mesh_shader explicitly limits max invocation size to 32

night charm
#

hmm i see

#

32 it is

limber rapids
#

AMD is chad and likes big workgroup sizes

#

Up to 256

languid fern
#

Oh also Penguin do you mind if I make some QoL improvements to context creation? (like the ability to select GPU stuff like that)

night charm
#

oh yeah go ahead, it should already have some options to prefer a certain gpu but an explicit picker might not be bad either

languid fern
#

Aight thanks yea

night charm
#

should be mostly extending AppSettings/GpuRequirements

languid fern
#

I have a scoring system already in my graphics API impl so I'd rather just pick manually

night charm
#

scoring instead of discarding would be nice to have

#

currently it just discards gpus that dont fit the requirements given

languid fern
#

I'll work on that too then lel

night charm
iron shadow
# limber rapids they are not

i agree. do not let the pretty rays trick you. in serious words: the debugging experience is horrible. you will get bugs that are completely silent KEKW

languid fern
#

First time doing a feature request on dis so hopefully it goes well

iron shadow
#

yo i should implement this so i can actually learn ash and vulkan

#

scoring? I feel like the user themselves could keep track of that

languid fern
#

Right yea that's why I don't recomend that method of doing it

#

And just letting the user pick their own PhysicalDevice

languid fern
#

It's mostly just rust / iterator stuff

#

Now the question would be "how to retrieve all possible PhysicalDevices" before creating the instance itself

#

You could pass a callback that will be called to "select" a PhysicalDevice

#

So something like this

        .gpu(|physical_devices_iter| {
              // select one physical device from the iterator and return it
        })
#

Then you could pass what queues / features you want for said physical device / device

night charm
#

That’s not bad yeah

languid fern
#

I just realized that the reason you might be so offline is because of different time zones lol

#

It's 3 am in canada rn kek

languid fern
#

Dang complete opposite eh

#

Anyways I'll get to work on phobos soon

night charm
#

aye

languid fern
#

I alr cloned it and started doing some testing just to get used to the API

night charm
#

yeah thats perfect

#

I think for returning a default gpu in case the selector fails we could just pick the first dedicated gpu if there is one and log a warning that the selector failed

languid fern
languid fern
night charm
#

Hmm that’s possible too

#

But it requires tracking state between each iteration to see which is better

languid fern
#

Up to the user KEKW

#

They could pick randomly if they wanted to as well

#

It's how wgpu does it too, just let's the user pick what adapter (phys device) they want

torn kettle
#

nb that it is a bit questionable if the app should do any heuristic for picking

night charm
#

Yeah I think just giving some requirements is the most you want to do

torn kettle
#

even that

#

if the user wants to use the integrated gpu bc they want to conserve power

#

how can the app know?

night charm
#

That is true tbh

#

Theres os settings for that usually right

iron shadow
#

OH

#

LMAOOOO it;s an iter, i thought you were gonna pass each gpu individually

#

Ok this makes sense now. I assume you iterate over that iter then return the desired gpu you want in same function

hybrid pilot
night charm
languid fern
#

Doesn't even need to be an iter, could just be a slice

languid fern
#

What I do in my rust app is check if the user is running on laptop battery (if they have one) and force the use of integrated graphics only then

#

If not it always uses the "best" dedicated card (one with the most vram and highest max buffer size)

torn kettle
#

didn't understand my point :/

languid fern
#

Oh no I was just talking about how my upstream API does it. Phobos IMO shouldn't handle that

#

GPU selection is completely up to the user is what I meant*

torn kettle
#

thats not what i said

languid fern
torn kettle
#

i explained a bit below

night charm
#

i think the point is that the app shouldnt care what gpu is used, thats up to the user to configure in os settings

hybrid pilot
night charm
#

depends

hybrid pilot
#

So the first one is the preferred one?

night charm
#

im pretty sure on linux at least you can disable them entirely

hybrid pilot
#

Do you mean shutting down the device?

night charm
#

i think so

#

or just disabling the driver

hybrid pilot
#

You can't shut down the integrated gpu in some setups though

#

Because those drive the display

night charm
#

oh yeah, igpu might be a special case

hybrid pilot
#

But Xorg had a way of choosing devices

#

DRI prime something

night charm
#

yeah

#

should work on wayland too I think thats a driver thing

hybrid pilot
#

I don't have such a devices so I can't test what it does to vulkan

night charm
#

either way xorg bad

hybrid pilot
#

Mboth xorg and Wayland compositors have to manage multi gpu afaik

languid fern
#

Descriptor indexing allows you to do bindless shenanigans right?

#

Is it supported in Phobos yet? Cause I saw an issue stating that you can't change descriptor sets after you call draw / dispatch, which might be problematic for my renderer (if not using bindless)

night charm
#

that issue is about something else, descriptor indexing is coming soon

#

i just have to add the api for it really

#

I added a comment to the issue to explain the problem better

#

its more of a design annoyance really

#

ill try to get descriptor indexing out by this weekend or so

#

im back from vacation friday night

languid fern
#

Oh deal deal

#

It's gonna be nice utilizing bindless for the first time

night charm
#

it is really nice

#

though vk api wise bindful isnt really annoying anymore with phobos

#

not like with a lot of vk renderers that store descriptor sets per material 🤢

languid fern
#

... that's what I do lel

#

very naive way but worked fine 4 me

#

scales horribly though kek

night charm
#

it really does lol

#

here you just call bind with an image or buffer and it Just Works ā„¢ļø

languid fern
#

Yep that's how my current high level graphics API worked, but it does some hideous stuff under the hood to make it work.

#

Good to know I don't have to deal with that anymore lel

night charm
#

but it does some hideous stuff under the hood to make it work.
nervous

#

ok its not that bad tbh

#

just a hashmap full of descriptor sets

languid fern
#

Yea it just "feels" very ugly lol

night charm
#

speaking of i should replace those with ahash before i forget

languid fern
#

Yess ahash all the things

night charm
#

especially pipeline lookup can get expensive

languid fern
#

There's also LruCache that automatically drops old values

night charm
#

but thats mostly because it needs to hash a lot of things

languid fern
#

Right yea

night charm
languid fern
#

Neat

#

Is there a hard-coded lifetime limit?

#

Like 2 - 3 frames?

night charm
#

I think its 4 or 8

#

it is hardcoded though yeah

languid fern
#

Awesome

night charm
#

if its used sporadically then recreating it is no big deal

languid fern
#

Okkk I was confused for a sec with how methods (bind storage texture, bind sampled texture) in incomplete command buffer automatically handled sync

#

They don't, I needed to look in the pass builder lol

#

I was scared for a sec thinking this lib doesn't do auto-sync and that I'll need to handle putting pipeline barriers myself

night charm
#

no worries it does

#

just not when binding no

#

you declare them when you build the pass

languid fern
#

Yep that's all I care about really

#

I'll just need to change my graphics lib to allow to build passes like that but it shouldn't be too hard