#Fwog and co.
1 messages ยท Page 15 of 1
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
well the cmake gui thing you were looking at was the wrong variable, same as mine
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
yes
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);
I was just saying, I am now opeartional
I gotta hed 2 bed now
I shall clone this
schweet
did you stay up all night
it's only 3:30am
oh that's not... the worst it could possibly be
anywho, feel free to spam this thread with issues that you find (or make PRs if you're so inclined, hehe)
I guess after you get some sleep you can explain why you need final fantasy x in your project
I'll write here all the problems I find:
- You can't compile with LLVM Clang on Windows (really? lol)
Huge bruh
hope you're on Windows lol
Idk
I mean there are open source drivers
Seems like that ecosystem is mostly carried by non-AMD people, but I dunno
wat
schleep schweet schleppi
Im pretty sure I did that half a year QFOT
p sure I did that half a year ago
oh
great
meant this
Literally all of my knowledge of AMD stuff on Linux comes from this server
It has 0 pertinence to my job
Ah
well except maybe steam deck stuff
anyways, I must retire for the night
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
I suggest you disable notifications 
It's a custom version of FFX made by Jaker to make it run on OpenGL I guess
But I guess the original FFX itself doesn't support clang?
oh I thought you mean compiling llvm on windows
Bad connection mustโve scrambled some letters
Scrumbulated
did pixel execute a QFOT in the middle of the convo 
yes, deep inside radv code, when VK_ERROR_DEVICE_LOST is returned, it does mv /dev/dri/renderD128 /lost+found
wow, no errors while I schlept, must've been a perfect port (
)
I actually have no idea if your thing has errors because I have no idea how to use the actual API 
So I've been reading documentation and trying different things
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 
Also, I'll be whipping together an example that you can refer to tonight (not guaranteed to be finished though)
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.
which call is generating it
Callstack
Yes
It's happening on a glGenTextures which doesn't make a lot of sense
hmm
maybe I messed up some function pointer
nah, should be fine
I guess it's the next line (glTextureView) that's triggering it?
The FSR2_PreparedInputColor is succeeding
FSR2_ReconstructedPrevNearestDepth is too
So are DilatedDepth and LockStatus
Only SpdAtomicCounter is failing
can you see what arguments are being passed to glTextureView when it fails
maybe I screwed this function up somehow
https://github.com/JuanDiegoMontoya/FidelityFX-FSR2/blob/master/src/ffx-fsr2-api/gl/ffx_fsr2_gl.cpp#L249
looks fine to me though
maybe I'm passing it a bad (uninitialized) argument
Arguments to glTextureView are fine
then maybe it's failing on glTextureSubImage, which I think is the only other place that has the format arg
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
hmm actually I might've screwed that up
I think I forgot the _INTEGER for the integer textures
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?
Yeah
This feels so incredibly wrong 
: )
Yeah, I have to pass a device somehow
lol I'm gonna remove that assert
There's also commandList in FfxFsr2DispatchDescription
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?
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)
Am I supposed to receive an error to stdout if they don't?
I made it so the backend returns an error if it fails
Then they compile just fine
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
I found it btw
Callstack
backendContext->glFunctionTable.glBindImageTexture(
job->computeJobDescriptor.pipeline.uavResourceBindings[uav].slotIndex,
...
slotIndex was 11
huh
Tf
that sounds plausible
Jaker DEFCON 1
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
Should I still open the issue?
I can't open issues ๐ฆ
lame excuse
What the heck
you have a github account ๐
You can make issues now
Btw, this is the file with all the bindings if you're curious
https://github.com/JuanDiegoMontoya/FidelityFX-FSR2/blob/master/src/ffx-fsr2-api/shaders/ffx_fsr2_callbacks_glsl2.h
I did the thing
best thing doer
muchas gracias
de nada
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 
@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>```
the API isn't header-only, but I'll note that to make the current includes easier, thx
poke
I pushed a fix for the format thingy
Epic
still integrating with my renderer (I only started like 1 hour ago)
You will be using Fwog for the backend?
Ah I see
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
Suffering from success
When I opened RenderDoc, I noticed the jitter was "fine" once more, but only because the framerate went down a lot lol
if you need a peasant to test for you on peasant hardware, boop me
Can't you make it go brrr on penguin OS too?
The ffx shader tool won't run on Linux
oh
Come on AMD, you're better than this
...creating issue... brb
You can't 
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)
There are 5 official quality modes
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
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
wouldnt surprise me
it also feels like they just crammed that in thre because every other game has it too
perhap
some studios have marketing agreements to integrate tech like this
no clue if this one did
https://github.com/GPUOpen-Effects/FidelityFX-FSR2/pull/60 There is a dude here who somehow reverse engineered the shader compiler
How did... what the
i use arch btw
He just added wine
And did some other stuff to undo windows hacks
Initally yes, but then he built a python script
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
you could "just" spin up a windows vm, to compile/build stuff there and move the output out of there again : >
imo it's pretty silly that Linux support isn't in base fsr2
it is
but then again, the Vulkan backend didn't initially ship with it either
but perhaps its also a time thing, windows is/was more important
Linux is probably a very small market for this, yeah
and then there is wine and the other emulated shit, let them figure it out ๐
fsr2 be lookin snazzy ๐
Oh my that's genius, you can't have aliasing if there is no image in the first place!
wtf
the debugger is jumping over this line
const FfxErrorCode errorCode = fsr2Dispatch(contextPrivate, dispatchParams);
the ONE line I'm interested in
debug vs release?
it's in defrog mode
I guess ABI issue somehow
because the function I'm calling is returning some random garbage
the greyed out items remind me of resharper telling me "you can remove them, they are unused"
is that an Exception code?
Doesn't 0x80000000 overflow in int32?
yeah i think that's invalid_size?
weird af design choice
lol I'm dumb
: >
it's returning on this line
FFX_RETURN_ON_ERROR(
contextPrivate->device,
FFX_ERROR_NULL_DEVICE);
it's not skipping anything lol
badumm tss
I rebuilt everything cuz I thought I was going insane
rip
making the error codes ints that overflow is frickin weird though

Hey, 'twas really hard for the committee to write "two's complement"
That's two whole words
two's words
finally
OpenGL Debug message (1281): GL_INVALID_VALUE error generated. <index> exceeds the maximum number of supported image units.
hehe
it is
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.
that is weird
MAX is 8 unfortunately
for image bindings
so it had nothing to do with stale bindings
its now defined to be 2s complement, but overflow is still ub
hmm
AMD cards have more apparently, at least according to gpuinfo
huehue
common AMD W
zink and llvmpipe also have way more ๐
my eyes are barely staying open so I shall retire once again
I'll dream of ways to fix this with bindless
good night my frog
Have a fine frog specimen before sleep
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
i read Dilated Llama ๐ฆ
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
looks like asserts are useless ๐
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
Ah I frogor to tell you that
Yeah I fixed it by switching everything back to UNORM and manually doing gamma (after fsr)
alright I'll raise the issue
wait
I'm not sure if it's an issue 
anyways, I schleep
I probably won't be able to work on it until sunday evening since I'll be gone this weekend ๐ข
we shall see anyways
maybe I'll find some time to work on it during work tomorrow ๐
re wat, it didnt show you directly whats up
ah jaker is back
Nuh uh
i have a question re Application.cpp
app->cursorFrameOffset += glm::dvec2{
currentCursorX - app->previousCursorPos.x,
app->previousCursorPos.y - currentCursorY
};
that looks somewhat weird
what's the q
is there a reason why y is calculated the other way around?
true
and we want upwards mouse movement to move the camera up

so we gotta floop flop it around
indeed
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
sounds like a plan
I think I only need to change one shader source too
this is still odd
you're reading off of app->previousCursorPos and writing to app->cursorFrameOffset, this should be past the point of fixing y-flip, no?
idk, the code works
previousCursorPos is in the same flipped Y space as currentCursorY
so uh yeah, mafs

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?
the second one has a std::span in it
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
yeah, can we remove the owning one (name wise), and have it cache the state always
hmm
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
yeah, and you only ever really create pipelines ones
but imagine where you could be if you just saved that allocation
i was about to say that i do be abouting doing thating
feels weird to force the user to make vectors instead of spans though ๐ณ
glm::span3 when
namespace glm {
using span3 = std::mdspan<float, std::extent<float, 3>>;
}
I wonder if you can still reduce an allocation by providing optional move semantics
idk what the call site looks like
like a construction site
just do dis
void func(SomeHugeStruct s)
{
internalData.push(std::move(s));
}
// if user wants a move
func(std::move(s));
// if user wants a copy
func(s);
now you have optional move semantics
but its not perfect
you can use a template to remove the intermediate struct, but perhaps it's not worf it since you're moving anyways
to remove that you need to provide emplace semantics not optional move semantics
@dapper gorge possibly something worth noting
https://github.com/GPUOpen-Effects/FidelityFX-FSR2/issues/108
Not sure if it's a real problem if the motion vectors are correctly provided
hmm
Maybe the jitter y offset would need to be inverted
Is that well defined in OpenGL?
I have no idea
no
Uh, you should use glClipControl for that anyways
Epic
Yeah true
GL_UPPER_LEFT and we are in Australia
Yeah that's the worst case scenario fix
Oh I'm not traveling atm
glPromptUserToRotateMonitor
I'm on the toilet 
Epic
I will be traveling in a few hours
That's plenty to fix FSR2
Mayhapsch enough time to hack bindless in
not travelling yet propulsion is engaged ๐ค
I'm deploying the swimmers to scout ahead, smhmh
without the floating equipment
Minimal equipment- they'll be relying on the currents for transportation
idk what to do
maybe it won't be too hard to fork glslang and make it support bindless textures 

or do we know someone who works on it
or maybe I can generate the shader permutations as text
mayhaps we can send moscow inkasso
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
@brazen glacier might know?
i mean you can just pass -DWHATEVER in iirc
trying to make glslang dump text instead of spir-v I guess
lemme read context lol
my problem is that I cannot use it to compile glsl that uses opengl bindless textures
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
can you run it with -E?
but the problem is that fsr2 relies on a bunch of compiler defines
i think you need to manually grab this output though, can't redirect to a file
I think I was being a moron
for some reason I wanted the #defines to be literally in the text 
but yeah just preprocessing works too 
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
what does it even do?
it invokes glslang for each shader permutation, then generates headers with info about the permutations
mayhaps I can take the python clone of it that someone made and modify that
yeah it's dumb
all this because I can't bind more than 8 images
(on nvidia)
common NVIDIA L
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)
at least it hits the assert without immediately generating gl errors now
hey, not their fault that nv hardware sucks and can only bind 8 images ๐
it's so dumb, you can bind a billion images on nv in vulkan
ah but you see if they limit it to 8 images they can do an optimisation that saves 3 femtoseconds on some cad program
look ma, no errors
i ran it and it spammed errors
are you on nv
no
spoopy
rx 5700xt, adrenalin 23.4.3, checked out the fsr2-test branch and running gltf viewer
coming from here (ffx_fsr2_gl.cpp:1194)
probably invalid format somehow
oh lemme do a debug run
it's trying to use a resource with unknown surface format
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
oh right lol
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
Does it work at least
it correctly generates a black screen
Nicely upscaled ๐

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
That could work yeah
rainbow from this evening, seems like you can see the oscillations below purple but i might be imagining it
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
That's truly one of the rainbows of all time
these formats 
btw, this strategy seems to work (no more gl errors on Nvidia ๐) but I still get a black screen because the wrong resources are being bound
I invoked glslang with -g
short for --gobble-ram
how ๐น๐ซ
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
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
it (setting image uniforms via glUniform1i) seems to work when I'm not using spirv 
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

FSR2 GL is back in the works, pog
poke
I'm gonna continue to test on AMD machine since I can bind images without having to use glUniform
I shall
da heck is that wcstombs
Settra himself wrote this code
Seriously though, is there a better way to convert wchar strings to c strings 
the best way is to not use them :P
I'm afraid I'm forced by fsr2 to use them
i figured, very unfortunate
wchar strings don't belong anywhere near render code, when are you going to have a texture with non-ascii chars in its name????
lel
glsl with wchar uniform name
I don't think they are causing any issues atm
more like lchars
Anyways, I know they're disgusting, but I'm not concerned with changing them atm
I just want mah got dang bindings to work
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
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
no
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
i recall dr. circle having big issues, but this seems a bit to 
can you not turn this into an amd hackathon next week, and make the initial authors help you : )

on the bright side, input samplers are ๐ซ๐ดoked the same way on both machines
fook
๐ซ๐ด๐ed
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);
}
hmm are you doing the same mistake i did, mixing image/texture?
datas ๐

also seeing this vulkan code immediately triggered my ptsd because this looks just like my vulkan code
except it's bigger
vulkan: sampled image
gl: glBindTextureUnit + glBindSampler
should be the same
it says computeJobDescriptor, was finking you bind to a cs, and glsl might use image not sampler2D
it's kinda dumb
but yeah this function is executeGpuJobCompute (write+bind resources and dispatch)
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
I swear even this line BackendContext_VK::Resource ffxResource = backendContext->resources[job->computeJobDescriptor.srvs[srv].internalIndex]; scares me because of [[[]]]
is this pure C?
so no attempt at any refactoring was made then
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;
btw did you change anything on the spirv?
bro I'm fighting for my life trying to make this code work
yeah I made them combined image samplers
well I am not talking about your code or your effort, otherwise understandable
whoever wrote the code must have worn down ctrl, c and v keys
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
do you ever change the sampler uniform value?
i'd think it would be
I do change it for images though, because nvidia is stinky and doesn't even allow binding images to indices > 7
well the version of the repo on my work pc does not have that yet, since it's not needed
I basically have these files side-by-side and am comparing them atm
https://github.com/JuanDiegoMontoya/FidelityFX-FSR2/blob/master/src/ffx-fsr2-api/gl/ffx_fsr2_gl.cpp
https://github.com/JuanDiegoMontoya/FidelityFX-FSR2/blob/master/src/ffx-fsr2-api/vk/ffx_fsr2_vk.cpp
big mcthankies
hey you can't just right click and save an image, they're non fungible
somehow textures that I'm not even passing to the fsr context are being bound 
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,
};
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
moon is at the anti gl phase

The blood moon is rising...
Ahh, the good old terraria flashbacks
Shouldn't motionVectorScale be the render resolution?
But well, I guess that's not important right now 
getTextureResourceGL does this
https://github.com/JuanDiegoMontoya/FidelityFX-FSR2/blob/master/src/ffx-fsr2-api/gl/ffx_fsr2_gl.cpp#L448
it depends
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
stalus bingus
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
do you not have ZeroThingyBindingThing() in your pipeline?
I forgor to put the fsr dispatch in a scope
ZeroThingyBindy
ah
there we go
Now they are all equally fooked?
for some reason, only some images and buffers are being bound
but no samplers nor textures
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?
yeah they are
ok
weird
job scheduling from the driver?
the driver is allowed to do many things but breaking your code is not one of them
maybe its not allowed to, but will it?
In theory
opengl issue
fsr2 calls them "jobs"
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
jaker will prove it by revealing you've been running vulkan the whole time
#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);
POPULATE_SHADER_BLOB should really be a function lol
ah, I see why it isn't
the info argument can be several types
templates?
that means I just need to make this a template
so are you guys hiring any remote eu devs 
make a pr ||that will never get merged||
๐
abandonware master developers
seriously ๐
Fullstack Java Developer

im too stupid for serious giraffics business
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
I'm realizing that there's no better place to learn other than on the job
i assume so yeah
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
Are you trying to outsource FSR2 OpenGL?

what does a graphics development job even look like, now that I think about it
what do you actually do
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);
I get that senior devs basically ponder the orb all day
idk
~Jaker, full time graphics developer at AMD
He spends his time shitposting on discord
so do I but I do database stuff so I thought my skills weren't transferrable
I'm a gpu devtech, so I don't make the renderers as much as I help the people who make the renderers
Interesting
is gpu devtech one of those jobs where they want to see a CE degree and time spent with FPGAs and stuff
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
Basically this discord except at AMD?
Without the #opengl channel unfortunately
no hardware skill required
the basic requirements are knowing how a GPU works, how graphics APIs work, and how to optimize graphics
Sounds reasonable yeah
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
the job itself is investigating bugs and perf issues in AAA games, doing frame breakdowns, etc.
most R&D projects don't turn into a product
and they aren't necessarily software
holy shit
is that a good holy shit or a bad holy shit
good
this ugly thing was looking for sampled images, not combined samplers
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
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)
glClipControl
Mate
we are probably the only people using FSR2 on OpenGL right now 
On the planet possibly
But yeah, good idea.
is all the math in the shader factored around a [-1, 1] depth or something?
I'm not sure how this function works, but I think it would be the one that needs to change to accommodate [-1, 1] depth
https://github.com/JuanDiegoMontoya/FidelityFX-FSR2/blob/master/src/ffx-fsr2-api/ffx_fsr2.cpp#L663
something assumes ndc z is [0, 1]
it wants all the other projection params
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.
He will be forbidden from seeing frogs for the rest of his life
that's a cruel and unusual punishment
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
is there a way to search all open files in vsc
ah, the giant magnifying glass on the left
ffx_fsr2_common.h has all the uses of DeviceToViewSpaceTransformFactors
FfxFloat32x3 UnprepareRgb(FfxFloat32x3 fRgb, FfxFloat32 fExposure)
unprepares your rgb

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
Huh, looks like a shrimple * 2.0 - 1.0 will do the tricc
Does that mean OpenGL FSR2 is almost working ๐
FFX_IS_UNHINGED_DEPTH_RANGE
yes
Huge hype
it will be pushed soonโข๏ธ alhamdulilah
Staying up to 2am was worth it
u should sleep and then observe the pushed version when you wake up
Itโll be like Christmas in summer
I shall admire the glory of The Pushโข๏ธ later then
Earth go spinny spinny, that's how they work
you fix up the engine to do things artists want
and seniors ask their orb for structural changes
what does that look like though, to me graphics only comes in "simple" and "arcane"
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
as in you interact with the arcane stuff the senior devs conjured?
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
nah it's because the engine is bad and the whole thing needs a rewrite

if I wrote the engine, things would be different
trust me, the seniors love it when juniors demand rewrites
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
so even the big engines can't avoid perpetual refactoring
i like how it is the seniors are my gods
but they refactor when its smart
they have lots of people with smart heads
my carefully architected code
my sensible style choice
my self-documenting code
their spaghetti codebase
their baffling style choices
their unreadable code
some things get really old tho, its not like its rewritten every year
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
oh they do tho
you just go throu the jungle and get it after time
first months are shit
but then its your swamp
: become shrek
learning to read other peoples code is a real skill
i could barely do it
now its ok, but muuuuch better then before
fsr2, despite the funny code I showed, is well-enough written that I could comprehend what it was doing in relatively little time
yeah
i think cpu code is usualy ok cause ides get it
but super big shaders can be really poopy to understand
I still need to cross the real threshold which is learning how to get info out of meaty papers
yeah navigating shaders is an atrocity
rider my beloved :)
full go to definition/code completion for hlsl
glsl though... lol
rider?
jetbrains ide, basically a drop in vs replacement
'ardly know 'er
btw does anyone know the extension that allows me to vertically stack tabs in VS
having one super long line of tabs sucks
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
- 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)
- if this is necessary, I wonder if I can just modify
DeviceToViewDepth(generated on the CPU) instead of doubling the shader permutations
I don't really understand what the function is doing
https://github.com/GPUOpen-Effects/FidelityFX-FSR2/blob/master/src/ffx-fsr2-api/ffx_fsr2.cpp#L663
@shell inlet do you have any thoughts about the device to view space transform thingy that I'm talking about
I guess this explains everything I need, as usual
http://www.songho.ca/opengl/gl_projectionmatrix.html
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
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 
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
nope, renderdoc says the bindings are "randomly" starting at high indices
"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
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 ๐ข
wtf, apparently bindless textures are supported
https://github.com/KhronosGroup/glslang/issues/3205
idk why it wasn't working with my thing, maybe I have an old version
ahh the thing that I thought was an nv driver bug is actually a renderdoc bug 
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
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 
no validation layers btw 
ADL is terrifying
is memory barrier not a command ๐ค
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
aces with correct color space looks more incorrect than the incorrect one
I just woke up and don't understand the question
the question is basically: what is the code in the link doing?
but I think I know, hence my follow-up link
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
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
https://github.com/baldurk/renderdoc/issues/2942 yeeted, deleted and cremated
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] 
no, I have not done that yet
that's probably contributing to blurriness, but my current motion vectors look wrong anyways
its an easy fix to clip control for now
ez fix indeed
I need to change like five places in the indirect lighting code to account for this 
thats just how opengl looks like
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 
anyways, my motion vectors are sane now
btw perspective divide in the fs is not always right
when is it wrong?
if you need clipping on the near plane
isn't the pipeline already doing clipping for me here
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
alr
were u thinking of doing perspective divide on gl_Position in the fs
ye
the pipeline takes another soul
though I still don't understand how is it that interpolated NDC aren't same as interpolated clip space coords with perspective division
i guess this threw me bc ndc coords are after persp divide
idk maybe interpolating the divisor (w) does something funny
in this sense i have no idea what this means then
well the clip space is linear so it shouldn't do anything funny
but interpolating NDC might
they generate ndc coords for current and previous frame unjittered positions, then pass them to the fs, do the persp divide, and then subtract to get the motion vectors
but then the interpolation is also perspective-correct
to the bone
anyways, I am once again staring at this function
https://github.com/GPUOpen-Effects/FidelityFX-FSR2/blob/master/src/ffx-fsr2-api/ffx_fsr2.cpp#L663
I think I can upgrade it by adding a third dimension to the matrix_elem_ variables with the corresponding magic numbers
where the heck did they get this from (apparently it corresponds to row 3, column 3 of the matrix somehow)
const float fQ = fMax / (fMin - fMax);
trying to figure out how they derived it from this
https://vincent-p.github.io/posts/vulkan_perspective_matrix/
the inverse of the matrix is shown later on, but I still don't see the connection
something still ain't right ๐ฆ
https://i.imgur.com/02Ni0D4.png

pushed my current stuff to fsr2-test branch of Fwog if anyone wants to observe the bugs
ye
i should really integrate that then tbh
most of the pics I showed were taken on my 3070
the api surface is quite small
yeah should be easy to make bindings for
idk why that person gave up ๐
๐คทgot bored probably
rust bit them in the butt ๐
Does baldurk just hate OpenGL? ๐ฆ
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 

9 months ago
exactly 
@long robin im trying to build fsr2 and im getting this when running the script 
hmm looking at whats inside i think i can just yeet that dependency
Yeah I stopped using it too
Do you know how fsr compiles/loads it shaders
Im a bit conchfused
I think ffxFsr2ContextCreate creates shaders?
But where does it expect sources to be
And does it compile them at build time or at runtime
They are all already compiled using their own shader compiler (I think)
It looks like itโs shipping dxc as a DLL so I assume at runtime somehow
Shaders are in ffx-fsr2-api/shaders
