#Fwog and co.

1 messages ยท Page 15 of 1

heavy cipher
#

no

#

the first one gets populated with the source dir of the fetchcontented shit

long robin
#

yeah I just figured the FETCHCONTENT_ was some extra thing they added to throw off the scent

#

ok so it's an issue of visibility

#

because the source dir isn't empty when I print it inside the file that fetches it

final cove
#

oh no way it does populate it

#

it just doesn't show on cmake-gui

long robin
#

well the cmake gui thing you were looking at was the wrong variable, same as mine

final cove
#

yeah I mean even with advanced variables on it doesn't show you volk_SOURCE_DIR has value

#

I guess it's uncached or whatever

heavy cipher
#

yes

long robin
#

this feels like a hack, but it fixed my issue
set(FSR2_SOURCE ${fsr2_SOURCE_DIR} PARENT_SCOPE)

#

ok @dapper gorge you can try giving it a shot now. the latest commit in the repo at least sorta works

#

and by that, I mean that this code runs and appears to work

  FfxFsr2ContextDescription contextDesc
  {
    .flags = FFX_FSR2_ENABLE_HIGH_DYNAMIC_RANGE | FFX_FSR2_ENABLE_AUTO_EXPOSURE,
    .maxRenderSize = {windowWidth, windowHeight},
  };
  auto scratchMemory = new char[ffxFsr2GetScratchMemorySizeGL()];
  ffxFsr2GetInterfaceGL(&contextDesc.callbacks, scratchMemory, ffxFsr2GetScratchMemorySizeGL(), glfwGetProcAddress);
  FfxFsr2Context context;
  ffxFsr2ContextCreate(&context, &contextDesc);
dapper gorge
#

I was just saying, I am now opeartional

long robin
#

I gotta hed 2 bed now

dapper gorge
#

I shall clone this

long robin
#

schweet

final cove
#

did you stay up all night

long robin
#

it's only 3:30am

final cove
#

oh that's not... the worst it could possibly be

long robin
final cove
#

I guess after you get some sleep you can explain why you need final fantasy x in your project

dapper gorge
#

I'll write here all the problems I find:

  • You can't compile with LLVM Clang on Windows (really? lol)
long robin
#

I think the issue is the ffx shader tool

#

Only a windows binary is provided (bruh)

dapper gorge
#

Huge bruh

long robin
#

hope you're on Windows lol

dapper gorge
#

So FSR2 is the breaking point with linux?

#

Damn..

long robin
#

maybe we can ship wine with it bleakekw

#

to cope, that is

dapper gorge
#

Isn't AMD the Linux guy?

#

Just do the thing for linux

long robin
#

Idk

#

I mean there are open source drivers

#

Seems like that ecosystem is mostly carried by non-AMD people, but I dunno

valid oriole
#

wat

golden schooner
#

schleep schweet schleppi

valid oriole
#

Im pretty sure I did that half a year QFOT

#

p sure I did that half a year ago

#

oh

#

great

long robin
#

Literally all of my knowledge of AMD stuff on Linux comes from this server

#

It has 0 pertinence to my job

#

Ah

long robin
#

anyways, I must retire for the night

valid oriole
#

thank you deutsche bahn + everyone else involved with mobile infrastructure along train tracks for the great internet

#

OH FUCK YOU I LOST CONNECTION AGAIN

#

least angry german

dapper gorge
#

I suggest you disable notifications KEKW

dapper gorge
#

But I guess the original FFX itself doesn't support clang?

valid oriole
#

oh I thought you mean compiling llvm on windows

#

Bad connection mustโ€™ve scrambled some letters

dapper gorge
#

Scrumbulated

heavy cipher
valid oriole
#

ah fuck it why didnโ€™t it delete it

#

i pressed delete before it was fully sent

golden schooner
#

device lost

#

i wonder if it will appear in /lost+found

valid oriole
#

yes, deep inside radv code, when VK_ERROR_DEVICE_LOST is returned, it does mv /dev/dri/renderD128 /lost+found

long robin
#

wow, no errors while I schlept, must've been a perfect port (pp)

dapper gorge
#

I actually have no idea if your thing has errors because I have no idea how to use the actual API KEKW

#

So I've been reading documentation and trying different things

long robin
#

hehe

#

I hope you're reading the fsr2 readme. That thing is gold

#

Also there are just two headers you gotta include in your project (the ones in that message), so you can try reading the docs in those

#

Note that the docs in the gl header are still 90% vulkan. I didn't really change them nervous

#

Also, I'll be whipping together an example that you can refer to tonight (not guaranteed to be finished though)

dapper gorge
#

Houston we have a problem

#

Unfortunately GL debug callback is always very shy, it doesn't like to talk much:
GL_INVALID_OPERATION error generated. Texture type and format combination is not valid.

long robin
#

which call is generating it

dapper gorge
#

Callstack

long robin
#

probably one of the glTextureSubImage calls

#

are you compiling for debug

dapper gorge
#

Yes

long robin
#

can you see what line is triggering it

#

well I guess it says right there lol

dapper gorge
#

It's happening on a glGenTextures which doesn't make a lot of sense

long robin
#

hmm

#

maybe I messed up some function pointer

#

nah, should be fine

#

I guess it's the next line (glTextureView) that's triggering it?

dapper gorge
#

The FSR2_PreparedInputColor is succeeding

#

FSR2_ReconstructedPrevNearestDepth is too

#

So are DilatedDepth and LockStatus

#

Only SpdAtomicCounter is failing

long robin
#

can you see what arguments are being passed to glTextureView when it fails

#

looks fine to me though

#

maybe I'm passing it a bad (uninitialized) argument

dapper gorge
#

Arguments to glTextureView are fine

long robin
#

then maybe it's failing on glTextureSubImage, which I think is the only other place that has the format arg

dapper gorge
#

Could it be this?

case FFX_SURFACE_FORMAT_R32_UINT:
case FFX_SURFACE_FORMAT_R16_FLOAT:
case FFX_SURFACE_FORMAT_R16_UINT:
case FFX_SURFACE_FORMAT_R16_UNORM:
case FFX_SURFACE_FORMAT_R16_SNORM:
case FFX_SURFACE_FORMAT_R8_UNORM:
case FFX_SURFACE_FORMAT_R8_UINT:
case FFX_SURFACE_FORMAT_R32_FLOAT:
return GL_RED;```
#

Instead of GL_RED perhaps GL_RED_INTEGER?

#

No nevermind

long robin
#

hmm actually I might've screwed that up

#

I think I forgot the _INTEGER for the integer textures

dapper gorge
#

Apparently:

glTextureStorage2D(GL_R32UI);
glTextureSubImage2D(GL_RED, GL_UNSIGNED_INT);``` is "invalid"
#

I have also confirmed that it is happening on SpdAtomicCounter

#

Alright

#

With GL_RED_INTEGER it works

#

But why?

#

It's not in the spec?

#

Can I have the render size equal to the display size if I don't want to upscale?

long robin
#

Yeah

dapper gorge
#

This feels so incredibly wrong KEKW

golden schooner
#

: )

long robin
#

is that your code

#

oh it wants a non null device

dapper gorge
#

Yeah, I have to pass a device somehow

long robin
#

lol I'm gonna remove that assert

dapper gorge
#

There's also commandList in FfxFsr2DispatchDescription

long robin
#

I can make the backend create a "non null" device

#

And command list I guess

dapper gorge
#

GL_INVALID_VALUE error generated. <index> exceeds the maximum number of supported image units.

#

?????????

#

How does this even happen

#

Isn't the limit like 1048576 or something?

long robin
#

no

#

what's the value?

dapper gorge
#

Hehe

#

You would like to know

#

Unfortunately this happens in wglSwapBuffers ๐Ÿ˜„

long robin
#

bruhment

#

I'm guessing either fsr tried to bind like 30 textures, or there is an uninitialized value somewhere

#

Hmm do the shaders actually compile and link?

#

I know glslang is happy, but I'm afraid it generated something OpenGL doesn't like (unrelated to this issue)

dapper gorge
long robin
#

I made it so the backend returns an error if it fails

dapper gorge
#

Then they compile just fine

long robin
#

Epic

#

Hmm these issues should be enumerated somewhere so I can fix them

#

Would you mind creating issues on the repo for this stuff, so I don't forget

#

I just need the error code and the line for the gl issues

dapper gorge
#

I found it btw

#

Callstack

#
backendContext->glFunctionTable.glBindImageTexture(
  job->computeJobDescriptor.pipeline.uavResourceBindings[uav].slotIndex,
  ...
#

slotIndex was 11

long robin
#

huh

dapper gorge
#

Which is less than 32

#

Assuming math still works

long robin
#

Tf

dapper gorge
#

Uhm

#
auto x = 0;
glGetIntegerv(GL_MAX_IMAGE_UNITS, &x);``` returns 8...
final cove
#

that sounds plausible

dapper gorge
#

Jaker DEFCON 1

long robin
#

that is quite unfortunate

#

I can probably fix it with bindless textures

#

hmm

#

It might work if I "unbind" the image units first

#

Since I doubt more than 1 or 2 actually need to be written at a time

#

So the issue is probably stale bindings eating up the slots

dapper gorge
#

Should I still open the issue?

long robin
#

Yeah

#

Cuz I'm not confident my solution will work lol

dapper gorge
#

I can't open issues ๐Ÿ˜ฆ

golden schooner
#

lame excuse

long robin
#

What the heck

golden schooner
#

you have a github account ๐Ÿ™‚

dapper gorge
#

No really

#

There is no issues button

long robin
#

Oh tf there is no thingy

#

Yeah lemme fix

golden schooner
#

oh

#

hehe

long robin
#

You can make issues now

dapper gorge
#

I did the thing

golden schooner
#

best thing doer

long robin
#

muchas gracias

golden schooner
#

de nada

dapper gorge
#

While Jaker performs The Great Fixโ„ข๏ธ, I'll be doing some more Vulkan because I still don't feel like learning what rayleigh scattering is KEKW

robust bough
#

@long robin

#

if you want to make a library that's header only

#

you just need to do a target_include_directories(<name> PUBLIC <directory>)

#

idk where your cmake is but

#

target_include_directories(<name> PUBLIC ../fsr2-src/src/ffx-fsr2-api)

#

should turn the include to

#include <ffx_fsr2.h>
#include <gl/ffx_fsr2_gl.h>```
#

actually, making it target_include_directories(<name> PUBLIC ../fsr2-src/src/ffx-fsr2-api ../fsr2-src/src/ffx-fsr2-api/gl)

#

should make the include what you wanted

#
#include <ffx_fsr2.h>
#include <ffx_fsr2_gl.h>```
long robin
#

the API isn't header-only, but I'll note that to make the current includes easier, thx

dapper gorge
#

poke

long robin
#

I pushed a fix for the format thingy

dapper gorge
#

Epic

long robin
#

still integrating with my renderer (I only started like 1 hour ago)

dapper gorge
#

You will be using Fwog for the backend?

long robin
#

huh

#

I'm using one of the fwog samples as a testbed for the opengl fsr2 backend

dapper gorge
#

Ah I see

long robin
#

I wasted some time searching for a bug earlier

#

When I enabled filtered RSM, the jitter would seem to disappear

#

But what actually happened is that I have a 240hz monitor and it's much easier to notice the subpixel jitter at lower framerates

dapper gorge
#

Suffering from success

long robin
#

When I opened RenderDoc, I noticed the jitter was "fine" once more, but only because the framerate went down a lot lol

golden schooner
#

if you need a peasant to test for you on peasant hardware, boop me

long robin
#

It won't run on Linux ๐Ÿ˜ฆ

#

Unless I ship the spirv binaries

dapper gorge
#

Can't you make it go brrr on penguin OS too?

long robin
#

The ffx shader tool won't run on Linux

golden schooner
#

oh

long robin
#

And the source isn't public afaik

#

Quite a bruhment if you ask me

dapper gorge
#

Come on AMD, you're better than this

golden schooner
#

...creating issue... brb

long robin
#

You can't bleakekw

golden schooner
#

i was jk

#

FSR2 is super laggy on me system, tried it in everspace2

#

(and there seem to be 10 different versions/qualitygrades of it)

long robin
#

There are 5 official quality modes

golden schooner
#

makes sense

#

it was probably those 5 only

#

even when game wasnt loadd and i was just in ui, you could feel the slowdown when trying all of them : >

#

ah and im not trashtalking fsr2

long robin
#

Hehe

#

I wonder if maybe the game was so cheap to render that fsr2 was more expensive than the game lol

#

Or maybe the game wasn't fragment bound in the first place, so fsr was just extra overhead

golden schooner
#

wouldnt surprise me

#

it also feels like they just crammed that in thre because every other game has it too

long robin
#

perhap

#

some studios have marketing agreements to integrate tech like this

#

no clue if this one did

dapper gorge
#

How did... what the

golden schooner
#

i use arch btw

long robin
#

And did some other stuff to undo windows hacks

dapper gorge
#

Initally yes, but then he built a python script

long robin
#

Ah

#

I didn't see that

#

Ye the shader tool is not super complicated

#

It automatically generates permutations by invoking glslang and makes some headers with hardcoded data

golden schooner
#

you could "just" spin up a windows vm, to compile/build stuff there and move the output out of there again : >

long robin
#

imo it's pretty silly that Linux support isn't in base fsr2

golden schooner
#

it is

long robin
#

but then again, the Vulkan backend didn't initially ship with it either

golden schooner
#

but perhaps its also a time thing, windows is/was more important

long robin
#

Linux is probably a very small market for this, yeah

golden schooner
#

and then there is wine and the other emulated shit, let them figure it out ๐Ÿ™‚

long robin
#

fsr2 be lookin snazzy ๐Ÿ˜

dapper gorge
#

Oh my that's genius, you can't have aliasing if there is no image in the first place!

long robin
#

wtf

#

the debugger is jumping over this line

const FfxErrorCode errorCode = fsr2Dispatch(contextPrivate, dispatchParams);
#

the ONE line I'm interested in

golden schooner
#

debug vs release?

long robin
#

it's in defrog mode

dapper gorge
#

wat function is that?

#

I was calling ffxFsr2ContextDispatch

long robin
dapper gorge
#

a

#

I see.

long robin
#

I guess ABI issue somehow

#

because the function I'm calling is returning some random garbage

golden schooner
#

the greyed out items remind me of resharper telling me "you can remove them, they are unused"

long robin
golden schooner
#

is that an Exception code?

long robin
#

doesn't look like any of these

#

wait a minute

#

ah nvm

dapper gorge
#

Doesn't 0x80000000 overflow in int32?

long robin
#

idk

#

hmm

dapper gorge
#

Yeah it does

brazen glacier
#

yeah i think that's invalid_size?

long robin
#

weird af design choice

golden schooner
#

-2147483636 = -0x7FFFFFF4

#

hmm

long robin
#

lol I'm dumb

golden schooner
#

: >

long robin
#

it's returning on this line

    FFX_RETURN_ON_ERROR(
        contextPrivate->device,
        FFX_ERROR_NULL_DEVICE);
#

it's not skipping anything lol

golden schooner
#

badumm tss

long robin
#

I rebuilt everything cuz I thought I was going insane

brazen glacier
#

rip

long robin
#

making the error codes ints that overflow is frickin weird though

dapper gorge
#

At least it's no longer undefined behaviour (integer overflow) in C++20

long robin
dapper gorge
#

Hey, 'twas really hard for the committee to write "two's complement"

#

That's two whole words

long robin
#

two's words

#

finally

OpenGL Debug message (1281): GL_INVALID_VALUE error generated. <index> exceeds the maximum number of supported image units.

golden schooner
#

hehe

dapper gorge
#

Is it?

#

Then I guess that's misinfo

long robin
#

it's not even binding that many images before it fails ๐Ÿ˜ฆ

binding image slot index: 1
binding image slot index: 2
binding image slot index: 3
binding image slot index: 4
binding image slot index: 5
binding image slot index: 6
binding image slot index: 7
binding image slot index: 11
OpenGL Debug message (1281): GL_INVALID_VALUE error generated. <index> exceeds the maximum number of supported image units.

golden schooner
#

that is weird

dapper gorge
#

MAX is 8 unfortunately

golden schooner
#

for image bindings

long robin
#

so it had nothing to do with stale bindings

heavy cipher
long robin
#

hmm

golden schooner
#

AMD cards have more apparently, at least according to gpuinfo

long robin
#

huehue

dapper gorge
#

common AMD W

golden schooner
#

zink and llvmpipe also have way more ๐Ÿ™‚

long robin
#

my eyes are barely staying open so I shall retire once again

#

I'll dream of ways to fix this with bindless

dapper gorge
golden schooner
#

good night my frog

dapper gorge
#

Have a fine frog specimen before sleep

long robin
#

btw, it is conceivably binding all these images to write to

image name: FSR2_SpdAtomicCounter
image name: FSR2_ExposureMips
image name: FSR2_ExposureMips
image name: FSR2_AutoExposure
image name: FSR2_ReconstructedPrevNearestDepth
image name: FSR2_InternalDilatedVelocity1
image name: FSR2_DilatedDepth
image name: FSR2_LockInputLuma

golden schooner
#

i read Dilated Llama ๐Ÿฆ™

long robin
#

it binds like 3 more textures before failing an assert

#

ah, it's failing the assert because I forgor to write a field of the ffxResource struct in ffxGetTextureResourceGL

#

or did I

#

ah, I just provided it with an unknown format

#

quite epic

golden schooner
#

looks like asserts are useless ๐Ÿ˜„

long robin
#

I'm not even sure if I'm supposed to pass srgb images to fsr2

#

I guess I'm supposed to give it unorm or hdr images

dapper gorge
#

Ah I frogor to tell you that

#

Yeah I fixed it by switching everything back to UNORM and manually doing gamma (after fsr)

long robin
#

alright I'll raise the issue

#

wait

#

I'm not sure if it's an issue KEKW

#

anyways, I schleep

#

I probably won't be able to work on it until sunday evening since I'll be gone this weekend ๐Ÿ˜ข

dapper gorge
long robin
#

we shall see anyways

#

maybe I'll find some time to work on it during work tomorrow ๐Ÿ˜‰

golden schooner
#

re wat, it didnt show you directly whats up

golden schooner
#

ah jaker is back

long robin
#

Nuh uh

golden schooner
#

i have a question re Application.cpp

#
app->cursorFrameOffset += glm::dvec2{
    currentCursorX - app->previousCursorPos.x,
    app->previousCursorPos.y - currentCursorY
};
#

that looks somewhat weird

long robin
#

what's the q

golden schooner
#

is there a reason why y is calculated the other way around?

long robin
#

yeah

#

Y in window space starts at the top rather than the bottom

golden schooner
#

true

long robin
#

and we want upwards mouse movement to move the camera up

golden schooner
long robin
#

so we gotta floop flop it around

golden schooner
#

indeed

dapper gorge
#

tfw no fsr2 for a weekend

long robin
#

well I thought about the issue a little bit when I was hallucinating in bed

#

I can shrimply make ubo containing handles to all the samplers, textures, and images I need, then index it with the binding slot provided by fsr2

#

the limit of 8 images is really schtewpid though

golden schooner
#

sounds like a plan

long robin
#

I think I only need to change one shader source too

daring surge
#

you're reading off of app->previousCursorPos and writing to app->cursorFrameOffset, this should be past the point of fixing y-flip, no?

long robin
#

idk, the code works

#

previousCursorPos is in the same flipped Y space as currentCursorY

#

so uh yeah, mafs

dapper gorge
golden schooner
#

hmm

#
  struct ColorBlendStateOwning
  {
    bool logicOpEnable;
    LogicOp logicOp;
    std::vector<ColorBlendAttachmentState> attachments;
    float blendConstants[4];
  };

  struct ColorBlendState
  {
    bool logicOpEnable = false;
    LogicOp logicOp = LogicOp::COPY;
    std::span<const ColorBlendAttachmentState> attachments = {};
    float blendConstants[4] = { 0, 0, 0, 0 };
  };
#

whats the deal with these 2?

long robin
#

the second one has a std::span in it

golden schooner
#

hehe

#

must be rightier then

long robin
#

but if I want to cache this (I do), I have to make an owning version of the struct, or the reference will likely dangle

golden schooner
#

hmm

#

im not happy with this

long robin
#

the user doesn't see the owning version

#

but yeah I agree it's icky

golden schooner
#

yeah, can we remove the owning one (name wise), and have it cache the state always

long robin
#

hmm

golden schooner
#

after the message to our sponsor your trip

#

there are a few more Owningisms

long robin
#

I suppose that the span version is "unnecessary" (it saves one allocation) since every time you make a pipeline, it'll create the owning version

golden schooner
#

yeah, and you only ever really create pipelines ones

final cove
#

but imagine where you could be if you just saved that allocation

long robin
#

you can raise an issue if you'd like

#

"remove unnecessary owningisms"

golden schooner
#

i was about to say that i do be abouting doing thating

long robin
#

feels weird to force the user to make vectors instead of spans though ๐Ÿ˜ณ

heavy cipher
#

glm::span3 when

golden schooner
#

i have no permissions to label apropriately

long robin
final cove
#

I wonder if you can still reduce an allocation by providing optional move semantics

#

idk what the call site looks like

golden schooner
#

like a construction site

long robin
#

now you have optional move semantics

final cove
#

but its not perfect

long robin
#

you can use a template to remove the intermediate struct, but perhaps it's not worf it since you're moving anyways

heavy cipher
#

to remove that you need to provide emplace semantics not optional move semantics

long robin
#

Not sure if it's a real problem if the motion vectors are correctly provided

dapper gorge
#

hmm

long robin
#

Maybe the jitter y offset would need to be inverted

dapper gorge
#

Perhaps

#

I could also just set a negative offset to all my glViewports

long robin
#

Is that well defined in OpenGL?

dapper gorge
#

I have no idea

heavy cipher
#

no

long robin
#

Uh, you should use glClipControl for that anyways

dapper gorge
dapper gorge
#

GL_UPPER_LEFT and we are in Australia

long robin
#

Yeah that's the worst case scenario fix

dapper gorge
#

I would test

#

if only you weren't in the middle of nowhere driving

long robin
#

Oh I'm not traveling atm

heavy cipher
#

glPromptUserToRotateMonitor

long robin
#

I'm on the toilet KEKW

dapper gorge
#

Epic

long robin
#

I will be traveling in a few hours

dapper gorge
#

That's plenty to fix FSR2

long robin
#

Mayhapsch enough time to hack bindless in

heavy cipher
long robin
#

I'm deploying the swimmers to scout ahead, smhmh

golden schooner
#

without the floating equipment

long robin
#

Minimal equipment- they'll be relying on the currents for transportation

golden schooner
#

narf

#

reminds me of mojoshaders not being able to support texture2darrays ;C

long robin
#

idk what to do

#

maybe it won't be too hard to fork glslang and make it support bindless textures nervous

dapper gorge
golden schooner
#

or do we know someone who works on it

long robin
#

or maybe I can generate the shader permutations as text

golden schooner
#

mayhaps we can send moscow inkasso

long robin
#

hmm

#

is it possible to make glslang insert compiler defines at the beginning of the shader?

#

because the compiler uses a bunch of flags like -DFOO_ENABLE and such

golden schooner
#

@brazen glacier might know?

brazen glacier
#

i mean you can just pass -DWHATEVER in iirc

long robin
#

trying to make glslang dump text instead of spir-v I guess

brazen glacier
#

lemme read context lol

long robin
#

so at most I can use it to preprocess shaders

#

what I'd like to do is have it emit the shader permutations I need, but in text form for OpenGL to directly consume

brazen glacier
#

can you run it with -E?

long robin
#

but the problem is that fsr2 relies on a bunch of compiler defines

brazen glacier
#

i think you need to manually grab this output though, can't redirect to a file

long robin
#

I think I was being a moron

#

for some reason I wanted the #defines to be literally in the text KEKW

brazen glacier
#

ohhh

#

then why preprocess it at all lol

long robin
#

but yeah just preprocessing works too nice

#

anyways, thanks for engaging with my stupidity

#

now I need to change some schtuff to make this wurk

#

hmm

#

I'm afraid the ffx shader tool will be a roadblock with this ๐Ÿ˜ฆ

#

it wants to take the spirv binary and do a bunch of shit with it

brazen glacier
#

what does it even do?

long robin
#

it invokes glslang for each shader permutation, then generates headers with info about the permutations

brazen glacier
#

right

#

naturally that needed to be an executable and not a script lol

long robin
#

mayhaps I can take the python clone of it that someone made and modify that

long robin
#

all this because I can't bind more than 8 images

golden schooner
#

(on nvidia)

dapper gorge
#

common NVIDIA L

long robin
#

I'm gonna push my current stuff to a branch and test it on my AMD compooter

#

now y'all can try it for yourselves

#

(if you're on windows)

#

(and not NV)

dapper gorge
#

Ah I see, so that's AMD's marketing strategy

#

You just coerce people, interesting

long robin
#

at least it hits the assert without immediately generating gl errors now

brazen glacier
#

hey, not their fault that nv hardware sucks and can only bind 8 images ๐Ÿ˜

long robin
#

it's so dumb, you can bind a billion images on nv in vulkan

brazen glacier
#

ah but you see if they limit it to 8 images they can do an optimisation that saves 3 femtoseconds on some cad program

long robin
#

look ma, no errors

brazen glacier
#

i ran it and it spammed errors

long robin
#

are you on nv

brazen glacier
#

no

long robin
#

hmm

#

what errors

brazen glacier
long robin
#

spoopy

brazen glacier
#

rx 5700xt, adrenalin 23.4.3, checked out the fsr2-test branch and running gltf viewer

long robin
#

hmm

#

Application.cpp has the debug callback if you wanna throw a breakpoint in there

brazen glacier
#

coming from here (ffx_fsr2_gl.cpp:1194)

long robin
#

probably invalid format somehow

brazen glacier
#

oh lemme do a debug run

#

it's trying to use a resource with unknown surface format

long robin
#

ah

#

I'm dumb^2

#

it's because of the GL_SRGB8_ALPHA8 format I gave it

#

I already fixed it in my local branch, but forgot to tell you

#

"fixed"

#

I just told fsr2 that it's actually GL_RGBA8 and that made it not complain

brazen glacier
#

oh right lol

long robin
#

too bad I can't decipher what's happening in rdc

#

are all these checkered inputs unbound or unused ๐Ÿค”

#

I can open them in the resource inspector, so I guess they aren't unbound

#

interestingly, each shader only uses a few sampler and image bindings ๐Ÿ‘€

#

decompiled shader

#

three of the passes have a bunch of unbound resources somehow

#

those unbound resources do not correspond with all the checkerboards I see in the texture viewer

oak garden
#

Does it work at least

long robin
#

it correctly generates a black screen

oak garden
#

Nicely upscaled ๐Ÿ‘Œ

long robin
#

my new plan of attack for fixing the too-many-binds is to manually set them for each shader

#

hmm is there a function to set the binding of an image in a shader

#

I think it's just glUniform

#

I can do something like

int currBinding = 0;
for (binding : imagesToBind)
{
  auto loc = glGetUniformLocation(program, binding.name);
  glProgramUniformi(program, loc, currBinding);
  glBindImageTexture(currBinding, binding.image, ...);
  currBinding++;
}
#

to make sure images are always bound starting at 0

oak garden
#

That could work yeah

fair thicket
#

rainbow from this evening, seems like you can see the oscillations below purple but i might be imagining it

long robin
#

kinda faint, but I think you can barely see the supernumerary rainbows

#

but maybe that's just the violet part of the main one

#

anywhomst, I gtg in like 10 minutes, so no more fsr2 stuff for me

dapper gorge
#

That's truly one of the rainbows of all time

long robin
#

these formats nervous

long robin
long robin
#

I invoked glslang with -g

heavy cipher
#

short for --gobble-ram

long robin
#

how ๐Ÿ‡น๐Ÿ‡ซ

long robin
#

no clue how all the bindings are getting mixed up

#

renderdoc is telling me no, but my mind is telling me yes (seriously though, wtf)

#

epic misinfo in the wiki (emphasis mine)

Image bindings can be layered or non-layered, which is determined by layeredโ€‹. If layeredโ€‹ is GL_TRUE, then textureโ€‹ must be an Array Texture (of some type), a Cubemap Texture, or a 3D Texture. If a layered image is being bound, then the entire mipmap level specified by levelโ€‹ is bound.

#

it seems like renderdoc is just ignoring the glUniform1i calls

long robin
#

it (setting image uniforms via glUniform1i) seems to work when I'm not using spirv bleakekw

#

an absolute baba of a booey, tbqh

#

at this point, I'm tempted to compile the shaders back to glsl at runtime just to see if it changes things

oak garden
dapper gorge
#

FSR2 GL is back in the works, pog

dapper gorge
#

poke

long robin
dapper gorge
#

cute

#

Where's my FSR2

#

Something that's rightfully mine

#

(jk)

long robin
#

I'm gonna continue to test on AMD machine since I can bind images without having to use glUniform

dapper gorge
#

epic

#

Good luck soldier

#

Let me know if I can be of any help

long robin
#

I shall

golden schooner
heavy cipher
#

da heck is that wcstombs

golden schooner
heavy cipher
#

Settra himself wrote this code

long robin
#

Seriously though, is there a better way to convert wchar strings to c strings nervous

brazen glacier
#

the best way is to not use them :P

long robin
#

I'm afraid I'm forced by fsr2 to use them

brazen glacier
#

i figured, very unfortunate

heavy cipher
#

its your flork jaker

#

kill the wchars

brazen glacier
#

wchar strings don't belong anywhere near render code, when are you going to have a texture with non-ascii chars in its name????

long robin
#

lel

oak garden
#

glsl with wchar uniform name

long robin
#

I don't think they are causing any issues atm

heavy cipher
#

more like lchars

golden schooner
long robin
#

Anyways, I know they're disgusting, but I'm not concerned with changing them atm

#

I just want mah got dang bindings to work

heavy cipher
#

btw why are you feeding spirv

#

is that what you do on fwog as well?

#

i'd be spooked that they didn't actually give two shits when implementing that

long robin
#

yes I'm afraid of implementations having spir-v bugs too

#

I'm feeding spir-v because that's what I have to work with

#

I could feed it glsl, but that'd require changing a lot of stuff, which is effort I'd rather not spend right now

long robin
#

I'd expect Nvidia's impl of spir-v shaders to be okay. At least it was the last time I tried in my voxel engine

heavy cipher
#

i recall dr. circle having big issues, but this seems a bit to frog_shrimple

golden schooner
#

can you not turn this into an amd hackathon next week, and make the initial authors help you : )

long robin
long robin
golden schooner
#

fook

daring surge
#

๐Ÿ‡ซ๐Ÿ‡ด๐Ÿ‘Œed

shell inlet
long robin
#

I wonder if my translation of this vk backend code is somehow wrong
vk:

    // bind srvs
    for (uint32_t srv = 0; srv < job->computeJobDescriptor.pipeline.srvCount; ++srv)
    {
        addBarrier(backendContext, &job->computeJobDescriptor.srvs[srv], FFX_RESOURCE_STATE_COMPUTE_READ);

        BackendContext_VK::Resource ffxResource = backendContext->resources[job->computeJobDescriptor.srvs[srv].internalIndex];

        writeDatas[descriptorWriteIndex] = {};
        writeDatas[descriptorWriteIndex].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
        writeDatas[descriptorWriteIndex].dstSet = pipelineLayout->descriptorSets[pipelineLayout->descriptorSetIndex];
        writeDatas[descriptorWriteIndex].descriptorCount = 1;
        writeDatas[descriptorWriteIndex].descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
        writeDatas[descriptorWriteIndex].pImageInfo = &imageInfos[imageInfoIndex];
        writeDatas[descriptorWriteIndex].dstBinding = job->computeJobDescriptor.pipeline.srvResourceBindings[srv].slotIndex;
        writeDatas[descriptorWriteIndex].dstArrayElement = 0;

        imageInfos[imageInfoIndex] = {};
        imageInfos[imageInfoIndex].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
        imageInfos[imageInfoIndex].imageView = ffxResource.allMipsImageView;

        imageInfoIndex++;
        descriptorWriteIndex++;
    }
#

gl:

  // bind srvs (sampled textures)
  for (uint32_t srv = 0; srv < job->computeJobDescriptor.pipeline.srvCount; ++srv)
  {
    addBarrier(backendContext, &job->computeJobDescriptor.srvs[srv], FFX_RESOURCE_STATE_COMPUTE_READ);

    BackendContext_GL::Resource ffxResource = backendContext->resources[job->computeJobDescriptor.srvs[srv].internalIndex];

    backendContext->glFunctionTable.glBindTextureUnit(job->computeJobDescriptor.pipeline.srvResourceBindings[srv].slotIndex, ffxResource.textureAllMipsView.id);
    backendContext->glFunctionTable.glBindSampler(job->computeJobDescriptor.pipeline.srvResourceBindings[srv].slotIndex, backendContext->linearSampler.id);
  }
golden schooner
#

hmm are you doing the same mistake i did, mixing image/texture?

shell inlet
#

datas ๐Ÿ˜”

dapper gorge
shell inlet
#

also seeing this vulkan code immediately triggered my ptsd because this looks just like my vulkan code

#

except it's bigger

long robin
#

should be the same

golden schooner
#

it says computeJobDescriptor, was finking you bind to a cs, and glsl might use image not sampler2D

long robin
#

it's kinda dumb

#

but yeah this function is executeGpuJobCompute (write+bind resources and dispatch)

golden schooner
#

perhaps there is no difference in the spriv/underlying assembly between image/samplerisms

#

but there is in glsl, and when you bind a sampler to an image you get black, if that makes any sense

shell inlet
#

I swear even this line BackendContext_VK::Resource ffxResource = backendContext->resources[job->computeJobDescriptor.srvs[srv].internalIndex]; scares me because of [[[]]]

#

is this pure C?

long robin
#

no, it's C++

#

C-like C++ bleakekw

shell inlet
#

so no attempt at any refactoring was made then

long robin
#

I think the only standard lib feature used in the backend is on this line
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;

heavy cipher
#

btw did you change anything on the spirv?

long robin
heavy cipher
#

seems like the vk code uses separate samplers

#

thats not an opengl thing

long robin
#

yeah I made them combined image samplers

shell inlet
#

whoever wrote the code must have worn down ctrl, c and v keys

long robin
#

I also noticed that the point sampler isn't actually used anywhere, which is quite convenient for me

#

so I just used the linear sampler for everything

heavy cipher
#

do you ever change the sampler uniform value?

long robin
#

no

#

I figured the resource binding "slot index" would be the correct thing nervous

heavy cipher
#

i'd think it would be

long robin
#

well the version of the repo on my work pc does not have that yet, since it's not needed

final cove
#

I need it

final cove
#

big mcthankies

#

hey you can't just right click and save an image, they're non fungible

long robin
#

somehow textures that I'm not even passing to the fsr context are being bound nervous

#

that is the indirect illumination texture

#

oh and gAlbedo and gNormal are not passed as well

#

I forgot about those, because they kinda looked like inputs to fsr

#

see here

  FfxFsr2DispatchDescription dispatchDesc
  {
    .commandList = (void*)0x1,
    .color = ffxGetTextureResourceGL(&fsr2Context, frame.colorLdrRenderRes->Handle(), renderWidth, renderHeight, GL_RGBA8),
    .depth = ffxGetTextureResourceGL(&fsr2Context, frame.gDepth->Handle(), renderWidth, renderHeight, GL_DEPTH_COMPONENT32F),
    .motionVectors = ffxGetTextureResourceGL(&fsr2Context, frame.gMotion->Handle(), renderWidth, renderHeight, GL_RG32F),
    .exposure = {},
    .reactive = {},
    .transparencyAndComposition = {},
    .output = ffxGetTextureResourceGL(&fsr2Context, frame.colorLdrWindowRes->Handle(), windowWidth, windowHeight, GL_RGBA8),
    .jitterOffset = {jitterX, jitterY},
    .motionVectorScale = {1, 1},
    .renderSize = {renderWidth, renderHeight},
    .enableSharpening = false,
    .sharpness = 0,
    .frameTimeDelta = static_cast<float>(dt * 1000.0),
    .preExposure = 1,
    .reset = false,
    .cameraNear = cameraNear,
    .cameraFar = cameraFar,
    .cameraFovAngleVertical = cameraFovY,
    .viewSpaceToMetersFactor = 1,
  };
shell inlet
#

this oddly makes me think it might be an issue of smth like binding to indices[idx] vs to idx

#

but it can't be that, right

final cove
#

2 channels of GL image binding issues atm

#

ouch

shell inlet
#

moon is at the anti gl phase

dapper gorge
final cove
#

The blood moon is rising...

dapper gorge
#

Ahh, the good old terraria flashbacks

dapper gorge
#

But well, I guess that's not important right now KEKW

long robin
#

but atm the texture is completely black, so it does not matter ๐Ÿ˜„

#

I think 1, 1 scale means the motion vectors are in [-resolution, +resolution] space

#

ah, I think I see one issue

#

stale bindings

golden schooner
#

stalus bingus

long robin
#

idk why, but the frontend isn't trying to bind all the resources that the shader will use

#

so that's why all the random stuff is bound

golden schooner
#

do you not have ZeroThingyBindingThing() in your pipeline?

long robin
#

I forgor to put the fsr dispatch in a scope

dapper gorge
#

ZeroThingyBindy

golden schooner
#

ah

long robin
#

there we go

dapper gorge
#

Now they are all equally fooked?

long robin
#

for some reason, only some images and buffers are being bound

#

but no samplers nor textures

golden schooner
#

yeah so my initial question stands

#

you do glBindSampledTexture

#

on a compute program

#

is it actually samplers/textures or images in the shader?

#

idk, do you know what i mean?

long robin
#

yeah they are

golden schooner
#

ok

long robin
#

the problem must be in job scheduling

#

because the bindings aren't even in there

golden schooner
#

weird

final cove
#

job scheduling from the driver?

oak garden
#

the driver is allowed to do many things but breaking your code is not one of them

final cove
#

maybe its not allowed to, but will it?

oak garden
#

opengl issue

dapper gorge
#

OpenGL good

#

Jaker will prove it

#

I believe in him

long robin
#

really it's just a list of clears and dispatches that the frontend submits to the backend to execute all at once

#

hmm

#

I question whether the shader really needs everything bound at once

final cove
#

jaker will prove it by revealing you've been running vulkan the whole time

long robin
#

#define POPULATE_SHADER_BLOB(info, index) { info[index].blobData, info[index].blobSize, info[index].numStorageImageResources, info[index].numSampledImageResources, info[index].numUniformBufferResources, info[index].storageImageResourceNames, info[index].storageImageResourceBindings, info[index].sampledImageResourceNames, info[index].sampledImageResourceBindings, info[index].uniformBufferResourceNames, info[index].uniformBufferResourceBindings }

#

return POPULATE_SHADER_BLOB(g_ffx_fsr2_compute_luminance_pyramid_pass_PermutationInfo, tableIndex);

oak garden
#

amd engineers are paid to write this shit?

long robin
#

POPULATE_SHADER_BLOB should really be a function lol

#

ah, I see why it isn't

#

the info argument can be several types

oak garden
#

templates?

long robin
#

that means I just need to make this a template

oak garden
#

so are you guys hiring any remote eu devs kekw

long robin
#

make a pr ||that will never get merged||

oak garden
#

๐Ÿ˜”

golden schooner
#

dont be so grim

#

just text the person at work

final cove
#

abandonware master developers

golden schooner
#

seriously ๐Ÿ™‚

long robin
#

we are hiring engineers in EU though

#

I forgor what roles

golden schooner
#

Fullstack Java Developer

oak garden
golden schooner
#

im too stupid for serious giraffics business

oak garden
#

id love to do it eventually but i still have a lot to learn imo

#

then again i have 2 more years in uni to tinker around with stuff

final cove
#

I'm realizing that there's no better place to learn other than on the job

oak garden
#

i assume so yeah

golden schooner
#

you could hookup demongod

#

although he sits on the westcoast

long robin
#

there is apparently an open intern/co-op position for my internal org, but when I click on the link to the job it 404s

dapper gorge
#

Are you trying to outsource FSR2 OpenGL?

long robin
#

yeah

#

cheap EU child laborers will do it for me now

oak garden
final cove
#

what does a graphics development job even look like, now that I think about it

#

what do you actually do

long robin
#

here's some more epic code for you to gawk at

#define POPULATE_PERMUTATION_KEY(options, key)                                                                \
key.index = 0;                                                                                                \
key.FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_REPROJECT_USE_LANCZOS_TYPE);                     \
key.FFX_FSR2_OPTION_HDR_COLOR_INPUT = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_HDR_COLOR_INPUT);                 \
key.FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_LOW_RES_MOTION_VECTORS);   \
key.FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_JITTER_MOTION_VECTORS);   \
key.FFX_FSR2_OPTION_INVERTED_DEPTH = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_DEPTH_INVERTED);                   \
key.FFX_FSR2_OPTION_APPLY_SHARPENING = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_ENABLE_SHARPENING);                 \
key.FFX_HALF = FFX_CONTAINS_FLAG(options, FSR2_SHADER_PERMUTATION_ALLOW_FP16);
final cove
#

I get that senior devs basically ponder the orb all day

dapper gorge
oak garden
#

He spends his time shitposting on discord

dapper gorge
#

Damn

#

So you were hiring right?

final cove
#

so do I but I do database stuff so I thought my skills weren't transferrable

long robin
oak garden
#

Interesting

final cove
#

is gpu devtech one of those jobs where they want to see a CE degree and time spent with FPGAs and stuff

brazen glacier
#

good lord how much cpu side code can fsr 2 possibly have
surely at some point it'd be easier to just kick off the few dispatches yourself

dapper gorge
#

Without the #opengl channel unfortunately

long robin
#

the basic requirements are knowing how a GPU works, how graphics APIs work, and how to optimize graphics

oak garden
#

Sounds reasonable yeah

final cove
#
  • magic
  • dark magic
  • speculation and bikeshedding
#

I've got this down

oak garden
#

Doesnโ€™t sound too bad to do as a job honestly

#

does part of it involve writing tooling and stuff or it it really mostly answering questions or debugging things

long robin
#

the job itself is investigating bugs and perf issues in AAA games, doing frame breakdowns, etc.

oak garden
#

Right

#

Sound cool yeah

long robin
#

there are opportunities to work on tooling

#

and approved R&D projects

final cove
#

is that the abandonware department

#

how do I join that

long robin
#

most R&D projects don't turn into a product

#

and they aren't necessarily software

#

holy shit

final cove
#

is that a good holy shit or a bad holy shit

long robin
#

good

long robin
#

but I changed the shader to use combined samplers

#

I think the jitter is backwards or something

#

probably viewport/clip convention issue, but that's easy to solve

#

yeah negating the Y jitter that I pass to fsr fixes that

long robin
#

fsr2 still doesn't know about the [-1, 1] depth convention that opengl has, and I don't think there's a way to change it

#

(yet)

dapper gorge
#

glClipControl

long robin
#

yeah, but I don't want to force that upon the user

#

unless I have to

dapper gorge
#

Mate

#

we are probably the only people using FSR2 on OpenGL right now KEKW

#

On the planet possibly

#

But yeah, good idea.

final cove
#

is all the math in the shader factored around a [-1, 1] depth or something?

long robin
long robin
#

it wants all the other projection params

dapper gorge
#

You see, once upon a time someone decided to make OpenGL's NDC depth range [-1;1], we're still working on finding him for adequate punishment.

oak garden
#

He will be forbidden from seeing frogs for the rest of his life

long robin
#

that's a cruel and unusual punishment

final cove
#

oh there are a lot more shaders in fsr than I thought

#

I was hoping to find the formuoli that those 4 constants corresponded to

long robin
#

is there a way to search all open files in vsc

#

ah, the giant magnifying glass on the left

golden schooner
#

ctrl+shift+f

#

like in most editors ๐Ÿ™‚

long robin
#

FfxFloat32x3 UnprepareRgb(FfxFloat32x3 fRgb, FfxFloat32 fExposure)
unprepares your rgb

dapper gorge
final cove
#
FfxFloat32 GetViewSpaceDepth(FfxFloat32 fDeviceDepth)
{
    const FfxFloat32x4 fDeviceToViewDepth = DeviceToViewSpaceTransformFactors();

    // fDeviceToViewDepth details found in ffx_fsr2.cpp
    return (fDeviceToViewDepth[1] / (fDeviceDepth - fDeviceToViewDepth[0]));
}
#

looks like this is all there is to it

dapper gorge
#

Huh, looks like a shrimple * 2.0 - 1.0 will do the tricc

long robin
#

I can just add a compile-time flag for that I guess

#

just like the inverted depth one

oak garden
#

Does that mean OpenGL FSR2 is almost working ๐Ÿ‘€

dapper gorge
#

FFX_IS_UNHINGED_DEPTH_RANGE

dapper gorge
#

Huge hype

long robin
#

it will be pushed soonโ„ข๏ธ alhamdulilah

dapper gorge
#

Staying up to 2am was worth it

long robin
#

u should sleep and then observe the pushed version when you wake up

oak garden
#

Itโ€™ll be like Christmas in summer

dapper gorge
#

I shall admire the glory of The Pushโ„ข๏ธ later then

final cove
#

isn't it still spring

#

I don't know how seasons work

dapper gorge
snow sun
#

and seniors ask their orb for structural changes

final cove
#

what does that look like though, to me graphics only comes in "simple" and "arcane"

snow sun
#

im a junior i usually optimise or work on new graphics features or more like additions to existing features

#

for example i just finished a thing that lets water make static geo wet

#

sounds super boring but looks really cool when you see the difference

#

rn i work on (to me) arcane stuff

final cove
#

as in you interact with the arcane stuff the senior devs conjured?

snow sun
#

yes

#

when i add something to for example water, i have to read a ton of code to even know where to begin as engine big and stuff

#

but off thats cause im junior

#

but the engines are big so it takes years to get a good overview of everyhting

long robin
#

nah it's because the engine is bad and the whole thing needs a rewrite

snow sun
final cove
#

if I wrote the engine, things would be different

long robin
#

trust me, the seniors love it when juniors demand rewrites

snow sun
#

its honestly very good, i was expecting much worse from what i hear people always say about old engines

#

it also gets semi rewrites all the time in parts

final cove
#

so even the big engines can't avoid perpetual refactoring

snow sun
#

i like how it is the seniors are my gods

snow sun
#

they have lots of people with smart heads

long robin
#

my carefully architected code
my sensible style choice
my self-documenting code

their spaghetti codebase
their baffling style choices
their unreadable code

snow sun
#

some things get really old tho, its not like its rewritten every year

final cove
#

sounds pretty cool tho, I guess it makes sense they don't literally let you get overwhelmed and drown in the code

#

is your 3rd eye slowly opening from looking at the arcane code though

snow sun
#

oh they do tho

#

you just go throu the jungle and get it after time

#

first months are shit

#

but then its your swamp

long robin
#

gp: become shrek

snow sun
#

learning to read other peoples code is a real skill

#

i could barely do it

#

now its ok, but muuuuch better then before

long robin
#

fsr2, despite the funny code I showed, is well-enough written that I could comprehend what it was doing in relatively little time

final cove
#

yeah

snow sun
#

i think cpu code is usualy ok cause ides get it

#

but super big shaders can be really poopy to understand

final cove
#

I still need to cross the real threshold which is learning how to get info out of meaty papers

long robin
#

yeah navigating shaders is an atrocity

brazen glacier
#

rider my beloved :)
full go to definition/code completion for hlsl

#

glsl though... lol

snow sun
#

rider?

brazen glacier
#

jetbrains ide, basically a drop in vs replacement

long robin
#

'ardly know 'er

snow sun
#

h

#

mm

long robin
#

btw does anyone know the extension that allows me to vertically stack tabs in VS

#

having one super long line of tabs sucks

snow sun
#

non code can do that natively

#

i use that

long robin
#

oh wut

#

how

snow sun
#

its a setting

#

but its there im sure of it

long robin
#

found it

#

this is gonna be a gamechanger

#

I've no idea if this is correct, but I'm gonna ๐Ÿšข ๐Ÿคก

FfxFloat32 GetViewSpaceDepth(FfxFloat32 fDeviceDepth)
{
    const FfxFloat32x4 fDeviceToViewDepth = DeviceToViewSpaceTransformFactors();

    // fDeviceToViewDepth details found in ffx_fsr2.cpp
#if FFX_FSR2_OPTION_DEPTH_NEGATIVE_ONE_TO_ONE
    return (fDeviceToViewDepth[1] / ((fDeviceDepth * 2.0 - 1.0) - fDeviceToViewDepth[0]));
#else
    return (fDeviceToViewDepth[1] / (fDeviceDepth - fDeviceToViewDepth[0]));
#endif
}
#

two things

  1. I'm not sure if I even need something like this (but I assume yes, if the depth buffer is generated with a [-1 ,1] z projection)
  2. if this is necessary, I wonder if I can just modify DeviceToViewDepth (generated on the CPU) instead of doubling the shader permutations
#

@shell inlet do you have any thoughts about the device to view space transform thingy that I'm talking about

long robin
#

despite fsr2 working on amd, it fails on NV due to the dumb image binding limit and not being able to change image bindings via glUniform (driver bug)

#

I noticed that I'm able to subtract a constant amount from certain bindings (each shader uses a different set of consecutive bindings), so hopefully that can work

#

I'll have to introduce some magic numbers to the shaders though

long robin
#

I tried using the glslang option --auto-map-bindings to just generate bindings starting at 0 for each shader, but for some reason the bindings are not starting at 0 listenyoupieceofshit

#

I think it's the ffx shader tool reading a file and assuming bindings are equal to the numbers in there

#

maybe these can help

--shift-image-binding [stage] num            base binding number for images (uav)
--shift-image-binding [stage] [num set]...   per-descriptor-set shift values
--sib                                        synonym for --shift-image-binding
long robin
#

"show unused items" in renderdoc reveals no more bindings, so I have no clue why the bindings are so high

#

apparently glslang is supposed to alias unused bindings, making this even more baffling

#

lol renderdoc crashes when you have negative resource bindings

#

guess the --shift-image-binding strategy isn't going to work unless I somehow know the base binding

#

or maybe I used it wrong

long robin
#

I have a small test shader to confirm that these all work, so I have no clue why it's failing in the real thing

#

I think I see the issue

#

seems like glslang has one namespace for all resource bindings, and images happen to be bound last, which means they get super high bindings ๐Ÿ˜ข

#

idk why it wasn't working with my thing, maybe I have an old version

long robin
#

ahh the thing that I thought was an nv driver bug is actually a renderdoc bug bleakekw

long robin
#

at least nsight works for debugging this, but holy moly is it painful

#

it takes like 10 seconds to open the thing that lets me look at a single texture

#

every. single. time.

#

literal torture using this application to debug

long robin
#

houston, we have an image (ignore the sRGB fail)

#

I noticed (using nsight and apitrace) that everything seemed to be working except the write to the output target

#

seems like writes to an sRGB texture via a unorm image variable are not appreciated by nvidia's driver nervous

#

no validation layers btw bleakekw

#

ADL is terrifying

heavy cipher
#

is memory barrier not a command ๐Ÿค”

long robin
#

it was, then I determined that it's useful outside of command scopes

#

I might want a memory barrier outside of my abstract rendering or compute scopes for a number of reasons

#

eh, but only rendering or compute can generate the conditions in which you'd need a subsequent memory barrier

#

I have atoned for my sRGB crimes, now enjoy ACES crimes instead

#

aces with correct color space input does not look that different, heh

shell inlet
#

aces with correct color space looks more incorrect than the incorrect one

shell inlet
long robin
#

the question is basically: what is the code in the link doing?

#

but I think I know, hence my follow-up link

shell inlet
#

does something with some matrix, computes some constants, uses bool in subscript operator

#

has to do with projection type

#

no clue what those constants are used for, probably for depth linearization or something

final cove
#

yeah if you follow the functions in the .h you posted yesterday (working from memory at this point) it uses that depth function for reconstructing a position in view space

heavy cipher
long robin
#

I don't see why it being spir-v would suddenly make that ub

#

but whatever

#

now I wonder if this is the correct way to generate unjittered motion vectors in ndc space

vec2 GetNdcPos(mat4 vp, vec3 worldPos)
{
  vec4 clip = (vp * vec4(worldPos, 1.0));
  return clip.xy / clip.w;
}

void main()
{
  v_motion = GetNdcPos(oldViewProjUnjittered, v_position) - GetNdcPos(viewProjUnjittered, v_position);
}
#

the output is rather blurry under motion with these

#

and renderdoc be saying that a lot of my motion vectors are outside of [-1, 1] nervous

heavy cipher
#

are you accounting for ndc differences?

#

or did you clip control yourself to vk

long robin
#

no, I have not done that yet

#

that's probably contributing to blurriness, but my current motion vectors look wrong anyways

heavy cipher
#

its an easy fix to clip control for now

long robin
#

I need to change like five places in the indirect lighting code to account for this bleakekw

heavy cipher
#

thats just how opengl looks like

long robin
#

I "took inspiration" from teardown's code finally

#

they pass ndc coords to the fs and do the perspective divide there

#

apparently passing the ndc motion vector to the fs screws it up

#

same as doing the matrix multiply in the fs rgbemoji

#

anyways, my motion vectors are sane now

heavy cipher
#

btw perspective divide in the fs is not always right

long robin
#

when is it wrong?

heavy cipher
#

if you need clipping on the near plane

long robin
#

isn't the pipeline already doing clipping for me here

shell inlet
#

why would there be a fragment shader invocation for a fragment that gets clipped between vertex and fragment shader

#

if you only get interpolated data from vertices in fragment shader

#

and inbetween that the clipping happens

heavy cipher
#

o hwait

#

i am doin a dumb

#

disregard me completely

shell inlet
#

alr

long robin
#

were u thinking of doing perspective divide on gl_Position in the fs

heavy cipher
#

ye

long robin
#

the pipeline takes another soul

shell inlet
#

though I still don't understand how is it that interpolated NDC aren't same as interpolated clip space coords with perspective division

heavy cipher
long robin
heavy cipher
#

in this sense i have no idea what this means then

shell inlet
#

well the clip space is linear so it shouldn't do anything funny

#

but interpolating NDC might

long robin
shell inlet
#

but then the interpolation is also perspective-correct

heavy cipher
#

are you sure you don't mean clip space

#

again ndc is after persp divide

long robin
#

oops I mean clip space gets interpolated

#

misinfo moment

heavy cipher
#

misinfo to the bone

long robin
#

I think I can upgrade it by adding a third dimension to the matrix_elem_ variables with the corresponding magic numbers

heavy cipher
#

fsr3

#

FFX_FSR2_ENABLE_DEPTH_BAD

long robin
#

the inverse of the matrix is shown later on, but I still don't see the connection

long robin
golden schooner
long robin
#

pushed my current stuff to fsr2-test branch of Fwog if anyone wants to observe the bugs

oak garden
#

wait so i have a really dumb question

#

fsr2 works fine on n๐Ÿ…ฑ๏ธidia gpus right?

long robin
#

ye

oak garden
#

i should really integrate that then tbh

long robin
#

most of the pics I showed were taken on my 3070

oak garden
#

much less "magic black box" than dlss lmao

#

time to make fsr2-real

long robin
#

the api surface is quite small

oak garden
#

yeah should be easy to make bindings for

long robin
#

idk why that person gave up ๐Ÿ˜„

oak garden
#

๐Ÿคทgot bored probably

golden schooner
#

rust bit them in the butt ๐Ÿ˜›

oak garden
#

that is a chonker of a readme

dapper gorge
#

Does baldurk just hate OpenGL? ๐Ÿ˜ฆ

long robin
#

I have no idea if he's correct in that what I'm trying to do is not well-defined

#

I don't see why not. After all, spirv supports regular-ass uniform variables

#

Either way, I'm relying on that behavior for this whole operation to succeed nervous

oak garden
valid oriole
oak garden
#

exactly dread_cat

oak garden
#

@long robin im trying to build fsr2 and im getting this when running the script Thonk

oak garden
#

hmm looking at whats inside i think i can just yeet that dependency

long robin
#

Hmm

#

I don't even use that script lol

oak garden
#

Yeah I stopped using it too

#

Do you know how fsr compiles/loads it shaders

#

Im a bit conchfused

dapper gorge
#

I think ffxFsr2ContextCreate creates shaders?

oak garden
#

But where does it expect sources to be

#

And does it compile them at build time or at runtime

dapper gorge
#

They are all already compiled using their own shader compiler (I think)

oak garden
#

It looks like itโ€™s shipping dxc as a DLL so I assume at runtime somehow

dapper gorge
#

Shaders are in ffx-fsr2-api/shaders

oak garden
#

Hmm okay

#

So I donโ€™t really have to care

#

Thatโ€™s cool

#

I wonโ€™t be including the headers directly in the rust bindings ofc

#

Do they embed the shaders in the binary?

long robin
#

Shaders are compiled at build time using the ffx shader tool, which invokes glslang, dxc, or fxc

#

Shaders get embedded into header files if that's what you're wondering