VPP  0.7
A high-level modern C++ API for Vulkan
vppLangIntImages.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 
91 template< class ImageViewT, unsigned int MEMFLAGS = 0 >
92 class ioImage
93 {
94 public:
104  ioImage ( unsigned int set = 0, int binding = -1 );
105 
120  auto operator= ( const ImageViewT& view );
121 
129  auto operator= ( bind ( const ImageViewT& view, VkImageLayout layout ) );
130 
139  typedef <implementation_defined> scalar_type;
140 
149  typedef <implementation_defined> pointer_coord_type;
150 
159  const pointer_coord_type& coords );
160 
171  const pointer_coord_type& coords,
172  const Int& nSample );
173 };
174 
175 // -----------------------------------------------------------------------------
189 template< class SamplerT >
191 {
192 public:
202  inSampler ( unsigned int set = 0, int binding = -1 );
203 
220  auto operator= ( const SamplerT& value );
221 };
222 
223 // -----------------------------------------------------------------------------
236 template< class SamplerT >
238 {
239 public:
250  inConstSampler ( const SamplerT& sampler, unsigned int set = 0, int binding = -1 );
251 };
252 
253 // -----------------------------------------------------------------------------
330 template< class ImageViewT >
332 {
333 public:
343  inTexture ( unsigned int set = 0, int binding = -1 );
344 
360  auto operator= ( const ImageViewT& value );
361 
369  auto operator= ( vpp::bind ( const ImageViewT& view, VkImageLayout layout ) );
370 };
371 
372 // -----------------------------------------------------------------------------
461 template< class ImageViewT >
463 {
464 public:
474  inSampledTexture ( unsigned int set = 0, int binding = -1 );
475 
493  auto operator= ( vpp::bind ( const ImageViewT& view, const NormalizedSampler& sampler ) );
494 
502  auto operator= ( vpp::bind ( const ImageViewT& view, const UnnormalizedSampler& sampler ) );
503 
512  auto operator= ( vpp::bind ( const ImageViewT& view, const NormalizedSampler& sampler, VkImageLayout layout ) );
513 
522  auto operator= ( vpp::bind ( const ImageViewT& view, const UnnormalizedSampler& sampler, VkImageLayout layout ) );
523 };
524 
525 // -----------------------------------------------------------------------------
600 template< class ImageViewT >
602 {
603 public:
618  const NormalizedSampler& sampler,
619  unsigned int set = 0, int binding = -1 );
620 
635  const UnnormalizedSampler& sampler,
636  unsigned int set = 0, int binding = -1 );
637 
654  auto operator= ( const ImageViewT& value );
655 
663  auto operator= ( bind ( const ImageViewT& view, VkImageLayout layout ) );
664 };
665 
666 // -----------------------------------------------------------------------------
676 template< class FormatT >
678 {
679 public:
689  inTextureBuffer ( unsigned int set = 0, int binding = -1 )
690 
691 
705  auto operator= ( const TexelBufferView< FormatT, Buf::UNITEX >& value );
706 };
707 
708 // -----------------------------------------------------------------------------
716 template< class FormatT >
718 {
719 public:
729  ioImageBuffer ( unsigned int set = 0, int binding = -1 );
730 
746 };
747 
748 // -----------------------------------------------------------------------------
865 template< class ImageViewT, unsigned int COUNT = 1 >
867 {
868 public:
869  typedef typename ImageViewT::format_type format_type;
870  typedef TImageBinding< ImageViewT > assignment_type;
871 
883  inAttachment (
884  const Attachment< format_type >& attachmentNode,
885  unsigned int set = 0,
886  int binding = -1 );
887 
904  auto operator= ( const ImageViewT& view );
905 
914  auto operator= ( bind ( const ImageViewT& view, VkImageLayout layout ) )
915 };
916 
917 // -----------------------------------------------------------------------------
991 template< class FormatT >
993 {
1011  typedef <implementation_defined> rvalue_type;
1012 
1020  outAttachment ( const Attachment< FormatT >& attachmentNode );
1021 
1029  outAttachment ( const Display& attachmentNode );
1030 
1040  void operator= ( const rvalue_type& value );
1041 
1053  void assign ( const rvalue_type& value, int index = 0 );
1054 };
1055 
1056 // -----------------------------------------------------------------------------
1057 // -----------------------------------------------------------------------------
1096 template< class BufferT >
1098 {
1107  TexelArray ( const BufferT& buf );
1108 
1117  auto operator[]( const Int& index ) const;
1118 
1124  Int Size() const;
1125 };
1126 
1127 // -----------------------------------------------------------------------------
1128 } // namespace vpp
1129 // -----------------------------------------------------------------------------
ioImage(unsigned int set=0, int binding=-1)
Creates the binding point.
auto operator[](const Int &index) const
Provides read and write access to specified item.
auto operator=(const SamplerT &value)
Binds a sampler object to the binding point.
Static sampler binding point.
Definition: vppLangIntImages.hpp:237
inConstSampler(const SamplerT &sampler, unsigned int set=0, int binding=-1)
Creates the binding point.
Output attachment binding point.
Definition: vppLangIntImages.hpp:992
typedef< implementation_defined > rvalue_type
The type of the pixel color value.
Definition: vppLangIntImages.hpp:1011
inAttachment(const Attachment< format_type > &attachmentNode, unsigned int set=0, int binding=-1)
Creates the binding point.
TexelArray(const BufferT &buf)
Constructs accessor for given texel buffer binding point.
void assign(const rvalue_type &value, int index=0)
Writes output color value to the attachment.
inSampler(unsigned int set=0, int binding=-1)
Creates the binding point.
typedef< implementation_defined > scalar_type
The type of the atomic variable which can be stored in the image.
Definition: vppLangIntImages.hpp:139
inTextureBuffer(unsigned int set=0, int binding=-1) auto operator
Creates the binding point.
ioImageBuffer(unsigned int set=0, int binding=-1)
Creates the binding point.
The VPP namespace.
Definition: main.hpp:1
Represents attachment graph node.
Definition: vppRenderGraphNodes.hpp:74
auto operator=(const ImageViewT &value)
Binds an image view to the binding point.
Pointer< scalar_type > GetPointer(const pointer_coord_type &coords)
Creates a pointer to specified texel within the image.
Input attachment binding point.
Definition: vppLangIntImages.hpp:866
Sampler binding point.
Definition: vppLangIntImages.hpp:190
inSampledTexture(unsigned int set=0, int binding=-1)
Creates the binding point.
auto operator=(const ImageViewT &value)
Binds an image view to the binding point.
Storage (read-write) image binding point.
Definition: vppLangIntImages.hpp:92
Shader (GPU-side) data type for pointers to mutable variables.
Definition: vppLangScalarTypes.hpp:642
void operator=(const rvalue_type &value)
Writes output color value to the attachment.
auto bind(const ImageView< AttributesT > &view, VkImageLayout layout=VK_IMAGE_LAYOUT_UNDEFINED)
Helper function to bind specified image view to a binding point in a pipeline.
auto operator=(const ImageViewT &view)
Binds an image view to the binding point.
Int Size() const
Returns GPU-side value equal to the size of the array.
Texture sampler object (normalized).
Definition: vppSampler.hpp:375
A binding point for read-only texture with predefined (constant) sampler.
Definition: vppLangIntImages.hpp:601
Represents display attachment graph node.
Definition: vppRenderGraphNodes.hpp:160
auto operator=(const ImageViewT &view)
Binds an image view to the binding point.
Texture (read-only) image binding point.
Definition: vppLangIntImages.hpp:331
inTexture(unsigned int set=0, int binding=-1)
Creates the binding point.
Shader (GPU-side) data type for 32-bit signed integer values.
Definition: vppLangScalarTypes.hpp:167
auto operator=(vpp::bind(const ImageViewT &view, const NormalizedSampler &sampler))
Binds an image view and normalized sampler to the binding point.
auto operator=(const TexelBufferView< FormatT, Buf::STORTEX > &value)
Binds a buffer view to the binding point.
A binding point for read-only texture with associated sampler.
Definition: vppLangIntImages.hpp:462
Buffer view for texel buffers.
Definition: vppBufferView.hpp:52
Storage (read-write) texel buffer binding point.
Definition: vppLangIntImages.hpp:717
outAttachment(const Attachment< FormatT > &attachmentNode)
Creates the binding point.
Uniform (read-only) texel buffer binding point.
Definition: vppLangIntImages.hpp:677
Texture sampler object (normalized).
Definition: vppSampler.hpp:415
inConstSampledTexture(const NormalizedSampler &sampler, unsigned int set=0, int binding=-1)
Creates the binding point.
typedef< implementation_defined > pointer_coord_type
Type of coordinates within the image used to locate texels for making pointers.
Definition: vppLangIntImages.hpp:149
Provides shader code access to a binding point for a buffer holding array of formatted texels...
Definition: vppLangIntImages.hpp:1097