Vulkan: Initial Graphics Pipeline #106224
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Depends on
#106899 GPU: Add Texture Usage Parameter to GPUOffscreen.
blender/blender
Reference: blender/blender#106224
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Jeroen-Bakker/blender:vulkan-offscreen-rendering"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Initial graphic pipeline targeting. The goal of this PR is to have an initial
graphics pipeline with missing features. It should help identifying
areas that requires engineering.
Current state is that developers of the GPU module can help with the many
smaller pieces that needs to be engineered in order to get it working. It is not
intended for users or developers from other modules, but your welcome to learn
and give feedback on the code and engineering part.
We do expect that large parts of the code still needs to be re-engineered into
a more future-proof implementation.
Some highlights:
per pipeline. In the near future this could be used as a cache. More research
is needed against the default pipeline cache that vulkan already provides.
work from him in the next areas
binding state(render pass). Some Vulkan commands require no render pass to be
active, other require a render pass. As the order of our commands on API level
can not be separated this PR introduces a state engine to keep track of the
current state and desired state. This is a temporary solution, the final
solution will be proposed when we have a pixel on the screen. At that time
I expect that we can design a command encoder that supports all the cases
we need.
Notices:
is known not to work (stalls) and Intel GPUs have not been tested at all. Windows might work
but hasn't been validated yet.
when a draw call is scheduled it is flushed and waited until it is finished drawing, before
other draw calls can be scheduled. We expected the performance to be worse that it actually
is, but we expect huge performance gains in the future.
implemented and might crash when used.
WIP: Vulkan: Initial Graphics Pipeline.to WIP: Vulkan: Initial Graphics PipelineWIP: Vulkan: Initial Graphics Pipelineto Vulkan: Initial Graphics PipelineVulkan: Initial Graphics Pipelineto WIP: Vulkan: Initial Graphics PipelineWIP: Vulkan: Initial Graphics Pipelineto Vulkan: Initial Graphics Pipeline@ -73,0 +94,4 @@
VkShaderModule vertex_module,
VkShaderModule fragment_module,
VkPipelineLayout &pipeline_layout,
const VKBatch &batch,
Don't pass VKBatch, but
GPUPrimType
. This makes the function also usable when using immediate mode.Vulkan: Initial Graphics Pipelineto WIP: Vulkan: Initial Graphics Pipeline@ -344,7 +344,6 @@ static void gpu_backend_create()
void gpu_backend_delete_resources()
{
BLI_assert(g_backend);
Revert this change. It is not intended
@ -124,0 +155,4 @@
void wait_idle()
{
if (device) {
!= VK_NULL_HANDLE)
!= VK_NULL_HANDLE)
@ -170,3 +386,1 @@
if (m_device) {
vkDeviceWaitIdle(m_device);
}
// TODO: see if we can use a usage counter to free the global device.
Remove comment
@ -121,3 +126,3 @@
void VKCommandBuffer::end_render_pass(const VKFrameBuffer &framebuffer)
{
UNUSED_VARS_NDEBUG(framebuffer)
UNUSED_VARS_NDEBUG(framebuffer);
Commit directly to main.
@ -136,1 +160,3 @@
image_info.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
image_info.sampler = binding.vk_sampler;
image_info.imageView = binding.texture->vk_image_view_handle();
/* TODO: use the correct one from the texture. */
Remove comment
WIP: Vulkan: Initial Graphics Pipelineto Vulkan: Initial Graphics Pipeline@ -1622,6 +1623,7 @@ void DRW_draw_view(const bContext *C)
{
View3D *v3d = CTX_wm_view3d(C);
if (v3d) {
GPU_debug_capture_begin();
Revert these changes. Draw manager support will be added later as it requires more features to be added to the VKBackend.
@ -304,6 +322,24 @@ bool VKTexture::allocate()
return result == VK_SUCCESS;
}
// TODO: move texture/image bindings to shader.
This should be done as part of this change.
@ -318,0 +360,4 @@
void VKTexture::unbind()
{
VKContext &context = *VKContext::get();
/* TODO get a list of shaders this texture is bound to. */
Remove comment. The solution is to remove the informative warning from vulkan validation layers using message utils. The reason is that due to the dynamic and extensible character of Blender it isn't possible to keep textures alive until the next time the pipeline is being used. Other solutions like filling it with an dummy textures would add more complexity just to remove an informative message. The complexity is that the texture requires similar formats/usages and might be a larger set than expected.
@ -39,3 +39,3 @@
const VKDescriptorSet::Location descriptor_set_location(
const shader::ShaderCreateInfo::Resource &resource) const;
const VKDescriptorSet::Location descriptor_set_location(
const std::optional<VKDescriptorSet::Location> descriptor_set_location(
Need to re-evaluate if this change is still needed, or has been fixed by using late resource binding via the VKStateManager
@ -513,0 +481,4 @@
VkDevice device = vulkan_device->device;
if (m_currentFrame != m_lastFrame) {
vkResetFences(device, 1, &m_in_flight_fences[m_currentFrame]);
}
Add early exit when
m_currentFrame == m_lastFrame
. In this case swapChain is triggered without anything being rendered.@ -848,3 +839,3 @@
/* Driver can stall if only using minimal image count. */
uint32_t image_count = capabilities.minImageCount;
uint32_t image_count = capabilities.minImageCount + 1;
According to vulkan it is better to allocate one extra.
@ -10,3 +15,3 @@
namespace blender::gpu {
void VKBatch::draw(int /*v_first*/, int /*v_count*/, int /*i_first*/, int /*i_count*/) {}
void VKBatch::draw(int v_first, int v_count, int i_first, int i_count)
Use full names to make a difference between indexed and instanced.
@ -0,0 +16,4 @@
/**
* Helper struct to enable buffers to be bound with an offset.
*/
struct VKBufferWithOffset {
This is specifically added to support VKImmediate where internally an VKBuffer is used, and can have multiple layouts. This should be mentioned in the comments.
It was added in its own file as it needs to be included to the command buffer. We might want to move this to the VKBuffer as for now I don't see other specific subtypes being added.
@ -510,3 +478,3 @@
submit_info.pSignalSemaphores = &m_render_finished_semaphores[m_currentFrame];
vkResetFences(device, 1, &m_in_flight_fences[m_currentFrame]);
assert(vulkan_device.has_value() && vulkan_device->device != VK_NULL_HANDLE);
Describe the swapchan in a technical document.
@ -65,3 +65,3 @@
{
VKContext &context = *VKContext::get();
VKShader *shader = static_cast<VKShader *>(context.shader);
context.bind_compute_pipeline();
Add late binding of compute pipeline
9cab0604f5
to3fc7d631af