Page MenuHome

Fix T94881: GPU subdivision fails with high polycount coarse meshes
ClosedPublic

Authored by Kévin Dietrich (kevindietrich) on Feb 16 2022, 5:04 PM.

Details

Summary

Coarse meshes with high polycount would show as corrupted when GPU
subdivision is used with AMD cards This was caused by the OpenSubdiv
library not taking GL_MAX_COMPUTE_WORK_GROUP_COUNT into account when
dispatching computes. AMD drivers tend to set the limit lower than
NVidia ones (2^16 for the former, and 2^32 for the latter, at least
on my machine).

This moves the GLComputeEvaluator from the OpenSubdiv library into
intern/opensubdiv and modifies it to compute a dispatch size in a
similar way as for the draw code: we split the dispatch size into a 2
dimensional value based on GL_MAX_COMPUTE_WORK_GROUP_COUNT and
manually compute an index in the shader.

We could have patched the OpenSubdiv library and sent the fix upstream
(which can still be done), however, moving it to our side allows us to
better control the GLComputeEvaluator and in the future remove some
redundant work that it does compared to Blender (see T94644) and
probably prepare the ground for Vulkan support. As a matter of fact,
this patch also removes the OpenGL initialization that OpenSubdiv would
do here. This removal is not related to the bug fix, but necessary to not
have to copy more files/code over.

Diff Detail

Repository
rB Blender
Branch
fix_T94881_amd_gpu_subdiv_corruption (branched from master)
Build Status
Buildable 20605
Build 20605: arc lint + arc unit

Event Timeline

Kévin Dietrich (kevindietrich) requested review of this revision.Feb 16 2022, 5:04 PM
Kévin Dietrich (kevindietrich) created this revision.
intern/opensubdiv/internal/evaluator/gl_compute_evaluator.h
2–4

Keep the full original license header instead of SPDX, since this is not exactly Apache-2.0.

Pixar has an addition regarding trademarks, and we should preserve that.

Sergey Sharybin (sergey) requested changes to this revision.Feb 16 2022, 5:40 PM

It would surely be very nice to contribute improvements to the upstream! Until this is done I think it is just easier and better for everyone to have the evaluator implemented on our side.

The copyright/license notice better be preserved as-is.

This revision now requires changes to proceed.Feb 16 2022, 5:40 PM
  • Use original copyright license.
This revision is now accepted and ready to land.Feb 17 2022, 11:05 AM