Blender V5.3
eevee_volume.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
12
13#include "GPU_capabilities.hh"
14
15#include "GPU_debug.hh"
16
17#include "eevee_instance.hh"
18#include "eevee_pipeline.hh"
19
20#include "eevee_volume.hh"
21
22namespace blender::eevee {
23
25{
26 enabled_ = false;
27
28 const Scene *scene_eval = inst_.scene;
29
30 /* The froxel grid's aspect ratio must match the view it will be sampled against in
31 * `VolumeModule::set_view`, otherwise `coord_scale` ends up sampling outside the valid tile
32 * range. */
33 const int2 extent = inst_.film.render_extent_get();
34 int tile_size = clamp_i(scene_eval->eevee.volumetric_tile_size, 1, 16);
35
36 int3 tex_size;
37 /* Try to match resolution setting but fall back to lower resolution
38 * if it doesn't fit the hardware limits. */
39 for (; tile_size <= 16; tile_size *= 2) {
40 /* Find Froxel Texture resolution. */
41 tex_size = int3(math::divide_ceil(extent, int2(tile_size)), 0);
42 tex_size.z = std::max(1, scene_eval->eevee.volumetric_samples);
43
44 if (math::reduce_max(tex_size) < GPU_max_texture_3d_size()) {
45 /* Fits hardware limits. */
46 break;
47 }
48 }
49
50 if (tile_size != scene_eval->eevee.volumetric_tile_size) {
51 inst_.info_append_i18n(
52 "Warning: Volume rendering data could not be allocated. Now using a resolution of 1:{} "
53 "instead of 1:{}.",
54 tile_size,
55 scene_eval->eevee.volumetric_tile_size);
56 }
57
58 data_.tile_size = tile_size;
59 data_.tile_size_lod = int(log2(tile_size));
60 data_.tex_size = tex_size;
61 data_.inv_tex_size = 1.0f / float3(tex_size);
62
63 const bool shadow_enabled = (scene_eval->eevee.flag & SCE_EEVEE_VOLUMETRIC_SHADOWS) != 0;
64 data_.shadow_steps = (shadow_enabled) ? scene_eval->eevee.volumetric_shadow_samples : 0;
65
66 data_.light_clamp = scene_eval->eevee.volumetric_light_clamp;
67 data_.light_clamp = (data_.light_clamp > 0.0) ? data_.light_clamp : 1e20;
68
69 use_reprojection_ = (scene_eval->eevee.flag & SCE_EEVEE_TAA_REPROJECTION) != 0;
70}
71
73{
74 previous_objects_ = current_objects_;
75 current_objects_.clear();
76}
77
78void VolumeModule::world_sync(const WorldHandle &world_handle)
79{
80 if (!use_reprojection_) {
81 return;
82 }
83
84 if (world_handle.recalc && !inst_.is_playback) {
85 valid_history_ = false;
86 }
87}
88
90{
91 for (int i : IndexRange(ob_handle.instances_count())) {
92 current_objects_.add(ObjectKey(ob_handle, i));
93 }
94
95 if (!use_reprojection_) {
96 return;
97 }
98
99 if (ob_handle.recalc && !inst_.is_playback) {
100 valid_history_ = false;
101 }
102}
103
105{
106 return inst_.world.has_volume() || !current_objects_.is_empty() ||
107 inst_.film.get_data().volume_light_id != -1;
108}
109
111{
112 enabled_ = will_enable();
113 /* Save reset state. */
114 viewport_sampling_is_reset_ = inst_.is_viewport() && inst_.sampling.is_reset();
115
116 const Scene *scene_eval = inst_.scene;
117
118 const bool custom_range = scene_eval->eevee.flag & SCE_EEVEE_VOLUME_CUSTOM_RANGE;
119 const float camera_clip_start = inst_.camera.data_get().clip_near;
120 const float camera_clip_end = inst_.camera.data_get().clip_far;
121 float integration_start = custom_range ? scene_eval->eevee.volumetric_start : camera_clip_start;
122 float integration_end = custom_range ? scene_eval->eevee.volumetric_end : camera_clip_end;
123
124 if (!inst_.camera.is_camera_object() && inst_.camera.is_orthographic()) {
125 integration_start = -integration_end;
126 }
127
128 std::optional<Bounds<float>> volume_bounds = inst_.pipelines.volume.object_integration_range();
129 if (volume_bounds && !inst_.world.has_volume() && !inst_.camera.is_panoramic()) {
130 /* Restrict integration range to the object volume range. This increases precision.
131 * Panoramic cameras render several views and `volume_bounds` is currently derived from only
132 * the main camera transform, therefore is not a valid shared range for their radial froxels.
133 */
134 integration_start = math::max(integration_start, -volume_bounds.value().max);
135 integration_end = math::min(integration_end, -volume_bounds.value().min);
136 }
137
138 /* Negate clip values (View matrix forward vector is -Z). */
139 float near = -math::max(integration_start, camera_clip_start - 1e-4f);
140 float far = -math::min(integration_end, camera_clip_end + 1e-4f);
141
142 if (assign_if_different(history_camera_is_perspective_, inst_.camera.is_perspective())) {
143 /* Currently, the re-projection uses the same path for volume_z_to_view_z conversion for both
144 * the current view and the history view. Moreover, re-projecting in this huge change is more
145 * detrimental than anything. */
146 valid_history_ = false;
147 }
148
149 if (valid_history_) {
150 /* Avoid the (potentially expensive) check if valid_history_ is already false. */
151 if (current_objects_ != previous_objects_) {
152 valid_history_ = false;
153 }
154 }
155
156 if (!inst_.camera.is_orthographic()) {
157 /* Must match GPU's `ViewMatrices::is_perspective()`, true for panoramic subviews too. */
158 float sample_distribution = scene_eval->eevee.volumetric_sample_distribution;
159 sample_distribution = 4.0f * math::max(1.0f - sample_distribution, 1e-2f);
160
161 data_.depth_near = (far - near * exp2(1.0f / sample_distribution)) / (far - near);
162 data_.depth_far = (1.0f - data_.depth_near) / near;
163 data_.depth_distribution = sample_distribution;
164 }
165 else {
166 data_.depth_near = near;
167 data_.depth_far = far;
168 data_.depth_distribution = 0.0f; /* Unused. */
169 }
170
171 if (!enabled_) {
172 occupancy_tx_.free();
173 prop_scattering_tx_.free();
174 prop_extinction_tx_.free();
175 prop_emission_tx_.free();
176 prop_phase_tx_.free();
177 prop_phase_weight_tx_.free();
178 scatter_tx_.current().free();
179 scatter_tx_.previous().free();
180 extinction_tx_.current().free();
181 extinction_tx_.previous().free();
182 integrated_scatter_tx_.free();
183 integrated_transmit_tx_.free();
184
185 /* Update references for bindings. */
186 result.scattering_tx_ = dummy_scatter_tx_;
187 result.transmittance_tx_ = dummy_transmit_tx_;
188 /* These shouldn't be used. */
189 properties.scattering_tx_ = nullptr;
190 properties.extinction_tx_ = nullptr;
191 properties.emission_tx_ = nullptr;
192 properties.phase_tx_ = nullptr;
193 properties.phase_weight_tx_ = nullptr;
194 properties.occupancy_tx_ = nullptr;
195 occupancy.occupancy_tx_ = nullptr;
196 occupancy.hit_depth_tx_ = nullptr;
197 occupancy.hit_count_tx_ = nullptr;
198
199 /* Avoid undefined re-projection behavior. */
200 valid_history_ = false;
201 return;
202 }
203
204 bool has_scatter = inst_.world.has_volume_scatter() || inst_.pipelines.volume.has_scatter();
205 bool has_absorption = inst_.world.has_volume_absorption() ||
206 inst_.pipelines.volume.has_absorption();
207 use_lights_ = has_scatter;
208 /* TODO(fclem): Allocate extinction texture as dummy (1px^3) if has_absorption are false. */
209 UNUSED_VARS(has_absorption);
210
213
214 prop_scattering_tx_.ensure_3d(gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage);
215 prop_extinction_tx_.ensure_3d(gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage);
216 prop_emission_tx_.ensure_3d(gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage);
217 /* We need 2 separate images to prevent bugs in Nvidia drivers (See #122454). */
218 prop_phase_tx_.ensure_3d(gpu::TextureFormat::SFLOAT_16, data_.tex_size, usage);
219 prop_phase_weight_tx_.ensure_3d(gpu::TextureFormat::SFLOAT_16, data_.tex_size, usage);
220
221 int occupancy_layers = divide_ceil_u(data_.tex_size.z, 32u);
224 occupancy_tx_.ensure_3d(
225 gpu::TextureFormat::UINT_32, int3(data_.tex_size.xy(), occupancy_layers), occupancy_usage);
226
227 {
232 int2 hit_list_size = int2(1);
233 int hit_list_layer = 1;
234 if (inst_.pipelines.volume.use_hit_list()) {
235 hit_list_layer = clamp_i(inst_.scene->eevee.volumetric_ray_depth, 1, 16);
236 hit_list_size = data_.tex_size.xy();
237 }
238 hit_depth_tx_.ensure_3d(
239 gpu::TextureFormat::SFLOAT_32, int3(hit_list_size, hit_list_layer), hit_depth_usage);
240 if (hit_count_tx_.ensure_2d(gpu::TextureFormat::UINT_32, hit_list_size, hit_count_usage)) {
241 hit_count_tx_.clear(uint4(0u));
242 }
243 }
244
247 front_depth_tx_.ensure_2d(
248 gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, data_.tex_size.xy(), front_depth_usage);
249 occupancy_fb_.ensure(GPU_ATTACHMENT_TEXTURE(front_depth_tx_));
250
251 bool created = false;
252 created |= scatter_tx_.current().ensure_3d(
253 gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage);
254 created |= extinction_tx_.current().ensure_3d(
255 gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage);
256 created |= scatter_tx_.previous().ensure_3d(
257 gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage);
258 created |= extinction_tx_.previous().ensure_3d(
259 gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage);
260
261 if (created) {
262 valid_history_ = false;
263 }
264
265 integrated_scatter_tx_.ensure_3d(gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage);
266 integrated_transmit_tx_.ensure_3d(gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage);
267
268 /* Update references for bindings. */
269 result.scattering_tx_ = integrated_scatter_tx_;
270 result.transmittance_tx_ = integrated_transmit_tx_;
271 properties.scattering_tx_ = prop_scattering_tx_;
272 properties.extinction_tx_ = prop_extinction_tx_;
273 properties.emission_tx_ = prop_emission_tx_;
274 properties.phase_tx_ = prop_phase_tx_;
275 properties.phase_weight_tx_ = prop_phase_weight_tx_;
276 properties.occupancy_tx_ = occupancy_tx_;
277 occupancy.occupancy_tx_ = occupancy_tx_;
278 occupancy.hit_depth_tx_ = hit_depth_tx_;
279 occupancy.hit_count_tx_ = hit_count_tx_;
280
281 /* Set extend mode to extend and reject invalid samples in the shader.
282 * This avoids some black rim artifacts near the edge of the re-projected volume.
283 * Filter linear to avoid sharp artifacts during re-projection. */
284 const GPUSamplerState history_sampler = {GPU_SAMPLER_FILTERING_LINEAR,
287 scatter_ps_.init();
288 scatter_ps_.shader_set(
289 inst_.shaders.static_shader_get(use_lights_ ? VOLUME_SCATTER_WITH_LIGHTS : VOLUME_SCATTER));
290 scatter_ps_.bind_resources(inst_.hiz_buffer.front);
291 scatter_ps_.bind_resources(inst_.lights);
292 scatter_ps_.bind_resources(inst_.sphere_probes);
293 scatter_ps_.bind_resources(inst_.volume_probes);
294 scatter_ps_.bind_resources(inst_.shadows);
295 scatter_ps_.bind_resources(inst_.uniform_data);
296 scatter_ps_.bind_resources(inst_.sampling);
297 scatter_ps_.bind_image("in_scattering_img", &prop_scattering_tx_);
298 scatter_ps_.bind_image("in_extinction_img", &prop_extinction_tx_);
299 scatter_ps_.bind_texture("extinction_tx", &prop_extinction_tx_);
300 scatter_ps_.bind_image("in_emission_img", &prop_emission_tx_);
301 scatter_ps_.bind_image("in_phase_img", &prop_phase_tx_);
302 scatter_ps_.bind_image("in_phase_weight_img", &prop_phase_weight_tx_);
303 scatter_ps_.bind_texture("scattering_history_tx", &scatter_tx_.previous(), history_sampler);
304 scatter_ps_.bind_texture("extinction_history_tx", &extinction_tx_.previous(), history_sampler);
305 scatter_ps_.bind_image("out_scattering_img", &scatter_tx_.current());
306 scatter_ps_.bind_image("out_extinction_img", &extinction_tx_.current());
307 scatter_ps_.bind_texture(RBUFS_UTILITY_TEX_SLOT, inst_.pipelines.utility_tx);
308 /* Sync with the property pass. */
310 scatter_ps_.dispatch(math::divide_ceil(data_.tex_size, int3(VOLUME_GROUP_SIZE)));
311
312 integration_ps_.init();
313 integration_ps_.shader_set(inst_.shaders.static_shader_get(VOLUME_INTEGRATION));
314 integration_ps_.bind_resources(inst_.uniform_data);
315 integration_ps_.bind_resources(inst_.sampling);
316 integration_ps_.bind_texture("in_scattering_tx", &scatter_tx_.current());
317 integration_ps_.bind_texture("in_extinction_tx", &extinction_tx_.current());
318 integration_ps_.bind_image("out_scattering_img", &integrated_scatter_tx_);
319 integration_ps_.bind_image("out_transmittance_img", &integrated_transmit_tx_);
320 /* Sync with the scatter pass. */
321 integration_ps_.barrier(GPU_BARRIER_TEXTURE_FETCH);
322 integration_ps_.dispatch(
324
325 resolve_ps_.init();
326 resolve_ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_CUSTOM);
327 resolve_ps_.shader_set(inst_.shaders.static_shader_get(VOLUME_RESOLVE));
328 resolve_ps_.bind_resources(inst_.uniform_data);
329 resolve_ps_.bind_resources(this->result);
330 resolve_ps_.bind_resources(inst_.hiz_buffer.front);
331 resolve_ps_.bind_image(RBUFS_COLOR_SLOT, &inst_.render_buffers.rp_color_tx);
332 resolve_ps_.bind_image(RBUFS_VALUE_SLOT, &inst_.render_buffers.rp_value_tx);
333 /* Sync with the integration pass. */
334 resolve_ps_.barrier(GPU_BARRIER_TEXTURE_FETCH);
335 resolve_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
336}
337
338void VolumeModule::set_view(View &main_view, int2 render_extent)
339{
340 data_.main_view_extent = float2(render_extent);
341 data_.main_view_extent_inv = 1.0f / float2(render_extent);
342 data_.coord_scale = float2(render_extent) / float2(data_.tile_size * data_.tex_size.xy());
343
344 /* Number of frame to consider for blending with exponential (infinite) average. */
345 int exponential_frame_count = 16;
346 if (inst_.is_image_render) {
347 /* Disable reprojection for rendering. */
348 exponential_frame_count = 0;
349 }
350 else if (!use_reprojection_) {
351 /* No re-projection if TAA is disabled. */
352 exponential_frame_count = 0;
353 }
354 else if (inst_.camera.is_panoramic()) {
355 /* Disable reprojection until the volume module supports per view history. */
356 exponential_frame_count = 0;
357 }
358 else if (inst_.is_playback) {
359 /* For now, we assume we want responsiveness for volume animation.
360 * But this makes general animation inside uniform volumes less stable.
361 * When we introduce updated volume tagging, we will be able to increase this for general
362 * playback. */
363 exponential_frame_count = 3;
364 }
365 else if (inst_.is_transforming) {
366 /* Improve responsiveness of volume if we are transforming objects. */
367 /* TODO(fclem): This is too general as it will be triggered even for non volume object.
368 * Instead, we should tag which areas of the volume that need increased responsiveness. */
369 exponential_frame_count = 3;
370 }
371 else if (inst_.is_navigating) {
372 /* Navigation is usually smooth because of the re-projection but we can get ghosting
373 * artifacts on lights because of voxels stretched in Z or anisotropy. */
374 exponential_frame_count = 8;
375 }
376 else if (viewport_sampling_is_reset_) {
377 /* If we are not falling in any cases above, this usually means there is a scene or object
378 * parameter update. Reset accumulation completely. */
379 exponential_frame_count = 0;
380 }
381
382 if (!valid_history_) {
383 history_frame_count_ = 0;
384 }
385 /* Interactive mode accumulate samples using exponential average.
386 * We still reuse the history when we go into static mode.
387 * However, using re-projection for static mode will show the precision limit of RG11B10 format.
388 * So we clamp it to the exponential frame count in any case. */
389 history_frame_count_ = math::min(history_frame_count_, exponential_frame_count);
390
391 /* In interactive mode, use exponential average (fixed ratio).
392 * For static / render mode use simple average (moving ratio). */
393 float history_opacity = history_frame_count_ / (history_frame_count_ + 1.0f);
394
395 /* Setting opacity to 0.0 will bypass any sampling of history buffer.
396 * Allowing us to skip the 3D texture clear. */
397 data_.history_opacity = (valid_history_) ? history_opacity : 0.0f;
398
399 float left, right, bottom, top, near, far;
400 projmat_dimensions(main_view.winmat().ptr(), &left, &right, &bottom, &top, &near, &far);
401
402 /* Just like up-sampling matrix computation, we have to be careful to where to put the bounds of
403 * our froxel volume so that a 2D pixel covers exactly the number of pixel in a tile. */
404 float2 render_size = float2(right - left, top - bottom);
405 float2 volume_size = render_size * float2(data_.tex_size.xy() * data_.tile_size) /
406 float2(render_extent);
407 /* Change to the padded extends. */
408 right = left + volume_size.x;
409 top = bottom + volume_size.y;
410
411 float4x4 winmat_infinite, winmat_finite;
412 /* Create an infinite projection matrix to avoid far clipping plane clipping the object. This
413 * way, surfaces that are further away than the far clip plane will still be voxelized. */
414 winmat_infinite = main_view.is_persp() ?
415 math::projection::perspective_infinite(left, right, bottom, top, near) :
416 math::projection::orthographic_infinite(left, right, bottom, top, near);
417 /* We still need a bounded projection matrix to get correct froxel location. */
418 winmat_finite = main_view.is_persp() ?
419 math::projection::perspective(left, right, bottom, top, near, far) :
420 math::projection::orthographic(left, right, bottom, top, near, far);
421 /* Save non-jittered finite matrix for re-projection. */
422 data_.winmat_stable = winmat_finite;
423 data_.wininv_stable = math::invert(winmat_finite);
424
425 /* Anti-Aliasing / Super-Sampling jitter. */
426 float2 jitter = inst_.sampling.rng_2d_get(SAMPLING_VOLUME_U);
427 /* Wrap to keep first sample centered (0,0) and scale to convert to NDC. */
428 jitter = math::fract(jitter + 0.5f) * 2.0f - 1.0f;
429 /* Convert to pixel size. */
430 jitter *= data_.inv_tex_size.xy();
431 /* Apply jitter to both matrices. */
432 winmat_infinite = math::projection::translate(winmat_infinite, jitter);
433 winmat_finite = math::projection::translate(winmat_finite, jitter);
434
435 data_.winmat_finite = winmat_finite;
436 data_.wininv_finite = math::invert(winmat_finite);
437
438 /* Compute re-projection matrix. */
439 data_.curr_view_to_past_view = history_viewmat_ * main_view.viewinv();
440
441 volume_view.sync(main_view.viewmat(), winmat_infinite);
442}
443
445{
446 if (!enabled_) {
447 return;
448 }
449
450 GPU_debug_group_begin("Volumes");
451 occupancy_fb_.bind();
452 inst_.pipelines.world_volume.render(main_view);
453
454 /* TODO(fclem): The infinite projection matrix makes the culling test unreliable (see #115595).
455 * We need custom culling for these but that's not implemented yet. */
456 volume_view.visibility_test(false);
457
458 if (!current_objects_.is_empty()) {
459 inst_.pipelines.volume.render(volume_view, occupancy_tx_);
460 }
462}
463
464void VolumeModule::draw_compute(View &main_view, int2 extent)
465{
466 if (!enabled_) {
467 return;
468 }
469
470 if (inst_.pipelines.deferred.is_empty()) {
471 /* This assume the volume are computed after deferred passes. This is needed to avoid broken
472 * lighting and shadowing as the lights are not setup otherwise (see #121971). */
473 inst_.hiz_buffer.swap_layer();
474 inst_.hiz_buffer.update();
475 inst_.volume_probes.set_view(main_view);
476 inst_.sphere_probes.set_view(main_view);
477 inst_.shadows.render(main_view, extent);
478 }
479
480 scatter_tx_.swap();
481 extinction_tx_.swap();
482
483 inst_.manager->submit(scatter_ps_, main_view);
484 inst_.manager->submit(integration_ps_, main_view);
485
486 /* Copy history data. */
487 history_viewmat_ = main_view.viewmat();
488 data_.history_depth_near = data_.depth_near;
489 data_.history_depth_far = data_.depth_far;
490 data_.history_depth_distribution = data_.depth_distribution;
491 data_.history_winmat_stable = data_.winmat_stable;
492 valid_history_ = true;
493 history_frame_count_ += 1;
494}
495
497{
498 if (!enabled_) {
499 return;
500 }
501
502 inst_.hiz_buffer.update();
503
504 resolve_fb_.ensure(GPU_ATTACHMENT_NONE,
505 GPU_ATTACHMENT_TEXTURE(inst_.render_buffers.combined_tx));
506 resolve_fb_.bind();
507 inst_.manager->submit(resolve_ps_, view);
508}
509
510} // namespace blender::eevee
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_NONE
#define UNUSED_VARS(...)
constexpr IndexRange()=default
bool is_persp(int view_id=0) const
Definition draw_view.hh:93
const float4x4 & winmat(int view_id=0) const
Definition draw_view.hh:148
const float4x4 & viewmat(int view_id=0) const
Definition draw_view.hh:136
const float4x4 & viewinv(int view_id=0) const
Definition draw_view.hh:142
struct blender::eevee::VolumeModule::@235034362354336005016350043217325022302275164354 result
void object_sync(const ObjectHandle &ob_handle)
void set_view(View &main_view, int2 render_extent)
void world_sync(const WorldHandle &world_handle)
struct blender::eevee::VolumeModule::@105155100155224106113172003277040034221247060352 properties
void draw_compute(View &main_view, int2 extent)
void draw_prepass(View &main_view)
#define RBUFS_UTILITY_TEX_SLOT
#define VOLUME_GROUP_SIZE
#define RBUFS_VALUE_SLOT
#define RBUFS_COLOR_SLOT
#define VOLUME_INTEGRATION_GROUP_SIZE
#define exp2
#define log2
MatBase< T, 4, 4 > orthographic(T left, T right, T bottom, T top, T near_clip, T far_clip)
Create an orthographic projection matrix using OpenGL coordinate convention: Maps each axis range to ...
MatBase< T, 4, 4 > orthographic_infinite(T left, T right, T bottom, T top)
Create an orthographic projection matrix using OpenGL coordinate convention: Maps each axis range to ...
MatBase< T, 4, 4 > translate(const MatBase< T, 4, 4 > &mat, const VecBase< T, 2 > &offset)
Translate a projection matrix after creation in the screen plane. Usually used for anti-aliasing jitt...
MatBase< T, 4, 4 > perspective_infinite(T left, T right, T bottom, T top, T near_clip)
Create a perspective projection matrix using OpenGL coordinate convention: Maps each axis range to [-...
MatBase< T, 4, 4 > perspective(T left, T right, T bottom, T top, T near_clip, T far_clip)
Create a perspective projection matrix using OpenGL coordinate convention: Maps each axis range to [-...
T reduce_max(const VecBase< T, Size > &a)
VecBase< T, Size > divide_ceil(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
T min(const T &a, const T &b)
CartesianBasis invert(const CartesianBasis &basis)
T fract(const T &a)
T max(const T &a, const T &b)
bool assign_if_different(T &old_value, T &&new_value)
void projmat_dimensions(const float winmat[4][4], float *r_left, float *r_right, float *r_bottom, float *r_top, float *r_near, float *r_far)
VecBase< uint32_t, 4 > uint4
@ GPU_SAMPLER_EXTEND_MODE_EXTEND
@ GPU_SAMPLER_FILTERING_LINEAR
MatBase< float, 4, 4 > float4x4
@ SCE_EEVEE_TAA_REPROJECTION
@ SCE_EEVEE_VOLUMETRIC_SHADOWS
@ SCE_EEVEE_VOLUME_CUSTOM_RANGE
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_SHADER_WRITE
@ GPU_TEXTURE_USAGE_ATOMIC
@ GPU_TEXTURE_USAGE_ATTACHMENT
@ GPU_BARRIER_TEXTURE_FETCH
Definition GPU_state.hh:40
@ GPU_BARRIER_SHADER_IMAGE_ACCESS
Definition GPU_state.hh:38
@ DRW_STATE_WRITE_COLOR
Definition draw_state.hh:32
@ DRW_STATE_BLEND_CUSTOM
Definition draw_state.hh:65
void GPU_debug_group_end()
Definition gpu_debug.cc:34
MINLINE uint divide_ceil_u(uint a, uint b)
VecBase< float, 3 > float3
int GPU_max_texture_3d_size()
MINLINE int clamp_i(int value, int min, int max)
void GPU_debug_group_begin(const char *name)
Definition gpu_debug.cc:23
const c_style_mat & ptr() const
eSceneEEVEE_Flag flag
struct SceneEEVEE eevee