VPP  0.7
A high-level modern C++ API for Vulkan
vppLangIntUniform.hpp
1 /*
2  Copyright 2016-2018 SOFT-ERG, Przemek Kuczmierczyk (www.softerg.com)
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification,
6  are permitted provided that the following conditions are met:
7 
8  1. Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10 
11  2. Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 
27 // -----------------------------------------------------------------------------
28 namespace vpp {
29 // -----------------------------------------------------------------------------
30 
137 {
138 public:
148  inUniformBuffer ( std::uint32_t set = 0, int binding = -1 );
149 
214  auto operator= ( const UniformBufferView& value );
215 };
216 
217 // -----------------------------------------------------------------------------
218 
333 class ioBuffer
334 {
335 public:
345  ioBuffer ( std::uint32_t set = 0, int binding = -1 );
346 
429  auto operator= ( const UniformBufferView& value );
430 };
431 
432 // -----------------------------------------------------------------------------
433 
439 {
440 public:
441  inUniformBufferDyn ( std::uint32_t set = 0, int binding = -1 );
442  auto operator= ( const UniformBufferView& value );
443 };
444 
445 // -----------------------------------------------------------------------------
446 
452 {
453 public:
454  ioBufferDyn ( std::uint32_t set = 0, int binding = -1 );
455  auto operator= ( const UniformBufferView& value );
456 };
457 
458 // -----------------------------------------------------------------------------
528 template< template< vpp::ETag TAG > class DefinitionT >
530 {
531 public:
535  inPushConstant();
536 
543  void cmdPush ( CommandBuffer currentBuffer );
544 
553  template< typename ValueT >
554  void cmdPush ( CommandBuffer currentBuffer, const ValueT& field );
555 
564  void cmdPush();
565 
577  template< typename ValueT >
578  void cmdPush ( const ValueT& field );
579 
584  typedef DefinitionT< CPU > DataBlock;
585 
599  DataBlock& data();
600 };
601 
602 // -----------------------------------------------------------------------------
697 template< ETag TAG, template< vpp::ETag TAG > class TDef >
699 {
700 };
701 
702 // -----------------------------------------------------------------------------
703 
748 template< ETag TAG, class HostT, int OFFSET = -1 >
750 {
752  UniformFld();
753 
755  UniformFld ( const HostT& value );
756 
758  operator HostT& ();
759 
761  operator const HostT& () const;
762 };
763 
764 // -----------------------------------------------------------------------------
856 template< template< vpp::ETag TAG > class TDef, class BufferT >
858 {
859 public:
861  UniformVar ( BufferT& buf );
862 
867  template< typename MemberT >
868  auto operator[]( MemberT Definition::* pMember ) const;
869 
874  auto operator[]( const Int& index ) const;
875 
877  auto operator[]( const UInt& index ) const;
878 
880  auto operator[]( int index ) const;
881 
883  auto operator[]( unsigned int index ) const;
884 
886  Int Size() const;
887 
889  int size() const;
890 };
891 
892 // -----------------------------------------------------------------------------
918 template< template< vpp::ETag TAG > class TDef, class BufferT >
920 {
921 public:
949  UniformArray ( BufferT& buf, int size = 0, int stride = 0 );
950 
960  auto operator[]( const Int& index ) const;
961 
963  auto operator[]( const UInt& index ) const;
964 
966  auto operator[]( int index ) const;
967 
969  auto operator[]( unsigned int index ) const;
970 
976  Int Size() const;
977 
982  int size() const;
983 };
984 
985 // -----------------------------------------------------------------------------
1027 template< class HostT, class BufferT >
1029 {
1030 public:
1058  UniformSimpleArray ( BufferT& buf, int size = 0, int stride = 0 );
1059 
1067  auto operator[]( const Int& index ) const;
1068 
1070  auto operator[]( const UInt& index ) const;
1071 
1073  auto operator[]( int index ) const;
1074 
1076  auto operator[]( unsigned int index ) const;
1077 
1083  Int Size() const;
1084 
1089  int size() const;
1090 };
1091 
1092 // -----------------------------------------------------------------------------
1093 } // namespace vpp
1094 // -----------------------------------------------------------------------------
UniformVar(BufferT &buf)
Constructs the accessor for provided binding point.
Shader (GPU-side) data type for 32-bit unsigned integer values.
Definition: vppLangScalarTypes.hpp:249
Currently not implemented.
Definition: vppLangIntUniform.hpp:451
Int Size() const
Returns GPU-side value equal to the size of the array. Arrayed buffers only.
DefinitionT< CPU > DataBlock
A typedef to CPU version of the data structure.
Definition: vppLangIntUniform.hpp:584
The VPP namespace.
Definition: main.hpp:1
Int Size() const
Returns GPU-side value equal to the size of the array.
ETag
Enumeration type allowing to select the flavor of shader structural type: the CPU or GPU version...
Definition: vppLangAggregates.hpp:42
auto operator[](const Int &index) const
Provides read and write access to specified item.
Represents a sequence of Vulkan commands.
Definition: vppCommandBuffer.hpp:68
Provides shader code access to a binding point for buffer holding array of structures.
Definition: vppLangIntUniform.hpp:919
DataBlock & data()
Allows to access the fields of the data structure.
Binding point class for storage (read-write) data buffer to shaders. Place in your pipeline configura...
Definition: vppLangIntUniform.hpp:333
Int Size() const
Returns GPU-side value equal to the size of the array.
int size() const
Returns CPU-side value equal to the size of the array. Arrayed buffers only.
int size() const
Returns CPU-side value equal to the size of the array.
Currently not implemented.
Definition: vppLangIntUniform.hpp:438
Provides shader code access to a binding point for buffer holding array of simple scalars...
Definition: vppLangIntUniform.hpp:1028
UniformArray(BufferT &buf, int size=0, int stride=0)
Constructs the accessor for given binding point, assuming the buffer is holding an array of structure...
auto operator[](const Int &index) const
Provides read and write access to specified item.
auto operator=(const UniformBufferView &value)
Binds a buffer to the binding point.
UniformFld()
Constructs uninitialized or GPU-side data field.
ioBuffer(std::uint32_t set=0, int binding=-1)
Creates the binding point.
Binding point class for push constant data input to shaders. Place in your pipeline configuration cla...
Definition: vppLangIntUniform.hpp:529
Base class for uniform data structures.
Definition: vppLangIntUniform.hpp:698
auto operator[](MemberT Definition::*pMember) const
Provides read and write access to specified field. Single buffers only.
Provides access to scalar or arrayed buffer binding point from shader code.
Definition: vppLangIntUniform.hpp:857
Template for defining uniform data fields.
Definition: vppLangIntUniform.hpp:749
Binding point class for uniform (read-only) data input to shaders. Place in your pipeline configurati...
Definition: vppLangIntUniform.hpp:136
UniformSimpleArray(BufferT &buf, int size=0, int stride=0)
Constructs accessor for given binding point, assuming the buffer is holding an array of simple items...
inPushConstant()
Constructor. Does not take any arguments.
Shader (GPU-side) data type for 32-bit signed integer values.
Definition: vppLangScalarTypes.hpp:167
int size() const
Returns CPU-side value equal to the size of the array.
auto operator=(const UniformBufferView &value)
Binds a buffer to the binding point.
Definition: vppBufferView.hpp:141
inUniformBuffer(std::uint32_t set=0, int binding=-1)
Creates the binding point.
void cmdPush()
Emits push command to default command buffer.