IDevice::createTextureSamplerD - dpw105f18/papago-api GitHub Wiki

Create a 1 dimensional texture sampler

unique_ptr<ISampler> createTextureSampler1D(Filter magFilter, Filter minFilter, TextureWrapMode modeU)

Returns

Returns a unique pointer to an ISampler representing a 1 dimensional texture sampler

Parameters

Parameter Description
magFilter Filter used when the sample rate is larger than the source
minFilter Filter used when the sample rate is smaller than the source
modeU Wrapmode on U axis

Exceptions

Exception Error Code Description
std::system_error -1 out of host memory
std::system_error -2 out of device memory
std::system_error -10 too many objects

Create a 2 dimensional texture sampler

unique_ptr<ISampler> createTextureSampler2D(Filter magFilter, Filter minFilter, TextureWrapMode modeU, TextureWrapMode modeV)

Returns

Returns a unique pointer to an ISampler representing a 2 dimensional texture sampler

Parameters

Parameter Description
magFilter Filter used when the sample rate is larger than the source
minFilter Filter used when the sample rate is smaller than the source
modeU Wrapmode on U axis
modeV Wrapmode on V axis

Exceptions

Exception Error Code Description
std::system_error -1 out of host memory
std::system_error -2 out of device memory
std::system_error -10 too many objects

Create a 3 dimensional texture sampler

unique_ptr<ISampler> createTextureSampler3D(Filter magFilter, Filter minFilter, TextureWrapMode modeU, TextureWrapMode modeV, TextureWrapMode modeW)

Returns

Returns a unique pointer to an ISampler representing a 3 dimensional texture sampler

Parameters

Parameter Description
magFilter Filter used when the sample rate is larger than the source
minFilter Filter used when the sample rate is smaller than the source
modeU Wrapmode on U axis
modeV Wrapmode on V axis
modeW Wrapmode on W axis

Exceptions

Exception Error Code Description
std::system_error -1 out of host memory
std::system_error -2 out of device memory
std::system_error -10 too many objects

Example with all samplers

#include <vector>
#include "idevice.hpp"

struct vec2
{
   float x, y;
};

int main()
{
   /*
  setup code omitted
  */

   //Examples of how to make 1, 2 and 3D texture samplers. They are later used to read from an image.
   auto sampler1D = device->createTextureSampler1D(Filter::eLinear, Filter::eLinear, TextureWrapMode::eMirroredRepeat);
   auto sampler2D = device->createTextureSampler2D(Filter::eLinear, Filter::eLinear, TextureWrapMode::eMirroredRepeat, TextureWrapMode::eMirrorClampToEdge);
   auto sampler3D = device->createTextureSampler3D(Filter::eLinear, Filter::eLinear, TextureWrapMode::eMirroredRepeat, TextureWrapMode::eMirrorClampToEdge, TextureWrapMode::eMirroredRepeat);
}
⚠️ **GitHub.com Fallback** ⚠️