diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2018-04-10 17:53:03 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-04-10 17:53:03 -0400 |
| commit | c4004b32ca2c0effb455ec847114240db3cb993b (patch) | |
| tree | 7530f131892e2973929948e61e46e957d38510a2 /source | |
| parent | 5298ccf7da486d0010c6157974d5dd9a5556f265 (diff) | |
Feature/dx12 compute (#482)
* Dx12 rendering works in test framework.
* Turn on dx12 render tests.
* Getting simpler dx12 compute tests to work.
* With expected data in test - check for specialized and then for the default, so that multiple test can share the same expected data, but specialized cases can still be set.
* Fixed construction and binding on dx12 textures.
* Control which render apis used in test from command line.
* Small aesthetic fixes in render-test/main.cpp.
* Fix binding problem for uavs/srvs dx12. Previously tried to create srv/uav for StorageBuffers (like dx11 does), but the binding breaks as you can end up with two srvs using the same register.
First pass at fixing problems with Texture creation for dx12 - assertions were hit with 3d or array textures.
* Fixes to improve Dx12 setup shader resource views for cubemaps/arrays.
* Fixed d3d12 textureSamplingTest - problem was that cubemap/array textures were not being uploaded correctly.
* Changed the order of how binding of constant buffers (as just set on the Renderer) indexes. Previously they were given the lowest indices, but they clashed with the indices from the 'Binding'. Changing this means all tests run on d3d12.
* Add code to allow use of warp (although not command line switchable yet).
Fix problem setting up raw UAV - as identified by warp.
* Added RenderApiUtil - which can detect if a render api is potentially available.
* Moved render flag testing/parsing into RenderApiUtil.
* Fix signed/unsigned warning.
* Fixes around enums prefixed with k on the review of feature/dx12 compute branch.
Diffstat (limited to 'source')
| -rw-r--r-- | source/core/core.vcxproj | 2 | ||||
| -rw-r--r-- | source/core/list.h | 2 | ||||
| -rw-r--r-- | source/core/slang-string-util.cpp | 29 | ||||
| -rw-r--r-- | source/core/slang-string-util.h | 17 | ||||
| -rw-r--r-- | source/core/slang-string.h | 29 |
5 files changed, 75 insertions, 4 deletions
diff --git a/source/core/core.vcxproj b/source/core/core.vcxproj index 77e91b32f..803c1ab12 100644 --- a/source/core/core.vcxproj +++ b/source/core/core.vcxproj @@ -36,6 +36,7 @@ <ClInclude Include="slang-io.h" /> <ClInclude Include="slang-math.h" /> <ClInclude Include="slang-result.h" /> + <ClInclude Include="slang-string-util.h" /> <ClInclude Include="slang-string.h" /> <ClInclude Include="smart-pointer.h" /> <ClInclude Include="stream.h" /> @@ -47,6 +48,7 @@ <ClCompile Include="platform.cpp" /> <ClCompile Include="slang-free-list.cpp" /> <ClCompile Include="slang-io.cpp" /> + <ClCompile Include="slang-string-util.cpp" /> <ClCompile Include="slang-string.cpp" /> <ClCompile Include="stream.cpp" /> <ClCompile Include="text-io.cpp" /> diff --git a/source/core/list.h b/source/core/list.h index 6c4a04fc7..3a325955a 100644 --- a/source/core/list.h +++ b/source/core/list.h @@ -504,7 +504,7 @@ namespace Slang template<typename T2> UInt IndexOf(const T2 & val) const { - for (int i = 0; i < _count; i++) + for (UInt i = 0; i < _count; i++) { if (buffer[i] == val) return i; diff --git a/source/core/slang-string-util.cpp b/source/core/slang-string-util.cpp new file mode 100644 index 000000000..c60ad9683 --- /dev/null +++ b/source/core/slang-string-util.cpp @@ -0,0 +1,29 @@ +#include "slang-string-util.h" + +namespace Slang { + +/* static */void StringUtil::split(const UnownedStringSlice& in, char splitChar, List<UnownedStringSlice>& slicesOut) +{ + slicesOut.Clear(); + + const char* start = in.begin(); + const char* end = in.end(); + + while (start < end) + { + // Move cur so it's either at the end or at next split character + const char* cur = start; + while (cur < end && *cur != splitChar) + { + cur++; + } + + // Add to output + slicesOut.Add(UnownedStringSlice(start, cur)); + + // Skip the split character, if at end we are okay anyway + start = cur + 1; + } +} + +} // namespace Slang diff --git a/source/core/slang-string-util.h b/source/core/slang-string-util.h new file mode 100644 index 000000000..bae576370 --- /dev/null +++ b/source/core/slang-string-util.h @@ -0,0 +1,17 @@ +#ifndef SLANG_STRING_UTIL_H +#define SLANG_STRING_UTIL_H + +#include "slang-string.h" +#include "list.h" + +namespace Slang { + +struct StringUtil +{ + static void split(const UnownedStringSlice& in, char splitChar, List<UnownedStringSlice>& slicesOut); +}; + +} // namespace Slang + + +#endif // SLANG_STRING_UTIL_H diff --git a/source/core/slang-string.h b/source/core/slang-string.h index 7d8d3eb81..9f18554f6 100644 --- a/source/core/slang-string.h +++ b/source/core/slang-string.h @@ -135,10 +135,14 @@ namespace Slang { public: UnownedStringSlice() - : beginData(0) + : beginData(nullptr) , endData(0) {} + explicit UnownedStringSlice(char const* a): + beginData(a), + endData(a + strlen(a)) + {} UnownedStringSlice(char const* b, char const* e) : beginData(b) , endData(e) @@ -159,13 +163,32 @@ namespace Slang return endData - beginData; } - bool operator==(UnownedStringSlice const& other) + int indexOf(char c) const + { + const int size = int(endData - beginData); + for (int i = 0; i < size; ++i) + { + if (beginData[i] == c) + { + return i; + } + } + return -1; + } + + const char& operator[](int i) const + { + assert(i >= 0 && i < int(endData - beginData)); + return beginData[i]; + } + + bool operator==(UnownedStringSlice const& other) const { return size() == other.size() && memcmp(begin(), other.begin(), size()) == 0; } - bool operator==(char const* str) + bool operator==(char const* str) const { return (*this) == UnownedStringSlice(str, str + strlen(str)); } |
