Comments (2)
I think the difference is that you are keeping the Texture in CPU accessible memory. So the data doesn't need to be copied from the GPU.
Out of curiosity, can you try creating the texture without the TEXTURE_USAGE_CPU_READ_BIT
flag?
Edit: I ended up testing myself. And can confirm your results. The first run I got about 3000ms for ssboTest()
and 8ms for textureTest()
.
Then i removed TEXTURE_USAGE_CPU_READ_BIT
and it became 3000ms and 400ms respectively.
Then I swapped the order of ssboTest()
and textureTest()
(I called textureTest()
first) and then I got 3000ms for textureTest()
and 2ms for ssboTest()
.
Oh, and bonus, if I leave TEXTURE_USAGE_CPU_READ_BIT
enabled, and have the calls swapped. Then I got 8ms for textureTest()
and 3000ms for ssboTest()
.
So this is pretty clearly just highlighting the real cost of stalling the GPU to read back data. Whichever one does it first incurs the cost, then the second one doesn't pay for the cost because the GPU has already been stalled. If you keep your texture in CPU accessible memory, then you don't have to pay that cost, which clearly pays off.
from godot.
Doing your tests on my device gives similar results. The problem then is that there is no equivalent of TEXTURE_USAGE_CPU_READ_BIT
for SSBOs exposed through the API. Comparing the source code for storage_buffer_create
and texture_create
, setting TEXTURE_USAGE_CPU_READ_BIT
in turn sets VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT
on the driver side when allocating the texture. driver->buffer_create
also has options that set this flag, but they aren't exposed by storage_buffer_create
.
As an aside, there was one case where your tests produced a different result on my machine. Running textureTest()
before ssboTest()
with the TEXTURE_USAGE_CPU_READ_BIT
enabled, I got 5us for textureTest()
and 145us ssboTest()
. That is, SSBO access sped up significantly, even though the GPU didn't appear to stall. EDIT: Removing the texture access entirely (that is, just creating the texture without reading from it) gives the same result. I noticed some code in the driver for pooling small allocations, so maybe the SSBO is actually reusing part of the texture's allocation.
from godot.
Related Issues (20)
- ResourceLoader.load_threaded_get_status returns THREAD_LOAD_LOADED after ResourceLoader.load_threaded_request with invalid path HOT 2
- Misleading return value on Object::call_deferred HOT 10
- Overlapping collision reports are non-deterministic when clicked despite sorting. HOT 3
- The number of draw calls keeps showing a zero when using the overdraw debug draw mode in Forward+ HOT 1
- Find in Files no longer works in 4.3 RC3 HOT 7
- undefined symbol: AudioDriverScriptProcessor::finish_driver() HOT 1
- MOUSE_MODE_CAPTURED - Remote Desktop (Raw Input Issue)
- Breakpoints or errors cause Godot window to be flagged as "Not Responding" by Windows HOT 3
- Can I use part of a sprite as the light texture? HOT 8
- Button no longer shows last character on resize
- `GPUParticles3D` collision point is unpredictable depending on particle collision speed HOT 3
- Release build has tree_exiting error that doesn't occur in debug build/editor (Windows, MinGW/GCC LTO regression) HOT 8
- StandardMaterial3D reports errors in some settings combinations
- Editor crash without any logs when re-importing empty obj file HOT 2
- Deleting track from bezier curve editor emits errors about "UndoRedo history mismatch"
- C# Compute Shaders run significantly slower than GDScript compute shaders. (Godot 4.3 RC3) HOT 4
- Editor crash when editing project with a specific GDExtension HOT 2
- Can't import generated BMFont .fnt file. HOT 10
- 3D Omni Lights cut in half after exporting to Web HOT 9
- Godot crashes after ```Index p_index = 0 is out of bounds (size() = 0)``` error. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godot.