Enumerationmigueldeicaza.swiftgodot 0.46.0SwiftGodot
SamplerFilter
RenderingDevice.swift:1027enum SamplerFilter
Cases
case nearest
Nearest-neighbor sampler filtering. Sampling at higher resolutions than the source will result in a pixelated look.
case linear
Bilinear sampler filtering. Sampling at higher resolutions than the source will result in a blurry look.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (132) members.
Types
struct BarrierMask
enum BlendFactor
enum BlendOperation
enum CompareOperator
enum DataFormat
enum DeviceType
enum DriverResource
enum FinalAction
enum IndexBufferFormat
enum InitialAction
enum Limit
enum LogicOperation
enum MemoryType
struct PipelineDynamicStateFlags
enum PipelineSpecializationConstantType
enum PolygonCullMode
enum PolygonFrontFace
enum RenderPrimitive
enum SamplerBorderColor
enum SamplerRepeatMode
enum ShaderLanguage
enum ShaderStage
enum StencilOperation
struct StorageBufferUsage
enum TextureSamples
enum TextureSliceType
enum TextureSwizzle
enum TextureType
struct TextureUsageBits
enum UniformType
enum VertexFrequency
Type members
static let invalidFormatId: Int
Returned by functions that return a format ID if a value is invalid.
static let invalidId: Int
Returned by functions that return an ID if a value is invalid.
class var godotClassName: StringName
Instance members
func barrier(from: RenderingDevice.BarrierMask, to: RenderingDevice.BarrierMask
) This method does nothing.
func bufferClear(buffer: RID, offset: UInt32, sizeBytes: UInt32
) -> GodotError Clears the contents of the
buffer
, clearingsizeBytes
bytes, starting atoffset
.func bufferCopy(srcBuffer: RID, dstBuffer: RID, srcOffset: UInt32, dstOffset: UInt32, size: UInt32
) -> GodotError Copies
size
bytes from thesrcBuffer
atsrcOffset
intodstBuffer
atdstOffset
.func bufferGetData(buffer: RID, offsetBytes: UInt32, sizeBytes: UInt32
) -> PackedByteArray Returns a copy of the data of the specified
buffer
, optionallyoffsetBytes
andsizeBytes
can be set to copy only a portion of the buffer.func bufferUpdate(buffer: RID, offset: UInt32, sizeBytes: UInt32, data: PackedByteArray
) -> GodotError Updates a region of
sizeBytes
bytes, starting atoffset
, in the buffer, with the specifieddata
.func captureTimestamp(name: String
) Creates a timestamp marker with the specified
name
. This is used for performance reporting with thegetCapturedTimestampCpuTime(index:)
,getCapturedTimestampGpuTime(index:)
andgetCapturedTimestampName(index:)
methods.func computeListAddBarrier(computeList: Int
) Raises a Vulkan compute barrier in the specified
computeList
.func computeListBegin(
) -> Int Starts a list of compute commands created with the
compute_*
methods. The returned value should be passed to othercompute_list_*
functions.func computeListBindComputePipeline(computeList: Int, computePipeline: RID
) Tells the GPU what compute pipeline to use when processing the compute list. If the shader has changed since the last time this function was called, Godot will unbind all descriptor sets and will re-bind them inside
computeListDispatch(computeList:xGroups:yGroups:zGroups:)
.func computeListBindUniformSet(computeList: Int, uniformSet: RID, setIndex: UInt32
) Binds the
uniformSet
to thiscomputeList
. Godot ensures that all textures in the uniform set have the correct Vulkan access masks. If Godot had to change access masks of textures, it will raise a Vulkan image memory barrier.func computeListDispatch(computeList: Int, xGroups: UInt32, yGroups: UInt32, zGroups: UInt32
) Submits the compute list for processing on the GPU. This is the compute equivalent to
drawListDraw(drawList:useIndices:instances:proceduralVertexCount:)
.func computeListDispatchIndirect(computeList: Int, buffer: RID, offset: UInt32
) Submits the compute list for processing on the GPU with the given group counts stored in the
buffer
atoffset
. Buffer must have been created with .dispatchIndirect flag.func computeListEnd(
) Finishes a list of compute commands created with the
compute_*
methods.func computeListSetPushConstant(computeList: Int, buffer: PackedByteArray, sizeBytes: UInt32
) Sets the push constant data to
buffer
for the specifiedcomputeList
. The shader determines how this binary data is used. The buffer’s size in bytes must also be specified insizeBytes
(this can be obtained by calling thesize
method on the passedbuffer
).func computePipelineCreate(shader: RID, specializationConstants: ObjectCollection<RDPipelineSpecializationConstant>
) -> RID Creates a new compute pipeline. It can be accessed with the RID that is returned.
func computePipelineIsValid(computePipeline: RID
) -> Bool Returns
true
if the compute pipeline specified by thecomputePipeline
RID is valid,false
otherwise.func createLocalDevice(
) -> RenderingDevice? Create a new local
RenderingDevice
. This is most useful for performing compute operations on the GPU independently from the rest of the engine.func drawCommandBeginLabel(name: String, color: Color
) Create a command buffer debug label region that can be displayed in third-party tools such as RenderDoc. All regions must be ended with a
drawCommandEndLabel
call. When viewed from the linear series of submissions to a single queue, calls todrawCommandBeginLabel(name:color:)
anddrawCommandEndLabel
must be matched and balanced.func drawCommandEndLabel(
) Ends the command buffer debug label region started by a
drawCommandBeginLabel(name:color:)
call.func drawCommandInsertLabel(name: String, color: Color
) This method does nothing.
func drawListBegin(framebuffer: RID, initialColorAction: RenderingDevice.InitialAction, finalColorAction: RenderingDevice.FinalAction, initialDepthAction: RenderingDevice.InitialAction, finalDepthAction: RenderingDevice.FinalAction, clearColorValues: PackedColorArray, clearDepth: Double, clearStencil: UInt32, region: Rect2
) -> Int Starts a list of raster drawing commands created with the
draw_*
methods. The returned value should be passed to otherdraw_list_*
functions.func drawListBeginForScreen(Int32, clearColor: Color
) -> Int High-level variant of
drawListBegin(framebuffer:initialColorAction:finalColorAction:initialDepthAction:finalDepthAction:clearColorValues:clearDepth:clearStencil:region:)
, with the parameters automatically being adjusted for drawing onto the window specified by thescreen
ID.func drawListBeginSplit(framebuffer: RID, splits: UInt32, initialColorAction: RenderingDevice.InitialAction, finalColorAction: RenderingDevice.FinalAction, initialDepthAction: RenderingDevice.InitialAction, finalDepthAction: RenderingDevice.FinalAction, clearColorValues: PackedColorArray, clearDepth: Double, clearStencil: UInt32, region: Rect2, storageTextures: VariantCollection<RID>
) -> PackedInt64Array This method does nothing and always returns an empty
PackedInt64Array
.func drawListBindIndexArray(drawList: Int, indexArray: RID
) Binds
indexArray
to the specifieddrawList
.func drawListBindRenderPipeline(drawList: Int, renderPipeline: RID
) Binds
renderPipeline
to the specifieddrawList
.func drawListBindUniformSet(drawList: Int, uniformSet: RID, setIndex: UInt32
) Binds
uniformSet
to the specifieddrawList
. AsetIndex
must also be specified, which is an identifier starting from0
that must match the one expected by the draw list.func drawListBindVertexArray(drawList: Int, vertexArray: RID
) Binds
vertexArray
to the specifieddrawList
.func drawListDisableScissor(drawList: Int
) Removes and disables the scissor rectangle for the specified
drawList
. See alsodrawListEnableScissor(drawList:rect:)
.func drawListDraw(drawList: Int, useIndices: Bool, instances: UInt32, proceduralVertexCount: UInt32
) Submits
drawList
for rendering on the GPU. This is the raster equivalent tocomputeListDispatch(computeList:xGroups:yGroups:zGroups:)
.func drawListEnableScissor(drawList: Int, rect: Rect2
) Creates a scissor rectangle and enables it for the specified
drawList
. Scissor rectangles are used for clipping by discarding fragments that fall outside a specified rectangular portion of the screen. See alsodrawListDisableScissor(drawList:)
.func drawListEnd(
) Finishes a list of raster drawing commands created with the
draw_*
methods.func drawListSetBlendConstants(drawList: Int, color: Color
) Sets blend constants for the specified
drawList
tocolor
. Blend constants are used only if the graphics pipeline is created with .dynamicStateBlendConstants flag set.func drawListSetPushConstant(drawList: Int, buffer: PackedByteArray, sizeBytes: UInt32
) Sets the push constant data to
buffer
for the specifieddrawList
. The shader determines how this binary data is used. The buffer’s size in bytes must also be specified insizeBytes
(this can be obtained by calling thesize
method on the passedbuffer
).func drawListSwitchToNextPass(
) -> Int Switches to the next draw pass.
func drawListSwitchToNextPassSplit(splits: UInt32
) -> PackedInt64Array This method does nothing and always returns an empty
PackedInt64Array
.func framebufferCreate(textures: VariantCollection<RID>, validateWithFormat: Int, viewCount: UInt32
) -> RID Creates a new framebuffer. It can be accessed with the RID that is returned.
func framebufferCreateEmpty(size: Vector2i, samples: RenderingDevice.TextureSamples, validateWithFormat: Int
) -> RID Creates a new empty framebuffer. It can be accessed with the RID that is returned.
func framebufferCreateMultipass(textures: VariantCollection<RID>, passes: ObjectCollection<RDFramebufferPass>, validateWithFormat: Int, viewCount: UInt32
) -> RID Creates a new multipass framebuffer. It can be accessed with the RID that is returned.
func framebufferFormatCreate(attachments: ObjectCollection<RDAttachmentFormat>, viewCount: UInt32
) -> Int Creates a new framebuffer format with the specified
attachments
andviewCount
. Returns the new framebuffer’s unique framebuffer format ID.func framebufferFormatCreateEmpty(samples: RenderingDevice.TextureSamples
) -> Int Creates a new empty framebuffer format with the specified number of
samples
and returns its ID.func framebufferFormatCreateMultipass(attachments: ObjectCollection<RDAttachmentFormat>, passes: ObjectCollection<RDFramebufferPass>, viewCount: UInt32
) -> Int Creates a multipass framebuffer format with the specified
attachments
,passes
andviewCount
and returns its ID. IfviewCount
is greater than or equal to2
, enables multiview which is used for VR rendering. This requires support for the Vulkan multiview extension.func framebufferFormatGetTextureSamples(format: Int, renderPass: UInt32
) -> RenderingDevice.TextureSamples Returns the number of texture samples used for the given framebuffer
format
ID (returned byframebufferGetFormat(framebuffer:)
).func framebufferGetFormat(framebuffer: RID
) -> Int Returns the format ID of the framebuffer specified by the
framebuffer
RID. This ID is guaranteed to be unique for the same formats and does not need to be freed.func framebufferIsValid(framebuffer: RID
) -> Bool Returns
true
if the framebuffer specified by theframebuffer
RID is valid,false
otherwise.func freeRid(RID
) Tries to free an object in the RenderingDevice. To avoid memory leaks, this should be called after using an object as memory management does not occur automatically when using RenderingDevice directly.
func fullBarrier(
) This method does nothing.
func getCapturedTimestampCpuTime(index: UInt32
) -> UInt Returns the timestamp in CPU time for the rendering step specified by
index
(in microseconds since the engine started). See alsogetCapturedTimestampGpuTime(index:)
andcaptureTimestamp(name:)
.func getCapturedTimestampGpuTime(index: UInt32
) -> UInt Returns the timestamp in GPU time for the rendering step specified by
index
(in microseconds since the engine started). See alsogetCapturedTimestampCpuTime(index:)
andcaptureTimestamp(name:)
.func getCapturedTimestampName(index: UInt32
) -> String Returns the timestamp’s name for the rendering step specified by
index
. See alsocaptureTimestamp(name:)
.func getCapturedTimestampsCount(
) -> UInt32 Returns the total number of timestamps (rendering steps) available for profiling.
func getCapturedTimestampsFrame(
) -> UInt Returns the index of the last frame rendered that has rendering timestamps available for querying.
func getDeviceName(
) -> String Returns the name of the video adapter (e.g. “GeForce GTX 1080/PCIe/SSE2”). Equivalent to
getVideoAdapterName
. See alsogetDeviceVendorName
.func getDevicePipelineCacheUuid(
) -> String Returns the universally unique identifier for the pipeline cache. This is used to cache shader files on disk, which avoids shader recompilations on subsequent engine runs. This UUID varies depending on the graphics card model, but also the driver version. Therefore, updating graphics drivers will invalidate the shader cache.
func getDeviceVendorName(
) -> String Returns the vendor of the video adapter (e.g. “NVIDIA Corporation”). Equivalent to
getVideoAdapterVendor
. See alsogetDeviceName
.func getDriverResource(RenderingDevice.DriverResource, rid: RID, index: UInt
) -> UInt Returns the unique identifier of the driver
resource
for the specifiedrid
. Some driver resource types ignore the specifiedrid
(seeDriverResource
descriptions).index
is always ignored but must be specified anyway.func getFrameDelay(
) -> UInt32 Returns the frame count kept by the graphics API. Higher values result in higher input lag, but with more consistent throughput. For the main
RenderingDevice
, frames are cycled (usually 3 with triple-buffered V-Sync enabled). However, localRenderingDevice
s only have 1 frame.func getMemoryUsage(type: RenderingDevice.MemoryType
) -> UInt Returns the memory usage in bytes corresponding to the given
type
. When using Vulkan, these statistics are calculated by Vulkan Memory Allocator.func indexArrayCreate(indexBuffer: RID, indexOffset: UInt32, indexCount: UInt32
) -> RID Creates a new index array. It can be accessed with the RID that is returned.
func indexBufferCreate(sizeIndices: UInt32, format: RenderingDevice.IndexBufferFormat, data: PackedByteArray, useRestartIndices: Bool
) -> RID Creates a new index buffer. It can be accessed with the RID that is returned.
func limitGet(limit: RenderingDevice.Limit
) -> UInt Returns the value of the specified
limit
. This limit varies depending on the current graphics hardware (and sometimes the driver version). If the given limit is exceeded, rendering errors will occur.func renderPipelineCreate(shader: RID, framebufferFormat: Int, vertexFormat: Int, primitive: RenderingDevice.RenderPrimitive, rasterizationState: RDPipelineRasterizationState?, multisampleState: RDPipelineMultisampleState?, stencilState: RDPipelineDepthStencilState?, colorBlendState: RDPipelineColorBlendState?, dynamicStateFlags: RenderingDevice.PipelineDynamicStateFlags, forRenderPass: UInt32, specializationConstants: ObjectCollection<RDPipelineSpecializationConstant>
) -> RID Creates a new render pipeline. It can be accessed with the RID that is returned.
func renderPipelineIsValid(renderPipeline: RID
) -> Bool Returns
true
if the render pipeline specified by therenderPipeline
RID is valid,false
otherwise.func samplerCreate(state: RDSamplerState?
) -> RID Creates a new sampler. It can be accessed with the RID that is returned.
func samplerIsFormatSupportedForFilter(format: RenderingDevice.DataFormat, samplerFilter: RenderingDevice.SamplerFilter
) -> Bool Returns
true
if implementation supports using a texture offormat
with the givensamplerFilter
.func screenGetFramebufferFormat(screen: Int32
) -> Int Returns the framebuffer format of the given screen.
func screenGetHeight(screen: Int32
) -> Int32 Returns the window height matching the graphics API context for the given window ID (in pixels). Despite the parameter being named
screen
, this returns the window size. See alsoscreenGetWidth(screen:)
.func screenGetWidth(screen: Int32
) -> Int32 Returns the window width matching the graphics API context for the given window ID (in pixels). Despite the parameter being named
screen
, this returns the window size. See alsoscreenGetHeight(screen:)
.func setResourceName(id: RID, name: String
) Sets the resource name for
id
toname
. This is used for debugging with third-party tools such as RenderDoc.func shaderCompileBinaryFromSpirv(spirvData: RDShaderSPIRV?, name: String
) -> PackedByteArray Compiles a binary shader from
spirvData
and returns the compiled binary data as aPackedByteArray
. This compiled shader is specific to the GPU model and driver version used; it will not work on different GPU models or even different driver versions. See alsoshaderCompileSpirvFromSource(shaderSource:allowCache:)
.func shaderCompileSpirvFromSource(shaderSource: RDShaderSource?, allowCache: Bool
) -> RDShaderSPIRV? Compiles a SPIR-V from the shader source code in
shaderSource
and returns the SPIR-V as aRDShaderSPIRV
. This intermediate language shader is portable across different GPU models and driver versions, but cannot be run directly by GPUs until compiled into a binary shader usingshaderCompileBinaryFromSpirv(spirvData:name:)
.func shaderCreateFromBytecode(binaryData: PackedByteArray, placeholderRid: RID
) -> RID Creates a new shader instance from a binary compiled shader. It can be accessed with the RID that is returned.
func shaderCreateFromSpirv(spirvData: RDShaderSPIRV?, name: String
) -> RID Creates a new shader instance from SPIR-V intermediate code. It can be accessed with the RID that is returned.
func shaderCreatePlaceholder(
) -> RID Create a placeholder RID by allocating an RID without initializing it for use in
shaderCreateFromBytecode(binaryData:placeholderRid:)
. This allows you to create an RID for a shader and pass it around, but defer compiling the shader to a later time.func shaderGetVertexInputAttributeMask(shader: RID
) -> UInt Returns the internal vertex input mask. Internally, the vertex input mask is an unsigned integer consisting of the locations (specified in GLSL via.
layout(location = ...)
) of the input variables (specified in GLSL by thein
keyword).func storageBufferCreate(sizeBytes: UInt32, data: PackedByteArray, usage: RenderingDevice.StorageBufferUsage
) -> RID Creates a storage buffer with the specified
data
andusage
. It can be accessed with the RID that is returned.func submit(
) Pushes the frame setup and draw command buffers then marks the local device as currently processing (which allows calling
sync
).func sync(
) Forces a synchronization between the CPU and GPU, which may be required in certain cases. Only call this when needed, as CPU-GPU synchronization has a performance cost.
func textureBufferCreate(sizeBytes: UInt32, format: RenderingDevice.DataFormat, data: PackedByteArray
) -> RID Creates a new texture buffer. It can be accessed with the RID that is returned.
func textureClear(texture: RID, color: Color, baseMipmap: UInt32, mipmapCount: UInt32, baseLayer: UInt32, layerCount: UInt32
) -> GodotError Clears the specified
texture
by replacing all of its pixels with the specifiedcolor
.baseMipmap
andmipmapCount
determine which mipmaps of the texture are affected by this clear operation, whilebaseLayer
andlayerCount
determine which layers of a 3D texture (or texture array) are affected by this clear operation. For 2D textures (which only have one layer by design),baseLayer
must be0
andlayerCount
must be1
.func textureCopy(fromTexture: RID, toTexture: RID, fromPos: Vector3, toPos: Vector3, size: Vector3, srcMipmap: UInt32, dstMipmap: UInt32, srcLayer: UInt32, dstLayer: UInt32
) -> GodotError Copies the
fromTexture
totoTexture
with the specifiedfromPos
,toPos
andsize
coordinates. The Z axis of thefromPos
,toPos
andsize
must be0
for 2-dimensional textures. Source and destination mipmaps/layers must also be specified, with these parameters being0
for textures without mipmaps or single-layer textures. Returns@GlobalScope.OK
if the texture copy was successful or@GlobalScope.ERR_INVALID_PARAMETER
otherwise.func textureCreate(format: RDTextureFormat?, view: RDTextureView?, data: VariantCollection<PackedByteArray>
) -> RID Creates a new texture. It can be accessed with the RID that is returned.
func textureCreateFromExtension(type: RenderingDevice.TextureType, format: RenderingDevice.DataFormat, samples: RenderingDevice.TextureSamples, usageFlags: RenderingDevice.TextureUsageBits, image: UInt, width: UInt, height: UInt, depth: UInt, layers: UInt
) -> RID Returns an RID for an existing
image
(VkImage
) with the giventype
,format
,samples
,usageFlags
,width
,height
,depth
, andlayers
. This can be used to allow Godot to render onto foreign images.func textureGetData(texture: RID, layer: UInt32
) -> PackedByteArray Returns the
texture
data for the specifiedlayer
as raw binary data. For 2D textures (which only have one layer),layer
must be0
.func textureGetFormat(texture: RID
) -> RDTextureFormat? Returns the data format used to create this texture.
func textureGetNativeHandle(texture: RID
) -> UInt Returns the internal graphics handle for this texture object. For use when communicating with third-party APIs mostly with GDExtension.
func textureIsFormatSupportedForUsage(format: RenderingDevice.DataFormat, usageFlags: RenderingDevice.TextureUsageBits
) -> Bool Returns
true
if the specifiedformat
is supported for the givenusageFlags
,false
otherwise.func textureIsValid(texture: RID
) -> Bool Returns
true
if thetexture
is valid,false
otherwise.func textureResolveMultisample(fromTexture: RID, toTexture: RID
) -> GodotError Resolves the
fromTexture
texture ontotoTexture
with multisample antialiasing enabled. This must be used when rendering a framebuffer for MSAA to work. Returns@GlobalScope.OK
if successful,@GlobalScope.ERR_INVALID_PARAMETER
otherwise.func textureUpdate(texture: RID, layer: UInt32, data: PackedByteArray
) -> GodotError Updates texture data with new data, replacing the previous data in place. The updated texture data must have the same dimensions and format. For 2D textures (which only have one layer),
layer
must be0
. Returns@GlobalScope.OK
if the update was successful,@GlobalScope.ERR_INVALID_PARAMETER
otherwise.func uniformBufferCreate(sizeBytes: UInt32, data: PackedByteArray
) -> RID Creates a new uniform buffer. It can be accessed with the RID that is returned.
func uniformSetCreate(uniforms: ObjectCollection<RDUniform>, shader: RID, shaderSet: UInt32
) -> RID Creates a new uniform set. It can be accessed with the RID that is returned.
func uniformSetIsValid(uniformSet: RID
) -> Bool Checks if the
uniformSet
is valid, i.e. is owned.func vertexArrayCreate(vertexCount: UInt32, vertexFormat: Int, srcBuffers: VariantCollection<RID>, offsets: PackedInt64Array
) -> RID Creates a vertex array based on the specified buffers. Optionally,
offsets
(in bytes) may be defined for each buffer.func vertexBufferCreate(sizeBytes: UInt32, data: PackedByteArray, useAsStorage: Bool
) -> RID It can be accessed with the RID that is returned.
func vertexFormatCreate(vertexDescriptions: ObjectCollection<RDVertexAttribute>
) -> Int Creates a new vertex format with the specified
vertexDescriptions
. Returns a unique vertex format ID corresponding to the newly created vertex format.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.