#Iris - A Journey through OpenGL and beyond to learn Graphics

1 messages · Page 14 of 1

glass sphinx
#

good

#

no braingarbage

distant lodge
#

same

delicate rain
#

I forgot 50% of Vulkan

#

Maybe more

glass sphinx
#

very good\

delicate rain
#

Gone

distant lodge
#

all the *Layout stuff is happily gone

#

goodbye

delicate rain
#

Replaced by daxa knowledge

#

And tears

distant lodge
#

all these vulkan structures lost to time, like tears in the rain

delicate rain
#

If Patrick (or me) actually rewrites task graph there will be so many bugs

#

I will not pull master for a month at least

distant lodge
#

oh yeah I am worried about looking at my frame graph again

wicked notch
#

there is only so many neurons in the human brain

#

it's either vulkan or your abstraction

#

can't have both

distant lodge
#

I really need to look into timeline semaphores though, I initially wrote them off

glass sphinx
#

i actually start to be backwards compatible + deprecation now

#

too many people shitting on me when i break things now

delicate rain
#

No ☹️

#

I hate deprecating

#

We just remove

glass sphinx
#

I will use this against you

delicate rain
#

I only shit on you because I'm tilted from my bugs and you are near

glass sphinx
delicate rain
#

I always pull by accident in the middle of something and then have to spend 2 years updating

#

I hate C API though

#

Wish we could deprecate that

delicate rain
#

SmallString gone bye bye

#

Actual 50 bugs in 200 loc

glass sphinx
#

you are my continuous integration

#

you ^

wicked notch
#

human slavery
continuous integration

glass sphinx
wicked notch
#

The ShaRT is finally complete

#

resource/state tracking is cancer

#

Now it's time for the even funnier part

#

edge cases bleakekw

frank sail
#

can you remind me why you ShaRTed yourself

#

(I forgot what it means)

wicked notch
#

The ShaRT or shader resource table is a big ass descriptor set that keeps track of resources bound to it

#

it's very useful because I can turn my brain off and get OpenGL level of ease when binding resources

wicked notch
#
template <uint64 N, typename T>
struct _descriptor_table_t {
    struct write_info_t {
        using content_type = std::conditional_t<std::is_same_v<T, arc_ptr<buffer_t<uint8>>>, buffer_info_t, image_info_t>;

        uint32 binding = -1;
        uint32 offset = -1;
        content_type content = {};
    };
    std::array<T, N> resources = {};
    std::array<uint64, N / 64> used = {};
    std::vector<write_info_t> updates;
};

_descriptor_table_t<max_descriptors_in_binding, arc_ptr<buffer_t<uint8>>> _buffer_table;
_descriptor_table_t<max_descriptors_in_binding, arc_ptr<sampler_t>> _sampler_table;
_descriptor_table_t<max_descriptors_in_binding, arc_ptr<image_t>> _image_table;
_descriptor_table_t<max_descriptors_in_binding, arc_ptr<texture_t>> _texture_table;
arc_ptr<descriptor_set_t> _set;```
glass sphinx
#

i like the lower case naming on first glance

#

something unusual

#

looks tempting

#

arc_ptr is also a sexy name

distant lodge
#

intel only

wispy spear
#

the underscore isms for types is ugly af

#

but i like the lowercase_t stuff too

#

i suppose _foo_t is supposed to be "internal" only

#

still ugly 😄

distant lodge
#

yet it has an internal type that doesn't have an underscore

wispy spear
#

what is arc supposed to be?

wicked notch
#

atomic reference counted

wicked notch
#

but it's probably better if all children of an internal type are classified as internal too

#

fo readability

wispy spear
#

its weird

#

the more i look at iris, the more i realise thats exactly how i write c# code

#

besides the self and (auto -> returntype) nonsense its quite neat too how you write code : )

wicked notch
#

I steal concepts from other langs bleakekw

frank sail
#

says the rust hater

wicked notch
#

not me hating rust while integrating half of their features KEKW

distant lodge
#

EEE but awesome

wispy spear
#

lvstri my man

#

how can i use your buffer_t in conjunction with std::make_unique

#

your buffer is using a neat factory method to create the thing... buffer_t::create which returns a buffer_t... but i would like to
std::unique_ptr<buffer_t> _vertexBuffer and _vertexBuffer = std::make_unique(buffer_t::create(......));

#

@wicked notch

wicked notch
#

You can just return buffer and C++ will take care of everything for you

#

I think buffer needs to be movable though

#

for ptr = std::make_unique<T>(T::create()); to work

wispy spear
#

hmmf

wicked notch
#

I return arc_ptr<buffer_t> if you notice

#

just removing the arc_ptr part will let you use make_unique, assuming your buffer is movable

wispy spear
#

i use Iris' bufferisms, not irisvk

wicked notch
#

oh

#

I forgor how those work bleakekw

wispy spear
#

: >

wicked notch
#

let me check one sec

wispy spear
#

shall i peek at irisvks'?

wicked notch
#

ok ye

#

my buffer_t in GL Iris should work fine with make_unique I think

#

did you try it and it doesn't work?

wispy spear
#

i am getting a template dump of isms

#

let me see if i can copy it out somehow

#
[build] /home/deccer/Personal/Code/Projects/lessGravity/OpenSpacePP/src/GameClient/GameApplication.cpp:52:121: error: no match for ‘operator=’ (operand types are ‘std::unique_ptr<Buffer>’ and ‘Buffer’)
[build]    52 |     _vertexBuffer = Buffer::Create("Buffer_Vertices_Triangle", GL_ARRAY_BUFFER, SizeInBytes(_vertices), GL_MAP_WRITE_BIT);
[build]       |                                                                                                                         ^
[build] In file included from /usr/include/c++/13.2.1/memory:78,
[build]                  from /home/deccer/Personal/Code/Projects/lessGravity/OpenSpacePP/src/Engine/Include/Engine/Application.hpp:4,
[build]                  from /home/deccer/Personal/Code/Projects/lessGravity/OpenSpacePP/src/GameClient/Include/GameClient/GameApplication.hpp:3,
[build]                  from /home/deccer/Personal/Code/Projects/lessGravity/OpenSpacePP/src/GameClient/GameApplication.cpp:1:
[build] /usr/include/c++/13.2.1/bits/unique_ptr.h:430:9: note: candidate: ‘template<class _Up, class _Ep> constexpr typename std::enable_if<std::__and_<std::__and_<std::is_convertible<typename std::unique_ptr<_Up, _Ep>::pointer, typename std::__uniq_ptr_impl<_Tp, _Dp>::pointer>, std::__not_<std::is_array<_Up> > >, std::is_assignable<_Dp&, _Ep&&> >::value, std::unique_ptr<_Tp, _Dp>&>::type std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Ep = _Up; _Tp = Buffer; _Dp = std::default_delete<Buffer>]’
[build]   430 |         operator=(unique_ptr<_Up, _Ep>&& __u) noexcept
[build]       |         ^~~~~~~~
[build] /usr/include/c++/13.2.1/bits/unique_ptr.h:430:9: note:   template argument deduction/substitution failed:
[build] /home/deccer/Personal/Code/Projects/lessGravity/OpenSpacePP/src/GameClient/GameApplication.cpp:52:121: note:   ‘Buffer’ is not derived from ‘std::unique_ptr<_Tp, _Dp>’
[build]    52 |     _vertexBuffer = Buffer::Create("Buffer_Vertices_Triangle", GL_ARRAY_BUFFER, SizeInBytes(_vertices), GL_MAP_WRITE_BIT);
[build]       |                                                                                                                         ^
[build] /usr/include/c++/13.2.1/bits/unique_ptr.h:414:19: note: candidate: ‘constexpr std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::unique_ptr<_Tp, _Dp>&&) [with _Tp = Buffer; _Dp = std::default_delete<Buffer>]’
[build]   414 |       unique_ptr& operator=(unique_ptr&&) = default;
[build]       |                   ^~~~~~~~
[build] /usr/include/c++/13.2.1/bits/unique_ptr.h:414:29: note:   no known conversion for argument 1 from ‘Buffer’ to ‘std::unique_ptr<Buffer>&&’
[build]   414 |       unique_ptr& operator=(unique_ptr&&) = default;
[build]       |                             ^~~~~~~~~~~~
[build] /usr/include/c++/13.2.1/bits/unique_ptr.h:440:7: note: candidate: ‘constexpr std::unique_ptr<_Tp, _Dp>& std::unique_ptr<_Tp, _Dp>::operator=(std::nullptr_t) [with _Tp = Buffer; _Dp = std::default_delete<Buffer>; std::nullptr_t = std::nullptr_t]’
[build]   440 |       operator=(nullptr_t) noexcept
[build]       |       ^~~~~~~~
[build] /usr/include/c++/13.2.1/bits/unique_ptr.h:440:17: note:   no known conversion for argument 1 from ‘Buffer’ to ‘std::nullptr_t’
[build]   440 |       operator=(nullptr_t) noexcept
[build]       |                 ^~~~~~~~~
#

i apologise for this wall ofisms

#

i cant take a screenshot of the popup in vscode, when i do the momenti press enter to capture the popup disappears ;C

wicked notch
#

I don't see le make_unique though, did you forgor?

wispy spear
#

one sec

#
    _vertexBuffer = Buffer::Create("Buffer_Vertices_Triangle", GL_ARRAY_BUFFER, SizeInBytes(_vertices), GL_MAP_WRITE_BIT);
#

left out the make unique because you said so earlier

wicked notch
#

Oh my bad yeah you need the make_unique here

#

try this: _vertexBuffer = std::make_unique<Buffer>(Buffer::Create("Buffer_Vertices_Triangle", GL_ARRAY_BUFFER, SizeInBytes(_vertices), GL_MAP_WRITE_BIT));

wispy spear
#

yeah i just did that and ofc it works :3

#

sorry for the nonsense : )

wispy spear
#
struct custom_hash_unique_object_representation {
    using is_avalanching = void;

    [[nodiscard]] auto operator()(point const& f) const noexcept -> uint64_t {
        static_assert(std::has_unique_object_representations_v<point>);
        return ankerl::unordered_dense::detail::wyhash::hash(&f, sizeof(f));
    }
};
#

is ankerl using those usings as comments? there is no use of is_avalanching nor void

#

ive seen you have it all over the place in irisvk too

#

ah he explains it

#

i was just to impatient

#

weird thing either way

frank sail
#

Now you can never complain about my hashisms again

wispy spear
#

: )

#

yours has a lot of ...voodoo in it

#

i admire you guys for understanding all that c++ nonsense, when to use what and how : )

finite yacht
#

i am also more on the c# side but I imagine its like learning OpenGL

wispy spear
#

i would say its 100 times more complicated

#

opengl has no template nonsense, no variadics, no this-and-that-elision

frank sail
#

But at the end of the day it's just a programming language and we're all familiar with those already

wispy spear
#

yep

#

just like c# is "hard" for noobs who just started 5mins ago

frank sail
#

Learning OpenGL without knowing another API is hard af

wispy spear
#

when i have

struct A
{
    XXX x;
};

struct B
{
    YYY y;
};

struct C
{
    A a;
    A aa;
    std::span<const B> bs;    
};
#

my understanding is thati have to implement operator== for all of them first

#

if i want to put them in a set-like-container

frank sail
#

you can do = default; on them

wispy spear
#

yeah for trivial types?

frank sail
#

if the members support comparison already

wispy spear
#

is that span covered by that as well?

#
struct C
{
    A a;
    A aa;
    std::span<const B> bs;

    bool operator==(const C& other) const
    {
        return a == other.a &&
               aa == other.aa &&
               bs == other.bs;
    }
};
#

hmm i believe i saw some std::funky_v thing which can detect whether an array is different, not sure where i did

frank sail
#

apparently std::span doesn't implement comparison

#

should be as shrimple as && std::ranges::equal(bs, other.bs)

wispy spear
#

nice

#

and now i need to impl a hash function per type too, if i dont want to solve it by 1 template

wicked notch
#

you can also default <=> for easy mode comparisons

wispy spear
#

yeah jakerino mentioned it, for trivial types i can just = default

frank sail
#

<=> is different

wispy spear
#

ah its something else

frank sail
#

it also does the < and > operators at the same time

wispy spear
#

:S

frank sail
#

it's the "spaceship" operator (your favorite)

wispy spear
#

: )

wispy spear
#

ah this one also mentions span_ext

wicked notch
#

remember to write a specialization for equal_to as well

#

unless

#

no nvm you can avoid that

wispy spear
#

specialization means template?

wicked notch
#

ye but you can avoid that if you just default/define == no prob

wispy spear
#

i want to try solve this in a naive fashion first

#

no unreadable templates for now if possible heh

wicked notch
#

you have ugly makros to solve unreadable templates though smart

wispy spear
#

hehe

wispy spear
#

i suppose what im trying right now will also not work

#

make hash functions for all of those

struct A
{
    XXX x;
};

struct B
{
    YYY y;
};

struct C
{
    A a;
    A aa;
    std::span<const B> bs;    
};
#
struct HashFunctions
{
  std::size_t operator() (const XXX& xxx) const
  {
    auto h1 = std::hash<whateverX1is>()(xxx.x1);
    return h1;
  }

  std::size_t operator() (const A& a) const
  {
    auto h1 = std::hash<XXX>()(a.x);
    return h1;
  }

  std::size_t operator() (const YYY& yyy) const
  ... and so forth... for all types involved
};
frank sail
#

yeah you basically need a hash function for everything

#

the only nice thing is that each thing only needs to call the hasher on each of its members, as long as those members (and its members, etc.) have a hash function

wispy spear
#

😛

#

the plain xor should also be wrong, usually you multiply by some prime number and xor, but thats not important here right now

frank sail
#

look up a hash combiner

#

I copied some variadic template thing from SO

wispy spear
#

i saw yours

frank sail
#

I wish I better understood how it worked exactly

#

like why they use giant prime numbers instead of just xoring everything like u

wispy spear
#

avoid collisions would be my guess

frank sail
#

ah it probably rotates the bits "randomly"

#

if you hash two of the same value with your thing, you'll end up with 0 when they get xor'd

#

but a smarter hasher will have a seed that gets randomized before it combines one hash with another

wispy spear
#

that makes sense

#

ah you also only use it for the VertexArrayCache

#

not for the framebuffercache

frank sail
#

I made the framebuffer cache a vector for some reason

wispy spear
#

perhaps one of the two existed before the other

frank sail
#

could do the same for the vao cache

wispy spear
#

not great, not terrible

#
    size_t GetFramebufferInfoHash(const FramebufferInfo& framebufferInfo)
    {
        size_t hashValue = {};

        auto part1 = std::make_tuple(framebufferInfo.DepthAttachment.Attachment._id, framebufferInfo.DepthAttachment.ClearOperation);
        Hash::CombineHash(hashValue, Hash::Hash<decltype(part1)>{}(part1));

        auto part2 = std::make_tuple(framebufferInfo.StencilAttachment.Attachment._id, framebufferInfo.StencilAttachment.ClearOperation);
        Hash::CombineHash(hashValue, Hash::Hash<decltype(part2)>{}(part2));

        for (const auto& colorAttachment : framebufferInfo.ColorAttachments)
        {
            auto part3 = std::make_tuple(colorAttachment.Attachment._id, colorAttachment.ClearOperation);
            Hash::CombineHash(hashValue, Hash::Hash<decltype(part3)>{}(part3));
        }

        return hashValue;
    }
frank sail
#

btw I'm not sure if caching framebuffers is worth it

#

compared to just having one framebuffer that you respec a bunch

wispy spear
#

hmm

#

id still need to cache those specs

#

that i know when to respec the single fbo

#

or just respec every frame?

frank sail
#

how often are you binding the same set of render targets

wispy spear
#

0 per frame

frank sail
#

ok so respecing is fine

wispy spear
#

yeah

frank sail
#

and you do it every time you bind a new set of render targets

wispy spear
#

yes

frank sail
#

no need to hash it up

#

(probs)

wispy spear
#

absolutely

#

we were much younger a year ago when we wrote fwog/enginekit : >

frank sail
#

hehe

#

caching makes me feel secure sometimes

#

even if it's definitely premature

wispy spear
#

yep, right now im not caching anything at all

#

and that will most likely be fine too

#

bindpipeline will enable/disable state, bindasubo/bind-ass-sbo/bindimage/texture will ust run per frame, then setting the fbo can run per frame too

#

i think i wanted to use the cache as impl detail

#

to hide teh fbo creation

#

instead of
_fbo1 = createfbo(attachments...)
_fbo2 = createfbo(otherattachments...);

while (true)
{
beginrender(_fbo1);
bindpipelione(_pipeloine1);
...
endrender();
...
}

#

have
...
beginrender({ ... describe fbo info here ... })
...

finite yacht
#

you can do exactly that when re-modifying a single fbo

wispy spear
#

hmm absolutely true

#

haha

#

you guys are the best ducks

twin bough
#

quack

frank sail
wispy spear
#

fresh off the press

wicked notch
#

for a fraction of a second

#

I'd hoped to see some epic algorithm that generated meshlets on the fly like we do in frogfood

#

rip

frank sail
#

I looked at a random source file and saw
#define TINYOBJLOADER_IMPLEMENTATION
so I'm guessing it's not supposed to be used as a library

wispy spear
#

or the author doesnt know how to make a library (yet)

#

1:21:21.212

wispy spear
#

😄

frank sail
#

a bunch of empty files too

wispy spear
#

cleaning indicles isnt important enough

frank sail
#

std::vector<uint32_t> AreaWeightedTriangleList(const std::vector<Triangle*>& triangles, const Vertex* vertexBuffer) {

frank sail
wispy spear
#

id hope somebody does

frank sail
#

I'm on page 1 and I've found several issues already 😄

wispy spear
#

oof

wicked notch
#

revive thyself!

#

ok so big update, the shader resource table is now fully functional

#

also big update, it's winter break!

#

I have one week of time before death

wispy spear
#

ill get bob the necromancer, after you have passed, no worries

#

you cant escape VSM/Nanite 2.0 🙂

wicked notch
#

my C++ brain also can't understand rust's modules

#

I have no idea how they work

wicked notch
#

Also, I think I'm going to do a slight rewrite of IrisVk

#

there's a lot of clutter and stuff from the past

wicked notch
#

man

#

Eradicating renderpasses feels good

#

dynamic rendering ftw

distant lodge
#

time for me to integrate renderpass2 (double the renderpasses to put the world into equilibrium)

pale horizon
#

Reject render pass, return to immediate drawing (GPUs are fast) KEKW

frank sail
#

vkQueueSubmit for every triangle bleakekw

wicked notch
wicked notch
#

I have a question for my boy potrick

#

I have the same thing in my code, except I wait for the next target value

#
auto SyncHostTimeline::WaitForNextTimelineValue() noexcept -> uint64 {
    const auto target = static_cast<int64>(_hostTimelineValue) - static_cast<int64>(_maxTimelineDifference);
    _deviceTimelineSemaphore->Wait(std::max<int64>(target + 1, 0));
    return _hostTimelineValue % _maxTimelineDifference;
}```
#

My reasoning is:
First FIF: wait for timeline 0 -> signals timeline 1
Second FIF: wait for timeline 0 -> signals for timeline 2
First FIF Again: wait for timeline 1 -> signals for timeline 3
...

#

Here _hostTimelineValue starts out as 0 and _maxTimelineDifference is 2

glass sphinx
#

hmm your reasoning makes sense rn

#

i dont remember the details

#

When I'm back home in 2 days i ll take another look

wicked notch
#

sure thing, merry christmas potrick frogeheart

glass sphinx
#

merry Christmas lvstri 🌲

delicate rain
#

As frame 0 is your worked on frame, frame 1 is your frame in flight, and frame 2 waits for frame 0 to finish - so to become the frame in flight instead of frame 1

wicked notch
#

That's what happens though isn't it?

#

0 waits NONE (or 0) signals 1
1 waits NONE (or 0) signals 2
2 waits 1 signals 3
3 waits 2 signals 4
...

delicate rain
#

Well in Daxa (with 2 frames in flight), 2 would not wait for 1 but wait for 0 no?

#

As the previous signal value is 2 - 2fif = 0

wicked notch
#

so 2 frames in flight means that the CPU can prepare 3 frames before waiting right?

delicate rain
#

Yes

wicked notch
#

gotcha

delicate rain
#

(I was also confused about that, before Patrick explained)

wicked notch
#

I defined frames in flight as the number of frames that the CPU can prepare

delicate rain
#

Yeah I had the same reasoning in mind

#

But apparently it's not like that

wicked notch
#

so when you make buffers that are updated from the CPU you allocate (FRAMES_IN_FLIGHT + 1) * capacity instead of just FIF * capacity?

delicate rain
#

We should

#

Now thinking about it I'm not sure I do in my projects hehe

#

Because I, until recently, thought the same and thought FIF = CPU buffered frames

glass sphinx
#

we have many comments in the cpp for swapchain

#

without them i wouldnt be able to reunderstand

#

sadly they only seem to be enough for me to understand. Probably cause i wrote them for me froge_bleak

wicked notch
#

llvm's cmake tries to run sh on windows if you don't use MSVC

#

How can people be so big brained to make LLVM and then proceed to make the most unhinged, retarded and stupid ass cmake build script ever known to man

wicked notch
#

ihatewindowsihatewindowsihatewindowsihatewindows

#

Completely random errors

#

llvm cmake can't find python with MSVC

#

made sure it was in the path and all

distant lodge
#

perfect timing, you're getting your brain in a twist with FIF and I'm finally upgrading to timeline semaphores

#

the +1 is quite weird though

wicked notch
#

it comes from my misunderstanding for what a FIF is

#

I thought that N FIF meant "The CPU can prepare N frames before waiting"

distant lodge
#

that's my understanding, and I'm pretty sure that's how my code works, e.g. 0 FIF would mean nothing happens

#

1 FIF means that, if my CPU takes less time to submit+present than my GPU takes to execute, I will have to wait on my sema every frame

wicked notch
#

ye, if you define FIF like that then you need to either target the next timeline value, or decrease the max timeline difference by one

distant lodge
#

yeah, that's what I do, doing that difference thing seems weirdly complicated. I literally just do

WaitSemaphores(frameIndex);
Submit(signal = frameIndex + 1);
++frameIndex;
#

and I use frameIndex % FIF for the binary semas on my swapchain

wicked notch
#

you need to wait for 0 twice though

#

that's what the difference thing does

distant lodge
#

nah, frame 0 waits for 0 which is a no-op since that's the start of the semaphore, frame 1 waits for 1 because of the ++frameIndex, and the last submit signals frameIndex + 1, so for frame 0 that'd be 1

#

wait hold on let me think about this some more...

wicked notch
#

for 2 FIF

distant lodge
#

yeah right shit

#

I was just happy that switching from fences to timeline semas ran with no validation errors so I didn't think about it lol

delicate rain
#

You never take the number of fif into consideration

distant lodge
#

lmao yep, time to rethink it (and probably make it work the same way as yours)

#

I guess it's just

signal(frame) = frame + 1
wait(frame) = max(frame - (FIF - 1), 0)
wicked notch
#

ye

distant lodge
#

and I'm guessing you don't do FIF - 1 hence the discrepancy

wicked notch
#

I do max(frame - FIF + 1, 0) which is the same thing

distant lodge
#

yeah, I meant that the - 1 is the reason for the discrepancy in thinking that FIF frames is FIF + 1 frames prepared before waiting

wicked notch
#

How does a human being remove vcpkg's cmake integration

#

vcpkg integrate remove says there's no integration

#

but running cmake fatally fails with the message that vcpkg is missing

wispy spear
#

is there some FindVcpkg nonsense maybe?

wicked notch
#

there's a singular cmake variable in a cache somewhere

#

I have no idea where this "global cache" is

wicked notch
#

I have fixed everything

#
#include <Macros.hlsl>

struct SVertexOutput {
    Location(0) float4 Position : SV_Position;
    Location(1) float4 Color : Color;
};

SVertexOutput VSMain(uint vertexId : SV_VertexID) {
    const float3 trianglePositions[] = {
        float3( 0.5,  0.5, 0.0),
        float3(-0.5,  0.5, 0.0),
        float3( 0.0, -0.5, 0.0)
    };
    const float3 triangleColors[] = {
        float3(1.0, 0.0, 0.0),
        float3(0.0, 1.0, 0.0),
        float3(0.0, 0.0, 1.0)
    };
    SVertexOutput output;
    output.Position = float4(trianglePositions[vertexId], 1.0);
    output.Color = float4(triangleColors[vertexId], 1.0);
    return output;
}

struct SPixelOutput {
    Location(0) float4 Color : SV_Target0;
};

SPixelOutput PSMain(SVertexOutput input) {
    SPixelOutput output;
    output.Color = input.Color;
    return output;
}

le tringle with le HLSL

#

let's see how far I can push DXC before it gives up on me

#

Also, with new IrisVk the tringle sample is only 100 LOC

wicked notch
#
struct SCamera {
    float4x4 Projection;
    float4x4 View;
    float4x4 ProjView;
    float4 Position;
};
[[Binding(0, 0)]] StructuredBuffer<SCamera> b_cameraBuffer[];``` this syntax is honestly pretty great
#

who said HLSL buffers suck

wispy spear
#

bindless when

wicked notch
#

no bda in hlsl

wispy spear
#

;C

wicked notch
#

at least I can do shader resource table

#

but meh

wispy spear
#

also funny how you went PascalCase : )

wicked notch
#

I have

#

I have been persuaded by Microsoft and the C# gang

wispy spear
#

hehe

#

is bda coming?

wicked notch
#

idk, devsh is working on it

wispy spear
#

ah

wicked notch
#

he's bullying DXC devs full time

wispy spear
#

aaah i remember some conversation about it

twin bough
#

add bda to hlsl pls 🥺

wicked notch
#

I love dxc

#
ModuleProcessed("dxc-commit-hash: 93ad5b31");
ModuleProcessed("dxc-cl-option:  -E VSMain -T vs_6_6 -spirv -fspv-target-env=vulkan1.3 -Zpc -Zi -O0 -I D:/Dev/CLion/Retina/Shaders");


struct SCamera {
  float4x4 Projection : [[RowMajor, MatrixStride(16), Offset(0)]];
  float4x4 View : [[RowMajor, MatrixStride(16), Offset(64)]];
  float4x4 ProjView : [[RowMajor, MatrixStride(16), Offset(128)]];
  float4 Position : [[Offset(192)]];
}```
#

me: make the default column major please

#

DXC: oh yeah sure (he doesn't know lmao)

wicked notch
#

@glass sphinx

#ifndef RETINA_HLSL_BINDINGS_HEADER
#define RETINA_HLSL_BINDINGS_HEADER

#include <Macros.hlsl>

#define RETINA_MASTER_ADDRESS_BINDING [[Binding(0, 0)]]

RETINA_MASTER_ADDRESS_BINDING ByteAddressBuffer b_masterBuffer[];
RETINA_MASTER_ADDRESS_BINDING RWByteAddressBuffer b_rwMasterBuffer[];

#define DeclareAliasedStructuredBuffer(type, name)               \
    RETINA_MASTER_ADDRESS_BINDING StructuredBuffer<type> name[];

#define DeclareAliasedRWStructuredBuffer(type, name)               \
    RETINA_MASTER_ADDRESS_BINDING RWStructuredBuffer<type> name[];

#endif
``` here's my epic fix for HLSL not having BDA
#

Is there any better way?

wicked notch
#

rip

glass sphinx
#

i think i ll kick out structured buffer tho

wicked notch
#

why?

glass sphinx
#

byteaddressbuffer is the best of the bunch

wicked notch
#

is it?

glass sphinx
#

i find its interface the best after having used it a lot at work

wicked notch
#

you can only load uint's tho

glass sphinx
#

ohohoh no

#

not true

#

it can load and stroe and atomic anything

wicked notch
#

how

#

teach me

glass sphinx
wicked notch
#

maybe the docs are outdated?

glass sphinx
#

they are its a little sus with the new things

#

the only downside of byteaddressbuffer is that it generates a lot of loads

#

it doesnt understand alignment past 4 bytes

#

so if make an aligned load/store of lets say 16 bytes it will cut it up into 4 spirv loads

#

sad life

wicked notch
#

damn

glass sphinx
#

only for spirv supposedly

wicked notch
#

is it that difficult to have good buffers

#

microsoft pls

glass sphinx
#

in dx its doing aligned loads just fine

#

hlsl vulkan is kinda poop in that way

wispy spear
#

need to put that on devsh's agenda

glass sphinx
#

afaik its also not a technical limitation they just implemented the spirv support for byteaddressbuffer poorly

#

could be wrong on that one

wicked notch
#

sigh

#

I'll stay with structuredbuffer for now

glass sphinx
#

its fine TM

wicked notch
#

thanks for the wiki page btw, sneaky little thing

#

lots of useful info there

glass sphinx
#

tho dont be afraid from the syntax suggesting you load a whole stuct or store a whole struct

#

if you do this:

RWByteAddressBuffer b : register(u0);
struct Tester{ float4 vec; uint4 intvec; };
void test()
{
  Tester t = b.Load<Tester>(some_offset);
  t.vec[0] = 1.3f;
  b.Store(some_offset, T);
}

This will consistently be optimized to only store the first element of vec and do nothing else

distant lodge
#

I saw some posts in #vulkan a while back about that generating different spirv than the equivalent GLSL, did they fix that or is it moreso that it converges at the driver level

glass sphinx
#

and RawBufferWrite, the poopy bda integration for hlsl. ByteAddressBuffers do not have this problem.

wicked notch
glass sphinx
wicked notch
#

nice

distant lodge
#

oh so what you're saying is HLSL BDA can give you perf landmines if you're porting from GLSL

#

fun

glass sphinx
#

definetly yes

#

well depends on how you do it

#

but they just dont optimize it properly

#

sadge

wicked notch
#

as I am seeing if you use StructuredBuffer<T> you're gonna be fine

glass sphinx
#

BufferPtr in hlsl will safe us all

wicked notch
#

ByteAddressBuffer is more tricky but it'll be fine as well

glass sphinx
#

not for me tho. I use tons or non aligned offsets everywhere within my buffers

#

cant really use structured buffers for much in my engine

distant lodge
#

maybe 2024 will be the year of the HLSL BDA

glass sphinx
#

my meshes for example are all subacllocated within buffers

#

xD

wicked notch
#

damn, I've yet to encounter a scenario where I need non-aligned load/store

glass sphinx
#

well i also have lots of buffers thyat have a counter in the first few byutes

#

i guess that is a common one you might encounter, no?

wicked notch
#

oh

#

I guess that counts as unaligned yes

#

yeah I hadn't thought about that shit

glass sphinx
#

💀

distant lodge
#

what is unaligned in this scenario

glass sphinx
#

well structured buffer requires alignment to the whole struct size

#

so you cant just put 4 bytes in the beginning

#

as your structs may have wild sizes

distant lodge
#

so you can't just be a smartass and make it part of your struct?

#

and have the rest of the data as the inner part

glass sphinx
#

huuuuuuuuuuuuuuuh

#

i guess so

#

yea that works but then you cant have unbound anything

wicked notch
#

wait hold up how the hell do I translate to HLSL

layout (...) buffer X {
    uint x;
    T data[];
};```
#

???

glass sphinx
#

yea cant do

wicked notch
#

💀

distant lodge
#

wow that sux

wicked notch
#

alright we're pulling the plug on HLSL

#

it's over

wispy spear
#

inb4 lvstri reinventing Cg

wicked notch
#

nah I have to be quick

#

gotta make the game

wispy spear
#

: )

distant lodge
#

glsl is fine tbh, gotta give hlsl more time to git gud

glass sphinx
#

🤠

wicked notch
#

devsh can't bully dxc devs enough really

#

we need more bullying

wispy spear
#

even potti wishes to go back to glsl but is stuck in d3d12

distant lodge
#

so true

#

if they want me to stop using glsl they gotta earn it

wicked notch
#

GLSL is back in

wicked notch
#

also it's kinda crazy how the vulkan sdk is so broken with other dependencies like shaderc or dxc lol

#

they have absolute paths to PDBs in their cmake apparently

glass sphinx
#

lmao

wispy spear
#

can you not apply for some internship at lunarg or something

#

and finish your masters there

wicked notch
#

I love templates

#

2AM template code is the best

wispy spear
#

i dont approve of C prefix in Regina, but i understand why its there and therefore implicitly approve its use

wicked notch
#
template <
    typename C,
    typename R = C::Resource,
    typename D = C::Descriptor,
    typename... Args
>
    requires (std::same_as<D, SBufferDescriptor>)
RETINA_NODISCARD auto AllocateResource(
    SConstructResourceInlineTag,
    Args&&... args
) noexcept -> C;

template <
    typename C,
    typename R = C::Resource,
    typename D = C::Descriptor,
    typename... Args
>
    requires (std::same_as<D, SBufferDescriptor>)
RETINA_NODISCARD auto AllocateResource(
    uint32 count,
    Args&&... args
) noexcept -> std::vector<C>;

template <
    typename C,
    typename R = C::Resource,
    typename D = C::Descriptor,
    typename... Args
>
    requires (std::same_as<D, SImageDescriptor>)
RETINA_NODISCARD auto AllocateResource(
    SConstructResourceInlineTag,
    EImageLayout layout,
    Args&&... args
) noexcept -> C;

template <
    typename C,
    typename R = C::Resource,
    typename D = C::Descriptor,
    typename... Args
>
    requires (std::same_as<D, SImageDescriptor>)
RETINA_NODISCARD auto AllocateResource(
    uint32 count,
    EImageLayout layout,
    Args&&... args
) noexcept -> std::vector<C>;``` This was the template madness of yesterday btw ![KEKW](https://cdn.discordapp.com/emojis/666849321462792234.webp?size=128 "KEKW")
wicked notch
#

so I went with the Unreal Engine™️ code style

wispy spear
#

R = C

#

D = C

#

😄

#

can you write out C, D and R? Descriptor, Resource, Cock reads better

wicked notch
#
layout (push_constant) uniform UPushConstant {
    uint u_inputImageId;
};

RetinaDeclareStorageImage(restrict readonly image2D, u_image2DBlock);
#define inputImage RetinaGetStorageImage(u_image2DBlock, u_inputImageId)

vec3 Tonemap(in vec3 color) {
    const float luminance = GetLuminance(color);
    const vec3 reinhard = color / (color + vec3(1.0));
    return Saturate(mix(color / (luminance + 1.0), reinhard, reinhard));
}

void main() {
    o_output = vec4(ToNonLinearFromLinear(Tonemap(vec3(imageLoad(inputImage, ivec2(gl_FragCoord.xy))))), 1.0);
}
#

beautiful

pale horizon
#

nice Lisp program

wicked notch
#

@glass sphinx how do you manage daxa::BufferId lifetimes

glass sphinx
#

manually

#

the c ghetto way

glass sphinx
#

fr tho: for daya to dictate the lifetime managememt for buffers and images aside from manual free and delete is sus because they have top variee lifetime requirements

#

and refcounting is too slow for this many objects for a general solution imo

runic surge
#

I’m literally ref counting it all

wicked notch
#

le tringle

glass sphinx
wispy spear
#

rendered out of thin air i assume?

glass sphinx
#

ref coubting gives you a lot of benefits that many ppl ignore/dont know

runic surge
#

yeah like i can just fire and forget bleakekw

#

and i don't what to worry about manually cleaning it all up later but that can also be a shot in the foot if i somehow mess up and do circular ref counts

glass sphinx
#

also lors of multithreadding guarantees

#

if you pass a rer counted handle to a function via ref you can know 100% the object wont be destroyed while running the function

#

which is a big problem with manual management

runic surge
#

yeah i kinda just accepted that i won't probably be making 1000+ vulkan objects in a single frame so performance is just neglible

glass sphinx
#

in daxa i avoided these peoblems with lots of hacks and a big id system

runic surge
glass sphinx
#

ref counting would have been muuuuch simpler

runic surge
#

huh big id system?

glass sphinx
#

hard to explain

#

index + version like entt

#

but it is also mt save and such via some other shingus

runic surge
#

KEKW i don't even know what entt does

glass sphinx
#

very fast tho

#

entt is great

#

its the usual ecs id tho

runic surge
#

mhm

glass sphinx
#
  • the extra daxa shingus
#

magic

runic surge
#

magik

#

❇️

#

my favorite magic engine (daxa)

glass sphinx
#

notice the daya purple in the eyes

#

i payed disney for it

wicked notch
#

1280 bytes for a BLAS

#

a single triangle BLAS

#

with compaction

#

wtf nvidia

glass sphinx
#

they have a fixed minimal overhead

#

i had like 80 in and it was the same size

runic surge
wicked notch
#
struct SAccelerationStructureGeometryInstance {
    glm::mat3x4 Transform = {};
    uint32 ObjectIndex : 24 = 0;
    uint32 Mask : 8 = 0xff;
    uint32 ShaderBindingTableOffset : 24 = 0;
    EAccelerationStructureGeometryInstanceFlag Flags : 8 = {};
    uint64 AccelerationStructureAddress = 0;
};``` why bitfields
#

why

#

why would you do this to me

wicked notch
#

refresh me on matrix memory layout

#

if the transform matrix is row major then the last column contains the transform?

frank sail
#

how the matrix is displayed there shouldn't depend on the majorness since that only defines the memory layout

#

tl;dr that column should be the translation

wicked notch
#

True

#

I guess this helps more

auto ToNativeTransformMatrix(const glm::mat4& transform) noexcept -> glm::mat3x4 {
    RETINA_PROFILE_SCOPED();
    auto result = glm::mat3x4();
    std::memcpy(&result, AsConstPtr(glm::transpose(transform)), sizeof(glm::mat3x4));
    return result;
}```
#

I think this is correct

#

maybe

frank sail
#

another way to remember is that the rotation+scale are expressed by a 3x3, and the translation is a 1x3

#

and with a non-square matrix you can tell by looking

wicked notch
#

bistro be looking a little wonky

#

And I have to go out in 5 minutes

wispy spear
#

solo un pochino

wicked notch
#

what laziness does to a mf:

if (u_frameIndex > 0) {
    const vec3 previousLighting = vec3(imageLoad(g_accumulationImage, ivec2(gl_LaunchIDEXT.xy)));
    incomingLight = mix(previousLighting, incomingLight, 1.0 / float(u_frameIndex + 1));
}
imageStore(g_accumulationImage, ivec2(gl_LaunchIDEXT.xy), vec4(incomingLight, 1.0));
imageStore(g_inputImage, ivec2(gl_LaunchIDEXT.xy), vec4(incomingLight, 1.0));```
runic surge
#

good enough

wicked notch
#

Alright

#

with this RT sample new Iris (codename Retina) is back to the same functionality level of old Iris

#

...but since RT is fucking addictive I'll be messing around for a day or twobleakekw

delicate rain
#

Or a year or few 🥹

glass sphinx
wicked notch
#

it truly is, addictive

wispy spear
#

that does look neat

#

is this real time still?

wicked notch
#

maybe, if 40ms counts as realtime

#

wanna try it on your 4070?

wispy spear
#

sure : >

#

Regina still?

#

i have the bistro gltf without the interior

wicked notch
#

ye let me 🅱️ush

wispy spear
#

are you pushing bistor too? 😛 i do have it here already

wicked notch
#

mayhaps

#

pushing incoming in 60 seconds

wispy spear
#

github will not be happy about it

#

should probably be on gitignore

wicked notch
#

alright 🅱️ushed

#

if you want textures you should put bistro through gltfpack

wispy spear
#

fuck

#

can you provide the gltf pack params necessary for this postprocess?

wicked notch
#

sure

#

gltfpack -v -noq -kn -km -ke -ac -tc -tq 10

wispy spear
#

a klingon love poem

#

sorry for calling Retina Regina, no idea why i thought it was the latter : (

#

noice gltfpack uses all the cores, thx zeux

wicked notch
#

why is everything so dark froghorror

wispy spear
#

it feels smooth though

wicked notch
#

can you try commenting out the section that grabs the textures

wispy spear
#

sure

wicked notch
#

it's in the rchit shader

wispy spear
#

i just commented line 230 out

wicked notch
#

something's wrong with how I shrimple textures maybe

wispy spear
#

gpu runs at 144W

#

do you want a little video fly through too?

#

or is that image enough?

twin bough
#

I'll test this too

wicked notch
wispy spear
#

one sec

wispy spear
wicked notch
#

alright so normal mapping is borked somehow

#

epic

wispy spear
#

something is tanking my pc atm

wicked notch
#

ah shit

#

I know why it's borked

wispy spear
#

when i alt tabbed the first time from the running retina 😄

wicked notch
#

it's because your the original gltfpack doesn't do normal maps properly

#

frick

wispy spear
#

oh @ normals

#

200 out of 215W

wicked notch
#

I think

wispy spear
#

alright

wicked notch
wispy spear
#

yeah and much less vram usage too it seems just 1.5gb

#

interesting my bistro.glb is 2xx mb

#

yours is 3xx mb

wicked notch
#

it has interior too I think

wispy spear
#

ah

#

i can feel the warmth creeping up from under the desk xD

delicate rain
#

It's addictive to look at too!! Looks awesome 😍

wispy spear
#

hmm looks rather flat

#

i believe i commented the rchit in again and rebuilt everything

wicked notch
#

it compiles shaders at runtime so there's no need to rebuild

wispy spear
#

ah

#

can you check that the road is suppoed to look like that?

wicked notch
#

I think it is

wispy spear
#

ok

wicked notch
#

I think my cosine weighted distribution is wrong

wispy spear
#

sun angle might just be in a weird angle 🙂

wicked notch
#

sun position is in the ray generation shader

#

I hardcoded it because I wanted to see shadows asap KEKW

wispy spear
#

you should set the spawn point outside though

#

first time i thought it dowsnt work because black screen 😛

wicked notch
#

now that I'm done bringing this new iris to full functionality I'll make the actual engine

#

first things first I gotta read what elias daler shared with me

wispy spear
#

: )

#

boop me if you need it somehow tested

pale horizon
#

Iris/Retina confirmed 99% stolen from me

wicked notch
#

true and real

pale horizon
#

Don’t read ideas.md if you don’t want the game spoiled KEKW

wicked notch
#

It's quite incredible that the FBX importer/exporter is so garbage that it can work at full speed even when there's a gigabillion page faults happening

#

(it has to load the entire FBX in memory so I'm currently using 170GB of virtual memory with a working set of 32GB KEKW)

#

Ah yes 178772237 page faults and counting

wicked notch
#

one must imagine Unreal users happy

glass sphinx
wicked notch
#

ffffffffuuuuuuuck

#

Why in the fucking hell would you use int to store the number of triangles of a model

wispy spear
#

break the model into chunks perhaps : (

wicked notch
#

I'm still waiting for the export to be done

#

Only now I've noticed that FBX2glTF can handle only 2 billion triangles

#

if this fails I'm gonna be so pissed

wispy spear
#

understandable, so would i

#

how long is it running already?

wispy spear
#

fuck

wicked notch
#

btw we're up to 400 million page faults KEKW

wispy spear
#

: >

#

whats the PF delta?

wicked notch
#

Honestly Windows is handling this incredibly well

wispy spear
#

(its another column you can enable)

wicked notch
#

ye right now it's small

wispy spear
#

~1k ?

wicked notch
#

yes

#

bouncing between 500 and 6000

wispy spear
#

so more doing IO then

wicked notch
#

I/O to page files exclusively bleakekw

wispy spear
#

: >

wicked notch
#

Anyways, glad to see that Window's memory management systems are working properly

#

I went into this fully expecting to crash, but the system's been running smoothly for hours now

wispy spear
#

knock on wood

#

windows professional?

wicked notch
#

yeah

#

key was cheap

#

since Windows 10

wispy spear
#

next time say something

wicked notch
#

ah yes

#

allocating a 3.6GiB vertex buffer

#

for a single mesh

wispy spear
#

UnsignedLongLongBuffer

wicked notch
#

I think it's time to call the Darian

delicate rain
#

Just download more VRAM from google

wispy spear
#

lustri, you should blog about your stuff and progress

#

and let epic games hire you

wicked notch
#

alright time to document FBX sdk adventures

#

numero uno

#

FbxStream is a class responsible for opening/reading/writing files

#

it has a pure virtual function that opens a file virtual bool Open(void* pStreamData) = 0;

#

now, which file is this function going to open

#

nobody fucking knows

wispy spear
#

: D

wicked notch
#

oh wait I get it

#

I'm supposed to put the filename in the constructor

#

and then Open just resets the file pointer to 0

#

this is great

wispy spear
#

lol wat

#

who writes apis like that

wicked notch
#

look at this poor excuse of an example

#

FBXSDK_strcpy(mFileName, 30, "CustomStreamClass_temp.txt");
hmm yes very clear thank you

#

this tells me exactly what I have to do

wispy spear
#

the heck

#

there are 2 open sauce variants of fbx

#

ufbx i believe is the one and openfbx the other

wicked notch
#

I looked at them

#

they're not multithreaded and they can't handle big files

#

everyone seems to like 4GiB max

wispy spear
#

ah

#

: (

#

and autodesks' fbx can handle more?

wicked notch
#

apparently so

#

FBX2glTF did manage to export it

#

after I changed every single uint32_t in the codebase to a size_t

wispy spear
#
...
        int offset = (int)pOffset;
        switch (pSeekPos)
        {
        case FbxFile::eBegin:
            fseek(mFile, offset, SEEK_SET);
...
wicked notch
#

the slow part is surprisingly not the FBX SDK

wispy spear
#

also just int offset

#

ah

wicked notch
#

ye you can define custom streams

#

Like I'm doing

wispy spear
#

ok

wicked notch
#

I'm not sure if ufbx can too

#

maybe I'll try it

wispy spear
#

writing a custom export plugin might probably still a better idea

wicked notch
#

yes

wispy spear
#

even if you just dump everything obj style into a txt file heh

wicked notch
#

but figuring out unreal doesn't seem fun bleakekw

wispy spear
#

yah : (

#

hmm maybe there is some blender bridge plugin

finite quartz
#

FBX SDK has been cursed by every developer that had to integrate it. So don't forget the tradition.

wicked notch
#

Alright

#

near 50% speedup already

#

thank god they put in zero effort, they make me look like a good programmer

delicate rain
#

LVSTRI is the city scene you posted gltf or FBX?

wicked notch
#

gltf

#

I'd never post anything FBX

#

it doesn't deserve taking my precious SSD space even

delicate rain
#

And you say it's ~9 gigs?

wicked notch
#

the FBX or the gltf?

delicate rain
#

Gltf

wicked notch
#

FBX is 11GiB, gltf is 500MiB of JSON + 7.5GiB of binary

delicate rain
#

That might actually fit in my VRAM

wicked notch
#

You need something slightly above 8GiB

#

unfortunately I have a garbage 3070

delicate rain
#

Hmmmm bleakekw I have 1080

frank sail
#

Just compress

wicked notch
#

mate

delicate rain
#

We do some index compression

wicked notch
#

the index buffer is 3GiB

#

you can compress the index buffer?

delicate rain
#

Palette compressing the indices to 8 bits if I understood correctly

wicked notch
#

damn

delicate rain
#

Microindices

#

Meshoptimizer does it iirc

#

But I have no binary gltf loading and no block compressed texture loading setup yet

#

But I wanna see if Patrick's culling can handle it

wicked notch
#

it's not a glb

#

it can't be bleakekw

#

also it has no textures

#

It's 7GiB of pure geometry

delicate rain
#

EASY

#

Gigachad model, I'll try tomorrow to load it

wicked notch
#

I'm still waiting for Darian to make moana island into a gltf

#

(he ain't gonna do it KEKW)

delicate rain
#

Bro I wanted to do that

#

And gave up

#

Its so much

wicked notch
#

yeah..

delicate rain
#

I opened part of it in blender but yeah

#

Out of core rt sure

#

But real time I gave up bleakekw

wicked notch
#

I just gotta figure nanite out

#

I'm making good progress

frank sail
#

How difficult would it be to modify gltf to support >4gb files

wicked notch
#

zero effort

#

just find any exporter that uses 8 byte integers instead of 4

#

cgltf and fastgltf come to mind

frank sail
#

@ sean

wicked notch
#

it wouldn't be spec compliant

#

but fuck the spec

delicate rain
#

Patrickpilled

wicked notch
#

I will prove you wrong

#

eventually

#

in the far future bleakekw

delicate rain
#

I gladly will be, but geometry stuff too scary for me

wicked notch
#

bro

#

I'm dying

#

but I won't let fear take over me

#

I just have to grow a brain big enough to store all the nanite knowledge

delicate rain
#

Compute tessellation my beloved 🥹

#

Join the gang

wicked notch
#

I'm too deep now

#

it's already over for me

twin musk
#

no need for a horrible index buffer using all your memory :^)

wicked notch
#

this is painful

#

I need a mesh small enough so that I can debug it easily

#

but it should also be big enough for me to be able to actually generate meshlets out of it

#

ok sphere it is

#

sphere is good

wispy spear
#

rip cubes

wicked notch
#

cubes have 12 faces

wispy spear
#

can you use deth's doom.wad?

wicked notch
#

not gud

wispy spear
#

i know cubes are not good

wicked notch
wispy spear
#

ah too much

wicked notch
#

I do 128 triangles max

#

which is already painful to debug but manageable

wispy spear
#

then some icosahedron-esque shape ye

wicked notch
#

low poly sphere KEKW

wispy spear
#

add subdivs

wicked notch
#

assuming my code is correct

#

(huge assumption)

#

these are the meshlets for suzanne

#

how the hell do I validate this

#

@frank sail if I give you vertex position in a txt file (ready to be copy pasted in C++) can you try loading it in frogfood and checking if the meshlets are correct? KEKW

wispy spear
#

hmm could you feed it as vertex positions into fastgltf and have it write a gltf?

wicked notch
#

oh yeah I could write a GLTF

#

let me try

#

after this I really gotta go study otherwise my exam tomorrow is gonna go baad

wispy spear
#

lol

wicked notch
#

it's not my fault

#

ok

#

graph partitioning is cool once you understand it

wispy spear
#

its UEs fault for taking so long

wicked notch
#

(I still don't understand it but I can fumble my way through at least)

#

the meshlets being all the same size is sus..

#

ffs writing a gltf file is too involved

#
for (auto i = 0; i < meshlets.size(); ++i) {
    const auto& meshlet = meshlets[i];
    auto accessor = new cgltf_accessor();
    accessor->type = cgltf_type_vec3;
    accessor->component_type = cgltf_component_type_r_32f;
    accessor->offset = 0;
    accessor->stride = sizeof(SVertex);
    accessor->count = meshlet.size();
    accessor->buffer_view = &meshletBufferViews[i];
    auto attribute = new cgltf_attribute();
    attribute->type = cgltf_attribute_type_position;
    attribute->data = accessor;
    auto primitive = new cgltf_primitive();
    primitive->type = cgltf_primitive_type_triangles;
    primitive->attributes_count = 1;
    primitive->attributes = attribute;
    auto mesh = cgltf_mesh();
    mesh.primitives_count = 1;
    mesh.primitives = primitive;
    meshes.emplace_back(mesh);
}``` who said memory leaks weren't useful
wicked notch
#

I just want to see the draw calls

#

they are both vertex only

#

so no index buffer

wispy spear
#

i cant load them with my loader : > it only accepts triangulated primitives 😢

wicked notch
#

alright I have a hack

wispy spear
#

please ignore me, my renderer wouldnt know if a meshwas indexless or not either

wicked notch
#

alright time to engage overdrive mode

#

Imma write an OpenGL gltf viewer in 5 nanoseconds

wispy spear
#

ah

#

nuh uh

#

fastgltf has a gltf opengl viewer

wicked notch
#

true

#

let me try it

#
  Target "fastgltf_gl_viewer" links to:

    glfw::glfw```
#

bruh

#

ah gotta execute the python script myself

#

smh

wispy spear
#

; (

wicked notch
#

after fixing the build issue it crashes

#

probably can't handle non indexed meshes

#

well it doesn't matter

#

Iris is still there ready for us

#

alright moment of truth

#

at least I see something

wispy spear
#

ah you are trying to make to write a meshlet algorithm?

#

and want to see if it spits any meshlets out

wicked notch
#

yes, using graph partitioning

wispy spear
#

aaah

wicked notch
#

hmm lots of empty draws

#

ah I'm very stupid

#

what in the frick is this

wicked notch
#

holy

#

fucking shit

#

I've done it

#

it's done

wispy spear
#

: O

#

meshlet looking meshlet scene

#

all these wolf faces everywhere

wicked notch
#

it's over

#

I did it

wispy spear
#

time to study

summer gyro
wispy spear
#

we celery later

wicked notch
#

hold up

#

I have to calm myself down first bleakekw

wispy spear
#

: )

wicked notch
#

Also

wispy spear
#

i think you are the smartest frog among us

wicked notch
#

so that I don't lose this

wispy spear
wicked notch
#

jesus..

#

we did it

wispy spear
#

for for for if 😄

#

did potrick do something else?

wicked notch
#

as far as I'm aware the only ones using METIS are:

#
  • me
#
  • unreal
#

that's it KEKW

#

alright NOW it is time to prepare for exams

wispy spear
#

ah

#

= )

wicked notch
#

we got the thing already

#

now it's time to make this actually work KEKW

#

this generates meshlets close to MAX_PRIMITIVES

#

but it doesn't actually respect the upper bound

#

and honestly, I have no idea how to make it work besides splitting the offending meshlet in 2

wispy spear
#

mayhaps run it by Suslik

#

see what he thinks

wicked notch
#

suslik made his own clusterizer

#

like the god he is

wispy spear
#

because he gave up on metis neh?

wicked notch
#

I don't think he ever thought of METIS KEKW

wispy spear
#

ah, i thought there was some conversation about it happening

#

possible that im mixing shit

wicked notch
#

regardless, I think I'll make my own clusterizer too

#

METIS is too garbage

#

I wonder if I can abstract away the graph too

#

in CSR format

wispy spear
#

took sir brian just a man-year

#

if you start now, we might have something by new years eve 2024/2025

wicked notch
#

I'm more of a child than a man if we compare me to brian bleakekw

wispy spear
#

true, but, its worth a try heh

#

although you are italian, you probabyl look more manly than him already

wicked notch
#

TODO fix self reference

wicked notch
#
clusterPrimitiveBuffer.emplace_back((face * 3 + 0) - minPrimitiveIndex);
clusterPrimitiveBuffer.emplace_back((face * 3 + 1) - minPrimitiveIndex);
clusterPrimitiveBuffer.emplace_back((face * 3 + 2) - minPrimitiveIndex);``` I have no idea what I'm doing ![KEKW](https://cdn.discordapp.com/emojis/666849321462792234.webp?size=128 "KEKW")
wicked notch
#

Hmm maybe I'll stray away from meshoptimizer's design completely

#

but EXT_mesh_shader kinda requires it

wicked notch
#

man

#

every second that passes I realize how big zeux's brain is and how small mine is in comparison agonyfrog

distant lodge
#

its ok, zeux is a legend

#

maybe in 20-30 years we will reach his level

wicked notch
#

I gotta use some more heuristics to make sure my partitions are topologically and spatially local

#

like using distance as edge weights

#

but there's still the problem of generating the micro index buffer

#

which I have no idea what it represents

#

(I don't have an idea about the vertex index buffer either bleakekw)

glass sphinx
#

hmm

wispy spear
#

maybe that's the "slack" sir brain was talking about 😄

glass sphinx
#

the micro indices point into a per meshlet vertex index buffer
the per meshlet vertex index buffer points to actual vertices

wicked notch
#

Yeah but what does it represent

#

for example, we know the index buffer is basically an half-edge list for a mesh graph

#

also with edge weights I get real funky meshlets bleakekw

wicked notch
#

yep I can get that

#

unfortunately unless I deeply understand things I can't reason with them

#

it's a big flaw of mine

glass sphinx
#

i see

#

hm

wicked notch
#

I think I'll start with a cube mesh

#

And look at what meshoptimizer outputs

#

just single meshlet, no funky business

glass sphinx
wispy spear
#

i have my laptop on the belly most of the day : )

#

whats the difference between yours and potrick's, lvstri?

#

besides meshoptimizer

#

or are you saying potrick's way is shit?

#

or cant do something you want to do?

wicked notch
#

I'm dumb

#

I can't partition a graph in a good way

#

Also I don't understand microindex buffers

#

How to generate them at least

wispy spear
#

then we need to find people who can explain it better to you

wicked notch
#

alright this looks promising

#

I changed the heuristic to (1.0 / (distance * distance + 1.0) * 2^20)

wispy spear
#

how come the arches have no meshlet looking meshlets?

#

coincidence? or just not enough verticles?

wicked notch
#

this is what I want

#

regular, equal sized, spatially local meshlets

wispy spear
#

ah

#

das ist what i thought

#

another weird question

#

do you perhaps need models with properly made "source" meshes

#

before even processing them into meshlets

wicked notch
#

not really, I can optimize them myself

wispy spear
#

ok

wicked notch
#

so long as they aren't completely degenerate

wispy spear
#

do those arches have weird vertices compared to the curtains?

wicked notch
#

yeah

#

meshes that have a big axis difference are a problem

wispy spear
#

ah, weird

#

can you somehow "unwrap" meshes onto a "plane" and go from there?

wicked notch
#

I don't think they're that much of a problem, just an annoyance

wispy spear
#

hmm no, that doesnt even make sense

wicked notch
#

knot looks good

wispy spear
#

uniform bends everywhere : )

#

how do my complex cubes look like?

wicked notch
#

I have not tried

#

and maybe you'll break my thing

#

because I can't really handle 1 sized partitions KEKW

wispy spear
#

heh, not my intention

#

but it has rotated bits in it too

wicked notch
#

oh, yeah

#

I don't take transforms into account at all yet

wispy spear
#

SM_Deccer_Cube_Complex.gltf i think its called

wicked notch
#

there's no transforms yet sadly

#

remember that I'm testing this on IrisGL bleakekw

#

some meshletisms end up squished

#

probably a tringle count problem

wispy spear
#

: )

#

but has that typical shape

#

what is that mesh now? suzanna?

wicked notch
#

the froge

wispy spear
#

oh : )

wicked notch
#

honestly the frog is a great test mesh

#

lots of meshlets, but it's single primitive

wispy spear
#

textures dont matter i think

wicked notch
#

I guess my deccer cubes role will be revoked now

wispy spear
#

: D

#

that was unexpected

wicked notch
#

yeah like I said, I don't handle transforms yet

wispy spear
#

oki

#

i didnt parse that, it seems

wicked notch
#

they're a hassle when you don't understand whatever the hell you're doing bleakekw

#

clion crashed

#

nevermind

wispy spear
#

are you on EAP?

wicked notch
#

nope

wispy spear
#

kk, eap is quite unstable

wicked notch
#

CLion.exe was using 100% of my CPU for whatever reason

#

I guess it didn't like me renaming a variable

wispy spear
#

ah indexingisms