![]() |
VPP
0.8
A high-level modern C++ API for Vulkan
|
A binding point for read-only texture with predefined (constant) sampler. More...
#include <vppLangIntImages.hpp>
Public Member Functions | |
inConstSampledTexture (const NormalizedSampler &sampler, unsigned int set=0, int binding=-1) | |
Creates the binding point. More... | |
inConstSampledTexture (const UnnormalizedSampler &sampler, unsigned int set=0, int binding=-1) | |
Creates the binding point. More... | |
auto | operator= (const ImageViewT &value) |
Binds an image view to the binding point. More... | |
auto | operator= (bind(const ImageViewT &view, VkImageLayout layout)) |
Binds an image view to the binding point. More... | |
A binding point for read-only texture with predefined (constant) sampler.
For this type of binding point, you specify the sampler directly in the constructor of the binding point object.
This type of binding point has a chance to be more efficient than variants with dynamically assigned samplers.
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::inConstSampledTexture< ImageViewT >::inConstSampledTexture | ( | const NormalizedSampler & | sampler, |
unsigned int | set = 0 , |
||
int | binding = -1 |
||
) |
Creates the binding point.
You must provide valid sampler object. This constructor works with normalized samplers. The sampler is associated with this binding point permanently.
Typically you do not need to specify other 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).
vpp::inConstSampledTexture< ImageViewT >::inConstSampledTexture | ( | const UnnormalizedSampler & | sampler, |
unsigned int | set = 0 , |
||
int | binding = -1 |
||
) |
Creates the binding point.
You must provide valid sampler object. This constructor works with unnormalized samplers. The sampler is associated with this binding point permanently.
Typically you do not need to specify other 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::inConstSampledTexture< ImageViewT >::operator= | ( | const ImageViewT & | value | ) |
Binds an image view 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.
auto vpp::inConstSampledTexture< ImageViewT >::operator= | ( | bind(const ImageViewT &view, VkImageLayout layout) | ) |
Binds an image view to the binding point.
This overload allows to specify the layout the image is in when accessing the binding point. For that purpose, use vpp::bind
construct.