Class GlDevice
java.lang.Object
com.mojang.blaze3d.opengl.GlDevice
- All Implemented Interfaces:
GpuDeviceBackend, GlDeviceExtension
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BufferStorageprivate final GlDebugLabelprivate final @Nullable GlDebugprivate final ShaderSourceprivate final DirectStateAccessprivate final CommandEncoderBackendprivate static final org.slf4j.Loggerprivate final intprivate final intprivate final Map<RenderPipeline, GlRenderPipeline> private final Map<GlDevice.ShaderCompilationKey, GlShaderModule> private final intprotected static booleanprotected static booleanprotected static booleanprotected static booleanprotected static booleanprotected static booleanprivate final VertexArrayCacheprivate final long -
Constructor Summary
ConstructorsConstructorDescriptionGlDevice(long windowHandle, ShaderSource defaultShaderSource, GpuDebugOptions debugOptions) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclose()private GlRenderPipelinecompilePipeline(RenderPipeline pipeline, ShaderSource shaderSource) private GlProgramcompileProgram(RenderPipeline pipeline, ShaderSource shaderSource) private GlShaderModulecompileShader(GlDevice.ShaderCompilationKey key, ShaderSource shaderSource) createBuffer(@Nullable Supplier<String> label, int usage, long size) createBuffer(@Nullable Supplier<String> label, int usage, ByteBuffer data) createExternalTexture(int usage, @Nullable String label, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels, int nativeId) Create a new GPU texture from an existing texture whose lifecycle is externally managed.createExternalTexture(@Nullable String label, int usage, int nativeId) Adopt an external OpenGL texture into a GpuTexture.createSampler(AddressMode addressModeU, AddressMode addressModeV, FilterMode minFilter, FilterMode magFilter, int maxAnisotropy, OptionalDouble maxLod) createTexture(@Nullable String label, int usage, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels) createTexture(@Nullable Supplier<String> label, int usage, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels) createTextureView(GpuTexture texture) createTextureView(GpuTexture texture, int baseMipLevel, int mipLevels) intprivate static intintprotected GlRenderPipelinegetOrCompilePipeline(RenderPipeline pipeline) protected GlShaderModulegetOrCompileShader(Identifier id, ShaderType type, ShaderDefines defines, ShaderSource shaderSource) intbooleanbooleanprecompilePipeline(RenderPipeline pipeline, @Nullable ShaderSource customShaderSource) voidprivate static voidvoidsetVsync(boolean enabled)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
USE_GL_ARB_vertex_attrib_binding
protected static boolean USE_GL_ARB_vertex_attrib_binding -
USE_GL_KHR_debug
protected static boolean USE_GL_KHR_debug -
USE_GL_EXT_debug_label
protected static boolean USE_GL_EXT_debug_label -
USE_GL_ARB_debug_output
protected static boolean USE_GL_ARB_debug_output -
USE_GL_ARB_direct_state_access
protected static boolean USE_GL_ARB_direct_state_access -
USE_GL_ARB_buffer_storage
protected static boolean USE_GL_ARB_buffer_storage -
encoder
-
debugLog
-
debugLabels
-
maxSupportedTextureSize
private final int maxSupportedTextureSize -
directStateAccess
-
defaultShaderSource
-
pipelineCache
-
shaderCache
-
vertexArrayCache
-
bufferStorage
-
enabledExtensions
-
uniformOffsetAlignment
private final int uniformOffsetAlignment -
maxSupportedAnisotropy
private final int maxSupportedAnisotropy -
windowHandle
private final long windowHandle
-
-
Constructor Details
-
GlDevice
-
-
Method Details
-
debugLabels
-
createCommandEncoder
- Specified by:
createCommandEncoderin interfaceGpuDeviceBackend
-
getMaxSupportedAnisotropy
public int getMaxSupportedAnisotropy()- Specified by:
getMaxSupportedAnisotropyin interfaceGpuDeviceBackend
-
createSampler
public GpuSampler createSampler(AddressMode addressModeU, AddressMode addressModeV, FilterMode minFilter, FilterMode magFilter, int maxAnisotropy, OptionalDouble maxLod) - Specified by:
createSamplerin interfaceGpuDeviceBackend
-
createTexture
public GpuTexture createTexture(@Nullable Supplier<String> label, int usage, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels) - Specified by:
createTexturein interfaceGpuDeviceBackend
-
createTexture
public GpuTexture createTexture(@Nullable String label, int usage, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels) - Specified by:
createTexturein interfaceGpuDeviceBackend
-
createExternalTexture
Adopt an external OpenGL texture into a GpuTexture. The lifecycle of the OpenGL texture will not be tied to this GpuTexture and the external system is responsible for cleaning up the OpenGL texture. Calling this is a relatively expensive operation since we introspect the texture using OpenGL getters.- Specified by:
createExternalTexturein interfaceGlDeviceExtension
-
createExternalTexture
public GpuTexture createExternalTexture(int usage, @Nullable String label, TextureFormat format, int width, int height, int depthOrLayers, int mipLevels, int nativeId) Create a new GPU texture from an existing texture whose lifecycle is externally managed. -
createTextureView
- Specified by:
createTextureViewin interfaceGpuDeviceBackend
-
createTextureView
- Specified by:
createTextureViewin interfaceGpuDeviceBackend
-
createBuffer
- Specified by:
createBufferin interfaceGpuDeviceBackend
-
createBuffer
- Specified by:
createBufferin interfaceGpuDeviceBackend
-
getImplementationInformation
- Specified by:
getImplementationInformationin interfaceGpuDeviceBackend
-
getLastDebugMessages
- Specified by:
getLastDebugMessagesin interfaceGpuDeviceBackend
-
isDebuggingEnabled
public boolean isDebuggingEnabled()- Specified by:
isDebuggingEnabledin interfaceGpuDeviceBackend
-
getRenderer
- Specified by:
getRendererin interfaceGpuDeviceBackend
-
getVendor
- Specified by:
getVendorin interfaceGpuDeviceBackend
-
getBackendName
- Specified by:
getBackendNamein interfaceGpuDeviceBackend
-
getVersion
- Specified by:
getVersionin interfaceGpuDeviceBackend
-
getMaxSupportedTextureSize
private static int getMaxSupportedTextureSize() -
getMaxTextureSize
public int getMaxTextureSize()- Specified by:
getMaxTextureSizein interfaceGpuDeviceBackend
-
getUniformOffsetAlignment
public int getUniformOffsetAlignment()- Specified by:
getUniformOffsetAlignmentin interfaceGpuDeviceBackend
-
clearPipelineCache
public void clearPipelineCache()- Specified by:
clearPipelineCachein interfaceGpuDeviceBackend
-
sacrificeShaderToOpenGlAndAmd
private static void sacrificeShaderToOpenGlAndAmd() -
getEnabledExtensions
- Specified by:
getEnabledExtensionsin interfaceGpuDeviceBackend
-
close
public void close()- Specified by:
closein interfaceGpuDeviceBackend
-
setVsync
public void setVsync(boolean enabled) - Specified by:
setVsyncin interfaceGpuDeviceBackend
-
presentFrame
public void presentFrame()- Specified by:
presentFramein interfaceGpuDeviceBackend
-
isZZeroToOne
public boolean isZZeroToOne()- Specified by:
isZZeroToOnein interfaceGpuDeviceBackend
-
directStateAccess
-
getOrCompilePipeline
-
getOrCompileShader
protected GlShaderModule getOrCompileShader(Identifier id, ShaderType type, ShaderDefines defines, ShaderSource shaderSource) -
precompilePipeline
public GlRenderPipeline precompilePipeline(RenderPipeline pipeline, @Nullable ShaderSource customShaderSource) - Specified by:
precompilePipelinein interfaceGpuDeviceBackend
-
compileShader
-
compileProgram
-
compilePipeline
-
vertexArrayCache
-
getBufferStorage
-