diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2021-03-12 11:58:14 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-12 11:58:14 -0800 |
| commit | d6a37a0f151e390808f196998c48a341bc4c7b60 (patch) | |
| tree | c1c6e3af434cb3627af67ecc8706124e4b8c7fb1 /build | |
| parent | 9ffe2f3ef245034a2dae42017a9059dfe4d02647 (diff) | |
Add a CPU renderer implementation (#1750)
* Add a CPU renderer implementation
This change adds a CPU back-end to `gfx` and ensures that most of our existing CPU tests pass when using it.
Detailed notes:
* Most of the CPU renderer implementation is copy-pasted from the CUDA case, so they share a lot of similar logic
* The main addition to the CPU renderer is a semi-complete implementation of host-memory textures. The logic here handles all the main shapes (Buffer, 1D, 2D, 3D, Cube) and all the currently-supported `Format`s that are sample-able as-is (no D24S8). The implementation is not intended to be fast, and it currently only does nearest-neighbor sampling, but otherwise it tries to avoid cutting too many corners and should be ar reasonable starting point for a more complete (but not performance-oriented) implementation.
* Refactored the CPU prelude `IRWTexture` interface to inherit from `ITexture`, since in most cases a single type will end up implementing both. It might be worth it to collapse it all down to a single interface later.
* Changed the CPU prelude `ITexture`/`IRWTexture` interface so that it takes both a pointer *and* a size for output arguments. This change seems necessary to allow a shader variable declared as a `Texture2D<float>` to fetch a single `float` when the underlying texture might be using RGBA32F.
* Added to the `IComponentType` public API so that we can query a "host callable" for an entry point and not just a binary.
* Turned off the `-shaderobj` flag on two tests that weren't yet compatible with shader objects but still had the flag left in on the path (since previously the CPU path always used the non-`gfx` non-shader-object logic anyway)
* Disabled one test (`dynamic-dispatch-11`) that relied on the `ConstantBuffer<IInterface>` idiom that we know we are planning to chagne soon anyway.
* Made a few changes to the CUDA path to bring it into line with what I added for the CPU path. These were mostly bug fixes around indexing logic for sub-objects and resources.
* fixup
Diffstat (limited to 'build')
| -rw-r--r-- | build/visual-studio/gfx/gfx.vcxproj | 2 | ||||
| -rw-r--r-- | build/visual-studio/gfx/gfx.vcxproj.filters | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/build/visual-studio/gfx/gfx.vcxproj b/build/visual-studio/gfx/gfx.vcxproj index 5f05d7586..08786b5cf 100644 --- a/build/visual-studio/gfx/gfx.vcxproj +++ b/build/visual-studio/gfx/gfx.vcxproj @@ -181,6 +181,7 @@ <ItemGroup> <ClInclude Include="..\..\..\slang-gfx.h" /> <ClInclude Include="..\..\..\tools\gfx\command-writer.h" /> + <ClInclude Include="..\..\..\tools\gfx\cpu\render-cpu.h" /> <ClInclude Include="..\..\..\tools\gfx\cuda\render-cuda.h" /> <ClInclude Include="..\..\..\tools\gfx\d3d\d3d-swapchain.h" /> <ClInclude Include="..\..\..\tools\gfx\d3d\d3d-util.h" /> @@ -206,6 +207,7 @@ <ClInclude Include="..\..\..\tools\gfx\vulkan\vk-util.h" /> </ItemGroup> <ItemGroup> + <ClCompile Include="..\..\..\tools\gfx\cpu\render-cpu.cpp" /> <ClCompile Include="..\..\..\tools\gfx\cuda\render-cuda.cpp" /> <ClCompile Include="..\..\..\tools\gfx\d3d\d3d-swapchain.cpp" /> <ClCompile Include="..\..\..\tools\gfx\d3d\d3d-util.cpp" /> diff --git a/build/visual-studio/gfx/gfx.vcxproj.filters b/build/visual-studio/gfx/gfx.vcxproj.filters index c7836d62f..cff8cc95a 100644 --- a/build/visual-studio/gfx/gfx.vcxproj.filters +++ b/build/visual-studio/gfx/gfx.vcxproj.filters @@ -15,6 +15,9 @@ <ClInclude Include="..\..\..\tools\gfx\command-writer.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="..\..\..\tools\gfx\cpu\render-cpu.h"> + <Filter>Header Files</Filter> + </ClInclude> <ClInclude Include="..\..\..\tools\gfx\cuda\render-cuda.h"> <Filter>Header Files</Filter> </ClInclude> @@ -86,6 +89,9 @@ </ClInclude> </ItemGroup> <ItemGroup> + <ClCompile Include="..\..\..\tools\gfx\cpu\render-cpu.cpp"> + <Filter>Source Files</Filter> + </ClCompile> <ClCompile Include="..\..\..\tools\gfx\cuda\render-cuda.cpp"> <Filter>Source Files</Filter> </ClCompile> |
