Skip to main content
gamedev.net
🔒 Locked

Texture cache

Started by n3Xus 1 reply 1.5k views
Original Post
n3Xus
n3Xus
Hello,

a while back I used the compute shader to perform blur in 2 passes (horizontal & vertical).

I used shared memory to load many pixels at once.


The obvious way was to load a long "line" of pixels at once - lets say a horizontal line of 128 pixels.

I then tried changing the pattern: I loaded a block of 32x4 pixels in the group shared memory.

This second version performed a lot faster than loading one big line.
Then not recently I read a GDC paper that says it is indeed better to load blocks of pixels instead of long lines.

How does texture caching works? Does it load in surrounding pixels from the ones you are trying to sample instead of just loading in the
cache the data that is positioned around the current pixel in memory (like a buffer)?
Adam_42
Adam_42
The layout and size of the texture cache is hardware dependant. However when reading a texture I would expect any sensible cache to work with square blocks of pixels so that simply rotating a texture by 90 degrees won't kill performance with cache misses.
n3Xus
n3Xus
Yea makes sense, thanks!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.