summaryrefslogtreecommitdiffstats
path: root/tools/render-test/cpu-memory-binding.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-01-15 14:58:45 -0500
committerGitHub <noreply@github.com>2020-01-15 14:58:45 -0500
commit662721ba4ab0e38924701df4c876a86eb8390968 (patch)
treedeef68220d0aebbdfff370918a3d42fcf12fd72c /tools/render-test/cpu-memory-binding.h
parentef41dfc605f7868c0ccc7dde05982232b7d49589 (diff)
Bind Location (#1166)
* First pass at BindLocation. * Added BindSet::init - for initializing with two input constant buffers. Needs better name, and perhaps should be another class. * Fix handling of constant buffer stripping. Improved initialization. * Trying to generalize BindLocation a little more. Split out CPULikeBindRoot. * More work to make BindLocation et al work with non uniform bindings. * Added parsing to a location. * WIP: Trying to get CPU working with BindLocation. * Describe problem of knowing the type of the reference point in the binding table. * More ideas on getBindings fix. * Remove BindSet as member of BindLocation. * Added BindLocation::Invalid * Made BindLocation able to be key in hash * Use BindLocation for bindings on BindingSet. * Added cuda and nvrtc categories to test infrastructure. Disabled CUDA synthetic tests by default. Fixed such that all tests now produce something in BindLocation style. * Use m_userIndex instead of m_userData on Resource. Move the binding setup out of cpu-compute-util (as no longer CPU specific) * Removed CPUBinding - used BindLocation/BindSet instead. Fixed some bugs around indexOf around uniform indirection. * Renamed BindSet::Resource -> BindSet::Value. * Document BindLocation. * Fixes for Clang/GCC Improve invariant requirement handling when constructing from BindPoints.
Diffstat (limited to 'tools/render-test/cpu-memory-binding.h')
-rw-r--r--tools/render-test/cpu-memory-binding.h88
1 files changed, 0 insertions, 88 deletions
diff --git a/tools/render-test/cpu-memory-binding.h b/tools/render-test/cpu-memory-binding.h
deleted file mode 100644
index 8ca8e0681..000000000
--- a/tools/render-test/cpu-memory-binding.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef CPU_MEMORY_BINDING_H
-#define CPU_MEMORY_BINDING_H
-
-#include "core/slang-basic.h"
-
-#include "core/slang-memory-arena.h"
-
-namespace renderer_test {
-
-struct CPUMemoryBinding
-{
- struct Buffer
- {
- Buffer() : m_data(nullptr), m_sizeInBytes(0) {}
- uint8_t* m_data;
- size_t m_sizeInBytes;
- };
-
- struct Location
- {
- bool isValid() const { return m_cur != nullptr; }
- bool isInvalid() const { return m_cur == nullptr; }
-
- Location toField(const char* name) const;
- Location toIndex(int index) const;
-
- slang::TypeLayoutReflection* getTypeLayout() const { return m_typeLayout; }
- uint8_t* getPtr() const { return m_cur; }
-
- SLANG_FORCE_INLINE Location():m_typeLayout(nullptr), m_cur(nullptr) {}
-
- SLANG_FORCE_INLINE Location(slang::TypeLayoutReflection* typeLayout, uint8_t* ptr):
- m_typeLayout(typeLayout),
- m_cur(ptr)
- {
- }
-
- protected:
- slang::TypeLayoutReflection* m_typeLayout;
- uint8_t* m_cur;
- };
-
- slang::VariableLayoutReflection* getParameterByName(const char* name);
- slang::VariableLayoutReflection* getEntryPointParameterByName(const char* name);
-
- /// Finds which buffer starts at the ptr index
- Slang::Index findBufferIndex(const void* ptr) const;
-
- Location find(const char* name);
-
- SlangResult setBufferContents(const Location& location, const void* initialData, size_t sizeInBytes);
- SlangResult setNewBuffer(const Location& location, const void* initialData, size_t sizeInBytes, Buffer& outBuffer);
- SlangResult setObject(const Location& location, void* object);
- SlangResult setInplace(const Location& location, const void* data, size_t sizeInBytes);
- /// Initialize memory with a 'sensible' value based on type. Pointer types become null.
- SlangResult initValue(slang::TypeLayoutReflection* typeLayout, void* dst);
- SlangResult initValue(const Location& location) { return initValue(location.getTypeLayout(), location.getPtr()); }
-
- /// Set the size of a *non fixed size* array at location.
- /// A non fixed size array is reflected as having a count of 0 elements.
- /// Only returns a buffer in outBuffer if a new buffer is created.
- SlangResult setArrayCount(const Location& location, int count, Buffer& outBuffer);
-
- SlangResult init(slang::ShaderReflection* reflection, int entryPointIndex);
- CPUMemoryBinding();
-
- Buffer _allocateBuffer(size_t size);
- Buffer _allocateBuffer(size_t size, const void* initialData, size_t initialSize);
-
- SlangResult _add(slang::VariableLayoutReflection* var, slang::TypeLayoutReflection* type, void* dst, Buffer& outBuffer);
-
- Slang::MemoryArena m_arena; ///< Storage for buffers
-
- Buffer m_rootBuffer;
- Buffer m_entryPointBuffer;
-
- slang::ShaderReflection* m_reflection;
-
- // All buffers
- Slang::List<Buffer> m_allBuffers;
-
- slang::EntryPointReflection* m_entryPoint;
- int m_entryPointIndex;
-};
-
-} // renderer_test
-
-#endif //CPU_MEMORY_BINDING_H