summaryrefslogtreecommitdiff
path: root/source/core/slang-random-generator.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-09-16 09:38:21 -0400
committerGitHub <noreply@github.com>2019-09-16 09:38:21 -0400
commit40d8f3aeedf018c7c6766e98ec64733abd90671e (patch)
tree0c9cae7bc88d4344dd53596a88c3ce9918f2df13 /source/core/slang-random-generator.h
parentc2e5d2468ad6a38cdb8a067da0678302f6cc6066 (diff)
CPU Performance/Testing improvements (#1055)
* First pass of render-test refactor. * Make window construction a function that can choose an implementation. * Remove OpenGL as currently has windows dependency. * Disable Vulkan as Renderer impl has dependency on windows. * Pass Window in as parameter of 'update'. * Add win-window.cpp as was missing. * Fix warning on windows about signs during comparison. * * Added mechanism to add random arrays as buffer inputs and select type * Improved RenderGenerator to generate more types, and to be more careful around int32 ranges. * Added support for security checks (for Visual Studio C++) * Disable Execption handling being on by default when compiling kernels * Added a 'Group' version of the entry point that will evaluate all threads in a group in a single call. In test code use this method if available. * Added -compile-arg to be able to pass arguments to the compile within render-test * Add documention for the _Group execution feature. * Fix some typos in cpu-target.md
Diffstat (limited to 'source/core/slang-random-generator.h')
-rw-r--r--source/core/slang-random-generator.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/core/slang-random-generator.h b/source/core/slang-random-generator.h
index 8b4d1759b..57f0e8630 100644
--- a/source/core/slang-random-generator.h
+++ b/source/core/slang-random-generator.h
@@ -30,6 +30,9 @@ class RandomGenerator: public RefObject
/// Get the next bool
virtual bool nextBool();
+ /// Next uint32_t
+ uint32_t nextUInt32() { return uint32_t(nextInt32()); }
+
/// Next Int32 which can only be positive
int32_t nextPositiveInt32() { return nextInt32() & 0x7fffffff; }
/// Next Int64 which can only be positive
@@ -38,9 +41,12 @@ class RandomGenerator: public RefObject
/// Returns value up to BUT NOT INCLUDING maxValue.
int32_t nextInt32UpTo(int32_t maxValue) { assert(maxValue > 0); return (maxValue <= 1) ? 0 : (nextPositiveInt32() % maxValue); }
- /// Returns value from min up to BUT NOT INCLUDING max
+ /// Returns value from min up to BUT NOT INCLUDING max.
int32_t nextInt32InRange(int32_t min, int32_t max);
+ /// Returns value from min up to BUT NOT INCLUDING max
+ uint32_t nextUInt32InRange(uint32_t min, uint32_t max);
+
/// Returns value up to BUT NOT INCLUDING maxValue
int64_t nextInt64UpTo(int64_t maxValue) { assert(maxValue > 0); return (maxValue <= 1) ? 0 : (nextPositiveInt64() % maxValue); }