GpuContext class base
A handle to a graphics context. Used to create and manage GPU resources.
To obtain the default graphics context, use getContext.
Properties
- defaultColorFormat → PixelFormat
-
A supported PixelFormat for textures that store 4-channel colors
(red/green/blue/alpha).
no setter
- defaultDepthStencilFormat → PixelFormat
-
A supported
PixelFormatfor textures that store both a stencil and depth component. This will never return a depth-only or stencil-only texture.no setter - defaultStencilFormat → PixelFormat
-
A supported PixelFormat for textures that store stencil information.
May include a depth channel if a stencil-only format is not available.
no setter
- doesSupportFramebufferRenderMipmap → bool
-
Whether the backend can attach a non-zero mip level of a texture as a
render target (see ColorAttachment.mipLevel). Rendering into a cube map
face or array layer is always supported; only non-zero mip levels are
gated. True on Metal and Vulkan; currently false on the GLES backend,
where rendering into non-zero mip levels is not yet implemented.
no setter
- doesSupportManuallyMippedTextures → bool
-
Whether a texture whose mip levels were uploaded by hand with
Texture.overwrite (rather than generated with
CommandBuffer.generateMipmap) samples with correct per-level selection. True on Metal and Vulkan; on OpenGL ES 2.0 devices without the GL_APPLE_texture_max_level extension this is false, and sampling such a texture reads as black. Check this before relying on hand-built mip chains (for example, prefiltered environment maps).no setter - doesSupportOffscreenMSAA → bool
-
Whether the backend supports multisample anti-aliasing for offscreen
color and stencil attachments. A subset of OpenGLES-only devices do not
support this functionality.
no setter
- doesSupportTextureArrays → bool
-
Whether 2D array textures (TextureType.texture2DArray) can be created,
uploaded, and sampled by shaders. True on Metal and Vulkan. Currently
false on the GLES backend, where shader bundles do not yet carry a
shader variant that can sample array textures.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxSamplerAnisotropy → int
-
The maximum anisotropy clamp supported by device samplers (see
SamplerOptions.maxAnisotropy).
no setter
- minimumUniformByteAlignment → int
-
The minimum alignment required when referencing uniform blocks stored in a
DeviceBuffer.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createBindingSet(
{Map< UniformSlot, BufferView> uniforms = const <UniformSlot, BufferView>{}, Map<UniformSlot, TextureBinding> textures = const <UniformSlot, TextureBinding>{}}) → BindingSet - Creates a reusable group of uniform and texture bindings.
-
createCommandBuffer(
) → CommandBuffer - Create a new command buffer that can be used to submit GPU commands.
-
createDeviceBuffer(
StorageMode storageMode, int sizeInBytes) → DeviceBuffer - Allocates a new region of GPU-resident memory.
-
createDeviceBufferWithCopy(
ByteData data) → DeviceBuffer -
Allocates a new region of host-visible GPU-resident memory, initialized
with the given
data. -
createHostBuffer(
{int blockLengthInBytes = HostBuffer.kDefaultBlockLengthInBytes}) → HostBuffer - Creates a bump allocator that managed a DeviceBuffer block list.
-
createImageSurface(
int width, int height, {PixelFormat? format}) → GpuImageSurface - Creates an image surface for rendering content that Flutter draws as a ui.Image.
-
createRenderPipeline(
Shader vertexShader, Shader fragmentShader, {VertexLayout? vertexLayout}) → RenderPipeline -
createTexture(
StorageMode storageMode, int width, int height, {PixelFormat format = PixelFormat.r8g8b8a8UNormInt, dynamic sampleCount = 1, TextureType? textureType, bool enableRenderTargetUsage = true, bool enableShaderReadUsage = true, bool enableShaderWriteUsage = false, int mipLevelCount = 1, int layerCount = 1}) → Texture - Allocates a new texture in GPU-resident memory.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
supportsTextureCompression(
TextureCompressionFamily family) → bool - Whether this device supports the given family of block-compressed texture formats. Hardware support is granted on a per-family basis.
-
supportsTextureFormat(
PixelFormat format, {bool renderTarget = false, bool shaderRead = true, bool shaderWrite = false}) → bool -
Whether this device can allocate a texture of the given
formatwith the requested usage flags. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited