WIP: Vulkan: Many small things to get no crashes #112287

Closed
Jeroen Bakker wants to merge 19 commits from Jeroen-Bakker:vulkan/working-towards-eevee-next into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
5 changed files with 43 additions and 2 deletions

View File

@ -327,6 +327,7 @@ bool Instance::do_probe_sync() const
**/
void Instance::render_sample()
{
GPU_debug_capture_begin();
if (sampling.finished_viewport()) {
film.display();
return;
@ -345,6 +346,7 @@ void Instance::render_sample()
main_view.render();
motion_blur.step();
GPU_debug_capture_end();
}
void Instance::render_read_result(RenderLayer *render_layer, const char *view_name)

View File

@ -112,4 +112,15 @@ TEST(std140, gpu_shader_2D_widget_base)
EXPECT_EQ(offset, 272);
}
TEST(std430, overlay_grid)
{
uint32_t offset = 0;
def_attr<Std430>(shader::Type::VEC3, 0, 0, 12, &offset);
def_attr<Std430>(shader::Type::INT, 0, 12, 16, &offset);
align_end_of_struct<Std430>(&offset);
EXPECT_EQ(offset, 16);
}
} // namespace blender::gpu

View File

@ -297,6 +297,9 @@ messenger_callback(VkDebugUtilsMessageSeverityFlagBitsEXT message_severity,
debugging_tools.print_labels(callback_data);
}
BLI_assert(callback_data->messageIdNumber != 0x47172512);
BLI_assert(callback_data->messageIdNumber != 0x2ba3a98e);
return VK_FALSE;
};

View File

@ -60,6 +60,7 @@ uint32_t Std430::element_components_len(const shader::Type type)
case shader::Type::VEC3:
case shader::Type::UVEC3:
case shader::Type::IVEC3:
return 3;
case shader::Type::VEC4:
case shader::Type::UVEC4:
case shader::Type::IVEC4:
@ -76,7 +77,31 @@ uint32_t Std430::element_components_len(const shader::Type type)
uint32_t Std430::array_components_len(const shader::Type type)
{
return Std430::element_components_len(type);
switch (type) {
case shader::Type::FLOAT:
case shader::Type::UINT:
case shader::Type::INT:
case shader::Type::BOOL:
return 1;
case shader::Type::VEC2:
case shader::Type::UVEC2:
case shader::Type::IVEC2:
return 2;
case shader::Type::VEC3:
case shader::Type::UVEC3:
case shader::Type::IVEC3:
case shader::Type::VEC4:
case shader::Type::UVEC4:
case shader::Type::IVEC4:
return 4;
case shader::Type::MAT3:
return 12;
case shader::Type::MAT4:
return 16;
default:
BLI_assert_msg(false, "Type not supported in dynamic structs.");
}
return 0;
}
uint32_t Std140::component_mem_size(const shader::Type /*type*/)

View File

@ -1006,7 +1006,7 @@ std::string VKShader::resources_declare(const shader::ShaderCreateInfo &info) co
if (push_constants_storage != VKPushConstants::StorageType::NONE) {
ss << "\n/* Push Constants. */\n";
if (push_constants_storage == VKPushConstants::StorageType::PUSH_CONSTANTS) {
ss << "layout(push_constant) uniform constants\n";
ss << "layout(push_constant, std430) uniform constants\n";
}
else if (push_constants_storage == VKPushConstants::StorageType::UNIFORM_BUFFER) {
ss << "layout(binding = " << push_constants_layout.descriptor_set_location_get()