![]() |
VPP
0.7
A high-level modern C++ API for Vulkan
|
A binding point for read-only texture with associated sampler. More...
#include <vppLangIntImages.hpp>
Public Member Functions | |
inSampledTexture (unsigned int set=0, int binding=-1) | |
Creates the binding point. More... | |
auto | operator= (vpp::bind(const ImageViewT &view, const NormalizedSampler &sampler)) |
Binds an image view and normalized sampler to the binding point. More... | |
auto | operator= (vpp::bind(const ImageViewT &view, const UnnormalizedSampler &sampler)) |
Binds an image view and unnormalized sampler to the binding point. More... | |
auto | operator= (vpp::bind(const ImageViewT &view, const NormalizedSampler &sampler, VkImageLayout layout)) |
Binds an image view and normalized sampler to the binding point. More... | |
auto | operator= (vpp::bind(const ImageViewT &view, const UnnormalizedSampler &sampler, VkImageLayout layout)) |
Binds an image view and unnormalized sampler to the binding point. More... | |
A binding point for read-only texture with associated sampler.
Note that for this type of binding point you must use bind() function in order to bind an image and sampler simultaneously. An example:
The binding point template is parameterized by the view type. In order to construct the proper type to be used as an argument here, you need to do two things.
The first thing is to define an image format. The recommended way is to make a typedef of vpp::format< ... > template. For example:
However, in case of textures the format is often not known at compile time (especially when the texture is in compressed format). In such case, use the special vpp::texture_format tag:
The difference is that you should provide format code at runtime to the image constructor. Otherwise VPP will create an image of unknown format, which may (or may not) be supported by the device.
Having defined the format type, declare view type as follows:
Now you can use these types as follows:
This binding point can be used in the following image functions: ExtractSampledTexture(), ImageSize(), TextureSize(), ImageQuerySamples(), ImageQueryLevels(), TextureQueryLod(), TexelFetch(), TexelFetchLod(), TexelFetchOffset(), Texture(), TextureLod(), TextureProj(), TextureLodProj(), TextureDref(), TextureLodDref(), TextureProjDref(), TextureLodProjDref(), TextureGather(), TextureGatherDref().
vpp::inSampledTexture< ImageViewT >::inSampledTexture | ( | unsigned int | set = 0 , |
int | binding = -1 |
||
) |
Creates the binding point.
Typically you do not need to specify any arguments for the constructor.
Optionally you can force the set and binding index. This feature may be useful if you need to interface VPP binding point with externally supplied shader (written in GLSL and compiled externally to SPIR-V blob).
auto vpp::inSampledTexture< ImageViewT >::operator= | ( | vpp::bind(const ImageViewT &view, const NormalizedSampler &sampler) | ) |
Binds an image view and normalized sampler to the binding point.
This operator returns a value that must be passed to ShaderDataBlock::update() method. You can also make a list of more assignments, joining them with comma operator. The update method accepts such a list.
The binding is stored inside ShaderDataBlock instance, immediately when update
is called. You select active ShaderDataBlock in your drawing command sequence by calling ShaderDataBlock::cmdBind(). Thus, actual resource binding (to the pipeline) occurs at command execution time, simultaneously for all bindings in that ShaderDataBlock instance.
This overload assumes the image is in VK_IMAGE_LAYOUT_GENERAL layout.
Use vpp::bind
construct to provide both image and sampler.
auto vpp::inSampledTexture< ImageViewT >::operator= | ( | vpp::bind(const ImageViewT &view, const UnnormalizedSampler &sampler) | ) |
Binds an image view and unnormalized sampler to the binding point.
This overload assumes the image is in VK_IMAGE_LAYOUT_GENERAL layout.
Use vpp::bind
construct to provide both image and sampler.
auto vpp::inSampledTexture< ImageViewT >::operator= | ( | vpp::bind(const ImageViewT &view, const NormalizedSampler &sampler, VkImageLayout layout) | ) |
Binds an image view and normalized sampler to the binding point.
This overload allows to specify the layout the image is in when accessing the binding point.
Use vpp::bind
construct to provide image, sampler and layout.
auto vpp::inSampledTexture< ImageViewT >::operator= | ( | vpp::bind(const ImageViewT &view, const UnnormalizedSampler &sampler, VkImageLayout layout) | ) |
Binds an image view and unnormalized sampler to the binding point.
This overload allows to specify the layout the image is in when accessing the binding point.
Use vpp::bind
construct to provide image, sampler and layout.