This covers implementation of the GPUTexture abstraction for the Metal backend, with additional utility functionality as required. Some components have been temporarily disabled pending dependencies on upcoming Metal backend components, and these will be addressed as the backend is fleshed out. One core challenge addressed in the Metal backend is the requirement for read/update routines for textures. MTLBlitCommandEncoders offer a limited range of the full functionality provided by OpenGLs texture update and read functions such that a series of compute kernels have been implemented to provide advanced functionality such as data format conversion and partial/swizzled component updates. This diff is provided in full, but if further division is required for purposes of code review, this can be done. Authored by Apple: Michael Parkin-White Ref T96261 Reviewed By: fclem Maniphest Tasks: T96261 Differential Revision: https://developer.blender.org/D14543
67 lines
1.2 KiB
C++
67 lines
1.2 KiB
C++
/** \file
|
|
* \ingroup gpu
|
|
*
|
|
* Debug features of OpenGL.
|
|
*/
|
|
|
|
#include "BLI_compiler_attrs.h"
|
|
#include "BLI_string.h"
|
|
#include "BLI_system.h"
|
|
#include "BLI_utildefines.h"
|
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "GPU_debug.h"
|
|
#include "GPU_platform.h"
|
|
|
|
#include "mtl_context.hh"
|
|
#include "mtl_debug.hh"
|
|
|
|
#include "CLG_log.h"
|
|
|
|
#include <utility>
|
|
|
|
namespace blender::gpu::debug {
|
|
|
|
CLG_LogRef LOG = {"gpu.debug.metal"};
|
|
|
|
void mtl_debug_init()
|
|
{
|
|
CLOG_ENSURE(&LOG);
|
|
}
|
|
|
|
} // namespace blender::gpu::debug
|
|
|
|
namespace blender::gpu {
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
/** \name Debug Groups
|
|
*
|
|
* Useful for debugging through XCode GPU Debugger. This ensures all the API calls grouped into
|
|
* "passes".
|
|
* \{ */
|
|
|
|
void MTLContext::debug_group_begin(const char *name, int index)
|
|
{
|
|
if (G.debug & G_DEBUG_GPU) {
|
|
id<MTLCommandBuffer> cmd = this->get_active_command_buffer();
|
|
if (cmd != nil) {
|
|
[cmd pushDebugGroup:[NSString stringWithFormat:@"%s_%d", name, index]];
|
|
}
|
|
}
|
|
}
|
|
|
|
void MTLContext::debug_group_end()
|
|
{
|
|
if (G.debug & G_DEBUG_GPU) {
|
|
id<MTLCommandBuffer> cmd = this->get_active_command_buffer();
|
|
if (cmd != nil) {
|
|
[cmd popDebugGroup];
|
|
}
|
|
}
|
|
}
|
|
|
|
/** \} */
|
|
|
|
} // namespace blender::gpu
|