ChanServ changed the topic of #dri-devel to: <ajax> nothing involved with X should ever be unable to find a bar
xcube has joined #dri-devel
NiksDev has quit [Ping timeout: 480 seconds]
camus1 has quit [Remote host closed the connection]
camus has joined #dri-devel
<xcube>
I have a GLSL post processing shader that uses `textureLod(previous_render, vec2(0.5, 0.5), high_lod_number)` to get the average value of the entire frame before the final post processing step. It is used to adjust the final exposure.
<xcube>
This seems to work on Nvidia and AMD's proprietary drivers at least (and at least on windows), but there is something odd about glGenerateMipmaps() on mesa that is causing things to flicker.
<xcube>
To be more specific, the shader in question from the SEUS shaderpack for Minecraft (it normaly does not work on linux/mesa, but I have a personal version that I patched up and it 99% works now. Just this one final bug to work out.)
<xcube>
I have an AMD RX580 and am digging around in the mesa source code to find the algorithm used for glGenerateMipmaps() but I am vary rusty/unfamiliar with mesa debugging.
camus1 has joined #dri-devel
<imirkin>
xcube: radeonsi doesn't use the generic mechanism for this
<xcube>
anarsoul: Oops, I overlooked it. It was in src/gallium/include/pipe/p_defines.h
<xcube>
I still can't find what sets it to true for radionsi though.
<anarsoul>
xcube: I think imirkin meant to change src/gallium/drivers/radeonsi/si_get.c to return 0 for PIPE_CAP_GENERATE_MIPMAP
Lightkey has quit [Ping timeout: 480 seconds]
<xcube>
I think I found it :)
camus1 has joined #dri-devel
camus has quit [Ping timeout: 480 seconds]
<xcube>
Anyway, I rendered textureLod(previous_render, coords, 7) to the screen to see what it looked like (about 8x8 large pixels) and it seems like instead of averaging the base level pixels, it feels like it is picking one or a sparse number of them (causing the flickering when the camera rotates just slightly).
Lightkey has joined #dri-devel
mbrost has joined #dri-devel
<imirkin>
xcube: it's supposed to do linear filtering :)
tarceri has joined #dri-devel
<xcube>
imirkin: When it generates the mipmap levels, generating level 7 should use level 6 and not level 0 right? Even if its not a perfect average, it should still work?
<imirkin>
right.
<xcube>
I wonder if it is using nearest instead of linear when generating the smallest mipmap levels. (when lod is 0 to 4 it seems ok, but past that, the issue is noticeable)
<imirkin>
shouldn't be!
mbrost has quit [Remote host closed the connection]
mbrost has joined #dri-devel
camus1 has quit [Remote host closed the connection]
camus has joined #dri-devel
sdutt has quit [Remote host closed the connection]
<xcube>
In si_pipe.c radeonsi_debug_options has a lot of useful looking stuff. What environment variable do I use to activate some of them?
sdutt has joined #dri-devel
<xcube>
I tried GALLIUM_PRINT_OPTIONS=info but that did not seem to do anything
boistordu_old has quit [Ping timeout: 480 seconds]
<imirkin>
xcube: did you try setting that PIPE_CAP to 0?
<xcube>
imirkin: If the RX580 has_3d_cube_border_color_mipmap it is set to 1 (I am forcing it to 0 right now, but it would be nice to get it to print out that info)
camus has quit [Remote host closed the connection]
camus has joined #dri-devel
rsalvaterra_ has joined #dri-devel
rsalvaterra has quit [Ping timeout: 480 seconds]
camus1 has joined #dri-devel
camus has quit [Ping timeout: 480 seconds]
xcube has quit [Remote host closed the connection]
Company has quit [Read error: Connection reset by peer]
<emersion>
encoding vs. primaries/white-point/transfer function?
<pq>
no
<pq>
VkColorSpaceKHR defines the chromaticity properties *and* encoding.
<pq>
VkFormat defines how the translation between the raw pixel value and the interpreted value your app actually works with.
<pq>
so SRGB in format only means that all access to the pixel goes through the sRGB non-linear de/encoding functions.
<emersion>
hm. so as far as wayland is concerned, we shouldn't care about UNORM/SRGB in VkFormat, these look the same to us?
<pq>
you can have a VkColorSpace with linear encoding, and if you access that through SRGB format, you get what you ask for: the linear raw value is linearized a second time, IOW, scrambled.
<pq>
emersion, exactly.
<pq>
UNORM/SRGB is only about how Vulkan interprets the raw pixel value bits
<pq>
if the user knows the underlying DRM_FORMAT_*, they could use *any* Vulkan "numeric format" and just compute the value accordingly.
<emersion>
i see
<pq>
the translation between DRM and Vk formats is a reinterpret_cast
<emersion>
what does that mean?
YuGiOhJCJ has quit [Ping timeout: 480 seconds]
<pq>
I'm referring to the C++ reinterpret_cast, or the plain C cast.
<pq>
hmm, no, not C cast. C reinterpret through a union.
<HdkR>
std::bit_cast is the officially blessed C++ way to do this :)
<pq>
The thing I'm not clear about is, what's the idea with the Vk formats.
<pq>
HdkR, sorry, my C++ is stuck in the 2006.
<pq>
:-)
xexaxo_ has joined #dri-devel
<HdkR>
Luckily this was added in C++20
<pq>
emersion, maybe I can talk about fragment shaders here? Like, in frag shader you have a float r, g, b values that you write as destination color.
<emersion>
right
<emersion>
VkFormat SRGB/UNORM is about these
<pq>
if your target VkFormat is UNORM or SRGB, then values from outside [0.0, 1.0] are "impossible". I suppose they just get clamped.
<pq>
with UNORM, the float value is trivially converted to, say uint8_t if it's 8 bpc.
<pq>
with SRGB, the float value goes through sRGB inverse EOTF function before trivially converted to uint8_t.
<emersion>
ok. so you write a linear value to the shader float, then vulkan de-linearizes it to SRGB
<pq>
yes - *if* your shader indeed computes a linear value
<pq>
it up to the app whether the float is linear or non-linear value
<emersion>
if it doesn't, you get wrong values and nothing else, i guess?
<pq>
but to get the expected result (non-linear value written), it needs to choose betweed UNORM and SRGB
<emersion>
ok. so in theory an app could use a nonlinear SRGB colorspace, with a UNORM format, and do the delinearization itself in the shader?
<pq>
yes!
<pq>
VkColorSpace says what the pixel values represent (encoding), and VkFormat is just a helper to convert your floats into what is needed.
<pq>
and only, the app, knows how the float in the frag shader is encoded, linear or non-linear
<pq>
*only you, the app
<pq>
I believe the same applies to OpenGL SRGB stuff.
<emersion>
makes sense
<emersion>
thanks for the explanation
pnowack has quit [Quit: pnowack]
<emersion>
it's kind of unfortunate that shader details are leaked into WSI stuff
<pq>
Let's hope my reasoning matches... well, reality might be flawed, but the Vulkan spec writers'. :-)
illwieckz has quit [Remote host closed the connection]
<pq>
yes
pnowack has joined #dri-devel
<pq>
I presume UNORM/SRGB apply in both directions: texture sampling and render target writing
<emersion>
i hope so :^)
pnowack has quit [Quit: pnowack]
pnowack has joined #dri-devel
<tzimmermann>
danvet, found it. i'll send a fix later today
vivijim has joined #dri-devel
<danvet>
tzimmermann, awesome, thx a lot
karolherbst has quit [Remote host closed the connection]
<MrCooper>
nroberts: weird, there should be a play button for each container job; maybe check the CI/CD settings in your project for anything that might differ from the default
<nroberts>
oh, I wasn’t signed in 🤦 I am an idiot, sorry for the noise :)
<MrCooper>
ah, cool
camus1 has joined #dri-devel
camus has quit [Ping timeout: 480 seconds]
camus1 has quit [Ping timeout: 480 seconds]
camus has joined #dri-devel
illwieckz has joined #dri-devel
iive has joined #dri-devel
flacks has quit [Quit: Quitter]
flacks has joined #dri-devel
jernej has quit [Ping timeout: 480 seconds]
xexaxo_ has quit [Read error: Connection reset by peer]
xexaxo_ has joined #dri-devel
pochu has quit [Ping timeout: 481 seconds]
Company has joined #dri-devel
camus has quit [Ping timeout: 480 seconds]
Guest292 has joined #dri-devel
jernej has joined #dri-devel
pochu has joined #dri-devel
gpoo has joined #dri-devel
Peste_Bubonica has joined #dri-devel
nirmoy has joined #dri-devel
Guest292 has quit [Ping timeout: 481 seconds]
itoral has quit []
aigleroy881 has joined #dri-devel
raket has left #dri-devel [#dri-devel]
jewins has joined #dri-devel
<swick>
pq, emersion: yes, the vk srgb formats linearize on read and delinearize on write. reason for those formats to exists is that (some?) ROPs have this build in so it's basically for free.
<swick>
and it's not really leaking into the WSI, it's just another vulkan format which maps to the same wl format
<emersion>
this bit of information is never relevant for the WSI
<emersion>
would make more sense imho to make it a flag when creating shaders, or something
<swick>
well, vulkan has multiple formats which have the same pixel layout which is the only thing that matters for wl formats
<swick>
it's not the shader doing the srgb conversion though
<emersion>
flag to VkImageView or even VkImage then
<pq>
swick, does Vulkan so the literally asked but nonsensical thing when you have a linear color space and use SRGB format?
<pq>
*do
<pq>
no effect on WSI, just curious
<swick>
yeah, no way to know what the user computes/stores
<swick>
if you ask for it, you get it
<pq>
good, so no surprise special cases there
frieder has quit [Remote host closed the connection]
camus has joined #dri-devel
<swick>
emersion: not completely sure but i think attachments only take a format and you then after the pipeline was created you assign VkImageViews to those attachments and sine the srgb load/store thing is part of the pipeline state it can't be a VkImage(View) flag
camus1 has joined #dri-devel
camus has quit [Ping timeout: 480 seconds]
<jekstrand>
swick: That's incorrect. sRGB encode/decode is part of the VkFormat in the VkImageView
<jekstrand>
There is no pipeline flag for it
<jekstrand>
Or maybe that's what you were trying to say? I'm having trouble parsing.
xexaxo_ has quit [Read error: Connection reset by peer]
xexaxo_ has joined #dri-devel
xexaxo_ has quit [Read error: Connection reset by peer]
xexaxo_ has joined #dri-devel
anujp_ has joined #dri-devel
Ahuj has quit [Ping timeout: 480 seconds]
jernej has quit [Remote host closed the connection]
jernej has joined #dri-devel
iive has quit []
camus has joined #dri-devel
camus1 has quit [Ping timeout: 480 seconds]
aigleroy881 has quit [Ping timeout: 480 seconds]
<danvet>
tzimmermann, oh just realized you didn't cc intel-gfx, so can't easily confirm with CI whether it's fixed there now too
mattrope has joined #dri-devel
anujp_ has quit [Ping timeout: 480 seconds]
rsalvaterra_ has joined #dri-devel
rsalvaterra has quit [Ping timeout: 480 seconds]
mlankhorst has quit [Ping timeout: 480 seconds]
vivijim_ has joined #dri-devel
<tzimmermann>
danvet, i'll send it out again with intel-gfx
mattrope has quit [Ping timeout: 480 seconds]
jewins has quit [Ping timeout: 480 seconds]
vivijim has quit [Ping timeout: 480 seconds]
camus1 has joined #dri-devel
apteryx_ has quit []
camus has quit [Ping timeout: 480 seconds]
tzimmermann has quit [Quit: Leaving]
pochu has quit [Ping timeout: 482 seconds]
GloriousEggroll has joined #dri-devel
camus1 has quit [Remote host closed the connection]
camus has joined #dri-devel
xexaxo_ has quit [Remote host closed the connection]
xexaxo_ has joined #dri-devel
sdutt has joined #dri-devel
camus has quit [Remote host closed the connection]
camus has joined #dri-devel
camus has quit [Remote host closed the connection]
camus has joined #dri-devel
camus has quit [Remote host closed the connection]
camus has joined #dri-devel
aigleroy881 has joined #dri-devel
lynxeye has quit [Quit: Leaving.]
mbrost has joined #dri-devel
camus1 has joined #dri-devel
camus has quit [Remote host closed the connection]
ngcortes has joined #dri-devel
<swick>
jekstrand: the image views of a framebuffer must have the same format as the attachments of the render pass. pipelines can only be used with framebuffers of a compatible render pass. render passes are compatible if the format of the attachments is the same. therefore the format and sRGB decode and encode of attachments is pipeline state.
<swick>
what am I missing?
<jekstrand>
swick: Correct
<jekstrand>
swick: I thought you were saying there was a pipeline create bit for it.
<jekstrand>
Drivers have the information in case they want to do it in the shader (a lot of mobile does) but it's specified as an image format.
<jekstrand>
Maybe I just misread what you'd typed?