Class VkRenderDevice
java.lang.Object
dev.engine.graphics.vulkan.VkRenderDevice
- All Implemented Interfaces:
RenderDevice, AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionVkRenderDevice(VkBindings vk, String[] requiredExtensions, LongUnaryOperator surfaceFactory, int initialWidth, int initialHeight) Creates a Vulkan render device.VkRenderDevice(VkBindings vk, String[] requiredExtensions, LongUnaryOperator surfaceFactory, int initialWidth, int initialHeight, int preferredFormat, int preferredPresentMode, GraphicsConfig config) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclose()createBuffer(BufferDescriptor descriptor) createComputePipeline(ComputePipelineDescriptor descriptor) createPipeline(PipelineDescriptor descriptor) createRenderTarget(RenderTargetDescriptor descriptor) createSampler(SamplerDescriptor descriptor) createStreamingBuffer(long frameSize, int frameCount, BufferUsage usage) createTexture(TextureDescriptor descriptor) createVertexInput(VertexFormat format) voiddestroyBuffer(Handle<BufferResource> handle) voiddestroyPipeline(Handle<PipelineResource> handle) voidvoiddestroySampler(Handle<SamplerResource> handle) voiddestroyTexture(Handle<TextureResource> handle) voiddestroyVertexInput(Handle<VertexInputResource> handle) voidendFrame()longgetBindlessTextureHandle(Handle<TextureResource> texture) getRenderTargetColorTexture(Handle<RenderTargetResource> renderTarget, int index) booleanisValidBuffer(Handle<BufferResource> handle) booleanisValidPipeline(Handle<PipelineResource> handle) booleanisValidTexture(Handle<TextureResource> handle) <T> TqueryCapability(DeviceCapability<T> capability) byte[]readFramebuffer(int width, int height) Reads back the entire framebuffer as RGBA8 byte array.int[]readPixel(int x, int y) Reads back pixels from the current swapchain image after rendering.voidsubmit(CommandList commands) intSwapchain height.intSwapchain width.voiduploadTexture(Handle<TextureResource> texture, ByteBuffer pixels) writeBuffer(Handle<BufferResource> handle) writeBuffer(Handle<BufferResource> handle, long offset, long length) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RenderDevice
getTextureIndex, supports
-
Constructor Details
-
VkRenderDevice
public VkRenderDevice(VkBindings vk, String[] requiredExtensions, LongUnaryOperator surfaceFactory, int initialWidth, int initialHeight) Creates a Vulkan render device.- Parameters:
vk- the Vulkan bindings implementationrequiredExtensions- instance extensions needed for surface supportsurfaceFactory- given the VkInstance handle, creates and returns a VkSurfaceKHR handle
-
VkRenderDevice
public VkRenderDevice(VkBindings vk, String[] requiredExtensions, LongUnaryOperator surfaceFactory, int initialWidth, int initialHeight, int preferredFormat, int preferredPresentMode, GraphicsConfig config)
-
-
Method Details
-
createBuffer
- Specified by:
createBufferin interfaceRenderDevice
-
destroyBuffer
- Specified by:
destroyBufferin interfaceRenderDevice
-
isValidBuffer
- Specified by:
isValidBufferin interfaceRenderDevice
-
writeBuffer
- Specified by:
writeBufferin interfaceRenderDevice
-
writeBuffer
- Specified by:
writeBufferin interfaceRenderDevice
-
createTexture
- Specified by:
createTexturein interfaceRenderDevice
-
uploadTexture
- Specified by:
uploadTexturein interfaceRenderDevice
-
destroyTexture
- Specified by:
destroyTexturein interfaceRenderDevice
-
isValidTexture
- Specified by:
isValidTexturein interfaceRenderDevice
-
getBindlessTextureHandle
- Specified by:
getBindlessTextureHandlein interfaceRenderDevice
-
createRenderTarget
- Specified by:
createRenderTargetin interfaceRenderDevice
-
getRenderTargetColorTexture
public Handle<TextureResource> getRenderTargetColorTexture(Handle<RenderTargetResource> renderTarget, int index) - Specified by:
getRenderTargetColorTexturein interfaceRenderDevice
-
destroyRenderTarget
- Specified by:
destroyRenderTargetin interfaceRenderDevice
-
createVertexInput
- Specified by:
createVertexInputin interfaceRenderDevice
-
destroyVertexInput
- Specified by:
destroyVertexInputin interfaceRenderDevice
-
createSampler
- Specified by:
createSamplerin interfaceRenderDevice
-
destroySampler
- Specified by:
destroySamplerin interfaceRenderDevice
-
createPipeline
- Specified by:
createPipelinein interfaceRenderDevice
-
destroyPipeline
- Specified by:
destroyPipelinein interfaceRenderDevice
-
createComputePipeline
- Specified by:
createComputePipelinein interfaceRenderDevice
-
isValidPipeline
- Specified by:
isValidPipelinein interfaceRenderDevice
-
createStreamingBuffer
- Specified by:
createStreamingBufferin interfaceRenderDevice
-
createFence
- Specified by:
createFencein interfaceRenderDevice
-
beginFrame
public void beginFrame()- Specified by:
beginFramein interfaceRenderDevice
-
endFrame
public void endFrame()- Specified by:
endFramein interfaceRenderDevice
-
readPixel
public int[] readPixel(int x, int y) Reads back pixels from the current swapchain image after rendering. Must be called between endFrame() submissions — waits for GPU idle. Returns RGBA8 pixel data as int[] {R, G, B, A} for 0-255 values. -
readFramebuffer
public byte[] readFramebuffer(int width, int height) Reads back the entire framebuffer as RGBA8 byte array. Must be called after endFrame(). Waits for GPU idle.- Specified by:
readFramebufferin interfaceRenderDevice
-
swapchainWidth
public int swapchainWidth()Swapchain width. -
swapchainHeight
public int swapchainHeight()Swapchain height. -
submit
- Specified by:
submitin interfaceRenderDevice
-
queryCapability
- Specified by:
queryCapabilityin interfaceRenderDevice
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRenderDevice
-