#pragma once #ifdef KINC_KONG #include #include #include #include /*! \file constantbuffer.h \brief Provides support for managing buffers of constant-data for shaders. */ #ifdef __cplusplus extern "C" { #endif typedef struct kinc_g4_constant_buffer { kinc_g4_constant_buffer_impl impl; } kinc_g4_constant_buffer; /// /// Initializes a constant-buffer. /// /// The buffer to initialize /// The size of the constant-data in the buffer in bytes KINC_FUNC void kinc_g4_constant_buffer_init(kinc_g4_constant_buffer *buffer, size_t size); /// /// Destroys a buffer. /// /// The buffer to destroy KINC_FUNC void kinc_g4_constant_buffer_destroy(kinc_g4_constant_buffer *buffer); /// /// Locks all of a constant-buffer to modify its contents. /// /// The buffer to lock /// The contents of the buffer KINC_FUNC uint8_t *kinc_g4_constant_buffer_lock_all(kinc_g4_constant_buffer *buffer); /// /// Locks part of a constant-buffer to modify its contents. /// /// The buffer to lock /// The offset of where to start the lock in bytes /// The number of bytes to lock /// The contents of the buffer, starting at start KINC_FUNC uint8_t *kinc_g4_constant_buffer_lock(kinc_g4_constant_buffer *buffer, size_t start, size_t count); /// /// Unlocks a constant-buffer so the changed contents can be used. /// /// The buffer to unlock KINC_FUNC void kinc_g4_constant_buffer_unlock_all(kinc_g4_constant_buffer *buffer); /// /// Unlocks parts of a constant-buffer so the changed contents can be used. /// /// The buffer to unlock /// /// The number of bytes to unlock, starting from the start-index from the previous lock-call KINC_FUNC void kinc_g4_constant_buffer_unlock(kinc_g4_constant_buffer *buffer, size_t count); /// /// Figures out the size of the constant-data in the buffer. /// /// The buffer to figure out the size for /// Returns the size of the constant-data in the buffer in bytes KINC_FUNC size_t kinc_g4_constant_buffer_size(kinc_g4_constant_buffer *buffer); #ifdef __cplusplus } #endif #endif