https://github.com/shader-slang/slang
Revision 4b74f994bf94217f174cf0fb02ed94abe62e9d7c authored by Tim Foley on 11 March 2021, 21:08:21 UTC, committed by GitHub on 11 March 2021, 21:08:21 UTC
* Change representation of initial data for textures

Before this change, initial data for a texture has been provided with the `ITextureResource::Data` type, where a call to `IDevice::createTexture()` would take zero or one `Data` and, if present, use it to initialize all the subresources of a texture.

The organization of `Data` was not actually quite how its own documentation comment described it (the implementations didn't agree with the comment), and while it aggressively factored out redundancies (e.g., only storing the stride for each mip level once, instead of once per subresource for large arrays), the result was that setting up a `Data` correcty was a bit confusing.

This change makes the initial data for a texture using a `SubresourceData` type that is almost identical to what D3D11 uses, so that developers are more likely to be comfortable filling it in. All of the existing implementations were easily adapted to use the new type, so it seems like a net win.

Note: Both Vulkan and D3D11 do away with the idea of initializing a texture with data as part of allocating it, and we might eventually want to do the same given the complexity that this system entails. The main reason to preserve this detail is for better compatibility with D3D11, where immutable textures/buffers need to have their data specified at creation time. It seems good to preserve the ability to have immutable resources on target APIs where this distinction could affect performance (e.g., immutable resources do not need state/transition tracking on APIs like D3D11).

* fixup: CUDA
1 parent a07455c
History
Tip revision: 4b74f994bf94217f174cf0fb02ed94abe62e9d7c authored by Tim Foley on 11 March 2021, 21:08:21 UTC
Change representation of initial data for textures (#1747)
Tip revision: 4b74f99
File Mode Size
.github
build
docs
examples
external
extras
prelude
source
tests
tools
.editorconfig -rw-r--r-- 937 bytes
.gitattributes -rw-r--r-- 95 bytes
.gitignore -rw-r--r-- 1.0 KB
.gitmodules -rw-r--r-- 951 bytes
CODE_OF_CONDUCT.md -rw-r--r-- 3.1 KB
LICENSE -rw-r--r-- 1.1 KB
README.md -rw-r--r-- 8.6 KB
github_build.sh -rw-r--r-- 495 bytes
github_test.sh -rw-r--r-- 546 bytes
premake.bat -rw-r--r-- 120 bytes
premake5.lua -rw-r--r-- 47.8 KB
slang-com-helper.h -rw-r--r-- 4.8 KB
slang-com-ptr.h -rw-r--r-- 4.9 KB
slang-gfx.h -rw-r--r-- 56.4 KB
slang-tag-version.h -rw-r--r-- 36 bytes
slang.h -rw-r--r-- 167.5 KB
slang.sln -rw-r--r-- 17.9 KB
test.bat -rw-r--r-- 1.4 KB

README.md

back to top