SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::GPUTexture Class Reference

An opaque handle representing a texture. More...

Public Member Functions

constexpr GPUTexture (GPUTextureRaw gPUTexture={})
 Wraps GPUTexture. More...
 
 GPUTexture (GPUDeviceParam device, const GPUTextureCreateInfo &createinfo)
 Creates a texture object to be used in graphics or compute workflows. More...
 
constexpr bool operator== (const GPUTexture &other) const =default
 Default comparison operator.
 
constexpr bool operator== (GPUTextureRaw gPUTexture) const
 Compares with the underlying type.
 
constexpr operator GPUTextureRaw () const
 Unwraps to the underlying GPUTexture. More...
 

Detailed Description

Since
This struct is available since SDL 3.2.0.
See also
GPUTexture.GPUTexture
GPUCopyPass.UploadToTexture
GPUCopyPass.DownloadFromTexture
GPUCopyPass.CopyTextureToTexture
GPURenderPass.BindVertexSamplers
GPURenderPass.BindVertexStorageTextures
GPURenderPass.BindFragmentSamplers
GPURenderPass.BindFragmentStorageTextures
GPUComputePass.BindStorageTextures
GPUCommandBuffer.GenerateMipmapsForTexture
GPUCommandBuffer.BlitTexture
GPUDevice.ReleaseTexture

Constructor & Destructor Documentation

◆ GPUTexture() [1/2]

constexpr SDL::GPUTexture::GPUTexture ( GPUTextureRaw  gPUTexture = {})
inlineconstexpr
Parameters
gPUTexturethe value to be wrapped

◆ GPUTexture() [2/2]

SDL::GPUTexture::GPUTexture ( GPUDeviceParam  device,
const GPUTextureCreateInfo createinfo 
)
inline

The contents of this texture are undefined until data is written to the texture.

Note that certain combinations of usage flags are invalid. For example, a texture cannot have both the SAMPLER and GRAPHICS_STORAGE_READ flags.

If you request a sample count higher than the hardware supports, the implementation will automatically fall back to the highest available sample count.

There are optional properties that can be provided through GPUTextureCreateInfo's props. These are the supported properties:

  • prop::GPUTexture.CREATE_D3D12_CLEAR_R_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture to a color with this red intensity. Defaults to zero.
  • prop::GPUTexture.CREATE_D3D12_CLEAR_G_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture to a color with this green intensity. Defaults to zero.
  • prop::GPUTexture.CREATE_D3D12_CLEAR_B_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture to a color with this blue intensity. Defaults to zero.
  • prop::GPUTexture.CREATE_D3D12_CLEAR_A_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture to a color with this alpha intensity. Defaults to zero.
  • prop::GPUTexture.CREATE_D3D12_CLEAR_DEPTH_FLOAT: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, clear the texture to a depth of this value. Defaults to zero.
  • prop::GPUTexture.CREATE_D3D12_CLEAR_STENCIL_NUMBER: (Direct3D 12 only) if the texture usage is GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, clear the texture to a stencil of this Uint8 value. Defaults to zero.
  • prop::GPUTexture.CREATE_NAME_STRING: a name that can be displayed in debugging tools.
Parameters
devicea GPU Context.
createinfoa struct describing the state of the texture to create.
Postcondition
a texture object on success.
Exceptions
Erroron failure.
Since
This function is available since SDL 3.2.0.
See also
GPUCopyPass.UploadToTexture
GPUCopyPass.DownloadFromTexture
GPURenderPass.BindVertexSamplers
GPURenderPass.BindVertexStorageTextures
GPURenderPass.BindFragmentSamplers
GPURenderPass.BindFragmentStorageTextures
GPUComputePass.BindStorageTextures
GPUCommandBuffer.BlitTexture
GPUDevice.ReleaseTexture
GPUDevice.TextureSupportsFormat

Member Function Documentation

◆ operator GPUTextureRaw()

constexpr SDL::GPUTexture::operator GPUTextureRaw ( ) const
inlineconstexpr
Returns
the underlying GPUTextureRaw.

The documentation for this class was generated from the following file: