Package icyllis.arc3d.opengl

# Class GLCaps

java.lang.Object
icyllis.arc3d.engine.Caps
icyllis.arc3d.opengl.GLCaps

Direct Known Subclasses:
  `GLCaps_GL`, `GLCaps_GLES`

public abstract class GLCaps extends Caps
Stores some capabilities of an OpenGL device.

OpenGL 3.3 or OpenGL ES 3.0 is the minimum requirement.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class icyllis.arc3d.engine.Caps

  `Caps.BlendEquationSupport`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `INVALIDATE_BUFFER_TYPE_INVALIDATE`
  `static final int`
  `INVALIDATE_BUFFER_TYPE_NULL_DATA`
  `static final List<String>`
  `MISSING_EXTENSIONS`
  Contains missing extensions on the last creation of GPU.

  ### Fields inherited from class icyllis.arc3d.engine.Caps

  `mAnisotropySupport, MAX_COLOR_TARGETS, MAX_VERTEX_ATTRIBUTES, MAX_VERTEX_BINDINGS, mBlendEquationSupport, mClampToBorderSupport, mConservativeRasterSupport, mDepthClipNegativeOneToOne, mDriverBugWorkarounds, mDynamicStateArrayGeometryProcessorTextureSupport, mGpuTracingSupport, mInternalMultisampleCount, mMapBufferFlags, mMaxColorAttachments, mMaxPreferredRenderTargetSize, mMaxPushConstantsSize, mMaxRenderTargetSize, mMaxTextureSize, mMaxVertexAttributes, mMaxVertexBindings, mMinStorageBufferOffsetAlignment, mMinUniformBufferOffsetAlignment, mMustSyncGpuDuringDiscard, mShaderCaps, mTextureBarrierSupport, mTransferPixelsToRowBytesSupport, mUseCpuStagingBuffers`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `canCopyImage(int srcFormat, int srcSampleCount, int dstFormat, int dstSampleCount)`
  `boolean`
  `canCopyTexSubImage(int srcFormat, int dstFormat)`
  `IResourceKey`
  `computeImageKey(ImageDesc desc, IResourceKey recycle)`
  `void`
  `dump(StringBuilder out, boolean includeFormatTable)`
  `BackendFormat`
  `getCompressedBackendFormat(int compressionType)`
  `ImageDesc`
  `getDefaultColorImageDesc(int imageType, int colorType, int width, int height, int depthOrArraySize, int mipLevelCount, int sampleCount, int imageFlags)`
  `ImageDesc`
  `getDefaultDepthStencilImageDesc(int depthBits, int stencilBits, int width, int height, int sampleCount, int imageFlags)`
  `GLUtil.GLDriver`
  `getDriver()`
  `static int`
  `getExternalTypeAlignment(int type)`
  `int`
  `getFormatDefaultExternalFormat(int format)`
  Gets the default external format to use with glTex[Sub]Image...
  `int`
  `getFormatDefaultExternalType(int format)`
  Gets the default external type to use with glTex[Sub]Image...
  `int`
  `getGLSLVersion()`
  Returns the minimum GLSL version that supported by the OpenGL device, this is based on OpenGL version.
  `ImageDesc`
  `getImageDescForSampledCopy(ImageDesc src, int width, int height, int depthOrArraySize, int imageFlags)`
  `int`
  `getInvalidateBufferType()`
  `int`
  `getMaxRenderTargetSampleCount(int format)`
  `int`
  `getMaxRenderTargetSampleCount(BackendFormat format)`
  Returns the maximum supported sample count for a format.
  `int`
  `getPixelsExternalFormat(int format, int dstColorType, int srcColorType, boolean write)`
  `int`
  `getPixelsExternalType(int format, int dstColorType, int srcColorType)`
  `int[]`
  `getProgramBinaryFormats()`
  `int`
  `getRenderbufferInternalFormat(int format)`
  Gets the internal format to use with glRenderbufferStorageMultisample...().
  `int`
  `getRenderTargetSampleCount(int sampleCount, int format)`
  `int`
  `getRenderTargetSampleCount(int sampleCount, BackendFormat format)`
  Find a sample count greater than or equal to the requested count which is supported for a render target of the given format or 0 if no such sample count is supported.
  `long`
  `getSupportedWriteColorType(int dstColorType, ImageDesc dstDesc, int srcColorType)`
  Given a dst pixel config and a src color type what color type must the caller coax the data into in order to use writePixels().
  `int`
  `getTextureInternalFormat(int format)`
  Gets the internal format to use with glTexImage...() and glTexStorage...().
  `GLUtil.GLVendor`
  `getVendor()`
  `short`
  `getWriteSwizzle(ImageDesc desc, int colorType)`
  `boolean`
  `hasBaseInstanceSupport()`
  `boolean`
  `hasBufferStorageSupport()`
  `boolean`
  `hasCopyImageSupport()`
  `boolean`
  `hasDebugSupport()`
  `boolean`
  `hasDrawElementsBaseVertexSupport()`
  `boolean`
  `hasDSASupport()`
  Modern OpenGL means OpenGL 4.5 is supported, so all of the following are supported: ARB_ES2_compatibility ARB_get_program_binary ARB_base_instance ARB_texture_storage ARB_internalformat_query ARB_shading_language_420pack ARB_invalidate_subdata ARB_explicit_uniform_location ARB_vertex_attrib_binding ARB_ES3_compatibility ARB_clear_texture ARB_buffer_storage ARB_enhanced_layouts ARB_texture_barrier ARB_direct_state_access Arc3D requires OpenGL 3.3 at least.
  `boolean`
  `hasInvalidateFramebufferSupport()`
  `boolean`
  `hasProgramBinarySupport()`
  `boolean`
  `hasSPIRVSupport()`
  `boolean`
  `hasVertexAttribBindingSupport()`
  `boolean`
  `hasVolatileContext()`
  `boolean`
  `isFormatRenderable(int format, int sampleCount)`
  `boolean`
  `isFormatRenderable(int colorType, BackendFormat format, int sampleCount)`
  `boolean`
  `isFormatRenderable(BackendFormat format, int sampleCount)`
  `boolean`
  `isFormatTexturable(int format)`
  `boolean`
  `isFormatTexturable(BackendFormat format)`
  Can a texture be made with the BackendFormat, and then be bound and sampled in a shader.
  `abstract boolean`
  `isGLES()`
  Returns true if OpenGL ES (embedded system), returns false if OpenGL (desktop, core profile).
  `boolean`
  `isTextureStorageCompatible(int format)`
  `PipelineKey_old`
  `makeDesc(PipelineKey_old desc, GpuRenderTarget renderTarget, GraphicsPipelineDesc_Old graphicsPipelineDesc)`
  `PipelineKey`
  `makeGraphicsPipelineKey(PipelineKey old, PipelineDesc pipelineDesc, RenderPassDesc renderPassDesc)`
  `int`
  `maxLabelLength()`
  `float`
  `maxTextureMaxAnisotropy()`
  `protected void`
  `onApplyOptionsOverrides(ContextOptions options)`
  `boolean`
  `onFormatCompatible(int colorType, BackendFormat format)`
  `protected BackendFormat`
  `onGetDefaultBackendFormat(int colorType)`
  `protected short`
  `onGetReadSwizzle(ImageDesc desc, int colorType)`
  `protected long`
  `onSupportedReadColorType(int srcColorType, BackendFormat srcFormat, int dstColorType)`
  `boolean`
  `skipErrorChecks()`
  Skip checks for GL errors, shader compilation success, program link success.
  `String`
  `toString()`

  ### Methods inherited from class icyllis.arc3d.engine.Caps

  `advancedBlendEquationSupport, advancedCoherentBlendEquationSupport, avoidLargeIndexBufferDraws, avoidStencilBuffers, avoidWritePixelsFastPath, blendEquationSupport, clampToBorderSupport, conservativeRasterSupport, crossContextTextureSupport, depthClipNegativeOneToOne, discardStencilValuesAfterRenderPass, drawInstancedSupport, dynamicStateArrayGeometryProcessorTextureSupport, fenceSyncSupport, finishInitialization, getDefaultBackendFormat, getDefaultColorImageDesc, getInternalMultisampleCount, getReadSwizzle, getSupportedReadColorType, gpuTracingSupport, halfFloatVertexAttributeSupport, hasAnisotropySupport, isFormatCompatible, maxColorAttachments, maxPreferredRenderTargetSize, maxPushConstantsSize, maxRenderTargetSize, maxTextureSize, maxVertexAttributes, maxVertexBindings, minStorageBufferOffsetAlignment, minUniformBufferOffsetAlignment, mipmapSupport, msaaResolvesAutomatically, mustClearUploadedBufferData, mustSyncGpuDuringDiscard, nativeDrawIndexedIndirectIsBroken, npotTextureTileSupport, oversizedStencilSupport, performColorClearsAsDraws, performPartialClearsAsDraws, performStencilClearsAsDraws, preferClientSideDynamicBuffers, preferDiscardableMSAAAttachment, preferFullscreenClears, preferVRAMUseOverFlushes, readPixelsRowBytesSupport, reducedShaderMode, requiresManualFBBarrierAfterTessellatedStencilDraw, reuseScratchBuffers, reuseScratchTextures, sampleLocationsSupport, semaphoreSupport, shaderCaps, shouldCollapseSrcOverToSrcWhenAble, shouldInitializeTextures, supportsTextureBarrier, textureBarrierSupport, transferBufferAlignment, transferFromBufferToTextureSupport, transferFromSurfaceToBufferSupport, transferPixelsToRowBytesSupport, twoSidedStencilRefsAndMasksMustMatch, useCpuStagingBuffers, usePrimitiveRestart, validateAttachmentParams, validateSurfaceParams, wireframeSupport, workarounds, writePixelsRowBytesSupport`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### MISSING_EXTENSIONS

    public static final List<String> MISSING_EXTENSIONS
    Contains missing extensions on the last creation of GPU. No synchronization.

  - ### INVALIDATE_BUFFER_TYPE_NULL_DATA

    public static final int INVALIDATE_BUFFER_TYPE_NULL_DATA
    See Also:
      - Constant Field Values

  - ### INVALIDATE_BUFFER_TYPE_INVALIDATE

    public static final int INVALIDATE_BUFFER_TYPE_INVALIDATE
    See Also:
      - Constant Field Values

- ## Method Details

  - ### getVendor

    public GLUtil.GLVendor getVendor()

  - ### getDriver

    public GLUtil.GLDriver getDriver()

  - ### isGLES

    public abstract boolean isGLES()
    Returns true if OpenGL ES (embedded system), returns false if OpenGL (desktop, core profile).

  - ### hasDSASupport

    public boolean hasDSASupport()
    Modern OpenGL means OpenGL 4.5 is supported, so all of the following are supported:
    - ARB_ES2_compatibility
    - ARB_get_program_binary
    - ARB_base_instance
    - ARB_texture_storage
    - ARB_internalformat_query
    - ARB_shading_language_420pack
    - ARB_invalidate_subdata
    - ARB_explicit_uniform_location
    - ARB_vertex_attrib_binding
    - ARB_ES3_compatibility
    - ARB_clear_texture
    - ARB_buffer_storage
    - ARB_enhanced_layouts
    - ARB_texture_barrier
    - ARB_direct_state_access
    Arc3D requires OpenGL 3.3 at least.

  - ### getInvalidateBufferType

    public int getInvalidateBufferType()

  - ### hasDebugSupport

    public boolean hasDebugSupport()

  - ### hasDrawElementsBaseVertexSupport

    public boolean hasDrawElementsBaseVertexSupport()

  - ### hasBaseInstanceSupport

    public boolean hasBaseInstanceSupport()

  - ### hasVertexAttribBindingSupport

    public boolean hasVertexAttribBindingSupport()

  - ### hasCopyImageSupport

    public boolean hasCopyImageSupport()

  - ### hasBufferStorageSupport

    public boolean hasBufferStorageSupport()

  - ### hasSPIRVSupport

    public boolean hasSPIRVSupport()

  - ### hasProgramBinarySupport

    public boolean hasProgramBinarySupport()

  - ### hasVolatileContext

    public boolean hasVolatileContext()

  - ### hasInvalidateFramebufferSupport

    public boolean hasInvalidateFramebufferSupport()

  - ### getProgramBinaryFormats

    @Nullable public int[] getProgramBinaryFormats()

  - ### getGLSLVersion

    public int getGLSLVersion()
    Returns the minimum GLSL version that supported by the OpenGL device, this is based on OpenGL version. May return 300, 310, 320 for es profile, 330 or above for core profile.

    The effective GLSL version that used by our pipeline and shader builder is `ShaderCaps.mGLSLVersion`.

  - ### isFormatTexturable

    public boolean isFormatTexturable(BackendFormat format)
    Description copied from class: `Caps`
    Can a texture be made with the BackendFormat, and then be bound and sampled in a shader. It must be a color format, you cannot pass a stencil format here.

    For OpenGL: Formats that deprecated in core profile are not supported; Compressed formats from extensions are uncertain; Others are always supported.

    Specified by:
      `isFormatTexturable` in class `Caps`

  - ### isFormatTexturable

    public boolean isFormatTexturable(int format)

  - ### isTextureStorageCompatible

    public boolean isTextureStorageCompatible(int format)

  - ### getMaxRenderTargetSampleCount

    public int getMaxRenderTargetSampleCount(BackendFormat format)
    Description copied from class: `Caps`
    Returns the maximum supported sample count for a format. 0 means the format is not renderable 1 means the format is renderable but doesn't support MSAA.
    Specified by:
      `getMaxRenderTargetSampleCount` in class `Caps`

  - ### getMaxRenderTargetSampleCount

    public int getMaxRenderTargetSampleCount(int format)

  - ### isFormatRenderable

    public boolean isFormatRenderable(int colorType, BackendFormat format, int sampleCount)
    Specified by:
      `isFormatRenderable` in class `Caps`

  - ### isFormatRenderable

    public boolean isFormatRenderable(BackendFormat format, int sampleCount)
    Specified by:
      `isFormatRenderable` in class `Caps`

  - ### isFormatRenderable

    public boolean isFormatRenderable(int format, int sampleCount)

  - ### getRenderTargetSampleCount

    public int getRenderTargetSampleCount(int sampleCount, BackendFormat format)
    Description copied from class: `Caps`
    Find a sample count greater than or equal to the requested count which is supported for a render target of the given format or 0 if no such sample count is supported. If the requested sample count is 1 then 1 will be returned if non-MSAA rendering is supported, otherwise 0.
    Specified by:
      `getRenderTargetSampleCount` in class `Caps`
    Parameters:
      `sampleCount` - requested samples

  - ### getRenderTargetSampleCount

    public int getRenderTargetSampleCount(int sampleCount, int format)

  - ### getDefaultColorImageDesc

    @Nullable public ImageDesc getDefaultColorImageDesc(int imageType, int colorType, int width, int height, int depthOrArraySize, int mipLevelCount, int sampleCount, int imageFlags)
    Overrides:
      `getDefaultColorImageDesc` in class `Caps`
    Parameters:
      `imageType` -
      `colorType` -
      `width` -
      `height` -
      `depthOrArraySize` -
      `mipLevelCount` -
      `sampleCount` -
      `imageFlags` -
    Returns:
    See Also:
      - `ISurface.FLAG_MIPMAPPED`
      - `ISurface.FLAG_SAMPLED_IMAGE`
      - `ISurface.FLAG_STORAGE_IMAGE`
      - `ISurface.FLAG_RENDERABLE`
      - `ISurface.FLAG_MEMORYLESS`
      - `ISurface.FLAG_PROTECTED`

  - ### getDefaultDepthStencilImageDesc

    @Nullable public ImageDesc getDefaultDepthStencilImageDesc(int depthBits, int stencilBits, int width, int height, int sampleCount, int imageFlags)
    Overrides:
      `getDefaultDepthStencilImageDesc` in class `Caps`

  - ### getImageDescForSampledCopy

    @Nullable public ImageDesc getImageDescForSampledCopy(ImageDesc src, int width, int height, int depthOrArraySize, int imageFlags)
    Overrides:
      `getImageDescForSampledCopy` in class `Caps`

  - ### onFormatCompatible

    public boolean onFormatCompatible(int colorType, BackendFormat format)
    Specified by:
      `onFormatCompatible` in class `Caps`

  - ### onGetDefaultBackendFormat

    @Nullable protected BackendFormat onGetDefaultBackendFormat(int colorType)
    Specified by:
      `onGetDefaultBackendFormat` in class `Caps`

  - ### getCompressedBackendFormat

    @Nullable public BackendFormat getCompressedBackendFormat(int compressionType)
    Specified by:
      `getCompressedBackendFormat` in class `Caps`

  - ### makeDesc

    @Nonnull public PipelineKey_old makeDesc(PipelineKey_old desc, GpuRenderTarget renderTarget, GraphicsPipelineDesc_Old graphicsPipelineDesc)
    Specified by:
      `makeDesc` in class `Caps`

  - ### makeGraphicsPipelineKey

    @Nonnull public PipelineKey makeGraphicsPipelineKey(PipelineKey old, PipelineDesc pipelineDesc, RenderPassDesc renderPassDesc)
    Specified by:
      `makeGraphicsPipelineKey` in class `Caps`

  - ### onGetReadSwizzle

    protected short onGetReadSwizzle(ImageDesc desc, int colorType)
    Specified by:
      `onGetReadSwizzle` in class `Caps`

  - ### getWriteSwizzle

    public short getWriteSwizzle(ImageDesc desc, int colorType)
    Specified by:
      `getWriteSwizzle` in class `Caps`

  - ### computeImageKey

    public IResourceKey computeImageKey(ImageDesc desc, IResourceKey recycle)
    Specified by:
      `computeImageKey` in class `Caps`

  - ### getSupportedWriteColorType

    public long getSupportedWriteColorType(int dstColorType, ImageDesc dstDesc, int srcColorType)
    Description copied from class: `Caps`
    Given a dst pixel config and a src color type what color type must the caller coax the data into in order to use writePixels().

    Low 32bits - colorType ((int) value). High 32bits - transferOffsetAlignment (value >>> 32). If the `write` is occurring using transferPixelsTo() then this provides the minimum alignment of the offset into the transfer buffer.

    Specified by:
      `getSupportedWriteColorType` in class `Caps`

  - ### getExternalTypeAlignment

    public static int getExternalTypeAlignment(int type)

  - ### onSupportedReadColorType

    protected long onSupportedReadColorType(int srcColorType, BackendFormat srcFormat, int dstColorType)
    Specified by:
      `onSupportedReadColorType` in class `Caps`

  - ### onApplyOptionsOverrides

    protected void onApplyOptionsOverrides(ContextOptions options)
    Overrides:
      `onApplyOptionsOverrides` in class `Caps`

  - ### getTextureInternalFormat

    public int getTextureInternalFormat(int format)
    Gets the internal format to use with glTexImage...() and glTexStorage...(). May be sized or base depending upon the GL. Not applicable to compressed textures.

  - ### getRenderbufferInternalFormat

    public int getRenderbufferInternalFormat(int format)
    Gets the internal format to use with glRenderbufferStorageMultisample...(). May be sized or base depending upon the GL. Not applicable to compressed textures.

  - ### getFormatDefaultExternalFormat

    public int getFormatDefaultExternalFormat(int format)
    Gets the default external format to use with glTex[Sub]Image... when the data pointer is null.

  - ### getFormatDefaultExternalType

    public int getFormatDefaultExternalType(int format)
    Gets the default external type to use with glTex[Sub]Image... when the data pointer is null.

  - ### getPixelsExternalFormat

    public int getPixelsExternalFormat(int format, int dstColorType, int srcColorType, boolean write)

  - ### getPixelsExternalType

    public int getPixelsExternalType(int format, int dstColorType, int srcColorType)

  - ### canCopyImage

    public boolean canCopyImage(int srcFormat, int srcSampleCount, int dstFormat, int dstSampleCount)

  - ### canCopyTexSubImage

    public boolean canCopyTexSubImage(int srcFormat, int dstFormat)

  - ### skipErrorChecks

    public boolean skipErrorChecks()
    Skip checks for GL errors, shader compilation success, program link success.

  - ### maxLabelLength

    public int maxLabelLength()

  - ### maxTextureMaxAnisotropy

    public float maxTextureMaxAnisotropy()

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### dump

    public void dump(StringBuilder out, boolean includeFormatTable)