Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee_next/eevee_shader_shared.hh
| Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | |||||
| /* NOTE(@fclem): Needs to be used in #StorageBuffer because of arrays of scalar. */ | /* NOTE(@fclem): Needs to be used in #StorageBuffer because of arrays of scalar. */ | ||||
| struct SamplingData { | struct SamplingData { | ||||
| /** Array containing random values from Low Discrepancy Sequence in [0..1) range. */ | /** Array containing random values from Low Discrepancy Sequence in [0..1) range. */ | ||||
| float dimensions[SAMPLING_DIMENSION_COUNT]; | float dimensions[SAMPLING_DIMENSION_COUNT]; | ||||
| }; | }; | ||||
| BLI_STATIC_ASSERT_ALIGN(SamplingData, 16) | BLI_STATIC_ASSERT_ALIGN(SamplingData, 16) | ||||
| /* Returns total sample count in a web pattern of the given size. */ | /* Returns total sample count in a web pattern of the given size. */ | ||||
| static inline int sampling_web_sample_count_get(int web_density, int ring_count) | static inline int sampling_web_sample_count_get(int web_density, int in_ring_count) | ||||
| { | { | ||||
| return ((ring_count * ring_count + ring_count) / 2) * web_density + 1; | return ((in_ring_count * in_ring_count + in_ring_count) / 2) * web_density + 1; | ||||
| } | } | ||||
| /* Returns lowest possible ring count that contains at least sample_count samples. */ | /* Returns lowest possible ring count that contains at least sample_count samples. */ | ||||
| static inline int sampling_web_ring_count_get(int web_density, int sample_count) | static inline int sampling_web_ring_count_get(int web_density, int sample_count) | ||||
| { | { | ||||
| /* Inversion of web_sample_count_get(). */ | /* Inversion of web_sample_count_get(). */ | ||||
| float x = 2.0f * (float(sample_count) - 1.0f) / float(web_density); | float x = 2.0f * (float(sample_count) - 1.0f) / float(web_density); | ||||
| /* Solving polynomial. We only search positive solution. */ | /* Solving polynomial. We only search positive solution. */ | ||||
| ▲ Show 20 Lines • Show All 637 Lines • Show Last 20 Lines | |||||