Package com.mojang.blaze3d.opengl
Class GlDevice
java.lang.Object
com.mojang.blaze3d.opengl.GlDevice
- All Implemented Interfaces:
GpuDevice
,GpuDeviceExtension
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final record
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BufferStorage
private final GlDebugLabel
private final GlDebug
private final BiFunction
<ResourceLocation, ShaderType, String> private final GpuDeviceProperties
private final DirectStateAccess
private final GpuDeviceFeatures
private final CommandEncoder
private static final org.slf4j.Logger
private final int
private final Map
<RenderPipeline, GlRenderPipeline> private final Map
<GlDevice.ShaderCompilationKey, GlShaderModule> private final int
protected static boolean
protected static boolean
protected static boolean
protected static boolean
protected static boolean
protected static boolean
private final VertexArrayCache
-
Constructor Summary
ConstructorsConstructorDescriptionGlDevice
(long pWindow, int pDebugVerbosity, boolean pSynchronous, BiFunction<ResourceLocation, ShaderType, String> pDefaultShaderSource, boolean pRenderDebugLabels) -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
void
void
close()
private GlRenderPipeline
compilePipeline
(RenderPipeline pPipeline, BiFunction<ResourceLocation, ShaderType, String> pShaderSource) private GlShaderModule
compileShader
(GlDevice.ShaderCompilationKey pKey, BiFunction<ResourceLocation, ShaderType, String> pShaderSource) createBuffer
(Supplier<String> pLabel, int pUsage, int pSize) createBuffer
(Supplier<String> pLabel, int pUsage, ByteBuffer pData) createExternalTexture
(int usage, 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
(String label, int usage, int nativeId) Adopt an external OpenGL texture into a GpuTexture.createTexture
(String pLabel, int pUsage, TextureFormat pFormat, int pWidth, int pHeight, int pDepthOrLayers, int pMipLevels) createTexture
(Supplier<String> pLabel, int pUsage, TextureFormat pFormat, int pWidth, int pHeight, int pDepthOrLayers, int pMipLevels) createTextureView
(GpuTexture pTexture) createTextureView
(GpuTexture pTexture, int pBaseMipLevel, int pMipLevels) GpuDeviceFeatures enabled during device configuration.private static int
int
protected GlRenderPipeline
getOrCompilePipeline
(RenderPipeline pPipeline) protected GlShaderModule
getOrCompileShader
(ResourceLocation pShader, ShaderType pType, ShaderDefines pDefines, BiFunction<ResourceLocation, ShaderType, String> pShaderSource) int
boolean
precompilePipeline
(RenderPipeline pRenderPipeline, BiFunction<ResourceLocation, ShaderType, String> pShaderSource) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.mojang.blaze3d.systems.GpuDevice
precompilePipeline
-
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 -
deviceProperties
-
enabledFeatures
-
-
Constructor Details
-
GlDevice
public GlDevice(long pWindow, int pDebugVerbosity, boolean pSynchronous, BiFunction<ResourceLocation, ShaderType, String> pDefaultShaderSource, boolean pRenderDebugLabels)
-
-
Method Details
-
debugLabels
-
createCommandEncoder
- Specified by:
createCommandEncoder
in interfaceGpuDevice
-
createTexture
public GpuTexture createTexture(@Nullable Supplier<String> pLabel, int pUsage, TextureFormat pFormat, int pWidth, int pHeight, int pDepthOrLayers, int pMipLevels) - Specified by:
createTexture
in interfaceGpuDevice
-
createTexture
public GpuTexture createTexture(@Nullable String pLabel, int pUsage, TextureFormat pFormat, int pWidth, int pHeight, int pDepthOrLayers, int pMipLevels) - Specified by:
createTexture
in interfaceGpuDevice
-
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. -
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:
createTextureView
in interfaceGpuDevice
-
createTextureView
- Specified by:
createTextureView
in interfaceGpuDevice
-
createBuffer
- Specified by:
createBuffer
in interfaceGpuDevice
-
createBuffer
- Specified by:
createBuffer
in interfaceGpuDevice
-
getImplementationInformation
- Specified by:
getImplementationInformation
in interfaceGpuDevice
-
getLastDebugMessages
- Specified by:
getLastDebugMessages
in interfaceGpuDevice
-
isDebuggingEnabled
public boolean isDebuggingEnabled()- Specified by:
isDebuggingEnabled
in interfaceGpuDevice
-
getRenderer
- Specified by:
getRenderer
in interfaceGpuDevice
-
getVendor
-
getBackendName
- Specified by:
getBackendName
in interfaceGpuDevice
-
getVersion
- Specified by:
getVersion
in interfaceGpuDevice
-
getMaxSupportedTextureSize
private static int getMaxSupportedTextureSize() -
getMaxTextureSize
public int getMaxTextureSize()- Specified by:
getMaxTextureSize
in interfaceGpuDevice
-
getUniformOffsetAlignment
public int getUniformOffsetAlignment()- Specified by:
getUniformOffsetAlignment
in interfaceGpuDevice
-
clearPipelineCache
public void clearPipelineCache()- Specified by:
clearPipelineCache
in interfaceGpuDevice
-
amdDummyShaderWorkaround
private static void amdDummyShaderWorkaround() -
getEnabledExtensions
- Specified by:
getEnabledExtensions
in interfaceGpuDevice
-
close
public void close() -
directStateAccess
-
getOrCompilePipeline
-
getOrCompileShader
protected GlShaderModule getOrCompileShader(ResourceLocation pShader, ShaderType pType, ShaderDefines pDefines, BiFunction<ResourceLocation, ShaderType, String> pShaderSource) -
precompilePipeline
public GlRenderPipeline precompilePipeline(RenderPipeline pRenderPipeline, @Nullable BiFunction<ResourceLocation, ShaderType, String> pShaderSource) - Specified by:
precompilePipeline
in interfaceGpuDevice
-
compileShader
private GlShaderModule compileShader(GlDevice.ShaderCompilationKey pKey, BiFunction<ResourceLocation, ShaderType, String> pShaderSource) -
compilePipeline
private GlRenderPipeline compilePipeline(RenderPipeline pPipeline, BiFunction<ResourceLocation, ShaderType, String> pShaderSource) -
vertexArrayCache
-
getBufferStorage
-
deviceProperties
- Specified by:
deviceProperties
in interfaceGpuDeviceExtension
- See Also:
-
enabledFeatures
Description copied from interface:GpuDeviceExtension
GpuDeviceFeatures enabled during device configuration.- Specified by:
enabledFeatures
in interfaceGpuDeviceExtension
- See Also:
-