jernej has quit [Remote host closed the connection]
jernej has joined #dri-devel
kts has joined #dri-devel
<soreau>
if I wanted to convert a cpu rendering algorithm to gpu (using compute or opencl) with the intent to use the result as a texture, what would be a good approach so that it performs well?
<soreau>
is there a way to keep the buffer on the gpu without having to copy it from vram to ram and back (to a texture)?
<tnt>
soreau: Yeah, you can use opencl or gl-compute to render/write to a gl texture directly.
<tnt>
Or you can also use Vulkan compute to do the same to a Vulkan texture if you want to use Vulkan.
<soreau>
this would be an egl gles2 type of thing
<tnt>
not sure if OpenGL ES2.x has compute shaders already.
<tnt>
I think that's a 3.x thing.
DodoGTA has quit [Quit: DodoGTA]
<tnt>
What's the target hardware ?
<soreau>
there's no real target, it would be a client, basically
DodoGTA has joined #dri-devel
<tnt>
Is requiring ES3.x viable ? Should be an easy requirement by today's standard.
<soreau>
yes, it is
<soreau>
do you happen to know if there's any code that does something similar to this that I can look at?
<tnt>
Just googling "Compute Shader" should yield plenty.
<soreau>
specifically, the 'staying on the gpu' part
<soreau>
I know how to setup and write the shader mostly
<tnt>
There is nothing special to do. You allocate the texture like you would normally then give it as argument to the compute shader, then you can use it to texture stuff.
<soreau>
well, writing the code is a bit special :)
<tnt>
The driver would have no reason to copy it out of VRAM so it won't.
<soreau>
so alloc the texture, pass it to the program, scribble on it, wait, and render
mszyprow has joined #dri-devel
<soreau>
does compute require using a specific render node?
<tnt>
No need to wait, AFAIR the driver will handle the dependency.
<tnt>
Not sure what you mean ?
<soreau>
well, I assume you're talking only about compute
<soreau>
I mean like having to open /dev/dri/renderD128/9
<tnt>
Huh, you don't do any of that yourself, mesa does that for you, the GL driver handles that.
<soreau>
ok so there's no context switching then?
<tnt>
you just get a GL context ... and then use GL.
AnuthaDev has quit [Ping timeout: 480 seconds]
neniagh has quit []
heat has joined #dri-devel
<ishitatsuyuki>
yeah I think allocations in GL just go to VRAM most of the time
<ishitatsuyuki>
in Vulkan you get to control it but as general principle CPU-side RAM will only be used for staging buffer for CPU->GPU upload only
Aura has quit [Ping timeout: 480 seconds]
<soreau>
the other question I have, is: are read operations any faster in compute than 'regular' glsl?
neniagh has joined #dri-devel
<ishitatsuyuki>
i suppose you mean graphics / fragment shader instead of 'regular'
<ishitatsuyuki>
at the end of the day it depends on your read pattern and therefore cache hit rate
<ishitatsuyuki>
images and buffers also have different layouts, the former is usually configured to be tiled (e.g. space filling curve order) while the latter is linear (the order you would have if you wrote buf[w][h] in C)
<soreau>
I just know that texture2D() is a killer if used heavily
<ishitatsuyuki>
not really
<ishitatsuyuki>
also you should account for the fact that dGPUs have like 10x the raw power of CPUs
<ishitatsuyuki>
so even if the GPU code is not optimized to the extreme it can still be fairly useful
<soreau>
well that's great and all, but IME writing blur algorithms in glsl, texture2D() can get expensive
<ishitatsuyuki>
well that's the same on CPU as well
<ishitatsuyuki>
you should do separable convolution for blurs to begin with
<soreau>
yes we do
<soreau>
I'm more interested in compute shaders, not cpu rendering (it already works on cpu slowly enough)
<ishitatsuyuki>
anything can become bottleneck if spammed too much
<soreau>
and of course the bigger the size, yea
<ishitatsuyuki>
in case of blurs, seek efficient approxmiations
neniagh has quit []
<ishitatsuyuki>
kawase blur, multi pass box blur, IIR filters, etc.
<soreau>
I think we've exhausted those avenues
<ishitatsuyuki>
IIR is a bit annoying to do on GPUs
anarsoul has joined #dri-devel
<soreau>
but if you'd like to have a look, we'd always like to optimize further :P
<Company>
soreau: your assumptions are all wrong
<Company>
as a rule of thumb
<soreau>
Company: no, you're wrong :D
<Company>
nothing you think you know about GPUs matches reality
<Company>
you'll figure that out once you start learning about GPUs
<soreau>
Company: bored again?
anarsoul|2 has quit [Read error: Connection reset by peer]
<Company>
"I just know that texture2D() is a killer if used heavily" or such are things you picked up reading something somewhere, but you likely fail to remember the context it was said in
<soreau>
well, it depends on the size of the texture really
<soreau>
and I'm talking about blurring HD resolutions with glsl
<soreau>
1920x1080+
<soreau>
Company: also this is nothing I read on reddit, this is IME
<soreau>
I don't waste time reading garbage
<soreau>
I usually waste more time writing garbage, lol
neniagh has joined #dri-devel
<soreau>
but net producer, so..
<Company>
the crappy GTK blur filter does only 150fps on 4k
<Company>
and it seems to depend on blur radius, somebody should fix that
hansg has joined #dri-devel
<soreau>
anyway, we use a lot of tricks for blur such as (ab)using blits to degrade the texture upfront and blur a smaller area than the actual size, then scale back up.. multi pass options, different shaders including kawase, box and guassian (even bokeh effect) probably everything except IIR filters
<soreau>
and there's always room for improvement
<soreau>
also blurring in a client tk is a bit different than doing it in the compositor, dealing with multiple surfaces, stacking wm, etc.
<soreau>
scissoring damage regions too, and the list goes on
kts has quit [Ping timeout: 480 seconds]
frankbinns1 is now known as frankbinns
glennk has joined #dri-devel
<kode54>
I just know
<kode54>
turning off the blur filter causes the compositor's gpu usage to drop to ~10%
<kode54>
while turning it on increases it to about 30%
<Company>
blurring is generally not something you should do if you want to go fast
<Company>
it's something you do if you want to put screenshots of your neofetch output on /r/unixporn
<soreau>
It all depends on how they want to spend their resources. Disabled by default, it's there if they want it.
junaid has quit [Remote host closed the connection]
neniagh has quit []
neniagh has joined #dri-devel
gouchi has joined #dri-devel
mszyprow has quit [Ping timeout: 480 seconds]
gouchi has quit [Quit: Quitte]
heat has quit [Remote host closed the connection]
heat has joined #dri-devel
neggles has joined #dri-devel
heat has quit [Remote host closed the connection]
heat has joined #dri-devel
simon-perretta-img has quit [Ping timeout: 480 seconds]
simon-perretta-img has joined #dri-devel
AnuthaDev has joined #dri-devel
camus has joined #dri-devel
ADS_Sr has quit [Ping timeout: 480 seconds]
thaytan has quit [Ping timeout: 480 seconds]
pcercuei has joined #dri-devel
thaytan has joined #dri-devel
heat has quit [Read error: Connection reset by peer]
heat has joined #dri-devel
heat has quit [Read error: Connection reset by peer]
heat has joined #dri-devel
camus1 has joined #dri-devel
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
camus has quit [Ping timeout: 480 seconds]
<ishitatsuyuki>
what kind of gpu are we talking about here for perf numbers? gaming dgpus? laptop igpus?
Duke`` has quit [Ping timeout: 480 seconds]
Duke`` has joined #dri-devel
junaid has joined #dri-devel
<Company>
ishitatsuyuki: that was a Radeon RX 6500 XT
<ishitatsuyuki>
ok
iive has joined #dri-devel
apinheiro has joined #dri-devel
rauji____ has joined #dri-devel
tango_ is now known as Guest10595
tango_ has joined #dri-devel
kts has joined #dri-devel
Guest10595 has quit [Ping timeout: 480 seconds]
ADS_Sr has joined #dri-devel
junaid has quit [Remote host closed the connection]
Aura has joined #dri-devel
heat has quit [Read error: Connection reset by peer]
heat has joined #dri-devel
yyds has quit [Remote host closed the connection]
hansg has quit [Quit: Leaving]
<Company>
pq, emersion: re the dmabuf format discussion - an example I just ran into is DRM_FORMAT_RGB565 - does that map to VK_FORMAT_R5G6B5_UNORM_PACK16 or VK_FORMAT_B5G6R5_UNORM_PACK16?
rz_ has joined #dri-devel
<Company>
because drm formats and VK formats do their packing slightly differently
<Company>
(this one exists in Mesa, so I can look it up)
<emersion>
Company: use pixfmtdb to find out
heat has quit [Remote host closed the connection]
rz has quit [Ping timeout: 480 seconds]
<Company>
oh, that's neat
heat has joined #dri-devel
asriel has quit [Quit: Don't drink the water. They put something in it to make you forget.]