WIP: Vulkan: Workbench #107886

Closed
Jeroen Bakker wants to merge 88 commits from Jeroen-Bakker:vulkan-draw-manager-workbench into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
5 changed files with 18 additions and 2 deletions
Showing only changes of commit 3c658d2c2e - Show all commits

View File

@ -11,6 +11,8 @@
#include "IMB_imbuf_types.h" #include "IMB_imbuf_types.h"
#include "GPU_capabilities.h"
#include "BLI_math_matrix_types.hh" #include "BLI_math_matrix_types.hh"
#include "BLI_math_vector_types.hh" #include "BLI_math_vector_types.hh"
@ -509,7 +511,9 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
offset++; offset++;
} }
} }
IMB_gpu_clamp_half_float(&extracted_buffer); if (!GPU_texture_clamp_to_half()) {
IMB_gpu_clamp_half_float(tile_buffer);
}
GPU_texture_update_sub(texture, GPU_texture_update_sub(texture,
GPU_DATA_FLOAT, GPU_DATA_FLOAT,
@ -562,7 +566,9 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
} }
BKE_image_release_ibuf(image, tile_buffer, lock); BKE_image_release_ibuf(image, tile_buffer, lock);
} }
IMB_gpu_clamp_half_float(&texture_buffer); if (!GPU_texture_clamp_to_half()) {
IMB_gpu_clamp_half_float(&texture_buffer);
}
GPU_texture_update(info.texture, GPU_DATA_FLOAT, texture_buffer.float_buffer.data); GPU_texture_update(info.texture, GPU_DATA_FLOAT, texture_buffer.float_buffer.data);
imb_freerectImbuf_all(&texture_buffer); imb_freerectImbuf_all(&texture_buffer);
} }

View File

@ -55,6 +55,9 @@ bool GPU_shader_draw_parameters_support(void);
bool GPU_mem_stats_supported(void); bool GPU_mem_stats_supported(void);
void GPU_mem_stats_get(int *totalmem, int *freemem); void GPU_mem_stats_get(int *totalmem, int *freemem);
/* Check if the active GPU backend automatically clamp values to fit in 16F. */
bool GPU_texture_clamp_to_half(void);
/** /**
* Return support for the active context + window. * Return support for the active context + window.
*/ */

View File

@ -201,6 +201,11 @@ bool GPU_transform_feedback_support(void)
return GCaps.transform_feedback_support; return GCaps.transform_feedback_support;
} }
bool GPU_texture_clamp_to_half(void)
{
return GCaps.texture_clamp_to_half;
}
/** \} */ /** \} */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */

View File

@ -56,6 +56,7 @@ struct GPUCapabilities {
bool use_hq_normals_workaround = false; bool use_hq_normals_workaround = false;
bool clear_viewport_workaround = false; bool clear_viewport_workaround = false;
/* Vulkan related workarounds. */ /* Vulkan related workarounds. */
bool texture_clamp_to_half = false;
/* Metal related workarounds. */ /* Metal related workarounds. */
/* Minimum per-vertex stride in bytes (For a vertex buffer). */ /* Minimum per-vertex stride in bytes (For a vertex buffer). */

View File

@ -193,6 +193,7 @@ void VKBackend::capabilities_init(VKDevice &device)
GCaps.compute_shader_support = true; GCaps.compute_shader_support = true;
GCaps.shader_storage_buffer_objects_support = true; GCaps.shader_storage_buffer_objects_support = true;
GCaps.shader_image_load_store_support = true; GCaps.shader_image_load_store_support = true;
GCaps.texture_clamp_to_half = true;
GCaps.max_texture_size = max_ii(limits.maxImageDimension1D, limits.maxImageDimension2D); GCaps.max_texture_size = max_ii(limits.maxImageDimension1D, limits.maxImageDimension2D);
GCaps.max_texture_3d_size = limits.maxImageDimension3D; GCaps.max_texture_3d_size = limits.maxImageDimension3D;