PipelineSpecializationConstantType
RenderingDevice.swift:1671enum PipelineSpecializationConstantTypeenum PipelineSpecializationConstantTypes10SwiftGodot15RenderingDeviceC34PipelineSpecializationConstantTypeO What are these?8JBOGimport SwiftGodotFramework to write Godot Game Extensions using the Swift Programming Language.
class RenderingDeviceAbstraction for working with modern low-level graphics APIs.
case boolBoolean specialization constant.
case intInteger specialization constant.
case floatFloating-point specialization constant.
static let invalidFormatId: IntReturned by functions that return a format ID if a value is invalid.
static let invalidId: IntReturned by functions that return an ID if a value is invalid.
override class var godotClassName: StringName { get }final func barrier(from: RenderingDevice.BarrierMask = [.vertex, .fragment, .compute, .transfer, .raster, .allBarriers], to: RenderingDevice.BarrierMask = [.vertex, .fragment, .compute, .transfer, .raster, .allBarriers]) This method does nothing.
final func bufferClear(buffer: RID, offset: UInt32, sizeBytes: UInt32) -> GodotError Clears the contents of the buffer, clearing sizeBytes bytes, starting at offset.
final func bufferCopy(srcBuffer: RID, dstBuffer: RID, srcOffset: UInt32, dstOffset: UInt32, size: UInt32) -> GodotError Copies size bytes from the srcBuffer at srcOffset into dstBuffer at dstOffset.
final func bufferGetData(buffer: RID, offsetBytes: UInt32 = 0, sizeBytes: UInt32 = 0) -> PackedByteArray Returns a copy of the data of the specified buffer, optionally offsetBytes and sizeBytes can be set to copy only a portion of the buffer.
final func bufferUpdate(buffer: RID, offset: UInt32, sizeBytes: UInt32, data: PackedByteArray) -> GodotError Updates a region of sizeBytes bytes, starting at offset, in the buffer, with the specified data.
final func captureTimestamp(name: String) Creates a timestamp marker with the specified name. This is used for performance reporting with the getCapturedTimestampCpuTime(index:), getCapturedTimestampGpuTime(index:) and getCapturedTimestampName(index:) methods.
final func computeListAddBarrier(computeList: Int) Raises a Vulkan compute barrier in the specified computeList.
final func computeListBegin() -> Int Starts a list of compute commands created with the compute_* methods. The returned value should be passed to other compute_list_* functions.
final 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:).
final func computeListBindUniformSet(computeList: Int, uniformSet: RID, setIndex: UInt32) Binds the uniformSet to this computeList. 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.
final 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:).
final 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 at offset. Buffer must have been created with .dispatchIndirect flag.
final func computeListEnd() Finishes a list of compute commands created with the compute_* methods.
final func computeListSetPushConstant(computeList: Int, buffer: PackedByteArray, sizeBytes: UInt32) Sets the push constant data to buffer for the specified computeList. The shader determines how this binary data is used. The buffer’s size in bytes must also be specified in sizeBytes (this can be obtained by calling the size method on the passed buffer).
final func computePipelineCreate(shader: RID, specializationConstants: ObjectCollection<RDPipelineSpecializationConstant>) -> RID Creates a new compute pipeline. It can be accessed with the RID that is returned.
final func computePipelineIsValid(computePipeline: RID) -> Bool Returns true if the compute pipeline specified by the computePipeline RID is valid, false otherwise.
final 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.
final 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 to drawCommandBeginLabel(name:color:) and drawCommandEndLabel must be matched and balanced.
final func drawCommandEndLabel() Ends the command buffer debug label region started by a drawCommandBeginLabel(name:color:) call.
final func drawCommandInsertLabel(name: String, color: Color) This method does nothing.
final func drawListBegin(framebuffer: RID, initialColorAction: RenderingDevice.InitialAction, finalColorAction: RenderingDevice.FinalAction, initialDepthAction: RenderingDevice.InitialAction, finalDepthAction: RenderingDevice.FinalAction, clearColorValues: PackedColorArray = PackedColorArray(), clearDepth: Double = 1.0, clearStencil: UInt32 = 0, region: Rect2 = Rect2 (x: 0, y: 0, width: 0, height: 0)) -> Int Starts a list of raster drawing commands created with the draw_* methods. The returned value should be passed to other draw_list_* functions.
final func drawListBeginForScreen(_ screen: Int32 = 0, clearColor: Color = Color (r: 0, g: 0, b: 0, a: 1)) -> 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 the screen ID.
final func drawListBeginSplit(framebuffer: RID, splits: UInt32, initialColorAction: RenderingDevice.InitialAction, finalColorAction: RenderingDevice.FinalAction, initialDepthAction: RenderingDevice.InitialAction, finalDepthAction: RenderingDevice.FinalAction, clearColorValues: PackedColorArray = PackedColorArray(), clearDepth: Double = 1.0, clearStencil: UInt32 = 0, region: Rect2 = Rect2 (x: 0, y: 0, width: 0, height: 0), storageTextures: VariantCollection<RID> = VariantCollection<RID> ()) -> PackedInt64Array This method does nothing and always returns an empty PackedInt64Array.
final func drawListBindIndexArray(drawList: Int, indexArray: RID) Binds indexArray to the specified drawList.
final func drawListBindRenderPipeline(drawList: Int, renderPipeline: RID) Binds renderPipeline to the specified drawList.
final func drawListBindUniformSet(drawList: Int, uniformSet: RID, setIndex: UInt32) Binds uniformSet to the specified drawList. A setIndex must also be specified, which is an identifier starting from 0 that must match the one expected by the draw list.
final func drawListBindVertexArray(drawList: Int, vertexArray: RID) Binds vertexArray to the specified drawList.
final func drawListDisableScissor(drawList: Int) Removes and disables the scissor rectangle for the specified drawList. See also drawListEnableScissor(drawList:rect:).
final func drawListDraw(drawList: Int, useIndices: Bool, instances: UInt32, proceduralVertexCount: UInt32 = 0) Submits drawList for rendering on the GPU. This is the raster equivalent to computeListDispatch(computeList:xGroups:yGroups:zGroups:).
final func drawListEnableScissor(drawList: Int, rect: Rect2 = Rect2 (x: 0, y: 0, width: 0, height: 0)) 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 also drawListDisableScissor(drawList:).
final func drawListEnd() Finishes a list of raster drawing commands created with the draw_* methods.
final func drawListSetBlendConstants(drawList: Int, color: Color) Sets blend constants for the specified drawList to color. Blend constants are used only if the graphics pipeline is created with .dynamicStateBlendConstants flag set.
final func drawListSetPushConstant(drawList: Int, buffer: PackedByteArray, sizeBytes: UInt32) Sets the push constant data to buffer for the specified drawList. The shader determines how this binary data is used. The buffer’s size in bytes must also be specified in sizeBytes (this can be obtained by calling the size method on the passed buffer).
final func drawListSwitchToNextPass() -> Int Switches to the next draw pass.
final func drawListSwitchToNextPassSplit(splits: UInt32) -> PackedInt64Array This method does nothing and always returns an empty PackedInt64Array.
final func framebufferCreate(textures: VariantCollection<RID>, validateWithFormat: Int = -1, viewCount: UInt32 = 1) -> RID Creates a new framebuffer. It can be accessed with the RID that is returned.
final func framebufferCreateEmpty(size: Vector2i, samples: RenderingDevice.TextureSamples = .textureSamples1, validateWithFormat: Int = -1) -> RID Creates a new empty framebuffer. It can be accessed with the RID that is returned.
final func framebufferCreateMultipass(textures: VariantCollection<RID>, passes: ObjectCollection<RDFramebufferPass>, validateWithFormat: Int = -1, viewCount: UInt32 = 1) -> RID Creates a new multipass framebuffer. It can be accessed with the RID that is returned.
final func framebufferFormatCreate(attachments: ObjectCollection<RDAttachmentFormat>, viewCount: UInt32 = 1) -> Int Creates a new framebuffer format with the specified attachments and viewCount. Returns the new framebuffer’s unique framebuffer format ID.
final func framebufferFormatCreateEmpty(samples: RenderingDevice.TextureSamples = .textureSamples1) -> Int Creates a new empty framebuffer format with the specified number of samples and returns its ID.
final func framebufferFormatCreateMultipass(attachments: ObjectCollection<RDAttachmentFormat>, passes: ObjectCollection<RDFramebufferPass>, viewCount: UInt32 = 1) -> Int Creates a multipass framebuffer format with the specified attachments, passes and viewCount and returns its ID. If viewCount is greater than or equal to 2, enables multiview which is used for VR rendering. This requires support for the Vulkan multiview extension.
final func framebufferFormatGetTextureSamples(format: Int, renderPass: UInt32 = 0) -> RenderingDevice.TextureSamples Returns the number of texture samples used for the given framebuffer format ID (returned by framebufferGetFormat(framebuffer:)).
final 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.
final func framebufferIsValid(framebuffer: RID) -> Bool Returns true if the framebuffer specified by the framebuffer RID is valid, false otherwise.
final func freeRid(_ rid: 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.
final func fullBarrier() This method does nothing.
final 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 also getCapturedTimestampGpuTime(index:) and captureTimestamp(name:).
final 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 also getCapturedTimestampCpuTime(index:) and captureTimestamp(name:).
final func getCapturedTimestampName(index: UInt32) -> String Returns the timestamp’s name for the rendering step specified by index. See also captureTimestamp(name:).
final func getCapturedTimestampsCount() -> UInt32 Returns the total number of timestamps (rendering steps) available for profiling.
final func getCapturedTimestampsFrame() -> UInt Returns the index of the last frame rendered that has rendering timestamps available for querying.
final func getDeviceName() -> String Returns the name of the video adapter (e.g. “GeForce GTX 1080/PCIe/SSE2”). Equivalent to getVideoAdapterName. See also getDeviceVendorName.
final 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.
final func getDeviceVendorName() -> String Returns the vendor of the video adapter (e.g. “NVIDIA Corporation”). Equivalent to getVideoAdapterVendor. See also getDeviceName.
final func getDriverResource(_ resource: RenderingDevice.DriverResource, rid: RID, index: UInt) -> UInt Returns the unique identifier of the driver resource for the specified rid. Some driver resource types ignore the specified rid (see DriverResource descriptions). index is always ignored but must be specified anyway.
final 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, local RenderingDevices only have 1 frame.
final 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.
final func indexArrayCreate(indexBuffer: RID, indexOffset: UInt32, indexCount: UInt32) -> RID Creates a new index array. It can be accessed with the RID that is returned.
final func indexBufferCreate(sizeIndices: UInt32, format: RenderingDevice.IndexBufferFormat, data: PackedByteArray = PackedByteArray(), useRestartIndices: Bool = false) -> RID Creates a new index buffer. It can be accessed with the RID that is returned.
final 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.
final func renderPipelineCreate(shader: RID, framebufferFormat: Int, vertexFormat: Int, primitive: RenderingDevice.RenderPrimitive, rasterizationState: RDPipelineRasterizationState?, multisampleState: RDPipelineMultisampleState?, stencilState: RDPipelineDepthStencilState?, colorBlendState: RDPipelineColorBlendState?, dynamicStateFlags: RenderingDevice.PipelineDynamicStateFlags = [], forRenderPass: UInt32 = 0, specializationConstants: ObjectCollection<RDPipelineSpecializationConstant>) -> RID Creates a new render pipeline. It can be accessed with the RID that is returned.
final func renderPipelineIsValid(renderPipeline: RID) -> Bool Returns true if the render pipeline specified by the renderPipeline RID is valid, false otherwise.
final func samplerCreate(state: RDSamplerState?) -> RID Creates a new sampler. It can be accessed with the RID that is returned.
final func samplerIsFormatSupportedForFilter(format: RenderingDevice.DataFormat, samplerFilter: RenderingDevice.SamplerFilter) -> Bool Returns true if implementation supports using a texture of format with the given samplerFilter.
final func screenGetFramebufferFormat(screen: Int32 = 0) -> Int Returns the framebuffer format of the given screen.
final func screenGetHeight(screen: Int32 = 0) -> 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 also screenGetWidth(screen:).
final func screenGetWidth(screen: Int32 = 0) -> 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 also screenGetHeight(screen:).
final func setResourceName(id: RID, name: String) Sets the resource name for id to name. This is used for debugging with third-party tools such as RenderDoc.
final func shaderCompileBinaryFromSpirv(spirvData: RDShaderSPIRV?, name: String = "") -> PackedByteArray Compiles a binary shader from spirvData and returns the compiled binary data as a PackedByteArray. 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 also shaderCompileSpirvFromSource(shaderSource:allowCache:).
final func shaderCompileSpirvFromSource(shaderSource: RDShaderSource?, allowCache: Bool = true) -> RDShaderSPIRV? Compiles a SPIR-V from the shader source code in shaderSource and returns the SPIR-V as a RDShaderSPIRV. 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 using shaderCompileBinaryFromSpirv(spirvData:name:).
final func shaderCreateFromBytecode(binaryData: PackedByteArray, placeholderRid: RID = RID()) -> RID Creates a new shader instance from a binary compiled shader. It can be accessed with the RID that is returned.
final 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.
final 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.
final 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 the in keyword).
final func storageBufferCreate(sizeBytes: UInt32, data: PackedByteArray = PackedByteArray(), usage: RenderingDevice.StorageBufferUsage = []) -> RID Creates a storage buffer with the specified data and usage. It can be accessed with the RID that is returned.
final func submit() Pushes the frame setup and draw command buffers then marks the local device as currently processing (which allows calling sync).
final 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.
final func textureBufferCreate(sizeBytes: UInt32, format: RenderingDevice.DataFormat, data: PackedByteArray = PackedByteArray()) -> RID Creates a new texture buffer. It can be accessed with the RID that is returned.
final 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 specified color. baseMipmap and mipmapCount determine which mipmaps of the texture are affected by this clear operation, while baseLayer and layerCount 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 be 0 and layerCount must be 1.
final func textureCopy(fromTexture: RID, toTexture: RID, fromPos: Vector3, toPos: Vector3, size: Vector3, srcMipmap: UInt32, dstMipmap: UInt32, srcLayer: UInt32, dstLayer: UInt32) -> GodotError Copies the fromTexture to toTexture with the specified fromPos, toPos and size coordinates. The Z axis of the fromPos, toPos and size must be 0 for 2-dimensional textures. Source and destination mipmaps/layers must also be specified, with these parameters being 0 for textures without mipmaps or single-layer textures. Returns @GlobalScope.OK if the texture copy was successful or @GlobalScope.ERR_INVALID_PARAMETER otherwise.
final func textureCreate(format: RDTextureFormat?, view: RDTextureView?, data: VariantCollection<PackedByteArray> = VariantCollection<PackedByteArray> ()) -> RID Creates a new texture. It can be accessed with the RID that is returned.
final 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 given type, format, samples, usageFlags, width, height, depth, and layers. This can be used to allow Godot to render onto foreign images.
final func textureCreateShared(view: RDTextureView?, withTexture: RID) -> RID Creates a shared texture using the specified view and the texture information from withTexture.
final func textureCreateSharedFromSlice(view: RDTextureView?, withTexture: RID, layer: UInt32, mipmap: UInt32, mipmaps: UInt32 = 1, sliceType: RenderingDevice.TextureSliceType = .textureSlice2d) -> RID Creates a shared texture using the specified view and the texture information from withTexture’s layer and mipmap. The number of included mipmaps from the original texture can be controlled using the mipmaps parameter. Only relevant for textures with multiple layers, such as 3D textures, texture arrays and cubemaps. For single-layer textures, use textureCreateShared(view:withTexture:)
final func textureGetData(texture: RID, layer: UInt32) -> PackedByteArray Returns the texture data for the specified layer as raw binary data. For 2D textures (which only have one layer), layer must be 0.
final func textureGetFormat(texture: RID) -> RDTextureFormat? Returns the data format used to create this texture.
final 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.
final func textureIsFormatSupportedForUsage(format: RenderingDevice.DataFormat, usageFlags: RenderingDevice.TextureUsageBits) -> Bool Returns true if the specified format is supported for the given usageFlags, false otherwise.
final func textureIsShared(texture: RID) -> Bool Returns true if the texture is shared, false otherwise. See RDTextureView.
final func textureIsValid(texture: RID) -> Bool Returns true if the texture is valid, false otherwise.
final func textureResolveMultisample(fromTexture: RID, toTexture: RID) -> GodotError Resolves the fromTexture texture onto toTexture 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.
final 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 be 0. Returns @GlobalScope.OK if the update was successful, @GlobalScope.ERR_INVALID_PARAMETER otherwise.
final func uniformBufferCreate(sizeBytes: UInt32, data: PackedByteArray = PackedByteArray()) -> RID Creates a new uniform buffer. It can be accessed with the RID that is returned.
final 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.
final func uniformSetIsValid(uniformSet: RID) -> Bool Checks if the uniformSet is valid, i.e. is owned.
final func vertexArrayCreate(vertexCount: UInt32, vertexFormat: Int, srcBuffers: VariantCollection<RID>, offsets: PackedInt64Array = PackedInt64Array()) -> RID Creates a vertex array based on the specified buffers. Optionally, offsets (in bytes) may be defined for each buffer.
final func vertexBufferCreate(sizeBytes: UInt32, data: PackedByteArray = PackedByteArray(), useAsStorage: Bool = false) -> RID It can be accessed with the RID that is returned.
final 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.
struct BarrierMaskenum BlendFactorenum BlendOperationenum CompareOperatorenum DataFormatenum DeviceTypeenum DriverResourceenum FinalActionenum IndexBufferFormatenum InitialActionenum Limitenum LogicOperationenum MemoryTypestruct PipelineDynamicStateFlagsenum PolygonCullModeenum PolygonFrontFaceenum RenderPrimitiveenum SamplerBorderColorenum SamplerFilterenum SamplerRepeatModeenum ShaderLanguageenum ShaderStageenum StencilOperationstruct StorageBufferUsageenum TextureSamplesenum TextureSliceTypeenum TextureSwizzleenum TextureTypestruct TextureUsageBitsenum UniformTypeenum VertexFrequencyprotocol CaseIterableA type that provides a collection of all of its values.
protocol CustomDebugStringConvertibleA type with a customized textual representation suitable for debugging purposes.
protocol EquatableA type that can be compared for value equality.
protocol Hashable : EquatableA 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.
init?(rawValue: Int64) var debugDescription: String { get }A textual representation of this instance, suitable for debugging
var hashValue: Int { get }static func != (lhs: Self, rhs: Self) -> Bool Returns a Boolean value indicating whether two values are not equal.
func hash(into hasher: inout Hasher)