Fix #115144: isect_data_setup compiler error

Rename `isect_data_setup` functions to avoid shader compiler errors.

Pull Request: https://projects.blender.org/blender/blender/pulls/115175
This commit is contained in:
Miguel Pozo 2023-11-23 16:02:10 +01:00
parent cb9584b561
commit ae1e2951c7
8 changed files with 41 additions and 41 deletions

View File

@ -84,7 +84,7 @@ CullingTile tile_culling_get(uvec2 tile_co)
tile.bounds = (is_persp) ? tile_bound_cone(corners[0], corners[4], corners[7], corners[3]) : tile.bounds = (is_persp) ? tile_bound_cone(corners[0], corners[4], corners[7], corners[3]) :
tile_bound_cylinder(corners[0], corners[4], corners[7], corners[3]); tile_bound_cylinder(corners[0], corners[4], corners[7], corners[3]);
tile.frustum = isect_data_setup(shape_frustum(corners)); tile.frustum = isect_frustum_setup(shape_frustum(corners));
return tile; return tile;
} }

View File

@ -27,10 +27,10 @@ void main()
return; return;
} }
IsectBox box = isect_data_setup(bounds.bounding_corners[0].xyz, IsectBox box = isect_box_setup(bounds.bounding_corners[0].xyz,
bounds.bounding_corners[1].xyz, bounds.bounding_corners[1].xyz,
bounds.bounding_corners[2].xyz, bounds.bounding_corners[2].xyz,
bounds.bounding_corners[3].xyz); bounds.bounding_corners[3].xyz);
vec3 local_min = vec3(FLT_MAX); vec3 local_min = vec3(FLT_MAX);
vec3 local_max = vec3(-FLT_MAX); vec3 local_max = vec3(-FLT_MAX);

View File

@ -32,16 +32,16 @@ void main()
IsectPyramid frustum; IsectPyramid frustum;
if (tilemap.projection_type == SHADOW_PROJECTION_CUBEFACE) { if (tilemap.projection_type == SHADOW_PROJECTION_CUBEFACE) {
Pyramid pyramid = shadow_tilemap_cubeface_bounds(tilemap, ivec2(0), ivec2(SHADOW_TILEMAP_RES)); Pyramid pyramid = shadow_tilemap_cubeface_bounds(tilemap, ivec2(0), ivec2(SHADOW_TILEMAP_RES));
frustum = isect_data_setup(pyramid); frustum = isect_pyramid_setup(pyramid);
} }
uint resource_id = resource_ids_buf[gl_GlobalInvocationID.x]; uint resource_id = resource_ids_buf[gl_GlobalInvocationID.x];
resource_id = (resource_id & 0x7FFFFFFFu); resource_id = (resource_id & 0x7FFFFFFFu);
IsectBox box = isect_data_setup(bounds_buf[resource_id].bounding_corners[0].xyz, IsectBox box = isect_box_setup(bounds_buf[resource_id].bounding_corners[0].xyz,
bounds_buf[resource_id].bounding_corners[1].xyz, bounds_buf[resource_id].bounding_corners[1].xyz,
bounds_buf[resource_id].bounding_corners[2].xyz, bounds_buf[resource_id].bounding_corners[2].xyz,
bounds_buf[resource_id].bounding_corners[3].xyz); bounds_buf[resource_id].bounding_corners[3].xyz);
int clipped = 0; int clipped = 0;
/* NDC space post projection [-1..1] (unclamped). */ /* NDC space post projection [-1..1] (unclamped). */

View File

@ -30,14 +30,14 @@ void main()
resource_id = (resource_id & 0x7FFFFFFFu); resource_id = (resource_id & 0x7FFFFFFFu);
ObjectBounds bounds = bounds_buf[resource_id]; ObjectBounds bounds = bounds_buf[resource_id];
box = isect_data_setup(bounds.bounding_corners[0].xyz, box = isect_box_setup(bounds.bounding_corners[0].xyz,
bounds.bounding_corners[1].xyz, bounds.bounding_corners[1].xyz,
bounds.bounding_corners[2].xyz, bounds.bounding_corners[2].xyz,
bounds.bounding_corners[3].xyz); bounds.bounding_corners[3].xyz);
} }
else { else {
/* Create a dummy box so initialization happens even when there are no shadow casters. */ /* Create a dummy box so initialization happens even when there are no shadow casters. */
box = isect_data_setup( box = isect_box_setup(
vec3(-1.0), vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0)); vec3(-1.0), vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0));
} }

View File

@ -77,10 +77,10 @@ void main()
} }
ObjectBounds bounds = bounds_buf[gl_GlobalInvocationID.x]; ObjectBounds bounds = bounds_buf[gl_GlobalInvocationID.x];
IsectBox box = isect_data_setup(bounds.bounding_corners[0].xyz, IsectBox box = isect_box_setup(bounds.bounding_corners[0].xyz,
bounds.bounding_corners[1].xyz, bounds.bounding_corners[1].xyz,
bounds.bounding_corners[2].xyz, bounds.bounding_corners[2].xyz,
bounds.bounding_corners[3].xyz); bounds.bounding_corners[3].xyz);
#ifdef DYNAMIC_PASS_SELECTION #ifdef DYNAMIC_PASS_SELECTION
if (is_visible(box)) { if (is_visible(box)) {

View File

@ -26,7 +26,7 @@ struct IsectPyramid {
vec4 planes[5]; vec4 planes[5];
}; };
IsectPyramid isect_data_setup(Pyramid shape) IsectPyramid isect_pyramid_setup(Pyramid shape)
{ {
vec3 A1 = shape.corners[1] - shape.corners[0]; vec3 A1 = shape.corners[1] - shape.corners[0];
vec3 A2 = shape.corners[2] - shape.corners[0]; vec3 A2 = shape.corners[2] - shape.corners[0];
@ -52,7 +52,7 @@ struct IsectBox {
vec4 planes[6]; vec4 planes[6];
}; };
IsectBox isect_data_setup(Box shape) IsectBox isect_box_setup(Box shape)
{ {
vec3 A1 = shape.corners[1] - shape.corners[0]; vec3 A1 = shape.corners[1] - shape.corners[0];
vec3 A3 = shape.corners[3] - shape.corners[0]; vec3 A3 = shape.corners[3] - shape.corners[0];
@ -73,7 +73,7 @@ IsectBox isect_data_setup(Box shape)
} }
/* Construct box from 1 corner point + 3 side vectors. */ /* Construct box from 1 corner point + 3 side vectors. */
IsectBox isect_data_setup(vec3 origin, vec3 side_x, vec3 side_y, vec3 side_z) IsectBox isect_box_setup(vec3 origin, vec3 side_x, vec3 side_y, vec3 side_z)
{ {
IsectBox data; IsectBox data;
data.corners[0] = origin; data.corners[0] = origin;
@ -101,7 +101,7 @@ struct IsectFrustum {
vec4 planes[6]; vec4 planes[6];
}; };
IsectFrustum isect_data_setup(Frustum shape) IsectFrustum isect_frustum_setup(Frustum shape)
{ {
vec3 A1 = shape.corners[1] - shape.corners[0]; vec3 A1 = shape.corners[1] - shape.corners[0];
vec3 A3 = shape.corners[3] - shape.corners[0]; vec3 A3 = shape.corners[3] - shape.corners[0];
@ -157,7 +157,7 @@ bool intersect_view(Pyramid pyramid)
} }
/* Now do Frustum vertices vs Pyramid planes. */ /* Now do Frustum vertices vs Pyramid planes. */
IsectPyramid i_pyramid = isect_data_setup(pyramid); IsectPyramid i_pyramid = isect_pyramid_setup(pyramid);
for (int p = 0; p < 5; ++p) { for (int p = 0; p < 5; ++p) {
bool is_any_vertex_on_positive_side = false; bool is_any_vertex_on_positive_side = false;
for (int v = 0; v < 8; ++v) { for (int v = 0; v < 8; ++v) {
@ -203,7 +203,7 @@ bool intersect_view(Box box)
} }
/* Now do Frustum vertices vs Box planes. */ /* Now do Frustum vertices vs Box planes. */
IsectBox i_box = isect_data_setup(box); IsectBox i_box = isect_box_setup(box);
for (int p = 0; p < 6; ++p) { for (int p = 0; p < 6; ++p) {
bool is_any_vertex_on_positive_side = false; bool is_any_vertex_on_positive_side = false;
for (int v = 0; v < 8; ++v) { for (int v = 0; v < 8; ++v) {
@ -317,7 +317,7 @@ bool intersect(IsectPyramid i_pyramid, Box box)
} }
/* Now do Pyramid vertices vs Box planes. */ /* Now do Pyramid vertices vs Box planes. */
IsectBox i_box = isect_data_setup(box); IsectBox i_box = isect_box_setup(box);
for (int p = 0; p < 6; ++p) { for (int p = 0; p < 6; ++p) {
bool is_any_vertex_on_positive_side = false; bool is_any_vertex_on_positive_side = false;
for (int v = 0; v < 5; ++v) { for (int v = 0; v < 5; ++v) {
@ -406,7 +406,7 @@ bool intersect(IsectFrustum i_frustum, Pyramid pyramid)
} }
/* Now do Frustum vertices vs Pyramid planes. */ /* Now do Frustum vertices vs Pyramid planes. */
IsectPyramid i_pyramid = isect_data_setup(pyramid); IsectPyramid i_pyramid = isect_pyramid_setup(pyramid);
for (int p = 0; p < 5; ++p) { for (int p = 0; p < 5; ++p) {
bool is_any_vertex_on_positive_side = false; bool is_any_vertex_on_positive_side = false;
for (int v = 0; v < 8; ++v) { for (int v = 0; v < 8; ++v) {
@ -451,7 +451,7 @@ bool intersect(IsectFrustum i_frustum, Box box)
} }
/* Now do Frustum vertices vs Box planes. */ /* Now do Frustum vertices vs Box planes. */
IsectBox i_box = isect_data_setup(box); IsectBox i_box = isect_box_setup(box);
for (int p = 0; p < 6; ++p) { for (int p = 0; p < 6; ++p) {
bool is_any_vertex_on_positive_side = false; bool is_any_vertex_on_positive_side = false;
for (int v = 0; v < 8; ++v) { for (int v = 0; v < 8; ++v) {

View File

@ -27,7 +27,7 @@ struct IsectPyramid {
vec4 planes[5]; vec4 planes[5];
}; };
IsectPyramid isect_data_setup(Pyramid shape) IsectPyramid isect_pyramid_setup(Pyramid shape)
{ {
vec3 A1 = shape.corners[1] - shape.corners[0]; vec3 A1 = shape.corners[1] - shape.corners[0];
vec3 A2 = shape.corners[2] - shape.corners[0]; vec3 A2 = shape.corners[2] - shape.corners[0];
@ -53,7 +53,7 @@ struct IsectBox {
vec4 planes[6]; vec4 planes[6];
}; };
IsectBox isect_data_setup(Box shape) IsectBox isect_box_setup(Box shape)
{ {
vec3 A1 = shape.corners[1] - shape.corners[0]; vec3 A1 = shape.corners[1] - shape.corners[0];
vec3 A3 = shape.corners[3] - shape.corners[0]; vec3 A3 = shape.corners[3] - shape.corners[0];
@ -74,7 +74,7 @@ IsectBox isect_data_setup(Box shape)
} }
/* Construct box from 1 corner point + 3 side vectors. */ /* Construct box from 1 corner point + 3 side vectors. */
IsectBox isect_data_setup(vec3 origin, vec3 side_x, vec3 side_y, vec3 side_z) IsectBox isect_box_setup(vec3 origin, vec3 side_x, vec3 side_y, vec3 side_z)
{ {
IsectBox data; IsectBox data;
data.corners[0] = origin; data.corners[0] = origin;
@ -102,7 +102,7 @@ struct IsectFrustum {
vec4 planes[6]; vec4 planes[6];
}; };
IsectFrustum isect_data_setup(Frustum shape) IsectFrustum isect_frustum_setup(Frustum shape)
{ {
vec3 A1 = shape.corners[1] - shape.corners[0]; vec3 A1 = shape.corners[1] - shape.corners[0];
vec3 A3 = shape.corners[3] - shape.corners[0]; vec3 A3 = shape.corners[3] - shape.corners[0];
@ -158,7 +158,7 @@ bool intersect_view(Pyramid pyramid)
} }
/* Now do Frustum vertices vs Pyramid planes. */ /* Now do Frustum vertices vs Pyramid planes. */
IsectPyramid i_pyramid = isect_data_setup(pyramid); IsectPyramid i_pyramid = isect_pyramid_setup(pyramid);
for (int p = 0; p < 5; ++p) { for (int p = 0; p < 5; ++p) {
bool is_any_vertex_on_positive_side = false; bool is_any_vertex_on_positive_side = false;
for (int v = 0; v < 8; ++v) { for (int v = 0; v < 8; ++v) {
@ -204,7 +204,7 @@ bool intersect_view(Box box)
} }
/* Now do Frustum vertices vs Box planes. */ /* Now do Frustum vertices vs Box planes. */
IsectBox i_box = isect_data_setup(box); IsectBox i_box = isect_box_setup(box);
for (int p = 0; p < 6; ++p) { for (int p = 0; p < 6; ++p) {
bool is_any_vertex_on_positive_side = false; bool is_any_vertex_on_positive_side = false;
for (int v = 0; v < 8; ++v) { for (int v = 0; v < 8; ++v) {
@ -318,7 +318,7 @@ bool intersect(IsectPyramid i_pyramid, Box box)
} }
/* Now do Pyramid vertices vs Box planes. */ /* Now do Pyramid vertices vs Box planes. */
IsectBox i_box = isect_data_setup(box); IsectBox i_box = isect_box_setup(box);
for (int p = 0; p < 6; ++p) { for (int p = 0; p < 6; ++p) {
bool is_any_vertex_on_positive_side = false; bool is_any_vertex_on_positive_side = false;
for (int v = 0; v < 5; ++v) { for (int v = 0; v < 5; ++v) {
@ -407,7 +407,7 @@ bool intersect(IsectFrustum i_frustum, Pyramid pyramid)
} }
/* Now do Frustum vertices vs Pyramid planes. */ /* Now do Frustum vertices vs Pyramid planes. */
IsectPyramid i_pyramid = isect_data_setup(pyramid); IsectPyramid i_pyramid = isect_pyramid_setup(pyramid);
for (int p = 0; p < 5; ++p) { for (int p = 0; p < 5; ++p) {
bool is_any_vertex_on_positive_side = false; bool is_any_vertex_on_positive_side = false;
for (int v = 0; v < 8; ++v) { for (int v = 0; v < 8; ++v) {
@ -452,7 +452,7 @@ bool intersect(IsectFrustum i_frustum, Box box)
} }
/* Now do Frustum vertices vs Box planes. */ /* Now do Frustum vertices vs Box planes. */
IsectBox i_box = isect_data_setup(box); IsectBox i_box = isect_box_setup(box);
for (int p = 0; p < 6; ++p) { for (int p = 0; p < 6; ++p) {
bool is_any_vertex_on_positive_side = false; bool is_any_vertex_on_positive_side = false;
for (int v = 0; v < 8; ++v) { for (int v = 0; v < 8; ++v) {

View File

@ -33,10 +33,10 @@ void main()
ObjectBounds bounds = bounds_buf[gl_GlobalInvocationID.x]; ObjectBounds bounds = bounds_buf[gl_GlobalInvocationID.x];
if (bounds.bounding_sphere.w != -1.0) { if (bounds.bounding_sphere.w != -1.0) {
IsectBox box = isect_data_setup(bounds.bounding_corners[0].xyz, IsectBox box = isect_box_setup(bounds.bounding_corners[0].xyz,
bounds.bounding_corners[1].xyz, bounds.bounding_corners[1].xyz,
bounds.bounding_corners[2].xyz, bounds.bounding_corners[2].xyz,
bounds.bounding_corners[3].xyz); bounds.bounding_corners[3].xyz);
Sphere bounding_sphere = shape_sphere(bounds.bounding_sphere.xyz, bounds.bounding_sphere.w); Sphere bounding_sphere = shape_sphere(bounds.bounding_sphere.xyz, bounds.bounding_sphere.w);
Sphere inscribed_sphere = shape_sphere(bounds.bounding_sphere.xyz, Sphere inscribed_sphere = shape_sphere(bounds.bounding_sphere.xyz,
bounds._inner_sphere_radius); bounds._inner_sphere_radius);