#Fwog and co.
1 messages Β· Page 21 of 1
and it adds one important bit
you cant randomly mix and call functions
you can force specific flows
similar to Frame/Render Graphisms
using it probably feels nicer too than calling functions with 20 arguments
perhap
GL_NICEST coupling
https://youtu.be/cvJ2BDkcLjE?si=4TaLnZcXbfUXTFiN&t=73
Me after building a time machine so that I can slap myself for my mistakes
Jukin Media Verified (Original)
- For licensing / permission to use: Contact -Β licensing(at)jukinmediadotcom
Wait for it... Sneak attack. Lucifur always waits for a distraction... He is a dick.
xD
lol i got it and indeed
undelete the treasures this instant
template hell
i had a poc (phucked obsolote code) before that relied on macro embedded glsl string
but meh i wouldn't do that crap irl
irl
hmm I kinda recall you talking about it
or maybe it's some kind of quantum interference with the shared neuron
as you can see from the link, its an L π―
The macro yelling at me means something epic is about to happen
sorry,
, a filepath?
if so, why? i suppose it depends on what the texture is entirely supposed to represent, i.e. a handle to the asset system, vs direct into the renderer
Yeah so imagine trying to create a g-buffer texture with that setup
It's just a layer below what I'd prefer to have it at
oh, the only constructor is a path?
the very neat and cool thing about constructors is that you can have multiple!
illegal
I still don't think loading texels from a file belongs at the low level abstraction layer
i think the question is whether a small-scale enough renderer can just embed the asset systeme
the renderer basically has to embed a cpu->gpu upload system
disk->gpu doesn't seem like a ton more, especially if you're not doing much with that info on the cpu
disk->cpu requires an arbitrarily complex decoding process though
i'm not exactly sure why that's something to be scared of when renderers are out there using BC formats
if you want to keep stb out of your standalone renderer, i get it
it really depends for me what scale of renderer you're talking about
I'm just saying they belong at different levels of abstraction
umm, okay :)
in the case of fwog (the channel we're in), that behavior isn't what I want
the person making the renderer should decide how they want to load textures from disk
yeah i could agree with that
i think i'm thinking more on the engine-side than the lib side, that's what i meant by this ->if you want to keep stb out of your standalone renderer, i get it
if you only meant on the lib side, then we prob agree fully π€
ye
i saw gracien like this one https://github.com/yslib/Cameray perhaps something for later later later later
btw the FSR2 bindings were fine all along.
The FSR2 OpenGL backend was binding some UBOs and my app wasnt rebinding its UBOs. That caused the crash
@dim bluff if you are still interested https://www.nuget.org/packages/FFX_FSR2/1.0.0
one of the UBOs was meant to contain bindless textures
oopsi
Ah
in order for FSR2 to work correctly do I need glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE); because DeviceDepthNegativeOneToOne == 1 is not yet implemented?
Yeah although I noticed it still kinda works even if you omit that gl call
Btw if you change the clip convention you'll need to change your projection matrices
If you ever figure out the math to make the -1 to 1 convention correct please let me know lol
i am afraid I wont be that guy
Lol yeah I tried to get criver's help and he didn't know either
The default convention is bad anyway
uh what I have now is to keep the projection matrix and instead change how I convert from uv to ndc.
Like ndc = vec3(uv * 2.0 - 1.0, depth); where as before vec3(uv, depth) * 2.0 - 1.0.
This is dump right? I dont know what I am doing
Why not change the projection
will do now
Also what is that code for
for example when reconstructing frag pos in lighting pass
Oh ok
Yeah that's correct
You'll have to change that plus change the projection
I thought you were doing this in the VS instead of changing the projection lol
okok
Holy shit nice
Yeah one of the passes runs way slower than it should. You can try profiling if you want
For whatever reason, nv optimizes the shader differently and it performs a lot worse in GL
i believe that's because vulkan is faster (and better)
have you seen the benchmarks?

oh ok. Well it does perform as expected on RX 5700XT, 1ms at FullHD and Im very happy with the results. Cant even tell the difference between (0.75x + FSR2) and (Native + TAA)
yeah on AMD it's fine
NV perf is horrible for some reason
I profiled and there was a pass that was taking a very long time. I noticed a comment in the source code that said something needed to be {dis, en}abled to fix perf for that pass in Vulkan, but I couldn't replicated it myself
interesting
if you want to investigate the issue yourself, that link should be a start
actually I'll make an issue so people looking at the repo are informed
thats what I thought too you documented it well
hmm where else did I document that π
idk
this won't help you but
https://github.com/JuanDiegoMontoya/FidelityFX-FSR2-OpenGL/issues/8
btw I am experiencing a memory leak when recreating fsr2 context for resizing. It might have to do with my application still need to look into but getting the same behaviour in your 03_gltf_viewer
my GPU readings are not precise though since I'm looking at task manager lol
ok that's interesting
which GPU?
RX 5700XT, 23.9.1 driver
same behaviour on RTX 3050 Ti (tested only with my application)
okay I see it in my things now
I was looking at the wrong numbers 
hmm yeah must be an fsr2 leak because I don't see it when fsr2 is disabled
looks like I'm properly cleaning up all GL objects at a glance
I also see no calls to new or malloc in that the backend that could leak
if (vendorId == 0x01de) { Sleep(0.1f); }
I have observed similar things in the past (but not sure how correct my conclusions are) : When you resize the swapchain to a larger size, the memory usage increases (obviously since swapchain now has larger images).
As for the continuous resizing, if you leave the swapchain size unchanged for a few seconds, memory usage will stabilize
oh sorry didnt read the message on the fsr2 disabiling thing
Perhaps you might want to mention your OpenGL backend here.
https://github.com/GPUOpen-Effects/FidelityFX-FSR2/issues/10
I'm iffy about posting it there because I don't want to make people think it's officially sanctioned
any posts of mine there could be interpreted as "official AMD" since I work there
I can see if it's chill for me to post there though
ok I see. Yeah and I guess you could just point out that its a private unofficial thing
ye
if you are not gonna do it I will : )
I also noticed that rys said he'd consider PRs that add GL support
I doubt such a PR would be merged tbh
it's another big chunk of code to maintain
true
plus I didn't follow official style or follow good practice with the cmake
needs more acronyms TBH
*NMA TBH (FTFY)
OGISYFR (JK OFC ILY)
just a CRITICAL failure, nothing to see here
what the fuck, the solution to the critical errors was to add an extra magic underline after hyperlinks
https://github.com/sphinx-doc/sphinx/issues/3921
yeah this lang is absolute shit
random whitespace and formatting are important syntactical constructs
like it's an error to remove the "extraneous" newline here
.. code-block:: cpp
Fwog::RenderColorAttachments colorAttachments[] = {aAlbedo, aNormal, aMaterial};
I was getting an error for the number of dashes here not exactly matching the length of the title
`Shader.h`
---------
I pushed, and yet

rebuilt and the critical errors are back 
most stable web framework
the error isn't even pointing to a line where it could happen
eh whatever, I'll just keep working on VSM
perchance i can take a look at it next weekend
it's not that important, just annoying to look at the "docs failing" on the github
yeah
top 5 repos to check
Honorable mention: Fwog 
right next to annotadted
me fail english? that's unpossible
its just tad, talking at ted, reading annotated mario assembly
bravo anno
excuse me jaker
but wtf is this
: D
return *new (this) Buffer(std::move(old));
Fwog/Buffer.cpp:45
yestergestern i learnd copy and swap
and then i see this π
lustri, do you implement copy & swappino properly in iris? π
yes
my man
a less wacky way I've seen is to have the operator= be the 'master' and just have your move ctor be
*this = std::move(other);
IR_CONSTEXPR
nvcc doesn't like constexpr on some schtuff
isnt the new thing to avoid std::move?
It works when you have const and reference members, unlike the other methods
Idk what's lazy about it
the c in nvcc stands for cringe
true
ye jaker's method technically works best
but it's unsightly 
And my linter complains about it being unusual 
im also slightly weirded out by your using self = buffer_t; thing lvstri
: )
Rust has this nice thing where you don't need to type out the full type name everytime, you can just use Self
but im weirded out because i dont understand anything c++
yeah its common in c# too
I saw the C++ weekly regarding this pop up in my feed
haven't watched it yet
you should try the thing I posted above and reverse it
reuse the assignment operator in the constructor instead of vice versa
wdym
ββ Awesome T-Shirts! Sponsors! Books! ββ
Calling all C++ developers: A free preview of CLion with much faster core IDE functions is out! π Introducing CLion Nova β a version of CLion with the C++ language engine from ReSharper C++ and JetBrains Rider. It brings:
Faster highlighting speeds
A more responsive UI
Significantly fewer fr...
le shrug
I was using that before, but it doesn't work when you have const or reference members as I stated
oh missed that
You have to reconstruct the object to change em
Btw somehow I'm only learning about the copy & swap idiom now, but it doesn't seem that epic unless you're doing exception-safe programming
schmells like bait
i meant the vid, but i am willing to make an exception
Ah
except it wouldn't be safe to do that, wouldn't it
Exceptions my beloved
I am qualifying this convo with noexcept
throw up;
yep, that video from jason, DR linked : )
totally related, I found this awesome jif
and i think some cppcon talk was talking about it too, but i dont remember which one it was
Btw going to the gym can help with back pain
I'm gonna go soonβ’οΈ
It sure helped me
I know it's common to overuse std::move as if it's some kind of magic incantation to improve perf
But there aren't actually that many places where it's useful to have (and sometimes it's detrimental as pointed out)
Cargo culting is kinda fun doe
yeah
and i also wouldnt know what is cargo and what is cult
while trying to pick up some of the c++isms
spamming std::move probably isn't as bad as not including it where it's necessary
but it's still painful, especially since it clutters your code
it's reassuring to know that I never wrote std::move once in my entire IrisVk codebase 
it's all NRVO
lel
Most of the time I write std::move, it's because I'm coping for a poor choice I made previously
As a fun exercise, you can ctrl+f std::move in this file and try to see how I could've avoided them
https://github.com/JuanDiegoMontoya/Frogfood/blob/main/src/SceneLoader.cpp
: )
the back to basics RAII talk on cppcon, was talking about copy and schlepp
is that something you should go for still
and not write a separate schlepp function then i suppose
ah
are you a bad example then to sample from π (jk)
Maybe
Fwog doesn't have any user defined copy constructor probably
So it's the same amount of work to just write a correct move constructor and assignment op
hmm
i dont know what a user defined copy ctor is... whats the diffrence to an ordinary copy ctor?
or do you mean = default vs non default
the fact you apparently can't use std::move as hints for copy ellision is annoying
Ye
though hopefully the compiler is smart enough to do it either way
Default move and copy functions are perfect a lot of the time
copy elisionisms
Especially if the members of your class already have correct copy and move semantics
quite magical what compilers can do
pet peeve: mixing copy elision and nrvo 
nrvono
I mean stuff like this
I hope its smart enough to ellide the copies one way or another
hopefully the compiler will hear my prayer iether way π
God is dead and we killed him
true and real
this time i will not comment '*gob' π³
poor lifetime management
good deadtime management
if only they called it rvalue_cast like it really is
dingus_cast pls
this would help the difference set of people who don't understand what move does but know what an rvalue is (the empty set)
speaking of which, @golden schooner
https://scryfall.com/search?q=dingus
But at least people won't be tricked by the name into thinking it performs some kind of magic
by the law of big numbers there is at least one person who fits this description
I wrap all my calls in std::magic just in case
current name move (too magical)
new name: cast (not magical)
alr
std::shrooms
if you tell me its a no-op I won't believe you
what if it's a magic noop
std::move_but_pls_read_the_docs_before_using
your case 7 up there is dingus_cast
whats the ETA for this year's frozen treat
last year's was 12/19 iirc
sometime around christ mass probs
dunno what christ mass is, but christ density is very low since he walked on water
man did you know that you can express acceleration as pounds per kilogram
which is a constant 2.2, and that's why the universe is constantly accelerating outwards
pounds (force) / kilograms (mass) = acceleration
you can express 1.151 as mile / mile
I will personally kill all imperial users
you could also express acceleration as pounds per pound if you're unhinged enough
number of open jira tickets is my favorite
your honor, that comment
mmhg
i imagine this is deccer reading gp

Several random questions I have about fwog (sorry if was asked before)
- How does it compare to other GL wrappers? I've seen a few of them around but not sure if there are some quality ones
- If I made something similar in 3.3, how much different would it be?
- If I suddenly wanted to change to a different API (e.g. webgpu or Metal, idk), how much pain would it be? Do you need even more abstractions to make it easier for yourself?
- its not just your ordinary Texture, Shader, Buffer abstraction, its a toolset to let you define renderpasses and pipelines (graphics/compute) opengl state is somewhat hidden from you and you dont have to manage fbos either. you still can use raw gl here and there where you think its necessary
- not much, Fwog is just using DSAisms where possible, and you wont have kompoot in 3.3
- fwog is very tied to gl as it is, but given its architecture as mentioned in 1) it "shouldnt"(tm) be too hard to switch to something else
idk what you are trying to say martty
. _ .
Idk if I've seen a "good" gl wrapper besides the one in erhe
the ones im aware of are just glX wrapped in classes 1:1
Most of them are your classic buffer, texture, etc. abstraction with non-existent move semantics
AKA what beginners make
So yeah fwog is that but it also has pipelines and "render passes" to minimize the amount of global state that needs to be touched
Uh oh there is some oldism in the docs (non-lambda render pass example)
https://fwog.readthedocs.io/en/latest/pipelines.html
good times hehe
Too bad the docs inexplicably no longer build 
Anyways @hexed bay if you want an annotated example, check my le triangle
https://github.com/JuanDiegoMontoya/Fwog/blob/a190998a24c32df63849981c803ec26d6dbbbfb3/example/01_hello_triangle.cpp
As far as abstractions go, it's pretty thin (there is a lot of low-hanging fruit in OpenGL), and most of it could be recreated in GL 3.3 with slightly more effort
So basically what deccy said
The most "radical" (not if you ever saw d3d12 or Vulkan) thing it does is 360 noscope the global state
Also, this post is the precursor to fwog
https://juandiegomontoya.github.io/modern_opengl.html
A lot of handy modern gl features aren't difficult to emulate with a 3.3 wrapper
What are your thoughts on more abstractiony abstractions? E.g. bgfx, magnum, etc. π
Fwog is my go-to abstraction for ogl. 
I don't have many
I "tried" bgfx once and wasn't too impressed, though I don't benefit much from its cross-platformness
In general you lose nice features as you start to support more APIs and lock yourself into the least common denominator
bgfx feels weird
Building bgfx is a massive pain in the a$$ too
it feels like a "better" raylib
Or at least that's how it appeared when I saw my colleague do it in college
but can probably do more
It seems lower level to me
But it has some random high levelisms that feel random
I'm not the best person to comment on it though
Personally the two kinds of abstractions I'm vaguely aware of are near-1:1 abstractions like Fwog, and render graphs
how fwog compares to other wrappers
(B
That sums up pretty much my experience with it. Tried installing it, struggled, then decided it wasn't worth it.
Did you try any other gfx abstraction libs?
Does Ogre count ? π€
Was a long time ago tho
(I don't think I tried any other otherwise, but I got tired of C++ as well so that didn't motivate me to try more)
Mike Acton roasted Ogre, so itβs dead to me now 
Tfw you love glm so much, you stop using standard types 
My first reaction: where VBO 
He did it on Ogre 1, Ogre 2 addresses many things if I'm not mistaken.
Btw, heβs doing streams on his Substack on porting a Unity game to C++ (itβs pure C) for now
And Iβm so impressed by his programming powers. Itβs truly next level skills: π
Ha interesting
It looked like this for 20+ hours though
He wasnβt kidding when he said "data oriented design" π
(He then writes a script which exports spreadsheet into a binary file and even generates a header to read it without parsing)
vertexPosBuffer
I read fwog examples before, and now I understand a lot more. But kinda think that Iβll live with more immediate more rendering for now π
Pipelines are cool, but I think that reimplementing this would lead me to make fwog 2 (instead of making an actual game
) π
Gotta say that fwog features some of the cleverest (in good sense) C++ code Iβve seen. My code is like C++98 in comparison 
pipeline is nothing else but grouping state calls to prepare draws/computedispatch
Yeah, it makes sense to me, but I feel like it requires a lot of abstractions/code to make it flexible enough compared to (almost) raw gl calls
not really
and it depends π
if you have tons o f effects where a horde of fbos is involved, then you have more BeginRendering/EndRender sections
when more shaders are involved then you have more pipelines to setup, but all that setup is abstracted away nicely
Yeah I don't do cringe vbo classes
Fr I'm not even convinced myself that pipelines are the endgame
They are useful for the way I use gl
its better than
Have you guys tried LLGL yet
(needed this emoji for another server)
banana's low level gl libraryframework thing its quite old as in around for some time
fwog Emscripten when
You must experience how bad Emscripten/WebGL/OpenGL ES are 
is it even possible
Jesus Christ,why so many switches in ApiToEnum
because there are a lot of values in a lot of domains to cover
but they dont include all Format enums.Like isFormatNormalizedGL does not include compressed formats
yeah because its most likely not necessary in that case
and possibly jaker is just a lazy bum and didnt add all formats back when, before adding compression support when loading ktx : >
if you have code relying on missing formats, feel free to send a PR
planning to encode almost everything inside 32bits
: >
im half way though
im coming from this point that he cant have all this stuff in his head, adding format to a hundred enums
i mean they are all defined : )
but were probably not necessary
half of it is part of legacy opengl, which fwog isnt exactly supporting anyway
starting to wonder what looks better
i understand why you (would) format it like that
but i find it ugly, personally
if you want to PR then stick with the style of the project
Because compressed formats don't make sense for vertex attributes
This is also sometimes true
However, I think I just copied valid vkFormats where necessary
If I made Fwog again, I'd just get rid of all the vertex attrib stuff which would simplify that file greatly
yep i wasnt serious here either
i sometimes wonder when VP became a thing and why John didnt come up with it himself back then already to push card manufacturers to support this sort of stuff
I am trying to install Fwog via xmake (by using cmake import)
C:\Users\Raildex\AppData\Local\.xmake\cache\packages\2404\f\fwog_git\v0.2.1\source\src\Fence.cpp(40,43): error C2039: 'numeric_limits': is not a member of 'std' [E:\2drpg\build\.packages\f\fwog_git\v0.2.1\cache\build_70a1113b\fwog.vcxproj]
C:\Users\Raildex\AppData\Local\.xmake\cache\packages\2404\f\fwog_git\v0.2.1\source\src\Fence.cpp(40,58): error C2275: 'GLuint64': expected an expression instead of a type [E:\2drpg\build\.packages\f\fwog_git\v0.2.1\cache\build_70a1113b\fwog.vcxproj]
C:\Users\Raildex\AppData\Local\.xmake\cache\packages\2404\f\fwog_git\v0.2.1\source\src\Fence.cpp(40,69): error C2039: 'max': is not a member of '`global namespace'' [E:\2drpg\build\.packages\f\fwog_git\v0.2.1\cache\build_70a1113b\fwog.vcxproj]
C:\Users\Raildex\AppData\Local\.xmake\cache\packages\2404\f\fwog_git\v0.2.1\source\src\Fence.cpp(40,69): error C3861: 'max': identifier not found [E:\2drpg\build\.packages\f\fwog_git\v0.2.1\cache\build_70a1113b\fwog.vcxproj]
C:\Users\Raildex\AppData\Local\.xmake\cache\packages\2404\f\fwog_git\v0.2.1\source\src\Fence.cpp(38,21): error C2198: 'PFNGLCLIENTWAITSYNCPROC': too few arguments for call [E:\2drpg\build\.packages\f\fwog_git\v0.2.1\cache\build_70a1113b\fwog.vcxproj]
Did you forget to add WIN32_LEAN_AND_MEAN? and NOMINMAX?
hmm I thought I fixed that issue
i am using v0.2.1
does fwog use glad internally, or do i have to load the functions myself?
i receive an access violation on Fwog::Initialize and wondered whether its because i do not load glad.
Initializes Fwogβs internal structures.
Call at program start to initialize Fwogβs internal state. Must be called after an OpenGL context has been acquired.
To create a Fwog (context), you will first need an OpenGL 4.6 context (e.g., one created with GLFW) and have loaded OpenGL function pointers in the appropriate location. Then, you can call Fwog::Initialize().
you are expected to load gl functions yourself via glad or some other means, then provide the gl headers. however, glad's gl header is used by default and fwog vendors glad so you should be able to just use it
let me see what I do in my own project
ye looks like fwog exports lib_glad in cmake so you should be able to link that to your project if you don't want to vendor it yourself
target_link_libraries(MyRenderer PRIVATE lib_glad)
then you just need something like this before you initialize fwog
#include FWOG_OPENGL_HEADER
...
int version = gladLoadGL(glfwGetProcAddress);
if (version == 0)
{
glfwTerminate();
throw std::runtime_error("Failed to initialize OpenGL");
}
hmm you might not need to explicitly link glad in your project since fwog already does it
. I think you just need to include FWOG_OPENGL_HEADER or <glad/gl.h> (which is what FWOG_OPENGL_HEADER expands to by default)
i think lib_glad needs to be linked publicly then by fwog
idk what the default visibility is, but fwog does this
https://github.com/JuanDiegoMontoya/Fwog/blob/main/CMakeLists.txt#L88
i believe i had that "problem" in my cmake-starter template thing
should be public, otherwise I can't find it's headers
target_link_libraries(<target> <item>...)
Library dependencies are transitive by default with this signature. When this target is linked into another target then the libraries linked to this target will appear on the link line for the other target too.
should be good then
is this for an older version of glad? I had to do this:
add_subdirectory(${FASTGLTF_DEPS_DIR}/glad/cmake glad_cmake)
glad_add_library(fg_glad_gl46 REPRODUCIBLE EXCLUDE_FROM_ALL LOADER API gl:core=4.6)
target_link_libraries(fastgltf_gl_viewer PRIVATE fg_glad_gl46)
@tired sandal did you manage to fix your issue with glad?
kinda. Since I am using xmake i had to resort to putting glad into my source tree
ah I am unfamiliar with xmake 
since glad is mandatory anyway, why isn't it automatically initialized in Fwog::Initialize?
vendoring glad's files is perfectly fine though
I prefer not to care about opengl extensions and let Fwog handle it
it's for flexibility. the user may already be loading opengl functions and/or use another header for it
I did think about it last night. I think using glad's loader by default (but still offering an option to disable that) would help
in fact I can add that right now
uh maybe, but I won't be able to maintain it probably
you could make a PR and then I could link to it in the readme instead of merging it
if it's frozen in time then I won't accidentally break the xmake build in the future
ugh I need to make Fwog::Initialize take a pointer to the load function 
at least I won't need a compile-time option
using ApiProc = void (*)(void);
using ApiLoadFunc = ApiProc (*)(const char* name);
struct ContextInitializeInfo
{
ApiLoadFunc glLoadFunc = nullptr;
...
};
then you just pass glfwGetProcAddress or it won't load the functions
Sounds good to me

@tired sandal pushed
Fwog::Initialize({
.glLoadFunc = glfwGetProcAddress,
});
hrm you will still need the gl headers if you want to make your own debug callback
Fwog::ContextInitializeInfo init_info{
.glLoadFunc = glfwGetProcAddress,
.verboseMessageCallback = [](std::string_view msg){
rpg::logd("[Fwog] %s\n", msg.data());
}
};

and it fucking works without linking glad now
bye bye glad 
epic
thank you very much!
Hmm Jaker my frog
i was wondering if it makes sense to move the INFER_FORMAT values out of UploadFormat/UploadType and make the UploadFormat/UploadType std::optionals in CopyBufferUploadInfo instead
per chancekowski i should just fiddle a PR together
I think I prefer this
The current design I mean
std::optional slightly obfuscates it imo
oki
3:33
I find it interesting that OpenGL debug labels can be null terminated or explicit length, but Vulkan's are only null terminated
That means I can't use string_view for Vulkan
Seems like a step back imo
: (
made using proto-fwog: #wip message
@tired sandal you only need glfw / fwog?
or do i still need another library to load stuff
GLFW and Fwog is the only thing you need now.
epic
ikr
Does anyone know if I'm missing something here?
while (!glfwWindowShouldClose(window)) {
Fwog::RenderToSwapchain({
.viewport = Fwog::Viewport{.drawRect{.offset = {0, 0}, .extent = {1920, 1080}}},
.colorLoadOp = Fwog::AttachmentLoadOp::CLEAR,
.clearColorValue = {.1f, .2f, .4f, 1.0f},
},
[&] {
});
glfwPollEvents();
}```
Im just trying to clear the window for now
whats happening?
did you setup Fwog correctly?
this is my entire program
int main() {
auto info = Fwog::ContextInitializeInfo {
.glLoadFunc = glfwGetProcAddress,
.verboseMessageCallback = [](std::string_view msg) {
std::cout << msg << std::endl;
}
};
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
auto window = glfwCreateWindow(1920, 1080, "CFD", nullptr, nullptr);
glfwMakeContextCurrent(window);
Fwog::Initialize(info);
while (!glfwWindowShouldClose(window)) {
Fwog::RenderToSwapchain({
.viewport = Fwog::Viewport{.drawRect{.offset = {0, 0}, .extent = {1920, 1080}}},
.colorLoadOp = Fwog::AttachmentLoadOp::CLEAR,
.clearColorValue = {.1f, .2f, .4f, 1.0f},
},
[&] {
});
glfwPollEvents();
}
return 0;
}```
you need error checking lol 
void on_error(int error_code, const char* description) {
loge("[GLFW ERROR %d] %s\n",error_code,description);
}
GLFWwindow* create_glfw_window() {
if(glfwInit() != GLFW_TRUE) {
return nullptr;
}
//...//
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR,6);
glfwSetErrorCallback(on_error);
return glfwCreateWindow(800, 600, "Test", nullptr, nullptr);
}
void destroy_glfw_window(GLFWwindow* window) {
glfwDestroyWindow(window);
glfwTerminate();
}
void on_window_should_close(GLFWwindow* window) {
glfwSetWindowShouldClose(window, GLFW_TRUE);
}
std::expected<std::unique_ptr<GLFWwindow,void(*)(GLFWwindow*)>,error_code> create_window() {
auto window = std::unique_ptr<GLFWwindow, void(*)(GLFWwindow*)>(create_glfw_window(),destroy_glfw_window);
if(!window) {
return std::unexpected<error_code>(error_code::glfw_create_window);
}
glfwSetWindowCloseCallback(window.get(),[](GLFWwindow* w){
glfwSetWindowShouldClose(w, GLFW_TRUE);
});
glfwSwapInterval(1);
glfwMakeContextCurrent(window.get());
return window;
}
int main() {
auto window = rpg::create_window();
if(!window) {
//...//
}
glfwShowWindow(window->get());
Fwog::ContextInitializeInfo init_info{
.glLoadFunc = glfwGetProcAddress,
.verboseMessageCallback = [](std::string_view msg){
rpg::logd("[Fwog] %s\n", msg.data());
}
};
Fwog::Initialize(init_info);
//...//
float accumulator = 0.0f;
while(!glfwWindowShouldClose(window->get())) {
glfwPollEvents();
//...//
glfwSwapBuffers(window->get());
}
Fwog::Terminate();
}
@long robin Fwog::Render takes a const std::function<void ()> & func.
Wouldn't be a std::invocable<void()> or a template<typename Func> (if no concepts) better?
I think I used std::function instead of a template so I could avoid putting the function definition in the header
ah I see. Makes sense. I wouldn't leak that as well
@long robin Any chance to add SPIRV shader compilation? 
can you elaborate
I have a spirv file that contains multiple entry points.
yeah I could whip something up
in plain OGL, I would use glShaderBinary and glSpecializeShader
right now the interface accepts this struct, but the string view is a little problematic if I want to add spirv support
struct ShaderSourceInfo
{
/// @brief Specifies the language of the source string
SourceLanguage language = SourceLanguage::GLSL;
/// @brief A GLSL or C++ source string
std::string_view source;
};
I could just make it so you treat the string view as a span of bytes for your spirv module, but that seems kinda meh
meh I'll just make another struct for spirv specifically 
also needs a entry point string
idk what source languages you support but there could be multiple entry points there, too
eh true, vcc supports it
but spirv is the only one with spec constants
I could just not support those however
@tired sandal do you need spec constants?
actually I can just put spec constants in and have them do nothing if you're not targeting spirv 
I guess it would be convenient to have them at some point
that sounds less error-prone
ok, I got a spirv triangle in fwog
the API is probably good enough
@tired sandal I pushed spirv support. let me know if there are any issues
I've got nothing better to do 
@long robin I think you are missing a
#if FWOG_VCC_ENABLE==1
in Shader.cpp
the constructor is not declared and ShaderCppInfo is not defined when FWOG_VCC_ENABLE is 0
#if FWOG_VCC_ENABLE == 1
Shader::Shader(PipelineStage stage, const ShaderCppInfo& cppInfo, std::string_view name)
{
const auto glsl = detail::CompileShaderCppToGlsl(cppInfo.source);
id_ = detail::CompileShaderGLSL(stage, glsl);
detail::ValidateShader(id_);
if (!name.empty())
{
glObjectLabel(GL_SHADER, id_, static_cast<GLsizei>(name.length()), name.data());
}
detail::InvokeVerboseMessageCallback("Created shader with handle ", id_);
}
#endif
This compiles
Damn, I knew I should've tested with the define disabled
I'm in bed now so I'll fix it tomorrow
let raildex send in a PR
He can keep the bandaid until I push my fix. It'll be easier I think
are spirv binaries really integers and not bytes?
yes 32-bit words
I am trying to compile the following spirv file:
Fwog::ShaderSpirvInfo spirv_vertex{"vertex",spirv_span};
Fwog::ShaderSpirvInfo spirv_fragment{"pixel",spirv_span};
auto fullscreen_vertex = Fwog::Shader(Fwog::PipelineStage::VERTEX_SHADER,spirv_vertex,"fullscreen_vertex" );
auto fullscreen_fragment = Fwog::Shader(Fwog::PipelineStage::FRAGMENT_SHADER,spirv_fragment,"fullscreen_fragment" );
Fwog::GraphicsPipelineInfo info {
"Fullscreen",
&fullscreen_vertex,
&fullscreen_fragment,
nullptr,
nullptr,
{Fwog::PrimitiveTopology::TRIANGLE_LIST},
{},
{},
{
true,
Fwog::PolygonMode::FILL,
Fwog::CullMode::BACK,
Fwog::FrontFace::COUNTERCLOCKWISE,
false,
0.0f,
0.0f,
0.0f,
0.0f,
},
{},
{false,false},
{},
{}
};
But I receive a linker error.
Maybe I am missing something?
I'm investigating this rn
btw I suggest using designated initializers for GraphicsPipelineInfo so you don't have to specify everything (everything defaults to zero, null, or some other sane value)
so I am unable to compile the vertex shader
auto [ptr, size] = Application::LoadBinaryFile("shaders/fullscreen.spirv");
auto code = std::span{reinterpret_cast<const uint32_t*>(ptr.get()), size / sizeof(uint32_t)};
auto vertexInfo = Fwog::ShaderSpirvInfo{.entryPoint = "vertex", .code = code};
auto fragmentInfo = Fwog::ShaderSpirvInfo{.entryPoint = "pixel", .code = code};
auto vertexShader = Fwog::Shader(Fwog::PipelineStage::VERTEX_SHADER, vertexInfo, "Triangle VS");
auto fragmentShader = Fwog::Shader(Fwog::PipelineStage::FRAGMENT_SHADER, fragmentInfo, "Triangle FS");
I get a bunch of (0) : error C8001: SPIR-V: Invalid opcode followed by (0) : error C8006: SPIR-V: Invalid entry point vertex
I get essentially the same errors with the fragment shader
can you show how you are loading the spirv from the file? alternatively, you could send an array of hex literals that I can simply paste into my code
i cant read
but if you deconstruct binary it would look neater [shaderBlob, shaderBlobLength]
no .first and .second isms
ok
is the spirv file blocked by the os perchance?
since it was downloaded from an obscure source
I can see that there are 1234*4 bytes in the loaded data
ah
hmm
I noticed that there is nonsemantic debug/source info in the spirv. I wonder if that's an issue
but raildex has apparently gotten the shaders to compile, so idk
raildex and I are ostensibly both using the same spirv and loading it into gl
using the same version of the tools?
what tools
my understanding is, raildex gets a linker error
only thing that might be different is the cpp code, the spirv itself, or the os/gpu/driver
and you get one too
I get a compile error
oh
it can't specialize the shader
mayhaps they mispelled that one
and the spv is just not made for opengl glsl, but vulkan glsl
raildex is using fwog though, which is gl
yes, but only feeding it binary spvs?
ye
so
when you use glslangvalidator to cook spv, you need to specify that you want to cook for opengl or not
-G missing
anyways I presume it's opengl-viable since he was apparently able to get it to specialize
maybe not
ah wait, -G is for glslangvalidotor
yeah this is slang
ye
also no hint of opengl in slang cli reference
perchance its worth to compile whatever glsl with the slang competitor and see if that wor.... ah nvm, as you said, wait for raildex
sry, i can send you the file today evening, since i am not at home. I use the profile glsl_460 and target spirv . but i do not specify entrypoints.
i had the impression i can have multiple entry points for glsl, since glSpecializeShader can specify them
it's not glsl though, but multiple entry points are allowed in spirv
I think the glsl spec says only main is allowed as the entry point, but
- glslang (glsl->spirv) ignores that
- you're compiling to spirv so it shouldn't matter anyway
so, what do you need? @long robin
struct vertex_out {
float4 screen_pos : sv_position;
float2 texture_coord;
};
struct pixel_out {
float4 color : sv_target0;
};
[shader("vertex")]
vertex_out vertex(uint vertex: sv_vertexid) {
vertex_out output;
output.texture_coord = float2((vertex << 1) & 2, vertex & 2);
output.screen_pos = float4(output.texture_coord * float2(2, -2) + float2(-1, 1), 0, 1);
return output;
}
Texture2D texture;
SamplerState sampler;
[shader("pixel")]
pixel_out pixel(vertex_out input) {
pixel_out output;
output.color = texture.Sample(sampler, input.texture_coord);
return output;
}
This is fullscreen.slang
And the compile args:
compileargs = {"-lang","slang","-profile","glsl_460" ,"-target" ,"spirv","-g3", "--",path.absolute(sourcefile_bin) }
-lang slang -profile glsl_460 -target spirv -g3
The spirv you sent earlier wouldn't specialize when I tried to reproduce your linker error, so I wanted to be sure it was the right spirv
I am on a 3070 with the latest Windows drivers
its definitely the same spirv i use
What gpu+driver are you using?
Also can you send me an array of bytes or uint32 so I can be sure it wasn't an issue loading the code on my end
wouldn't the Fwog::ShaderSpirvInfo throw an error if the spirv data would be wrong?
or rather the Shader Objects
Yeah I get an error when trying to create the shader
But you get the error when linking
I'm trying to figure out why
[deccer@rootfs tmp]$ $VULKAN_SDK/bin/glslang -lang slang -profile glsl_460 -target spirv -g3 ./test.hlsl
/home/deccer/Storage/Tools/Vulkan/1.3.268.0/x86_64/bin/glslang: Error: -profile: unrecognized command-line option (use -h for usage)
ah you are on windows, neh?
glslang?
is slang yet another thing? π
ye
shiet
this is my "binary to spirv" conversion:
spirv convert_binary_to_spirv(const std::span<const unsigned char> binary) {
auto target_size = binary.size() / sizeof(std::uint32_t);
auto ptr = std::make_unique_for_overwrite<std::uint32_t[]>(target_size);
std::memcpy(ptr.get(),binary.data(),binary.size()); // UB?
return spirv{.binary= std::move(ptr),.count = (unsigned int)target_size};
}
what the heck is make unique for overwrite
it skips default initialization
c++23 i think
Ok I see
@long robin do you have a spirv file i can test?
It's just the one you sent lol
slangc v2024.1.18
maybe vblanco knows, something, he recommended slang to me
their wiki is also legendary
I thought you were embedding the spirv as bytes in your program
I am
wait a sec maybe I am doing something wrong then?
the spirv file i sent is binary, isn't it?
I'm loading the spirv as a file and fear I screwed it up
You're getting farther by having a linker error in the pipeline. My shaders won't even specialize correctly
sorry for the inconvenience 
xxd and hexdump can do that if you are on a linuxlike
It's past noon, I need to get up lol
i wrote this tool myself and i love it 
its before noon somewhere in the world
so I get the same invalid spirv opcodes and entry point as before
what's the error you're getting exactly?
GraphicsPipelineCompilationException
weird
what gpu are you on?
also can you show what's in the info log/exception message
Amd Radeon RX 7900 XT
unknown reason
ok that could explain the discrepancies
Linking fails for unknown reason
PS H:\Repositories\Fwog\example\shaders> spirv-val.exe --target-env opengl4.5 .\fullscreen.spirv
error: line 0: Invalid SPIR-V binary version 1.5 for target environment SPIR-V 1.0 (under OpenGL 4.5 semantics).
without --target-env opengl4.5 it passes
I am pretty sure you can use higher spirv versions with opengl though 
Implementations must support the 1.0 version of SPIR-V and the 1.0 version of
the SPIR-V Extended Instructions for the OpenGL Shading Language (see sec-
tion 1.3.4).
it's so joever
it never bidentered
why does glslang support --target-env opengl --target--env spirv1.6 then
wtf does that do
it makes the error machine go brrr
A capability describes an optional feature that a target may or may not support. When a -capability is specified, the
compiler may assume that the target supports that capability, and generate code accordingly.
spirv_1_{ 0, 1, 2, 3, 4, 5 }: minimum supported SPIR - V version
...
is this from the slang wiki
from slangc -h
cool, raildex should try that
[deccer@rootfs ~]$ ~/Tools/slang/bin/linux-x64/release/slangc -lang slang -profile glsl_460 -target spirv -g3 -capability spirv_1_0 /tmp/test.hlsl > test.spv
that spits out an actual binary here
lemme try
is this raildex's code
yes
rip it still fails with invalid opcodes
is binary spv portable like that?
@golden schooner there is no difference between your file and my file.
hmm you're right, the only difference is the path that's embedded
weird
I use this
https://www.khronos.org/spir/visualizer/
ran it on a rtx4070 if that matters
: )
A capability describes an optional feature that a target may or may not support. When a -capability is specified, the
compiler may assume that the target supports that capability, and generate code accordingly.
spirv_1_{ 0, 1, 2, 3, 4, 5 }: minimum supported SPIR - V version
Invalid
textualTarget
hlsl
...
PDD (potrick driven development) strikes again
prepare for RDD
raildex is probably the literal first person to try using slang for opengl
btw can't slang emit glsl?
have PDiDdy create an issue
i think it can
inb4 it uses vulkanisms only

ah there it is
pls send
gl_VertexIndex
it's bover
truly we must embrace: slang (spv 1.5) -> spirv-cross (glsl) -> glslang (spv 1.0)
and separate textures and samplers
i tried all the spirv_1_0 capabilities and it does not change anything
because they specced it as a minimum cap smh
you cant even pipe slangc -h into a file πΉπ«
this is khronos punishing us for trying to use something other than glsl
it wouldnt surprise me if John had his fingers in slang too, just didnt tell anyone
welp, I guess slang is done for me then.
Thanks guys. Guess I am doomed writing GLSL then 
atleast Fwog has SPIRV support now
I think you or deccer should open an issue or two in the slang repo
it seems like it wouldn't be much effort for them to properly support opengl
also i may have posted it as a meme, but tripping through spirv-cross does work
yop
[deccer@rootfs ~]$ $VULKAN_SDK/bin/spirv-cross /tmp/test.spv
#version 450
struct vertex_out
{
vec4 screen_pos;
vec2 texture_coord;
};
layout(location = 0) out vec2 vertex_texture_coord;
void main()
{
uint _34 = uint(gl_VertexID);
vec2 _77 = vec2(float((_34 << uint(1)) & 2u), float(_34 & 2u));
gl_Position = vec4(fma(_77, vec2(2.0, -2.0), vec2(-1.0, 1.0)), 0.0, 1.0);
vertex_texture_coord = _77;
}
I might as well just write GLSL then
why not
stuff you actually use?
namespaces, member functions, and operator overloading alone are nice
or y'know, returning actual structs from the shader functions instead of writing to some globals
y tho
i need the source code of GLSL shaders so they can be compiled at runtime.
Slang->SPIRV->SPIRV-Cross->GLSL is just a weird route when I need to include the source in my program anyway
huh?
@golden schooner can you try this one?
this is a SPIRV 1.0
two entry points: vertex and pixel
try what
the hell
it works now
by separating the entry points into separate files and specifying "main" as the entry points, the GraphicsPipeline compiles now 
I'll try it
nothing anymore 
so Fwog has no entry point in the shadercreate struct and uses "main" always (hardcoded), but Fvog should have it
i know its not the issue, but a consequence
now I just straight-up crash inside glSpecializeShader when I try these 
(it's okay for the last two params to be null, and entryPoint is hardcoded to be "main")
I guess nv drivers just really don't like these shaders
AMD does not seem to be working correctly as well, using the Pipeline for rendering crashes my app
I'll be using plain GLSL then. fuck SPIRV
vulkan drivers already barely cope with spirv that wasn't generated by glslang. now imagine their dusty gl spirv integration 
understandable tbh
thanks anyway for the integration of SPIRV shader compilation. maybe in 30 years we get proper SPIRV support in GL
martty's troll suggestion to use spirv-cross unironically might be the most robust way to use spirv that didn't originate from glslang
in gl that is
but no one should be subjected to that kind of tooling
yeah but spirv-cross just spits out GLSL. I dont see a reason to use SPIRV-Cross when I can write GLSL directly
well you aren't writing glsl
it is so that you can write slang directly
in fact it doesn't really matter what it emits as long as the API accepts it
slightly better on the sliding scale of shader language cringe
slangtly
released version mayhaps
there are commits from a few weeks ago
Ξ» spirv-cross.exe
Git commit: 117161dd Timestamp: 2024-01-15T13:32:26
this is what i have on my path from the sdk
hell no
isnt that the version on shader-playground?
[deccer@rootfs ~]$ spirv-cross --revision
Git commit: 2de1265f Timestamp: 2023-10-20T19:55:51
``` : o ah im on 1.3.268.0
wait, no need for SPIRV-Cross, I can just compile slang to GLSL
it will compile to vulkan glsl
and there is no switch for opengl glsl, as we figured out last night
suggestion was to open an issue at slang mcslanglington
you could try make Potrick do it, he basically lives there anyway
it has separate glsl-vulkan target
#version 450
layout(row_major) uniform;
layout(row_major) buffer;
#line 1 0
layout(location = 0)
out vec2 vertex_texture_coord_0;
#line 1
struct vertex_out_0
{
vec4 screen_pos_0;
vec2 texture_coord_0;
};
#line 11
void main()
{
#line 11
uint _S1 = uint(gl_VertexIndex);
vertex_out_0 output_0;
vec2 _S2 = vec2(float(_S1 << 1 & 2U), float(_S1 & 2U));
#line 13
output_0.texture_coord_0 = _S2;
vec4 _S3 = vec4(output_0.texture_coord_0 * vec2(2.0, -2.0) + vec2(-1.0, 1.0), 0.0, 1.0);
#line 14
output_0.screen_pos_0 = _S3;
vertex_out_0 _S4 = output_0;
#line 15
gl_Position = output_0.screen_pos_0;
#line 15
vertex_texture_coord_0 = _S4.texture_coord_0;
#line 15
return;
}
Unless I am mistaken, this is valid OGL GLSL.
we looked at glsl generated by glsl last night
it had gl_xxxIndex in it, rather than gl_xxxID
hence the whole kerfuffle about opening an issue
oh yes you are right
kerfuffle 
Yes someone should do this 
That seems like a clear bug and an easy one to fix
Quick question - the docs show to pull the master... is that intended when releases are present? Asking as the latest master doesn't compile
I actually wonder if this will even try to run on MacOS
no
it wont run on mac
main target is opengl 4.6
it might via mesa and forced gl46 in software, or zinc, but no idea if that is also supported on macos
I am thinking of using MGL (https://github.com/openglonmetal/MGL), but I am not sure if Fwog doesn't by default require some bleeding-edge (in terms of OpenGL) feature it doesn't cover
still
it doesnt cover a lot of things
what could be worth though, is, if you ported Fwog to Metal, for science
Mwog so to speak π
Fmog
I think it would be more worthwhile to port it to vulkan at that point
jaker is porting to vulkan already
oh nice
theres a bulkan port branch
could check if that runs over MVK
Is that in some usable state already? Or heavy-in-dev state?
its not fully working yet
flickering and upsidedownisms are still a thing
among other things
All I want for christmas is something that lets me get into the meat of graphics programming without the incredible amount of boilerplate required by like every graphics API
then dive into webgpu
elimichiel posted his tutorial thing in #1019722539116802068 yestergestern
for webgpu dawn
Damn that looks nice
the most important thing it also will run on your mac thing
The docs are broken atm so they're a bit old 
There isn't
The Vulkan port is #1128020727380054046
knedlikkowitsch is bound to mac anyway
Ja
Jaker could you merge this real quick https://github.com/JuanDiegoMontoya/Fwog/pull/101
Ok but I was hoping raildex would make the change I suggested 
I merged anyway
Nah it's literally just some bs
That barely matters compared to main not building 
Btw how come you're using fwog suddenly?
mm secret
(I need to impress my image processing prof)
((I figured using my humongous Vulkan abstraction would be too much
))
Tell them a frog whispered in your ear
I will shill your lib
Just lmk if anything sucks when you try it. I want you to have a good time
Although I know you used it a bit when you were working on frogfood
why
ubuntu 18 or 20?
13.2 should be preinstalled
hmm idk then
probably just called gcc for ubuntu 22.04 apt
@ deccr pls fix 
default gcc on obotnu is 10.2 ;B
https://github.com/actions/runner-images/blob/ubuntu22/20240603.1/images/ubuntu/Ubuntu2204-Readme.md das is whats installed on the default image... ill look
thanks mwa grenouille
pas de sauci
what witchcraft is this
volumetric fog
almost 2 years already
smol question, why hashing is not used for getting cached samplers?
I did have hashing at one point but I think I removed it because it was an annoying amount of code for questionable gain
understandable, thanks
Hope you don't mind my replying to a 2 year old message, but how much vram did your GPU have at the time of this recording π€
I remember trying to load intel sponza with textures on my gtx 1650 (4 gigs of vram) and it was way to less. But note that this was with no fancy streaming and such
Jaker got married since and had 5 kids
well intel sponza has 4K images so you could also just downscale before uploading
I see, so it was basically a skill issue and not a gpu-vram issue
always is
3070 so like 8 gigs
But the scene wasn't heavy at all
Uncompressed Intel Sponza also didnt fit into 8GB VRAM for me. But with KTX textures its no problem
ktx on top πͺ
@long robin I would like to see if I can get a metal backend working for fwog, is this something that could go into the "main repo" or should I keep a fork?
π
I'd say fork because I wouldn't be able to maintain it at all
I could link to it from the main readme though
Alright
I am once again with my questions, in your
void CopyBufferToTexture(const CopyBufferToTextureInfo& copy)
{
glPixelStorei(GL_UNPACK_ROW_LENGTH, copy.bufferRowLength);
glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, copy.bufferImageHeight);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, copy.sourceBuffer.Handle());
copy.targetTexture.subImageInternal({copy.level,
copy.targetOffset,
copy.extent,
copy.format,
copy.type,
reinterpret_cast<void*>(static_cast<uintptr_t>(copy.sourceOffset)),
copy.bufferRowLength,
copy.bufferImageHeight});
}
```What is the point of calling glPixelStorei if subImageInternal will call it anyway?
And shouldn't it unbind pixel unpack buffer after updating texture?
It's possible I forgor
Not unbinding shouldn't be a problem however, as long as I consistently bind and don't rely on old bindings
@long robin I believe there might be a bug in fwog
I have a very shrimple fragment shader
#version 460 core
layout(location = 0) out vec4 o_colour;
layout(location = 0) in vec2 tex_coord;
layout(binding = 0) uniform sampler2D albedo;
layout(binding = 2, std140) buffer PlanetBuffer { mat4 planet_transforms[]; };
void main()
{
if (planet_transforms.length() > 0) {
o_colour = vec4(1.0f);
} else {
o_colour = vec4(vec3(0.0f), 1.0f);
}
}```
Fwog::RenderToSwapchain(
Fwog::SwapchainRenderInfo{
.name = "Render Grid",
.viewport = Fwog::Viewport{.drawRect{.offset = {0, 0}, .extent = {render_context.width, render_context.height}}},
.colorLoadOp = Fwog::AttachmentLoadOp::CLEAR,
.clearColorValue = {.2f, .0f, .2f, 1.0f},
},
[&]
{
Fwog::Cmd::BindSampledImage(0, frame_albedo, nearest_sampler);
Fwog::Cmd::BindStorageBuffer(2, planet_buffer);
Fwog::Cmd::BindGraphicsPipeline(shading_pipeline);
Fwog::Cmd::Draw(3, 1, 0, 0);
});```
This is what renderdoc says is in the buffer
But the output is just a black screen
wrong winding of your tringle?
check the pipeline state
depth test should fail
if I make it display white then it works
void main()
{
if (planet_transforms.length() > 0) {
o_colour = vec4(vec3(0.0f), 1.0f);
} else {
o_colour = vec4(vec3(1.0f), 1.0f);
}
}```
now the texture output, check the depth test overlay
where is that?
select draw call
then texture viewer
on teh right output tab
and overlay is a combobox in the texture viewer
: (
you know how it works
check the overlay for depth test
if its red then the vertices of your FST are in the wrong order
i dont know how it works
it's been a while since i've used renderdoc π
I am still a bit confused
how could this have any impact on the output?
if the depth test fails the FST is not drawn
Yeah, but I can make it display stuff
then you didnt reveal all relevant information
kk
let me try again though
void main()
{
if (planet_transforms.length() > 0) {
o_colour = vec4(vec3(1.0f), 1.0f);
} else {
o_colour = vec4(vec3(0.0f), 1.0f);
}
}```
what is supposed to be visible?
It's supposed to be white
can you send the rdc
this is weird
how so?
it looks correct
bindings check out
your albedo texture is empty
but that shouldnt matter
yeah before i did this in a compute pass
im doing it in a fragment shader now to shrimplify
the only odd thing is
there is no vao
i suppose you do vertexpulling there later
how do you setup shading_pipeline
auto vertexShader = Fwog::Shader(Fwog::PipelineStage::VERTEX_SHADER, util::read_file("shaders/shading_vs.glsl"), "Shading VS");
auto fragmentShader = Fwog::Shader(Fwog::PipelineStage::FRAGMENT_SHADER, util::read_file("shaders/shading_fs.glsl"), "Shading FS");
return Fwog::GraphicsPipeline{{
.name = "Shading Pipeline",
.vertexShader = &vertexShader,
.fragmentShader = &fragmentShader,
.inputAssemblyState = {.topology = Fwog::PrimitiveTopology::TRIANGLE_LIST},
.vertexInputState = {},
}};```
that looks fine too
weird that the planetbuffer.length() > 0 thing behaves so weirdly
there are clearly items in it
hmm, it must be something super stupid π
right?
played with the fragment shader a bit, and it makes no sense to me
mf clearly draws stuff
float rand(vec2 co){
return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);
}
o_colour = vec4(rand(gl_FragCoord.xy), 0.0, 0.0, 1.0f);
right?
it's literally the .length() thing
is it perhaps optimized out for some reason?
and just returns 0 when you are not using the buffer in anything
what if you have the color as .length() / 4 or sth
yeah @golden schooner im just completely lost 
odd
@long robin how do you reckon i could debug this?
win11, 3080, latest

