#Fwog and co.

1 messages ยท Page 14 of 1

long robin
#

I'm about to do one of the API breaks of all time

golden schooner
#

which one?

long robin
#

my buffer and texture abstractions are getting a new coat of polish

#

I'm fixing a bunch of broken inconsistent things

#

and naming

golden schooner
#

implementing clearCoat extension, ๐Ÿ‘

#

oho naming ๐Ÿ˜„

long robin
#

actually, what should I call SubImage and SubData while I'm at it

golden schooner
#

Update/Upload

long robin
#

idk why I find those unsatisfying

#

I think I have brain damage

golden schooner
#

hmm

#

Modify?

#

Mutate? ๐Ÿ™‚

long robin
#

I think your original ones are good choices

golden schooner
#

SublimalImage

long robin
#

I just have some gl infection

golden schooner
#

You could even provide overloads for Update/UploadRectangle perhaps for the x,y,width,height values

long robin
#

what the hell does "sub" even mean in glTexSubImage2D

#

substitute?

golden schooner
#

or part of?

long robin
#

ah

#

sub-image

golden schooner
#

sub-marine

#

something under something

#

idk

long robin
#

glTexImage is also a horrible name for a function that allocates an image and maybe uploads data to it

golden schooner
#

ja im really wondering why the opengl people couldnt come up with something more sofisticuffed

#

developers are horrible namers

#

glCreateTextureFromPixels ๐Ÿ™‚

long robin
#

glCreateTextures is already a thing that does something completely different ๐Ÿ˜ฆ

golden schooner
#

yeah that came much later

long robin
#

they really messed up the API tbh

golden schooner
#

but glTexImage is there since forever, 1.1 or so

long robin
#

well glTexStorage is new and is still jacked up

golden schooner
#

indeed

#

"Storage" feels weird

long robin
#

there really should have been one glCreateTexture function that makes an object AND allocates memory

golden schooner
#

just glCreateTexture it and thats it

#

yeah

long robin
#

glTexImage is especially horrid because you can make mip levels with arbitrary sizes and formats

golden schooner
#

ja ๐Ÿ˜ฆ

#

now that you mention refuckulating Buffer/Texture i also need to change my bufferisms

#

i do this atm

#
_instanceBuffer = _graphicsContext.CreateShaderStorageBuffer<GpuMeshInstance>("SceneInstances");
_instanceBuffer.AllocateStorage(1024 * Marshal.SizeOf<GpuMeshInstance>(), StorageAllocationFlags.Dynamic);
#

but i should incorporate storage into CSSB already

#

_instanceBuffer = _graphicsContext.CreateSSBO<T>(Label, elementCount, Flags);

#

or make the api even more obvious, and have CreateStatic/CreateDynamic

#

if i ever decide to add mapped buffer i can do CreateMapped too

#

i also like this one #general message ๐Ÿ™‚

long robin
#

back when I actually made renderers with more than 1 feature

golden schooner
#

why not redo with Fwog

long robin
#

too much schtuff on plate ๐Ÿ˜ฆ

#

I'm working on a secret article (which will be public when published) that I need to finish at some point so I don't feel guilty for touching fwog in the meantime

golden schooner
#

i see i see

shell inlet
shell inlet
#

at amd you mean?

long robin
#

man, I love that gif

#

this code is now engoodened a little

static auto pixelBuf = Fwog::Buffer(frame.gAlbedo->Extent().width * frame.gAlbedo->Extent().height * 4,                                     Fwog::BufferStorageFlag::MAP_MEMORY);

Fwog::CopyTextureToBuffer({.sourceTexture = *frame.gAlbedo, .targetBuffer = pixelBuf, .extent = frame.gAlbedo->Extent()});

glFinish();
auto pixels = pixelBuf.GetMappedPointer();
memset(pixels, 255, 4 * 1000 * 100);

Fwog::CopyBufferToTexture({.sourceBuffer = pixelBuf, .targetTexture = *frame.gAlbedo, .extent = frame.gAlbedo->Extent()});
#

the format and type are now INFER_FORMAT and INFER_TYPE by default (matching Vulkan), but you can still do conversions if you want

long robin
#

or maybe someTexture.Update() is descriptive enough

#

or UpdateImage (which would be consistent with the ClearImage that I already have)

#

I pick that one ๐Ÿ˜„

long robin
rugged notch
#

do y'all smell burnt toast

golden schooner
long robin
#

what the heck

#

spatial filter broke

heavy cipher
#

special filter

long robin
#

somehow the special filter works in the other sample that uses it

#

I accidentally overwrote a matrix (in other words, I found the bug)

long robin
#

le beeg API break pushed

#

10 changed files with 497 additions and 213 deletions
๐Ÿฅฐ

golden schooner
long robin
#

msaayy lmao (zoom in to see it)

rugged notch
#

disgusting

long robin
heavy cipher
#

these jaggies are visible from space

long robin
#

I'm actually surprised MSAA just worked tbh

#

just had to make an MS texture, draw to it as usual, then blit it to some other texture for resolve

#

thought fwog was gonna have some screwed up API usage somehow, but I guess not

heavy cipher
#

oh no msaa is very easy in ogl compared to vk bleakekw

long robin
#

exactamente

#

tfw you need VkPipelineMultisampleStateCreateInfo

rugged notch
long robin
#

that actually reminds me

#

I need to add a corresponding struct to fwog

#

otherwise you can't do A2C or other fancy tricks

long robin
#

for some reason, NV's driver gives 2 samples when I request 1

heavy cipher
#

the more you buy, the more you save

#

send cap of single samp

long robin
#

let me inspect the cap first to make sure I'm not tardo

#

somethin is definitely fucky

heavy cipher
#

what is this megabind

#

anyways

long robin
long robin
#

ye

heavy cipher
#

single shrimpled

long robin
#

you on AMD?

heavy cipher
#

as god intended

long robin
#

mashallah it must be an nv driver buge

#

bug = reported

#

should've kept it secret for that competitive advantage frfr

heavy cipher
#

WONTFIX + opengL + termination for helping a competitor

golden schooner
#

no fs trickery?

#

like that shadertoy thing does

long robin
#

the code is quite shrimple

#

there is an MS render target and a non MS texture that I blit to for resolve

#

then I blit that to the screen to upscale so you can see the big pixels

golden schooner
#

multishrimple is also something i have to work on, after being skolded yestergestern

long robin
#

MSAA is very simple when your renderer is microscopic

golden schooner
#

and not naively deferrered?

long robin
#

yeah that makes things double plus unshrimple

#

for complex forward renderers it's a huge pain, but in a different way

#

because all full screen effects now need to worry about multisampling

#

3000 multisample image resolves of Allah

golden schooner
#

: )

heavy cipher
#

testing my resolve smh

long robin
final cove
#

OIT with MLAB gave me the most pain because I thought I could resolve it without sample rate shading but that's just what I ended up doing

#

luckily nsight doesn't work on my card otherwise I'd see how awful that actually is

long robin
#

I guess some fullscreen stuff will have aliasing if you do it after MSAA resolve

#

so you have to be careful

long robin
#

I just learned that you can set a bunch of framebuffer parameters for when you render with no attachments

#

I wonder when you might want to draw with no attachments at all, let alone care about how many samples, layers, etc. are "drawn" to

heavy cipher
#

no attachment is transform feedback

digital lion
#

voxelization would be one case where you draw without attachments but still care about width, height and samples

long robin
#

ah

#

transform feedback alone doesn't care about those

#

guess I need to add these flags then

heavy cipher
#

also nanitey stuff

#

bypass the framebuffer so you can interleave hw and sw raster

long robin
#

I see

#

is that why they implement the UB depth spinlock atomic thing (besides needing 64 bit atomics)

#

idk what I'm even saying

#

I guess both the sw and rw rasterizer need the funky 64 bit atomic

#

btw, in vulkan with dynamic rendering, how do you set the "framebuffer size" if there are no attachments? is it just VkRenderingInfo::renderArea?

heavy cipher
#

a good question

#

ask in #goolkan

long robin
#

ogay

#

inb4 framebuffer size dynamic state

heavy cipher
#

vkCmdSetFramebufferWidth

long robin
#

sadly no such thing

final cove
#

maybe stuff like OIT? it at least cares about the depth buffer tho so not truly 0 attachment

#

but pretty much anything where you want to rasturbate but imageLoad/Store instead of writing out to attachments?

long robin
#

btw, what's the point of A2C when you can just make your own sample mask ๐Ÿธ

#

and you don't even get control over the pattern that's used

heavy cipher
#

i think A2C predates mask access in the shader

long robin
#

i c

heavy cipher
#

twatter bread with a2c impls

long robin
#

what is the purpose of alpha to one

#

GL_SAMPLE_ALPHA_TO_ONE
If enabled, each sample alpha value is replaced by the maximum representable alpha value.

heavy cipher
#

if you have both a2c and blending

long robin
#

hmm, if you're using a2c with, for example, foliage, would you normally want alpha to one enabled?

#

otherwise the alpha would be "applied" twice

heavy cipher
#

right, i am not sure why you wouldn't turn blending off though, or why you'd want no-a21 when a2c is on

long robin
#

true ๐Ÿธ

long robin
heavy cipher
#

p cool

#

weirdly changes from 8 to 16

long robin
#

yeah, quite odd

#

like it no longer cares about dithering and just quantizes

heavy cipher
#

it had enough of your shit jaker

#

is this with builtin a2c?

long robin
heavy cipher
#

v odd

#

ah i know

#

what is your card?

long robin
#

3070

#

infidel edition

heavy cipher
#

first of all, how dare you

#

but second of all, it only supports multishrimple to 8 on vulkan

#

my guess if it actually does support larger counts on ogl, it is emulated

#

did you check?

long robin
#

ye, it claims to support up to 32 frog_shrimpleles on gl ๐Ÿธ

heavy cipher
long robin
#

I wonder what the shrimple pattern is for 16 and 32

shell inlet
#

is this the hacked multisampling transparency

#

alpha to coverage

#

what I wonder is how it behaves when one 50% opaque object moves in front or behind another 50% opaque object

#

it sure is a problem with just dithered transparency

#

because samples are aligned in screen space

#

so you need to shift them somehow based on depth or something, yet also make sure to avoid flickering

long robin
#

because the shrimple masks align

shell inlet
#

so it does align, very sadge

#

what if you stochastically discard samples

long robin
#

you fix it by using hashed alpha testing

#

except the paper does some fancy stuff to make the pattern stable, but not move with the screen

shell inlet
#

I mean stochastic transparency was a thing too

long robin
#

the paper mentions it too

shell inlet
#

so obvious direction to take with that

#

actually wondering which is an earlier paper this or stochastic transparency

long robin
#

the latter

#

because this paper mentions it

shell inlet
#

oh yeah ST is from 2011

#

I just opened my local copy and checked

shell inlet
long robin
#

the stochastic transparency paper mentioned in this paper is from 2010 ๐Ÿธ

shell inlet
#

but ig proper word would have been "covers" instead of "mentions"

long robin
#

covered in a soft blankie

long robin
#

fake

shell inlet
#

different publication maybe

long robin
#

perhaps

#

btw there seem to be two versions of the paper

#

yours has 12 pages, but mine has 8

shell inlet
#

btw what I find funny is how many papers have ideas that you can explain in few sentences but papers are massive

#

and some of them esp in context of rasterization are proposed as new things but they inevitably come from ray tracing

#

or in concepts which are basic in ray tracing context

#

so most of them would be things people who started out with rt would be able to come up on their own accord

heavy cipher
#

stochastic publication: publish 16 different versions of your paper with randomly discarded pages

shell inlet
#

but then ray tracing papers are concepts from physics, and maths used there is basic maths used for physics solvers

#

the difference is that they have different notation lmao

#

physics notation is killing me inside every time I look at any papers on physics

#

not that I read papers on physics often if at all, the thing about stuff coming from physics to rt was pointed out by @analog fiber , however I've seen before an instance of that in woodcock tracking paper

long robin
#

can you link said paper

shell inlet
long robin
#

๐Ÿ‡พ๐Ÿ‡ช

shell inlet
#

it's from rt gems 1 or 2 probably

#

damn I should have posted the entire link as flag emojis

#

wasted opportunity

heavy cipher
#

@long robin some people of the interwebs claim that when you go above 8 it switches to SSAA

#

pretty hilarious tho

#

it breaks code that actually observes samples

#

like a2c

heavy cipher
#

well its no longer msaa

shell inlet
#

but it still has samples?

heavy cipher
#

no

#

thats what i mean

#

its just ssaa

shell inlet
#

you mean it's supersampling right

#

or does it stand for something else?

heavy cipher
#

supersampling, yeah

shell inlet
#

so why would it not have samples

heavy cipher
#

i don't mean it the signal processing way

#

i mean in the api way

#

you saw above Jaker's videos

#

you can no longer discard individual samples because it is not MSAA

shell inlet
heavy cipher
#

it discards entire fragments, and fragments are single sample

shell inlet
#

by transitivity fragment->sample
so it discards samples

heavy cipher
#

you are really high on this definition train atm

shell inlet
#

I still don't understand what you are talking about

heavy cipher
#

i can see that

#

API wise there is difference between an MSAA image and SSAA image

#

if your code depends on observing those differences, it will break when you go to 16 or 32 samples on nvogl

#

thats it

shell inlet
#

what is the difference though?

heavy cipher
#

for example modifying the coverage mask

#

if your image is not MSAA, and just supersampled, you can't modify the coverage mask

shell inlet
#

by the way how did jaker even set more than 8 samples

heavy cipher
#

by the power of opengl

#

its advertised

#

or you are looking at sample locations (in SSAA the sample is always at the center of the fragment)

shell inlet
#

ok so basically no dithering but overall a2c still functions

#

because the mask can't hold more than 8 bits

#

wait that doesn't make sense

#

how would you discard the samples

heavy cipher
#

anyways, nothing but a historical curiosity

#

just like opengl :3

shell inlet
#

ok I see so nvidia implements more than 8 samples by doubling fragments

#

for 16 and 32 samples

#

and leaves the 8 bit mask

#

for each

#

so the pattern should remain the same but there is additional step that downsamples all excess fragments

heavy cipher
#

but it doesn't remain the same

shell inlet
#

actually yes it does not

long robin
#

I wonder if I should only expose 8 samples in fwog then ๐Ÿธ

long robin
#

@heavy cipher do you have any idea about the truthiness of this statement: #opengl message

long robin
#

I guess the "implicitly" means something something bus snooping

#

And explicitly is glFlushMappedBufferRange

long robin
#

downloaded resharper c++ and it's interesting

#

it taught me about std::views::values for when you want to iterate over all the values in a map

#

#include <ranges> though frog_sweat

#

not doing that just to make one line of code look slightly nicer ๐Ÿ˜„

#

so much noise

rugged notch
#

Free-monadic meta-transformers would make this a one liner smhmh

shell inlet
#

it's just big brain opengl design to make glTextureX for each texture type

long robin
#

my complaint was about all the resharper hints and suggestions nervous

shell inlet
#

yeh I'm just casually hatin' on gl

long robin
#

resharper found a critical missing destructor already

#

nvm it wasn't critical or even necessary ๐Ÿธ (except maybe to prevent UB lel)

#

rate my UB

struct A { ~A() {} };

struct B : A {};

int main()
{
    A* bp = new B;
    delete bp;
}
#

btw, I really hate this inheritance I have
class TypedBuffer : public Buffer
class TextureView : public Texture

#

I used inheritance so I could copy the interface in the case of TextureView and so functions could accept both types while only specifying a const reference to Texture or Buffer in the signature

rugged notch
#

Stupid question, what's the UB here, non-virtual dtor?

long robin
#

yeah, so B doesn't get destroyed

#

but it has no members itself, so maybe that case isn't UB

rugged notch
#

Right, I had forgored

#

But now I rembered

rugged notch
long robin
#

I was thinking that I could make some reference thingy that can be implicitly constructed from Texture and TextureView, and make the functions take that as a param

rugged notch
#

Composition instead of inheritance is nice but then you can't pass them around as the base

#

Aah

#

Like a wrapper that accepts either?

long robin
#

yeah, then it just copies the gl handle and the createinfo struct

rugged notch
#

Sounds good ye

long robin
#

seems maybe less yucky than being forced to add virtual destructors

#

which is what I currently have

#

but then I'll be forced to copy the interfaces to the derived types ๐Ÿธ

rugged notch
#

I'm gonna sound like an orThODoX C++ guy but, inheritance in C++ not very good, it's too easy to mess up and so brittle

rugged notch
#

Make a macro

long robin
#

in my case, it (inheritance) is simply not the 100% correct solution

#

but it feels close to what I want

rugged notch
#

DECLARE_BUFFER_ACCESSORS(Bababuffer)

#

I'm half kidding, tbh

#

It can be fine in some cases, depends how involved the interface is

long robin
#

the interfaces aren't that big tbh

#

like <10 functions each

rugged notch
#

Hmm, question tho

#

Are users gonna be making untyped buffers

long robin
#

yeah

rugged notch
#

Darn

long robin
#

the use case I imagine is when you have a counter + array

rugged notch
#

Right

long robin
#

basically { unbounded array + anything else } can't be represented by my typed buffer

golden schooner
#

tbh i dont mind the big switch block

rugged notch
#

Eh sometimes a bit of copy paste is fine

rugged notch
golden schooner
#

i know ๐Ÿ™‚ but i had to read past all that other complaining of you ๐Ÿ˜›

rugged notch
#

Hehehe well I was just makin a silly jok

#

Free-monadic meta-transformers don't exist, though free monads exist and monadic transformers exist

long robin
#

anyways, buffer views were something I've been wanting to add

golden schooner
#

indeed

long robin
#

I could probably make some cursed template abomination to express all kinds of SSBOs

golden schooner
#

dont

#

i prefer readable code ๐Ÿ™‚

#

over saving a bit on code size

long robin
#

e.g.,
auto buffer = Fwog::TypedBuffer<uint32_t, Fwog::UnboundedArray<Bababooey>>(69);

#

idk how the uploading interface would look though

golden schooner
#

same as Texture's Update perchance, BufferView's Update knows the offset already, so no ned to pass that in

long robin
#

I mean to make this specific thing work

#
buffer.UpdateFirstThingy(someUint32);
buffer.UpdateSecondThingy(someArrayOfBababooeys);
golden schooner
#

buffer is just one thing, how can it know about first or second or fird

long robin
#

since unbounded arrays have to be the last member of an SSBO, you could logically partition the buffer as {struct of first members, unbounded array member }

golden schooner
#

oh its some c++ery

long robin
#

it wouldn't be super magical though. I'll show an exfrog_shrimplele

golden schooner
#

i was thinking, that Buffer is just a memory range of size size. and buffer views describe what type and range in buffer

#

similar to gltf bufferview and accessor nonsense

long robin
#
// shader
struct AABB { ... };
readonly buffer FOO
{
  uint counter;
  float someData;
  AABB boxes[];
};
// host
struct FooData
{
  uint32_t counter;
  float someData;
};

struct AABB { ... };

std::vector aabbs = ...
auto buffer = Fwog::TypedBuffer<FooData, AABB>(aabbs.size());
...
buffer.UpdateArray(aabbs.data(), aabbs.size());
golden schooner
#

hmm

#

why do you need 2 template parameters?

long robin
golden schooner
#

hmmmm

long robin
golden schooner
#

i am probably just too stupid to understand that

long robin
#

remember, unbounded arrays always have to be last in SSBOs

golden schooner
#

i didnt know that, but now i do, in glsl terms

long robin
#

and they are the sole thing fucking with my current impl (which accepts one template param)

golden schooner
#

ok i understand now, i just never staff more than Foo foos[] into a ssbo before ๐Ÿ™‚

long robin
#

the thing I showed is how you can have type safety for these without resorting to an untyped buffer

golden schooner
#

BufferView is a complete different topic here

long robin
#

then I can eliminate untyped buffers

golden schooner
#

hmm would be cool if your c++ code would generate the glsl counterpart for it

#

ok also differen topic

long robin
#

hehe

#

having to update structs in two places indeed sucks

#

but it's not the end of the world

golden schooner
#

it looks funny

long robin
#

having such a system would mean Fwog would interact with shaders and the filesystem

golden schooner
#
std::vector aabbs = ...
auto buffer = Fwog::TypedBuffer<FooData, AABB>(aabbs.size());
...
buffer.UpdateArray(aabbs.data(), aabbs.size());
long robin
#

yeah, it's PoC syntax ๐Ÿ˜„

golden schooner
#

like how would you as a consumer of fwog know when to call what

#

i know ๐Ÿ™‚

#

would it mayhaps make sense to have some reflection analyze the glsl part and yell at you when arrays are not the last fields in the struct

#

and you just fill the data on host side as usual

long robin
#

reflection makes it way harder

golden schooner
#

just to syntax check

long robin
#

I'd prefer if the user just input the types themselves ๐Ÿ˜„

golden schooner
#

fair

long robin
#

but you're asking to check on bind, I presume

#

honestly probably not too hard to do that

#

weellllllll

#

I forgor that reflecting C++ types is stupid hard

#

you could reflect the size of the struct types easily I guess

golden schooner
#

i just mean shader reflection by whatever means (builtin glism is kinda fucky for blocks tho) maybe some sort of regex

#

hmm

#

its a good question ๐Ÿ™‚

#

the whole buffer thing

#

hmm

#

@long robin how are you going to proceed right now?

long robin
#

guess I'll just do resharper stuff atm

long robin
#

ah, that was for a thingie used for vertex attributes, where those strange formats don't make sense

golden schooner
#

: )

#

now its biting you back

long robin
#

let's go

#

also ew that formatting

#

smh clang-format

golden schooner
#

: D

#

i also just read "Is Death Frog"

long robin
#

what do you think about spamming const everywhere

golden schooner
#

+1

long robin
#

maybe another day

golden schooner
#

to please the const correct gods

#

did you know resharper allows you to apply file/project/solution wide

long robin
#

I only care about const correctness for parameter passing and classes

long robin
#

I'm scared to do anything more than file-wide because I don't know if it will correctly detect my project

golden schooner
#

hehe

long robin
#

it already shows me random stuff in glfw when I use ctrl+t to search

golden schooner
#

you can press ctrl+t multiple times

#

that "search everywhere" should change accordingly

long robin
#

hmm

#

none of the options show exactly what I want

golden schooner
#

ah

long robin
#

๐Ÿค“

golden schooner
#

unconventional ๐Ÿ™‚

long robin
#

this is kinda annoying

#

the whole point of optional::value() is that it is checked, and will throw if empty

#

I'm aware of that fact, which is why I'm calling it

#

it wants me to write if (foo.has_value()) {} else {}

#

disabling the warning means it won't warn for the actually unchecked case of *foo or foo->thing (which are UB if foo is empty)

final cove
#

all of these warnings seem completely unhelpful

#

yeah but how well does this linter know what's actually unchecked?

long robin
#

idk, I already disabled this one

golden schooner
#

i dont think these warnings are unreasonable

long robin
#

I disabled a bunch already

#

most are just telling you to follow modernester c++ practices

golden schooner
#

yep

#

it also makes the code more readabler perhaps

long robin
#

there are over 1000 checks. I think it's okay if I disable a few dozen

long robin
#

I disabled a bunch of arithmetic conversion checks because I don't want to write a billion casts just to mix size_t and int on the same line

golden schooner
#

c/c++ were a mistake

#

: >

final cove
#

I bite the bullet and do those, but its not like it actually makes your code any safer/more correct

#

you can still overflow/index OOB

long robin
#

well some of them do

#

like the ones that tell you to cast to a wider type before doing maf

#

but I Know What I'm Doingโ„ข๏ธ, so I can """safely""" disable the checks

#

btw, the unmarked fallthrough check found a pretty bad bug

#

which made clearing the swapchain also invalidate it

fiery sorrel
#

about to do the topics from logl i never touched but with fwog

long robin
golden schooner
#

lol wat

shell inlet
#

I am so dumb that I cannot comprehend this after reading it like 3 times

#

spec people must be extra autistic

golden schooner
#

i wonder if jaker asked a colleague about multishrimple and that is the response

brazen glacier
#

i think it's just that they don't support multisampled textures with a sample count of 1, you have to use ordinary textures
makes sense since the sampler types are different and stuffs so it's probably different paths in hw

golden schooner
long robin
#

#1019779751600205955 message

golden schooner
#

thats where it began ๐Ÿ™‚

long robin
#

and some things like "there only needs to be a flag for clearing buffers" which is shrimply wrong

shell inlet
#

@long robin hey wanna make a probe based GI sample with my assistance

#

idk I can't write actual code it's too time consuming

#

if you could make cubemap capture code I could try to fill in the shader code though in free time

#

basically if I had a template to work with I could cook something

long robin
#

what kind of probe based GI

shell inlet
#

half life style but with rough reflections

long robin
#

would it be something scuffed where the probes are just cubemaps

shell inlet
#

well yes one radiance map and one irradiance map for diffuse

long robin
#

like source

shell inlet
#

irradiance map could be way smaller in resolution

long robin
#

it'd basically be one bounce of GI unless we bake it multiple times

shell inlet
#

rough reflections could be made from stochastic sampling at runtime

#

a few samples from radiance map mip based on roughness value

shell inlet
long robin
#

my motivation

shell inlet
#

if you don't wanna then fine

#

the baking would take only a few seconds max though even multiple times

long robin
#

well, if there are 1000 probes, then that would be at least a few seconds for one iteration

shell inlet
#

isn't 1000 probes is overkill

#

why so many

long robin
#

because it's a big number

shell inlet
#

especially if you can interpolate between them

long robin
#

big numbers cool

long robin
#

could do something like DDGI's variance shadow map per probe though

shell inlet
#

no leakage if placed right

long robin
#

do you mean manual placement

#

because I don't wanna do that

#

I'd rather have something that just naturally reduces leakage (like DDGI)

shell inlet
#

ok then implement ray tracing mr picky eater

long robin
#

well I don't need tray racing to be inspired by one part of DDGI

#

which is the VSM thingy to reduce leeking

shell inlet
#

how would that reduce leaking though

long robin
#

at some point the scuffed rasterized probes could be replaced by ray traced probes

shell inlet
#

ain't vsm actually increases leaking

#

in context of shadow mapping

long robin
#

so there is still leaking, but less than shrimple trilinear interpolation

#

(each probe would store its own VSM for this test in addition to radiance and/or irradiance)

#

I gotta push a bunch of MSAA stuff before I work on anything else

long robin
maiden peakBOT
long robin
#

updated VS and now I get this

daring surge
#

this is why you don't update things!

#

big missed steak

long robin
#

I wonder how to make resharper not spam me with this shit every time I launch vs

long robin
long robin
#

FSR 2 also requires samplerless texture functions, which should be easy enough to get around (just bind a dummy sampler and continue using texelFetch)

#

set = # will be an easy fix too

#

I'm not sure where to start when it comes to actually making a GL backend though. I guess I can just transform the Vulkan backend

#

I'll can try integrating it with the gltf viewer I guess. one more feature can't hurt

#

argh I don't think stb_include handles transitive includes ๐Ÿ˜ฆ

#

actually I may be wrong

#

hell yeah I'm wrong

dapper gorge
#

Hype

long robin
#

I'll need to do some minor translation of all the .glsl shaders here

#

I'm going to copy them and change the extension, but I'm not sure to what (since glsl is already taken)

#

I'm thinking about .glsl2 ๐Ÿ˜„

#

or maybe .openglglsl lol

dapper gorge
#

This is going to be one tedious thing

long robin
#

we'll see how far I get

#

I predict that translating the shaders will be relatively easy

#

the hard(er) part will be making a fresh backend

#

the vk one is "only" 2000 lines long, so I have some confidence that I can make a much shorter one in gl

#

resource creation, descriptor management, etc. are a lot shrimpler in GL

dapper gorge
#

glCreateBuffers, alright done, glNamedBufferSubData boom, stuffed with data, glBindBufferBase done

#

I imagine in vulkan it's like: "to create a buffer, you first have to invent a parallel Universe in which said buffer exists"

long robin
#

there are so many steps to do the equivalent things in vk that I can't even remember

#

creating a buffer alone requires like 3 function calls

#

vkCreateBuffer, vkGetBufferMemoryRequirements, and vkBindBufferMemory

#

to upload data, you need to make a staging buffer with the host visible flag, map it (vkMapMemory), memcpy your data to the pointer, unmap (vkUnmapMemory), then copy the buffer (vkCmdCopyBuffer), which requires an active command buffer

#

then (if you're using a simple staging buffer scheme) you put the temporary buffer in a zombie list because you can't just delete schtuff right away (unless you wait for the GPU to finish using it)

dapper gorge
#

Ah yes, just the """simple""" scheme

#

I imagine the complex scheme requires inventing a new protocol alongside PCIe to communicate with the GPU?

long robin
#

now that we have a buffer, we can finally copy its descriptor to a descriptor set and bind that bad boy before dispatching

#

which is ignoring the fact that creating a descriptor set requires a descriptor pool and is another thing that isn't magically sync'd by the driver (so you may need to make multiple)

#

gl drivers are quite magical indeed

dapper gorge
#

Is it GL that's weird because it doesn't require any of this stuff or do GPU actually need to perform all this..?

#

I mean I probably already know the answer, if it wasn't necessary they wouldn't have made it like this...

long robin
#

keep in mind vulkan is still an abstraction over the GPU

dapper gorge
long robin
#

heh

dapper gorge
long robin
#

no, it does not ๐Ÿ˜„

dapper gorge
#

Thank god

long robin
#

vulkan removes some significant fake stuff that gl has, like implicit sync

#

if you make a resource in vulkan, you only make one copy of it

#

you're responsible for making sure the CPU and GPU have overlapping work

#

if you want to write some data to a (e.g., uniform) buffer from the CPU, you have two real options

  • wait for the GPU to finish using that buffer first (big stall!)
  • have a second copy of the buffer that the CPU writes to while the GPU is reading
dapper gorge
long robin
#

descriptor sets are another resource that the CPU needs to write to frequently, so they need the same double buffering treatment

#

and when you delete a resource in vulkan, it gets deleted "immediately", so you need to make sure it's not being used by the GPU first

dapper gorge
#

Yeah, GL isn't that bad after all, GL_NEAREST disabling mips ain't a big deal

long robin
dapper gorge
#

Big thank you to all driver teams working on GL KEKW

long robin
#

now you hopefully have an idea why low-effort gl apps will run better than low-effort vk apps, because you're basically offloading all the optimization work to the driver in gl

dapper gorge
#

Yeah I always see deccer going "Vulkan will be slower, at first, than GL", now I know

long robin
#

it's even worse when you're porting a gl app to vulkan

#

because you get used to glisms like changing pipeline state randomly and on the fly, creating and destroying resources willy nilly, etc.

#

which require some effort to do performantly in vk (basically reimplementing the heroics that driver engineers have implemented already in their gl driver)

dapper gorge
#

"some"?

long robin
#

at least 1

dapper gorge
#

We are using the -ln(1 - x) scale right?

long robin
#

it seems more likely to not have to do these heroics if you're making an engine from scratch though

#

and you can take into account the limitations (more like difficulties) of the API you're using

dapper gorge
#

I wanted to read the vulkan-tutorial.com thing a few days ago, just to get a few things you fellas talk about, before going for occlusion culling, but I then compare the word count of that with the word count of learnopengl and I was scared away

long robin
#

vkguide.dev is better anyways

#

vulkan-tutorial teaches you how to render a simple model, but the code is not very reusable

#

vkguide uses vkb to abstract some annoying stuff (instance creation and device selection) and vma to abstract some other annoying stuff (memory management), and has a better renderer architecture

#

the stuff that gets abstracted away in vkguide is ultimately unimportant boilerplate, plus vma is widely used in the industry so you might as well learn it

dapper gorge
#

I see, I have a feeling I'll follow both, just because I think that's how much time it's going to take me to digest the stuff I'm reading

#

Rehearsing while digesting shouldn't be too bad (I hope)

long robin
#

yeah I did both, but that's only because I ignorantly thought I'd learn better from vulkan-tutorial

#

in reality, you'll need to read a million blog posts in addition to those tutorials to get a good grasp

dapper gorge
#

Jk, I'm not that surprised KEKW

long robin
#

you should be good on the basics of graphics stuff at this point

#

which means just learning the weird vulkan stuff

dapper gorge
#

There is still a lot I don't know, derivatives are magic

#

I used dFdxFine for calculating recevier depth plane bias, except I have no idea how the hell this works

#

Do derivatives just mean "rate of change" in this context, how do you measure that though?

shell inlet
#

finite difference

dapper gorge
#

Yeah but how?

#

If I write in the shader dFdx(some_random_float_idk), how does the GPU know what to do with it?

#

??? - ??? Fill in the gaps KEKW

long robin
#

gpu executes fragments in 2x2 quads

shell inlet
#

evaluated in blocks

#

subtracts values from each other

#

gets the difference

#

you want derivative of x, then shader will get you the derivative of x by subtracting from x es of neighbouring pixels in the block

dapper gorge
#

Hmm, so each thread in the GPU knows about the values of all x in the 2x2 block it's shading?

long robin
#

ye

#

luckily I have this pic I made a while ago

dapper gorge
#

Incredible

#

What if you are on a corner of the screen?

#

Like top right for example

shell inlet
#

if I had to guess it reverses the operands but idk

#

so instead of f(x+a)-f(x) you get f(x)-f(x-a) or something

final cove
#

yeah and also some of those can be helper invocations, which run the shader but don't execute any writes

golden schooner
daring surge
long robin
#

Absolutely hilarious even

daring surge
#

going 2 need to tell this one at open mic night

final cove
#

what's the deal with visual studio? [slap bass]

long robin
#

oof I just realized that I need to manually add a bunch of defines to the shader sources since I won't be using a spirv compiler

#

unless...

#

I suppose I can give spirv in opengl another shot

golden schooner
#

luckily you be using gl46 ๐Ÿ™‚

long robin
#

I'm debating whether to use fwog for the backend ๐Ÿ˜„

#

I don't think it will be too helpful, since it's just a bunch of compute shaders

#

hmm okay I convinced myself

golden schooner
#

: )

#

F in FSR means Fwog

#

Fwog's splendid renderisms

long robin
#

having no standard opengl header sucks

#

eh I guess I can just vendor glad........... again

golden schooner
#

cough-cmake-template-cough

#

hehe

long robin
#

you should get that cough checked out

long robin
#

does C have default function parameters thonk

golden schooner
#

i only find variadic nonsense and other hacks

#

i suppose thats where esotheric languages like zig and nim try to shine ๐Ÿ™‚

long robin
#

hmm

#

I ask because this code in the FSR 2 source uses default params in what is supposedly a C header

dapper gorge
#

No C doesn't have default parameters but you can have C linkage on any C++ function

long robin
#

hmm, so I guess the point is slightly better ABI compatibility?

#

otherwise they shouldn't bother with the extern "C" block

#

because it's ultimately a C++ header since it uses that one feature lol

#

I think it's an oversight tbh

dapper gorge
#

Probably, it could also mean easier loading from DLLs (or porting FFX to other languages)

long robin
#

tru

dapper gorge
#

Without, you know, writing dlsym("__ZZAFIYaa@@SD350951ffxGetTexture@@520faygtZZ_s__gteoi")

long robin
#

I wonder how other languages' FFI thingies interact with C++ headers though

dapper gorge
#

C++ name mangling was a mistake

long robin
#

or I guess you just write your own function prototypes when you write bindings

dapper gorge
#

Yeah

long robin
#

are you sure all C++ functions can have C linkage though ๐Ÿค”

#

what about overloaded functions

dapper gorge
#

You technically can't do that, but compilers usually have an extern "C++" that's supposed to deal with stuff like that

#

I am not entirely sure how it works though

long robin
#

huh

dapper gorge
#

It's all implementation defined

#

With namespaces it's even funnier, cursed stuff like:

namespace A { extern "C" void f(); }
namespace B { extern "C" void f(); }

Both declarations of f() refer to the same function KEKW

long robin
#

this convo reminds me of some cursed thing you can do with extern "C", kinda like this

class Joe
{
    void secret()
    {
        printf("boo!\n");
    }
};

extern "C"
{
    void secret(Joe*);
}

int main()
{
    Joe j;
    secret(&j);
}

(except this code doesn't actually link because I didn't predict how Joe::secret would get mangled)

dapper gorge
#

You can just do this


extern "C" {
    void Joe::secret() {
        printf("boo!\n");
    }
}```
long robin
#

yeah but my goal is to hack into a private member of a class

#

hmm how do I make compiler explorer show mangled identifiers

#

found it

golden schooner
#

its tru๐Ÿ‡ฑ๐Ÿ‡พ cursed

long robin
dapper gorge
#

Hmm yeah C linkage can't apply to class member functions

#

Sad

long robin
#

removing the spurious call to j.secret makes it not link, I guess because the symbol gets removed

dapper gorge
#

Disable LTO KEKW

long robin
#

smh gcc can't see that _ZN3Joe6secretEv(&j); is obviously referring to Joe::secret

long robin
dapper gorge
#

Damn, compiler is too smart

long robin
#

google tells me that the flags for disabling lto don't work

#

I'll try clang

#

ah, now you can make secret private and it still works ๐Ÿฅฐ

dapper gorge
#

epic

long robin
#

All inputs that are provided at Render Resolution, except for motion vectors, should be rendered with jitter. Motion vectors should not have jitter applied, unless the FX_FSR2_ENABLE_MOTION_VECTORS_JITTER_CANCELLATION flag is present.
how are you supposed to efficiently render motion vectors without jitter, if everything else in the gbuffer is jittered rgbemoji

#

I'm not sure when you wouldn't use that flag

brazen glacier
#

use an unjittered view matrix when computing the previous/current positions i guess?

long robin
#

Hmm I suppose

#

I didn't fink of dat

long robin
#

now 2% done hehe (renamed the interface functions)

#

oops I forgot the last one misinfo

long robin
#

hmm

/// Helper macro to do safe free on a pointer.
#define FFX_SAFE_FREE(x) \
    if (x)               \
    free(x)

void free( void *ptr);
If ptr is a null pointer, the function does nothing.

rugged notch
#

Classic

long robin
#

I'm a bit conchfused here, does glslang automatically make permutations of a shader if you pass defines in curly braces like this?
set(FFX_SC_ARGS ${FFX_SC_BASE_ARGS} ${FFX_SC_GL_BASE_ARGS} ${FFX_SC_PERMUTATION_ARGS} -DFFX_HALF={0,1})

#

the "docs" are lacking

-D<name[=def]> | --define-macro <name[=def]> | --D <name[=def]>
define a pre-processor macro

#

here is the full snippet of cmake where this appears

    # combine base and permutation args
    if (${PASS_SHADER_FILENAME} STREQUAL "ffx_fsr2_compute_luminance_pyramid_pass")
        # skip 16-bit permutations for the compute luminance pyramid pass
        set(FFX_SC_ARGS ${FFX_SC_BASE_ARGS} ${FFX_SC_GL_BASE_ARGS} ${FFX_SC_PERMUTATION_ARGS} -DFFX_HALF=0)  
    else()
        set(FFX_SC_ARGS ${FFX_SC_BASE_ARGS} ${FFX_SC_GL_BASE_ARGS} ${FFX_SC_PERMUTATION_ARGS} -DFFX_HALF={0,1})
    endif()
#

I have my work cut out for me bleakekw

long robin
#

le sigh, I wish opengl glsl had separate samplers

#

hopefully none of these textures are sampled in more than one way

#

fortunately, it looks like only one sampler is used

#

mfw Intel is the only vendor who supports GL_KHR_shader_subgroup_quad in OpenGL ๐Ÿ˜”

#

time to get an actually good GPU I guess

#

oh shid, the shaders actually compiled in gl mode ๐Ÿ˜ณ

#

wtf (there are 48 of these alone)

oak garden
#

are you porting fsr2 to opengl

long robin
#

perhap

oak garden
#

cool beans

digital lion
long robin
#

oh, huh

#

I didn't know that was a thing

#

I see it is part of KHR_shader_subgroup

#

unfortunately, glslang can't compile shaders with that extension unless the env is spirv1.3

#

I'm not sure if opengl can consume that

#

I'll try later I guess

long robin
#

sweet, now it seems like I really have the cmake and shaders working

#

now I can write code in an actual IDE and compile it to see if schtuff works

golden schooner
#

sounds promising

dapper gorge
#

Lovely

long robin
#

Tbh, the backend seems rather straightforward to implement

#

I just need to fill in the interface functions

#

And using the vk backend as a starting point makes it a lot easier

golden schooner
#

thank god we did the exercise of writing a modern-gl-almost-vk-looking thing already ๐Ÿ˜›

long robin
long robin
#

directx is a scourge on humanity

long robin
#

I love how everything is either a UAV or SRV, yet both can refer to textures and buffers bleakekw

golden schooner
#

Ultra Accessible Value, Sometimes Relevant Value

long robin
#

I love seeing // bind uavs and // bind srvs in vulkan code. it really helps me understand what is happening

golden schooner
#

developed on dx first then ported to vk?

long robin
#

perchance

golden schooner
#

or dx speak is shrimpler

long robin
#

eh

golden schooner
#

: >

long robin
#

dxisms are present throughout the public API

golden schooner
#

maybe you can hunt down the amd peeps who wrote this

long robin
#

I can chat with them anytime lol

#

I won't bother them with this nonsense

golden schooner
#

and interlocute them why everything is soaked in dxisms

#

you could ask for a friend ๐Ÿ™‚

long robin
#

I figure it's because everything in the industry is dx

#

almost

#

it feels like vulkan is barely past the threshold for most big companies to care about it ๐Ÿ˜ฆ

golden schooner
#

it feels like that ๐Ÿ˜ฆ

#

more something for niechisms and hobbyists

long robin
#

I blame inertia from dx being better than opengl for a long time

shell inlet
#

valve is pushing vk

golden schooner
#

i do remember a very brief discussion about opengl and 3dfx on the school yard decades ago

#

how opengl sucked over glide when the voodoo cards were killing it

#

vk = valve krafics

long robin
#

I wonder if fsr2 uses any ubos from last frame

#

the vk backend has this fancy ring buffer that they use for acquiring ubo ranges

fiery sorrel
long robin
#

no point in learning d3d11 if you already know opengl tbh

#

(same with d3d12 and vulkan tbqh :^))

#

idk, d3d12 is weird and doesn't feel as well-planned as vulkan

heavy cipher
#

d3d12 has some significant warts

long robin
#

seems like it inherits a lot of dumb stuff from d3d11 (and its own "special" stuff like sync)

fiery sorrel
#

oh okay. I'll stick to just OpenGL and WebGL then.

long robin
#

rate my type safety

namespace GL
{
  struct Texture { GLuint id; };
  struct Buffer { GLuint id; };
  struct Sampler { GLuint id; };
}
dapper gorge
#

I feel very safe now

long robin
#

I'm trying to make this ugly thing less ugly

    // store for resources and resourceViews
    struct Resource
    {
#ifdef _DEBUG
        char                    resourceName[64] = {};
#endif
        VkImage                 imageResource;
        VkImageAspectFlags      aspectFlags;
        VkBuffer                bufferResource;
        FfxResourceDescription  resourceDescription;
        FfxResourceStates       state;
        VkImageView             allMipsImageView;
        VkImageView             singleMipImageViews[FSR2_MAX_IMAGE_VIEWS];
    };
#

(btw, FSR2 uses C++11, so no std::variant)

heavy cipher
#

that char array shivers me timbers

rugged notch
#

I missed an episode

#

what are you up to with this FSR thing?

dapper gorge
#

It's my fault

#

I wanted FSR2 on OpenGL and Jaker went: "sure I needed an excuse to work on it anyways"

#

So now I am in debt with Jaker for the rest of my life (please don't sell me)

rugged notch
#

he will be exchanged for 2 silk bundles alhamdullah

long robin
#

progress is slow, but those areas that aren't packed with red stripes are what I've completed so far

heavy cipher
#

Not to worry

#

fix 1/4th of it then just upscale

oak garden
#

Can you do this at work since itโ€™s kinda related or would that not fly

long robin
#

I could, at least in theory

#

let's just say that it's unlikely that you'll ever see an official GL backend

oak garden
#

I see

#

i guess active opengl support isnt really important anymore

long robin
#

yep froge_sad

oak garden
long robin
#

I love how there are tons of checks for null pointers here, where the function does nothing if the pointer is null

golden schooner
#

maybe to keep nullcheck linter things calm

long robin
#

it would be smarter to just terminate or smth instead of continuing in a clearly broken state

oak garden
#

or throw some error to let the user know at least

#

instead of just silently being broken lol

golden schooner
#

obvious null checks might also improve awareness of possible nullisms

#

not everyone is an elitec++ist

oak garden
#

the real solution is not being nullable in the first place smh

golden schooner
#

also true

#

but tell that to old code bases

oak garden
#

are C# objects nullable

long robin
#

it reminds me of when I was learning C and would write things like this

void vec2_add(const vec2* a, const vec2* b, vec2* c)
{
  if (!a || !b || !c) return;
  ... // implement logic
}
oak garden
#

we have all written bad code

#

too bad my oldest code only exists locally on a dead laptop

long robin
#

silently failing sucks

golden schooner
oak garden
#

alright at least you can disable it at compile time

#

i know java has @NonNull or something but thats just a hint iirc

long robin
#

I could imagine C++ having such a thing, but it's just used as a contract (i.e., it's another source of UB)

golden schooner
#

ye JetBrains provided those hints too over a long time, CanBeNull/NotNull to aid analysers, and notify the user

#

nullable is an actual compiler ism

oak garden
#

another win for kotlin over java

golden schooner
#

kotlin is nice indeed

oak garden
#

kotlin is actually super nice to work with

golden schooner
#

thats what java should have been

final cove
#

using the dereference operator in general makes the non-null assumption, so you'd have just as much UB

long robin
#

I love me some ub though

golden schooner
#
Foo foo;
...
foo?.Method(); // method will not run when foo is null
dapper gorge
oak garden
#

living on the edge

long robin
#

dodging ub makes me alive

oak garden
golden schooner
#

objects are nullable by default

oak garden
#

oh i thought we were talking about kotlin

golden schooner
#

ah

#

sorry

#

i was talking about c#

oak garden
#

right

rugged notch
#

C# nullability is v v v v nice

golden schooner
#

its also a little pain in the rear

rugged notch
#

only annoying part about it is value types imo

golden schooner
#

when you make valuetypes nullable then its the same pos and negative thing

final cove
#

I remember in high school arguing with someone using unity that bool? was dumb for a tri-state value lol

golden schooner
#

hehe

#

i wish more gp people would use c# (im not talking about unity or mono)

long robin
#

I still need a program to actually hook this up to when I'm done

#

mayhaps I can use @dapper gorge's as a lab rat

golden schooner
#

Fwog goes FSR2.x, stay tuned

long robin
#

or I can finally add motion vectors to 03_gltf_viewer and use that

dapper gorge
#

I shall be the first user in the world of OpenGL FSR2

long robin
#

I haven't pushed anything yet

#

but soonโ„ข๏ธ

heavy cipher
#

man made horrors upscaled beyond comprehension

long robin
#

is there a way to search VS keybindings by key

#

I accidentally resolved a keybind conflict with some dumb resharper functionality and I can't find the option to rectify it

#

(the shortcut I fucked was alt+down arrow to move a line down)

#

fuckit, reset all keybinds and it works fine now

golden schooner
#

i think so yes

#

in the keymap dialog should be a textbox above the list of all actions/keyassignments

long robin
#

btw I'm about 50% done with the gl backend now

golden schooner
#

oi that was kwik

dapper gorge
#

Big hype

long robin
#

it's nice not having to create descriptor pools, descriptor sets, pipeline layouts, or search for memory heaps with specific properties

digital lion
#

deccer if jaker succedes with making a fsr 2 gl backend you know your job

#

make it work with C#

#

pls

long robin
#

fortunately it has a very shrimple C interface

#

hmm is it very difficult to make C# bindings for a library with a C interface? mayhaps you could do it yourself

oak garden
#

i doubt its very hard

digital lion
#

never tried its probably doable

#

i just know deccer knows better than me

long robin
#

hehe maybe it's better for you to learn than make deccer do monkey labor

digital lion
#

ok sir

long robin
brazen glacier
#

same with structs, just copy paste c ones and stick a layout attribute on the top

final cove
#

don't you also have to marshall the inputs from C# properly

brazen glacier
#

that's automatic for DllImport

#

you can even just go unsafe and use raw pointers

final cove
#

tbf the only time I tried exposing C to "C#" was trying to make bindings for powershell and that was basically playing on challenge mode

golden schooner
#

its super shrimple

#

i do be using function pointers

#

a newer way to interop with c

#

almost 0/no performance loss

long robin
#

how do you make variadic function bindings lol

golden schooner
#

id go to the c person and beat them up first

dapper gorge
#

Valid

golden schooner
#

and then id ask them to get rid of variadics

#

nah there should be a way as well

long robin
#

mayhaps you have to make a binding for each set of argument types

golden schooner
#

c# has some options for marshalling things

#

otherwise there could be a way via C++/CLI bridge

#

Foo(params int[] parameters) is much cooler

#

Foo(23, 4, 5, 3, 5);

long robin
#

hmm, it needs to accept any set of types (primitive and aggregate) though

golden schooner
#

object[] instead of int[] then

long robin
#

actually idk if varadics work with aggregate types

#

well you can't pass arrays since they just decay to pointers

golden schooner
#

was just saying how "variadics" manifest in c#

long robin
#

ah

golden schooner
#

sorry for sizzling in some conchfusion

long robin
#

np

#

smh va_start can only take one argument starting in C23

#

otherwise you're forced to pass some useless extra param to it

golden schooner
#

all this stuff boils down to shrimple pointerisms anyway

long robin
#

yeah

#

though variadics are kinda wacky

#

since the way they work in C is by putting a list of arguments on the stack, then iterating over them with the weird va_ macros

golden schooner
#

yeah

long robin
#

I guess they're not that weird when I put it that way lol

#

though they still suck because it requires the user to somehow indicate how many args there are and the type of each, and to follow some careful contract (or get UB)

golden schooner
#

i never liked that , ... syntax

#

id rather have a hint like params $DataType[] parameterName

long robin
#

or perhaps template<typename... Ts> hehe

golden schooner
#

same shit ๐Ÿ˜„

long robin
long robin
#

inshallah the backend is "done"

#

missing a bunch of optimizations like fp16 and subgroup ops, but theoretically (barring all the bugs that are certainly hiding here) this will work if you plug it into a renderer

heavy cipher
#

but does it

long robin
#

no clue tbqh

#

I'll try cramming it in my gltf viewer with no motion vectors

#

but first, lemme commit + push

#

@dapper gorge ^

#

it's probably super broken, so don't get your hopes up too much

signal widget
#

Haha, love the pedantic backend renaming :p

-         message(STATUS " This framework supports DX12 and VULKAN, you need to invoke cmake in one of these ways:")
+         message(STATUS " This framework supports DX12, Vulkan, and OpenGL. You need to invoke CMake in one of these ways:")
long robin
#

incidental fixes, I must say

#

now I gotta figure out how to fetchcontent this thing bleakekw

dapper gorge
#

We shall try this

long robin
#

maybe it's not ideal to get a 1.5 gb repo with fetchcontent

heavy cipher
#

woah

#

why is it so beeg?

long robin
#

actually I might be misinfo

#

there is a fat sponza model in a submodule methinks

#

yeah, cauldron-media is 2.5 gb ๐Ÿ’€

#

๐Ÿ‡ญ๐Ÿ‡ฒ somehow the fsr2 project is ignoring the options I set when I fetch

dapper gorge
#

Let me know when you won't make me download 3GB of data bleakekw

long robin
#

it's still trying to build the vulkan target with this

option(GFX_API_DX12 "" OFF)
option(GFX_API_VK "" OFF)
option(GFX_API_GL "" ON)
option(FFX_FSR2_API_DX12 "" OFF)
option(FFX_FSR2_API_VK "" OFF)
option(FFX_FSR2_API_GL "" ON)
FetchContent_Declare(
    fsr2
    GIT_REPOSITORY https://github.com/JuanDiegoMontoya/FidelityFX-FSR2.git
    GIT_TAG        3d0f3287f241daec7da336f77b36a8aac81abd82
    GIT_SUBMODULES ""
)
FetchContent_MakeAvailable(fsr2)
long robin
#

smh I just told you that GFX_API_VK is OFF bleakekw

if(GFX_API_VK)
    find_package(Vulkan REQUIRED)
    add_subdirectory(src/VK)
endif()
#

okay, it at least doesn't error anymore

#

nvm, linker error now bleakekw

#

hmm, I wonder if the issue is that there are two glad.c in the project

#

probably dies because the symbols are the same or smth

dapper gorge
#

--allow-multiple-definition

long robin
#

I just need the glad header tbh

dapper gorge
#

The linker will toss a coin to decide which to use every time

#

For a spicier experience

long robin
#

I just need prototypes and gl constants for stuff like this

#

I'll try simply not compiling glad.c in fsr

#

I forgor how to make a target with only an include directory though

dapper gorge
#

add_library INTERFACE?

long robin
#

rip, same error

LINK : fatal error LNK1104: cannot open file 'ffx_fsr2_api_.lib'

#

wait no that's different

#

well, hardcoded the target name and now it be running
target_link_libraries(03_gltf_viewer PRIVATE glfw lib_glad fwog glm lib_imgui ffx_fsr2_api_x64)

#

was previously ffx_fsr2_api_${FSR2_PLATFORM_NAME}, but I guess the variable wasn't visible

dapper gorge
#

Why not make your own platform deciderโ„ข๏ธ

long robin
#

well I wanted to use the one in fsr lol

dapper gorge
#

I wonder why the variable isn't available ๐Ÿค”

long robin
#

idk, it's probably private or some shit

final cove
long robin
#

cmake wizard I am not

#

lol I don't even know where the include for fsr.h is

golden schooner
#

i have a cmake with only headers

#

let me tcheck

long robin
#

ah, I needed to link another target

#

ffx_fsr2_api_gl_x64

golden schooner
#

oh fancy new line number link thing

long robin
#

rapa nui

final cove
#

I think interface is correct for header-only libs, the "cannot open file '*.lib'" is usually just when you supply a bad target name

golden schooner
#

yeah

long robin
#

I fixed that thing already

#

I want to include these now

#include "../ffx_fsr2.h"
#include "ffx_fsr2_gl.h"
#

this sucks

#include "../fsr2-src/src/ffx-fsr2-api/ffx_fsr2.h"
#include "../fsr2-src/src/ffx-fsr2-api/gl/ffx_fsr2_gl.h"
#

(also fsr2-src is only there if you use fetchcontent)

final cove
#

doesn't FetchContent populate some info variables about what you fetched

#

like can't you get fsr2_SOURCE_DIR or whatever

#

and build an interface around that

long robin
#

perchance

#

I added ${fsr2_SOURCE_DIR} to my target's include dirs, but it still isn't clear where the headers are

#

and the cmake docs are not clear on what foo_SOURCE_DIR is supposed to be populated with exactly

final cove
#

I've noticed they're suspiciously not populated

#

minus the base dir

long robin
#

is "default value" just nothing lmao

final cove
#

and there's basically nothing else

#

I think stuff like volk_FOUND and volk_INCLUDE_DIR only come from the find_package method

#

cmake's completely disjoint package finding methods strike again

long robin
#

how useful bleakekw

#

oddly, I'm already "successfully" using ${tinygltf_SOURCE_DIR} in some other targets

#

maybe it's not actually doing anything lol

final cove
#

I think tinygltf is header only so that might be why

long robin
#

man I hate cm*ke

final cove
#

I suggest dropping fetchcontent and using submodules

#

ynot

long robin
#

don't wanna

final cove
#

rip

#

its a lot nicer and it even makes your cmake build slightly faster

dapper gorge
#

I dun like fetchcontent because if I clear the cache I have to fetch all my shit again

final cove
#

because it doesn't make web requests every time

long robin
#

I'm like the guy with the pickaxe about to strike diamonds

dapper gorge
long robin
#

I just need 1 line of cmake to make this work (probably)

heavy cipher
final cove
#

only if you get frozen for the next 5 years and wait for them to write cmake 4

heavy cipher
#

did you read the variable name

#

its an override

long robin
#

where does it say override

heavy cipher
#

cmakecache

final cove
#

yeah so I think you'll have to slap your own paths together using base_dir

long robin
#

well I wasn't lookin at dat

heavy cipher
#

what i mean that it isn't VOLK_SOURCE_DIR it is FETCHCONTENT_SOURCE_DIR_VOLK

final cove
#

well, neither are expected to be populated with a meaningful value so its all the same

heavy cipher
#

wot