Files
test/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh
Clément Foucault f79b86553a EEVEE-Next: Add mesh volume bounds estimation
This adds correct object bounds estimation.

This works by creating an occupancy texture where one
bit represents one froxel. A geometry pre-pass fill this
occupancy texture and doesn't do any shading. Each bit
set to 0 will not be considered occupied by the object
volume and will discard the material compute shader for
this froxel.

There is 2 method of computing the occupancy map:
- Atomic XOR: For each fragment we compute the amount of
  froxels **center** in-front of it. We then convert that
  into occupancy bitmask that we apply to the occupancy
  texture using `imageAtomicXor`. This is straight forward
  and works well for any manifold geometry.
- Hit List: For each fragment we write the fragment depth
  in a list (contained in one array texture). This list
  is then processed by a fullscreen pass (see
  `eevee_occupancy_convert_frag.glsl`) that sorts and
  converts all the hits to the occupancy bits. This
  emulate Cycles behavior by considering only back-face
  hits as exit events and front-face hits as entry events.
  The result stores it to the occupancy texture using
  bit-wise `OR` operation to compose it with other non-hit
  list objects. This also decouple the hit-list evaluation
  complexity from the material evaluation shader.

## Limitations
### Fast
- Non-manifolds geometry objects are rendered incorrectly.
- Non-manifolds geometry objects will affect other objects
  in front of them.
### Accurate
- Limited to 16 hits per layer for now.
- Non-manifolds geometry objects will affect other objects
  in front of them.

Pull Request: https://projects.blender.org/blender/blender/pulls/113731
2023-10-19 19:22:14 +02:00

107 lines
3.7 KiB
C++

/* SPDX-FileCopyrightText: 2022 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#include "gpu_interface_info.hh"
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(gpu_shader_test)
.typedef_source("GPU_shader_shared.h")
.fragment_out(0, Type::UVEC4, "out_test")
.additional_info("draw_fullscreen");
GPU_SHADER_CREATE_INFO(gpu_math_test)
.fragment_source("gpu_math_test.glsl")
.additional_info("gpu_shader_test")
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(gpu_compute_1d_test)
.local_group_size(1)
.image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_1D, "img_output")
.compute_source("gpu_compute_1d_test.glsl")
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(gpu_compute_2d_test)
.local_group_size(1, 1)
.image(1, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "img_output")
.compute_source("gpu_compute_2d_test.glsl")
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(gpu_compute_ibo_test)
.local_group_size(1)
.storage_buf(0, Qualifier::WRITE, "uint", "out_indices[]")
.compute_source("gpu_compute_ibo_test.glsl")
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(gpu_compute_vbo_test)
.local_group_size(1)
.storage_buf(0, Qualifier::WRITE, "vec4", "out_positions[]")
.compute_source("gpu_compute_vbo_test.glsl")
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_test)
.local_group_size(1)
.storage_buf(0, Qualifier::WRITE, "int", "data_out[]")
.compute_source("gpu_compute_ssbo_test.glsl")
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(gpu_compute_ssbo_binding_test)
.local_group_size(1)
.storage_buf(0, Qualifier::WRITE, "int", "data0[]")
.storage_buf(1, Qualifier::WRITE, "int", "data1[]")
.compute_source("gpu_compute_dummy_test.glsl")
.do_static_compilation(true);
/* Push constants. */
GPU_SHADER_CREATE_INFO(gpu_push_constants_base_test)
.local_group_size(1)
.storage_buf(0, Qualifier::WRITE, "float", "data_out[]")
.compute_source("gpu_push_constants_test.glsl");
GPU_SHADER_CREATE_INFO(gpu_push_constants_test)
.additional_info("gpu_push_constants_base_test")
.push_constant(Type::FLOAT, "float_in")
.push_constant(Type::VEC2, "vec2_in")
.push_constant(Type::VEC3, "vec3_in")
.push_constant(Type::VEC4, "vec4_in")
.do_static_compilation(true);
/* Push constants size test. */
GPU_SHADER_CREATE_INFO(gpu_push_constants_128bytes_test)
.additional_info("gpu_push_constants_test")
.push_constant(Type::FLOAT, "filler", 20)
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(gpu_push_constants_256bytes_test)
.additional_info("gpu_push_constants_128bytes_test")
.push_constant(Type::FLOAT, "filler2", 32)
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(gpu_push_constants_512bytes_test)
.additional_info("gpu_push_constants_256bytes_test")
.push_constant(Type::FLOAT, "filler3", 64)
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(gpu_buffer_texture_test)
.local_group_size(1)
.sampler(0, ImageType::FLOAT_BUFFER, "bufferTexture")
.storage_buf(0, Qualifier::WRITE, "float", "data_out[]")
.compute_source("gpu_buffer_texture_test.glsl")
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(eevee_shadow_test)
.fragment_source("eevee_shadow_test.glsl")
.additional_info("gpu_shader_test")
.additional_info("eevee_shared")
.do_static_compilation(true);
GPU_SHADER_CREATE_INFO(eevee_occupancy_test)
.fragment_source("eevee_occupancy_test.glsl")
.additional_info("gpu_shader_test")
.additional_info("eevee_shared")
.do_static_compilation(true);