Metal: Remove empty lines in log messages

There produce unneeded empty lines in the
console. They are just relic from the time
these message were using printf.

Also remove some redundant informations in
the messages themselves.
This commit is contained in:
Clément Foucault
2023-06-06 18:35:24 +02:00
parent 79ec23b25f
commit 3ecb301a20
14 changed files with 163 additions and 165 deletions

View File

@@ -157,7 +157,7 @@ int MTLBatch::prepare_vertex_binding(MTLVertBuf *verts,
* has in the shader interface. */
MTL_LOG_WARNING(
"MTLBatch: Could not find attribute with name '%s' (defined in active vertex format) "
"in the shader interface for shader '%s'\n",
"in the shader interface for shader '%s'",
name,
interface->get_name());
continue;
@@ -175,7 +175,7 @@ int MTLBatch::prepare_vertex_binding(MTLVertBuf *verts,
/* Check if attribute is already present in the given slot. */
if ((~attr_mask) & (1 << mtl_attr.location)) {
MTL_LOG_INFO(
" -- [Batch] Skipping attribute with input location %d (As one is already bound)\n",
" -- [Batch] Skipping attribute with input location %d (As one is already bound)",
mtl_attr.location);
}
else {
@@ -194,7 +194,7 @@ int MTLBatch::prepare_vertex_binding(MTLVertBuf *verts,
desc.vertex_descriptor.num_vert_buffers++;
buffer_added = true;
MTL_LOG_INFO(" -- [Batch] Adding source %s buffer (Index: %d, Stride: %d)\n",
MTL_LOG_INFO(" -- [Batch] Adding source %s buffer (Index: %d, Stride: %d)",
(instanced) ? "instance" : "vertex",
buffer_index,
buffer_stride);
@@ -261,7 +261,7 @@ int MTLBatch::prepare_vertex_binding(MTLVertBuf *verts,
desc.vertex_descriptor.total_attributes++;
desc.vertex_descriptor.max_attribute_value = max_ii(
mtl_attr.location + i, desc.vertex_descriptor.max_attribute_value);
MTL_LOG_INFO("-- Sub-Attrib Location: %d, offset: %d, buffer index: %d\n",
MTL_LOG_INFO("-- Sub-Attrib Location: %d, offset: %d, buffer index: %d",
mtl_attr.location + i,
attribute_offset + i * 16,
buffer_index);
@@ -270,7 +270,7 @@ int MTLBatch::prepare_vertex_binding(MTLVertBuf *verts,
attr_mask &= ~(1 << (mtl_attr.location + i));
}
MTL_LOG_INFO(
"Float4x4 attribute type added for '%s' at attribute locations: %d to %d\n",
"Float4x4 attribute type added for '%s' at attribute locations: %d to %d",
name,
mtl_attr.location,
mtl_attr.location + 3);
@@ -377,7 +377,7 @@ int MTLBatch::prepare_vertex_binding(MTLVertBuf *verts,
* the source GPUVertFormat. */
MTL_LOG_INFO(
" -- Batch Attribute(%d): ORIG Shader Format: %d, ORIG Vert format: %d, Vert "
"components: %d, Fetch Mode %d --> FINAL FORMAT: %d\n",
"components: %d, Fetch Mode %d --> FINAL FORMAT: %d",
mtl_attr.location,
(int)mtl_attr.format,
(int)a->comp_type,
@@ -387,7 +387,7 @@ int MTLBatch::prepare_vertex_binding(MTLVertBuf *verts,
MTL_LOG_INFO(
" -- [Batch] matching %s attribute '%s' (Attribute Index: %d, Buffer index: %d, "
"offset: %d)\n",
"offset: %d)",
(instanced) ? "instance" : "vertex",
name,
mtl_attr.location,
@@ -555,7 +555,7 @@ id<MTLRenderCommandEncoder> MTLBatch::bind(uint v_count)
* This should happen after all other final rendering setup is complete. */
MTLPrimitiveType mtl_prim_type = gpu_prim_type_to_metal(this->prim_type);
if (!ctx->ensure_render_pipeline_state(mtl_prim_type)) {
MTL_LOG_ERROR("Failed to prepare and apply render pipeline state.\n");
MTL_LOG_ERROR("Failed to prepare and apply render pipeline state.");
BLI_assert(false);
return nil;
}
@@ -671,7 +671,7 @@ void MTLBatch::prepare_vertex_descriptor_and_bindings(MTLVertBuf **buffers, int
/* Extract Instance attributes (These take highest priority). */
for (int v = 0; v < GPU_BATCH_INST_VBO_MAX_LEN; v++) {
if (mtl_inst[v]) {
MTL_LOG_INFO(" -- [Batch] Checking bindings for bound instance buffer %p\n", mtl_inst[v]);
MTL_LOG_INFO(" -- [Batch] Checking bindings for bound instance buffer %p", mtl_inst[v]);
int buffer_ind = this->prepare_vertex_binding(
mtl_inst[v], desc, interface, attr_mask, true);
if (buffer_ind >= 0) {
@@ -689,7 +689,7 @@ void MTLBatch::prepare_vertex_descriptor_and_bindings(MTLVertBuf **buffers, int
/* Extract Vertex attributes (First-bound vertex buffer takes priority). */
for (int v = 0; v < GPU_BATCH_VBO_MAX_LEN; v++) {
if (mtl_verts[v] != NULL) {
MTL_LOG_INFO(" -- [Batch] Checking bindings for bound vertex buffer %p\n", mtl_verts[v]);
MTL_LOG_INFO(" -- [Batch] Checking bindings for bound vertex buffer %p", mtl_verts[v]);
int buffer_ind = this->prepare_vertex_binding(
mtl_verts[v], desc, interface, attr_mask, false);
if (buffer_ind >= 0) {
@@ -725,7 +725,7 @@ void MTLBatch::prepare_vertex_descriptor_and_bindings(MTLVertBuf **buffers, int
if (attr_mask & (1 << attr.location)) {
MTL_LOG_WARNING(
"Warning: Missing expected attribute '%s' with location: %u in shader %s (attr "
"number: %u)\n",
"number: %u)",
active_shader_->get_interface()->get_name_at_offset(attr.name_offset),
attr.location,
active_shader_->name_get(),
@@ -928,7 +928,7 @@ void MTLBatch::draw_advanced_indirect(GPUStorageBuf *indirect_buf, intptr_t offs
id<MTLBuffer> mtl_indirect_buf = mtlssbo->get_metal_buffer();
BLI_assert(mtl_indirect_buf != nil);
if (mtl_indirect_buf == nil) {
MTL_LOG_WARNING("Metal Indirect Draw Storage Buffer is nil.\n");
MTL_LOG_WARNING("Metal Indirect Draw Storage Buffer is nil.");
/* End of draw. */
this->unbind(rec);

View File

@@ -139,7 +139,7 @@ bool MTLCommandBufferManager::submit(bool wait)
"completed. Consider increasing GHOST_ContextCGL::max_command_buffer_count or reducing "
"work fragmentation to better utilise system hardware. Command buffers are flushed upon "
"GPUContext switches, this is the most common cause of excessive command buffer "
"generation.\n");
"generation.");
}
if (wait || (G.debug & G_DEBUG_GPU)) {

View File

@@ -94,7 +94,7 @@ void MTLContext::set_ghost_context(GHOST_ContextHandle ghostCtxHandle)
default_fbo_mtltexture_ = ghost_cgl_ctx->metalOverlayTexture();
MTL_LOG_INFO(
"Binding GHOST context CGL %p to GPU context %p. (Device: %p, queue: %p, texture: %p)\n",
"Binding GHOST context CGL %p to GPU context %p. (Device: %p, queue: %p, texture: %p)",
ghost_cgl_ctx,
this,
this->device,
@@ -136,7 +136,7 @@ void MTLContext::set_ghost_context(GHOST_ContextHandle ghostCtxHandle)
MTL_LOG_INFO(
"-- Bound context %p for GPU context: %p is offscreen and does not have a default "
"framebuffer\n",
"framebuffer",
ghost_cgl_ctx,
this);
#ifndef NDEBUG
@@ -146,8 +146,8 @@ void MTLContext::set_ghost_context(GHOST_ContextHandle ghostCtxHandle)
}
else {
MTL_LOG_INFO(
"[ERROR] Failed to bind GHOST context to MTLContext -- GHOST_ContextCGL is null "
"(GhostContext: %p, GhostContext_CGL: %p)\n",
" Failed to bind GHOST context to MTLContext -- GHOST_ContextCGL is null "
"(GhostContext: %p, GhostContext_CGL: %p)",
ghost_ctx,
ghost_cgl_ctx);
BLI_assert(false);
@@ -499,11 +499,11 @@ id<MTLRenderCommandEncoder> MTLContext::ensure_begin_render_pass()
/* Validate bound framebuffer before beginning render pass. */
if (!static_cast<MTLFrameBuffer *>(this->active_fb)->validate_render_pass()) {
MTL_LOG_WARNING("Framebuffer validation failed, falling back to default framebuffer\n");
MTL_LOG_WARNING("Framebuffer validation failed, falling back to default framebuffer");
this->framebuffer_restore();
if (!static_cast<MTLFrameBuffer *>(this->active_fb)->validate_render_pass()) {
MTL_LOG_ERROR("CRITICAL: DEFAULT FRAMEBUFFER FAIL VALIDATION!!\n");
MTL_LOG_ERROR("CRITICAL: DEFAULT FRAMEBUFFER FAIL VALIDATION!!");
}
}
@@ -868,14 +868,14 @@ bool MTLContext::ensure_render_pipeline_state(MTLPrimitiveType mtl_prim_type)
/* Check if an active shader is bound. */
if (!this->pipeline_state.active_shader) {
MTL_LOG_WARNING("No Metal shader for bound GL shader\n");
MTL_LOG_WARNING("No Metal shader for bound GL shader");
return false;
}
/* Also ensure active shader is valid. */
if (!this->pipeline_state.active_shader->is_valid()) {
MTL_LOG_WARNING(
"Bound active shader is not valid (Missing/invalid implementation for Metal).\n", );
"Bound active shader is not valid (Missing/invalid implementation for Metal).", );
return false;
}
@@ -892,7 +892,7 @@ bool MTLContext::ensure_render_pipeline_state(MTLPrimitiveType mtl_prim_type)
/* Fetch shader interface. */
MTLShaderInterface *shader_interface = this->pipeline_state.active_shader->get_interface();
if (shader_interface == nullptr) {
MTL_LOG_WARNING("Bound active shader does not have a valid shader interface!\n", );
MTL_LOG_WARNING("Bound active shader does not have a valid shader interface!", );
return false;
}
@@ -903,7 +903,7 @@ bool MTLContext::ensure_render_pipeline_state(MTLPrimitiveType mtl_prim_type)
this->pipeline_state.active_shader->bake_current_pipeline_state(
this, mtl_prim_type_to_topology_class(mtl_prim_type));
if (!pipeline_state_instance) {
MTL_LOG_ERROR("Failed to bake Metal pipeline state for shader: %s\n",
MTL_LOG_ERROR("Failed to bake Metal pipeline state for shader: %s",
shader_interface->get_name());
return false;
}
@@ -917,7 +917,7 @@ bool MTLContext::ensure_render_pipeline_state(MTLPrimitiveType mtl_prim_type)
this->main_command_buffer.get_active_render_command_encoder();
BLI_assert(rec);
if (rec == nil) {
MTL_LOG_ERROR("ensure_render_pipeline_state called while render pass is not active.\n");
MTL_LOG_ERROR("ensure_render_pipeline_state called while render pass is not active.");
return false;
}
@@ -957,7 +957,7 @@ bool MTLContext::ensure_render_pipeline_state(MTLPrimitiveType mtl_prim_type)
[rec setVertexBuffer:tf_buffer_mtl
offset:0
atIndex:pipeline_state_instance->transform_feedback_buffer_index];
MTL_LOG_INFO("Successfully bound VBO: %p for transform feedback (MTL Buffer: %p)\n",
MTL_LOG_INFO("Successfully bound VBO: %p for transform feedback (MTL Buffer: %p)",
tf_vbo_mtl,
tf_buffer_mtl);
}
@@ -976,7 +976,7 @@ bool MTLContext::ensure_render_pipeline_state(MTLPrimitiveType mtl_prim_type)
/* Bind Null attribute buffer, if needed. */
if (pipeline_state_instance->null_attribute_buffer_index >= 0) {
if (G.debug & G_DEBUG_GPU) {
MTL_LOG_INFO("Binding null attribute buffer at index: %d\n",
MTL_LOG_INFO("Binding null attribute buffer at index: %d",
pipeline_state_instance->null_attribute_buffer_index);
}
rps.bind_vertex_buffer(this->get_null_attribute_buffer(),
@@ -1195,11 +1195,11 @@ bool MTLContext::ensure_buffer_bindings(
* dummy buffer, which will be big enough, to avoid an OOB error. */
if (ubo_size < expected_size) {
MTL_LOG_UBO_ERROR(
"[Error][UBO] UBO (UBO Name: %s) bound at location: %d (buffer[[%d]]) with size "
"[UBO] UBO (UBO Name: %s) bound at location: %d (buffer[[%d]]) with size "
"%lu (Expected size "
"%d) (Shader Name: %s) is too small -- binding NULL buffer. This is likely an "
"over-binding, which is not used, but we need this to avoid validation "
"issues\n",
"issues",
shader_interface->get_name_at_offset(ubo.name_offset),
ubo_location,
pipeline_state_instance->base_uniform_buffer_index + buffer_index,
@@ -1213,9 +1213,9 @@ bool MTLContext::ensure_buffer_bindings(
}
else {
MTL_LOG_UBO_ERROR(
"[Warning][UBO] Shader '%s' expected UBO '%s' to be bound at buffer slot: %d "
"[UBO] Shader '%s' expected UBO '%s' to be bound at buffer slot: %d "
"(buffer[[%d]])-- but "
"nothing was bound -- binding dummy buffer\n",
"nothing was bound -- binding dummy buffer",
shader_interface->get_name(),
shader_interface->get_name_at_offset(ubo.name_offset),
ubo_location,
@@ -1249,7 +1249,7 @@ bool MTLContext::ensure_buffer_bindings(
else {
MTL_LOG_UBO_ERROR(
"[UBO] Shader '%s' has UBO '%s' bound at buffer index: %d -- but MTLBuffer "
"is NULL!\n",
"is NULL!",
shader_interface->get_name(),
shader_interface->get_name_at_offset(ubo.name_offset),
buffer_index);
@@ -1285,10 +1285,10 @@ bool MTLContext::ensure_buffer_bindings(
}
else {
MTL_LOG_SSBO_ERROR(
"[Error][SSBO] Shader '%s' expected SSBO '%s' to be bound at buffer location: %d "
"[SSBO] Shader '%s' expected SSBO '%s' to be bound at buffer location: %d "
"(buffer[[%d]]) -- "
"but "
"nothing was bound.\n",
"nothing was bound.",
shader_interface->get_name(),
shader_interface->get_name_at_offset(ssbo.name_offset),
ssbo_location,
@@ -1318,9 +1318,9 @@ bool MTLContext::ensure_buffer_bindings(
}
else {
MTL_LOG_SSBO_ERROR(
"[Error][SSBO] Shader '%s' had SSBO '%s' bound at SSBO location: %d "
"[SSBO] Shader '%s' had SSBO '%s' bound at SSBO location: %d "
"(buffer[["
"%d]]) -- but bound MTLStorageBuf was nil.\n",
"%d]]) -- but bound MTLStorageBuf was nil.",
shader_interface->get_name(),
shader_interface->get_name_at_offset(ssbo.name_offset),
ssbo_location,
@@ -1400,9 +1400,9 @@ bool MTLContext::ensure_buffer_bindings(
}
else {
MTL_LOG_UBO_ERROR(
"[Warning][UBO] Shader '%s' expected UBO '%s' to be bound at buffer location: %d "
"[UBO] Shader '%s' expected UBO '%s' to be bound at buffer location: %d "
"(buffer[[%d]]) -- but "
"nothing was bound -- binding dummy buffer\n",
"nothing was bound -- binding dummy buffer",
shader_interface->get_name(),
shader_interface->get_name_at_offset(ubo.name_offset),
ubo_location,
@@ -1429,7 +1429,7 @@ bool MTLContext::ensure_buffer_bindings(
else {
MTL_LOG_UBO_ERROR(
"[UBO] Compute Shader '%s' has UBO '%s' bound at buffer index: %d -- but MTLBuffer "
"is NULL!\n",
"is NULL!",
shader_interface->get_name(),
shader_interface->get_name_at_offset(ubo.name_offset),
buffer_index);
@@ -1464,10 +1464,10 @@ bool MTLContext::ensure_buffer_bindings(
}
else {
MTL_LOG_SSBO_ERROR(
"[Error][SSBO] Shader '%s' expected SSBO '%s' to be bound at SSBO location: %d "
"[SSBO] Shader '%s' expected SSBO '%s' to be bound at SSBO location: %d "
"(buffer[["
"%d]]) -- but "
"nothing was bound.\n",
"nothing was bound.",
shader_interface->get_name(),
shader_interface->get_name_at_offset(ssbo.name_offset),
ssbo_location,
@@ -1491,9 +1491,9 @@ bool MTLContext::ensure_buffer_bindings(
}
else {
MTL_LOG_SSBO_ERROR(
"[Error][SSBO] Shader '%s' had SSBO '%s' bound at SSBO location: %d "
"[SSBO] Shader '%s' had SSBO '%s' bound at SSBO location: %d "
"(buffer[["
"%d]]) -- but bound MTLStorageBuf was nil.\n",
"%d]]) -- but bound MTLStorageBuf was nil.",
shader_interface->get_name(),
shader_interface->get_name_at_offset(ssbo.name_offset),
ssbo_location,
@@ -1590,7 +1590,7 @@ void MTLContext::ensure_texture_bindings(
MTL_LOG_WARNING(
"(Shader '%s') Texture (%s) %p bound to slot %d is incompatible -- Wrong "
"texture target type. (Expecting type %d, actual type %d) (binding "
"name:'%s')(texture name:'%s')\n",
"name:'%s')(texture name:'%s')",
shader_interface->get_name(),
is_resource_sampler ? "TextureSampler" : "TextureImage",
bound_texture,
@@ -1605,7 +1605,7 @@ void MTLContext::ensure_texture_bindings(
MTL_LOG_WARNING(
"Shader '%s' expected texture (%s) to be bound to location %d (texture[[%d]]) -- No "
"texture was "
"bound. (name:'%s')\n",
"bound. (name:'%s')",
shader_interface->get_name(),
is_resource_sampler ? "TextureSampler" : "TextureImage",
location,
@@ -1640,7 +1640,7 @@ void MTLContext::ensure_texture_bindings(
else {
MTL_LOG_WARNING(
"Shader %p expected texture (%s) to be bound to slot %d -- Slot exceeds the "
"hardware/API limit of '%d'. (name:'%s')\n",
"hardware/API limit of '%d'. (name:'%s')",
this->pipeline_state.active_shader,
is_resource_sampler ? "TextureSampler" : "TextureImage",
slot,
@@ -1819,7 +1819,7 @@ void MTLContext::ensure_texture_bindings(
MTL_LOG_WARNING(
"(Shader '%s') Texture (%s) %p bound to slot %d is incompatible -- Wrong "
"texture target type. (Expecting type %d, actual type %d) (binding "
"name:'%s')(texture name:'%s')\n",
"name:'%s')(texture name:'%s')",
shader_interface->get_name(),
is_resource_sampler ? "TextureSampler" : "TextureImage",
bound_texture,
@@ -1834,7 +1834,7 @@ void MTLContext::ensure_texture_bindings(
MTL_LOG_WARNING(
"Shader '%s' expected texture (%s) to be bound to location %d (texture[[%d]]) -- No "
"texture was "
"bound. (name:'%s')\n",
"bound. (name:'%s')",
shader_interface->get_name(),
is_resource_sampler ? "TextureSampler" : "TextureImage",
location,
@@ -1861,7 +1861,7 @@ void MTLContext::ensure_texture_bindings(
else {
MTL_LOG_WARNING(
"Shader %p expected texture (%s) to be bound to slot %d -- Slot exceeds the "
"hardware/API limit of '%d'. (name:'%s')\n",
"hardware/API limit of '%d'. (name:'%s')",
this->pipeline_state.active_shader,
is_resource_sampler ? "TextureSampler" : "TextureImage",
slot,
@@ -2096,13 +2096,13 @@ bool MTLContext::ensure_compute_pipeline_state()
/* Verify if bound shader is valid and fetch MTLComputePipelineStateInstance. */
/* Check if an active shader is bound. */
if (!this->pipeline_state.active_shader) {
MTL_LOG_WARNING("No Metal shader bound!\n");
MTL_LOG_WARNING("No Metal shader bound!");
return false;
}
/* Also ensure active shader is valid. */
if (!this->pipeline_state.active_shader->is_valid()) {
MTL_LOG_WARNING(
"Bound active shader is not valid (Missing/invalid implementation for Metal).\n", );
"Bound active shader is not valid (Missing/invalid implementation for Metal).", );
return false;
}
/* Verify this is a compute shader. */
@@ -2110,7 +2110,7 @@ bool MTLContext::ensure_compute_pipeline_state()
/* Fetch shader interface. */
MTLShaderInterface *shader_interface = this->pipeline_state.active_shader->get_interface();
if (shader_interface == nullptr) {
MTL_LOG_WARNING("Bound active shader does not have a valid shader interface!\n", );
MTL_LOG_WARNING("Bound active shader does not have a valid shader interface!", );
return false;
}
@@ -2118,7 +2118,7 @@ bool MTLContext::ensure_compute_pipeline_state()
const MTLComputePipelineStateInstance &compute_pso_inst =
this->pipeline_state.active_shader->get_compute_pipeline_state();
if (!success || compute_pso_inst.pso == nil) {
MTL_LOG_WARNING("No valid compute PSO for compute dispatch!\n", );
MTL_LOG_WARNING("No valid compute PSO for compute dispatch!", );
return false;
}
return true;
@@ -2198,7 +2198,7 @@ void MTLContext::compute_dispatch_indirect(StorageBuf *indirect_buf)
id<MTLBuffer> mtl_indirect_buf = mtlssbo->get_metal_buffer();
BLI_assert(mtl_indirect_buf != nil);
if (mtl_indirect_buf == nil) {
MTL_LOG_WARNING("Metal Indirect Compute dispatch storage buffer does not exist.\n");
MTL_LOG_WARNING("Metal Indirect Compute dispatch storage buffer does not exist.");
return;
}
@@ -2265,7 +2265,7 @@ void MTLContext::texture_bind(gpu::MTLTexture *mtl_texture, uint texture_unit, b
if (texture_unit < 0 || texture_unit >= GPU_max_textures() ||
texture_unit >= MTL_MAX_TEXTURE_SLOTS)
{
MTL_LOG_WARNING("Attempting to bind texture '%s' to invalid texture unit %d\n",
MTL_LOG_WARNING("Attempting to bind texture '%s' to invalid texture unit %d",
mtl_texture->get_name(),
texture_unit);
BLI_assert(false);
@@ -2289,7 +2289,7 @@ void MTLContext::sampler_bind(MTLSamplerState sampler_state, uint sampler_unit)
if (sampler_unit < 0 || sampler_unit >= GPU_max_textures() ||
sampler_unit >= MTL_MAX_SAMPLER_SLOTS)
{
MTL_LOG_WARNING("Attempting to bind sampler to invalid sampler unit %d\n", sampler_unit);
MTL_LOG_WARNING("Attempting to bind sampler to invalid sampler unit %d", sampler_unit);
BLI_assert(false);
return;
}
@@ -2530,8 +2530,7 @@ void present(MTLRenderPassDescriptor *blit_descriptor,
/* Decrement count */
MTLCommandBufferManager::num_active_cmd_bufs--;
MTL_LOG_INFO("[Metal] Active command buffers: %d\n",
MTLCommandBufferManager::num_active_cmd_bufs);
MTL_LOG_INFO("Active command buffers: %d", MTLCommandBufferManager::num_active_cmd_bufs);
/* Drawable count and latency management. */
MTLContext::max_drawables_in_flight--;
@@ -2541,7 +2540,7 @@ void present(MTLRenderPassDescriptor *blit_descriptor,
.count();
MTLContext::latency_resolve_average(microseconds_per_frame);
MTL_LOG_INFO("Frame Latency: %f ms (Rolling avg: %f ms Drawables: %d)\n",
MTL_LOG_INFO("Frame Latency: %f ms (Rolling avg: %f ms Drawables: %d)",
((float)microseconds_per_frame) / 1000.0f,
((float)MTLContext::avg_drawable_latency_us) / 1000.0f,
perf_max_drawables);

View File

@@ -136,7 +136,7 @@ void MTLFrameBuffer::bind(bool enabled_srgb)
dirty_state_ = true;
}
else {
MTL_LOG_WARNING("Attempting to bind FrameBuffer, but no context is active\n");
MTL_LOG_WARNING("Attempting to bind FrameBuffer, but no context is active");
}
}
@@ -511,7 +511,7 @@ void MTLFrameBuffer::read(eGPUFrameBufferBits planes,
else {
MTL_LOG_ERROR(
"Attempting to read depth from a framebuffer which does not have a depth "
"attachment!\n");
"attachment!");
}
}
return;
@@ -541,7 +541,7 @@ void MTLFrameBuffer::read(eGPUFrameBufferBits planes,
return;
case GPU_STENCIL_BIT:
MTL_LOG_ERROR("GPUFramebuffer: Error: Trying to read stencil bit. Unsupported.\n");
MTL_LOG_ERROR("Framebuffer: Trying to read stencil bit. Unsupported.");
return;
}
}
@@ -781,8 +781,7 @@ void MTLFrameBuffer::apply_state()
int viewport_w = viewport_[2];
int viewport_h = viewport_[3];
if (viewport_w == 0 || viewport_h == 0) {
MTL_LOG_WARNING(
"Viewport had width and height of (0,0) -- Updating -- DEBUG Safety check\n");
MTL_LOG_WARNING("Viewport had width and height of (0,0) -- Updating -- DEBUG Safety check");
viewport_w = default_width_;
viewport_h = default_height_;
}
@@ -798,7 +797,7 @@ void MTLFrameBuffer::apply_state()
else {
MTL_LOG_ERROR(
"Attempting to set FrameBuffer State (VIEWPORT, SCISSOR), But FrameBuffer is not bound to "
"current Context.\n");
"current Context.");
}
}
@@ -818,7 +817,7 @@ bool MTLFrameBuffer::add_color_attachment(gpu::MTLTexture *texture,
if (texture) {
if (miplevel < 0 || miplevel >= MTL_MAX_MIPMAP_COUNT) {
MTL_LOG_WARNING("Attachment specified with invalid mip level %u\n", miplevel);
MTL_LOG_WARNING("Attachment specified with invalid mip level %u", miplevel);
miplevel = 0;
}
@@ -843,7 +842,7 @@ bool MTLFrameBuffer::add_color_attachment(gpu::MTLTexture *texture,
case GPU_TEXTURE_1D_ARRAY:
if (layer < 0) {
layer = 0;
MTL_LOG_WARNING("TODO: Support layered rendering for 1D array textures, if needed.\n");
MTL_LOG_WARNING("TODO: Support layered rendering for 1D array textures, if needed.");
}
BLI_assert(layer < texture->h_);
mtl_color_attachments_[slot].slice = layer;
@@ -897,7 +896,7 @@ bool MTLFrameBuffer::add_color_attachment(gpu::MTLTexture *texture,
mtl_color_attachments_[slot].depth_plane = 0;
break;
default:
MTL_LOG_ERROR("MTLFrameBuffer::add_color_attachment Unrecognized texture type %u\n",
MTL_LOG_ERROR("MTLFrameBuffer::add_color_attachment Unrecognized texture type %u",
texture->type_);
break;
}
@@ -929,7 +928,7 @@ bool MTLFrameBuffer::add_color_attachment(gpu::MTLTexture *texture,
else {
MTL_LOG_ERROR(
"Passing in null texture to MTLFrameBuffer::addColourAttachment (This could be due to not "
"all texture types being supported).\n");
"all texture types being supported).");
}
return true;
}
@@ -940,7 +939,7 @@ bool MTLFrameBuffer::add_depth_attachment(gpu::MTLTexture *texture, int miplevel
if (texture) {
if (miplevel < 0 || miplevel >= MTL_MAX_MIPMAP_COUNT) {
MTL_LOG_WARNING("Attachment specified with invalid mip level %u\n", miplevel);
MTL_LOG_WARNING("Attachment specified with invalid mip level %u", miplevel);
miplevel = 0;
}
@@ -963,7 +962,7 @@ bool MTLFrameBuffer::add_depth_attachment(gpu::MTLTexture *texture, int miplevel
case GPU_TEXTURE_1D_ARRAY:
if (layer < 0) {
layer = 0;
MTL_LOG_WARNING("TODO: Support layered rendering for 1D array textures, if needed\n");
MTL_LOG_WARNING("TODO: Support layered rendering for 1D array textures, if needed");
}
BLI_assert(layer < texture->h_);
mtl_depth_attachment_.slice = layer;
@@ -1059,7 +1058,7 @@ bool MTLFrameBuffer::add_stencil_attachment(gpu::MTLTexture *texture, int miplev
if (texture) {
if (miplevel < 0 || miplevel >= MTL_MAX_MIPMAP_COUNT) {
MTL_LOG_WARNING("Attachment specified with invalid mip level %u\n", miplevel);
MTL_LOG_WARNING("Attachment specified with invalid mip level %u", miplevel);
miplevel = 0;
}
@@ -1082,7 +1081,7 @@ bool MTLFrameBuffer::add_stencil_attachment(gpu::MTLTexture *texture, int miplev
case GPU_TEXTURE_1D_ARRAY:
if (layer < 0) {
layer = 0;
MTL_LOG_WARNING("TODO: Support layered rendering for 1D array textures, if needed\n");
MTL_LOG_WARNING("TODO: Support layered rendering for 1D array textures, if needed");
}
BLI_assert(layer < texture->h_);
mtl_stencil_attachment_.slice = layer;
@@ -1622,7 +1621,7 @@ MTLRenderPassDescriptor *MTLFrameBuffer::bake_render_pass_descriptor(bool load_c
id<MTLTexture> texture =
mtl_color_attachments_[attachment_ind].texture->get_metal_handle_base();
if (texture == nil) {
MTL_LOG_ERROR("Attempting to assign invalid texture as attachment\n");
MTL_LOG_ERROR("Attempting to assign invalid texture as attachment");
}
/* IF SRGB is enabled, but we are rendering with SRGB disabled, sample texture view. */
@@ -1777,8 +1776,7 @@ void MTLFrameBuffer::blit(uint read_slot,
/* Early exit if there is no blit to do. */
if (!(do_color || do_depth || do_stencil)) {
MTL_LOG_WARNING(
" MTLFrameBuffer: requested blit but no color, depth or stencil flag was set\n");
MTL_LOG_WARNING("FrameBuffer: requested blit but no color, depth or stencil flag was set");
return;
}
@@ -1835,7 +1833,7 @@ void MTLFrameBuffer::blit(uint read_slot,
1);
}
else {
MTL_LOG_ERROR("Failed performing colour blit\n");
MTL_LOG_ERROR("Failed performing colour blit");
}
}
}
@@ -1867,7 +1865,7 @@ void MTLFrameBuffer::blit(uint read_slot,
1);
}
else {
MTL_LOG_ERROR("Failed performing depth blit\n");
MTL_LOG_ERROR("Failed performing depth blit");
}
}
@@ -1896,7 +1894,7 @@ void MTLFrameBuffer::blit(uint read_slot,
1);
}
else {
MTL_LOG_ERROR("Failed performing Stencil blit\n");
MTL_LOG_ERROR("Failed performing Stencil blit");
}
}
}

View File

@@ -72,7 +72,7 @@ void MTLImmediate::end()
const char *ptr = (active_mtl_shader) ? active_mtl_shader->name_get() : nullptr;
MTL_LOG_WARNING(
"MTLImmediate::end -- cannot perform draw as active shader is NULL or invalid (likely "
"unimplemented) (shader %p '%s')\n",
"unimplemented) (shader %p '%s')",
active_mtl_shader,
ptr);
return;
@@ -162,7 +162,7 @@ void MTLImmediate::end()
if (attr == nullptr) {
MTL_LOG_ERROR(
"MTLImmediate::end Could not find matching attribute '%s' from Shader Interface in "
"Vertex Format! - TODO: Bind Dummy attribute\n",
"Vertex Format! - TODO: Bind Dummy attribute",
interface->get_name_at_offset(mtl_shader_attribute.name_offset));
return;
}
@@ -382,7 +382,8 @@ void MTLImmediate::end()
/* SSBO vertex fetch - Nullify elements buffer. */
if (rps.cached_vertex_buffer_bindings[MTL_SSBO_VERTEX_FETCH_IBO_INDEX].metal_buffer ==
nil) {
nil)
{
rps.bind_vertex_buffer(null_buffer, 0, MTL_SSBO_VERTEX_FETCH_IBO_INDEX);
}
@@ -423,4 +424,4 @@ void MTLImmediate::end()
}
}
} // blender::gpu
} // namespace blender::gpu

View File

@@ -95,7 +95,7 @@ void MTLIndexBuf::upload_data()
/* If new data ready, and index buffer already exists, release current. */
if ((ibo_ != nullptr) && (this->data_ != nullptr)) {
MTL_LOG_INFO("Re-creating index buffer with new data. IndexBuf %p\n", this);
MTL_LOG_INFO("Re-creating index buffer with new data. IndexBuf %p", this);
ibo_->free();
ibo_ = nullptr;
}
@@ -104,7 +104,7 @@ void MTLIndexBuf::upload_data()
if (ibo_ == nullptr && data_ != nullptr) {
alloc_size_ = this->size_get();
if (alloc_size_ == 0) {
MTL_LOG_WARNING("[Metal] Warning! Trying to allocate index buffer with size=0 bytes\n");
MTL_LOG_WARNING("Warning! Trying to allocate index buffer with size=0 bytes");
}
else {
ibo_ = MTLContext::get_global_memory_manager()->allocate_with_data(alloc_size_, true, data_);
@@ -424,7 +424,7 @@ id<MTLBuffer> MTLIndexBuf::get_index_buffer(GPUPrimType &in_out_primitive_type,
/* TODO(Metal): Line strip topology types would benefit from optimization to remove
* primitive restarts, however, these do not occur frequently, nor with
* significant geometry counts. */
MTL_LOG_INFO("TODO: Primitive topology: Optimize line strip topology types\n");
MTL_LOG_INFO("TODO: Primitive topology: Optimize line strip topology types");
} break;
case GPU_PRIM_LINE_LOOP: {
@@ -433,7 +433,7 @@ id<MTLBuffer> MTLIndexBuf::get_index_buffer(GPUPrimType &in_out_primitive_type,
* does not currently appear to be used alongside an index buffer. */
MTL_LOG_WARNING(
"TODO: Primitive topology: Line Loop Index buffer optimization required for "
"emulation.\n");
"emulation.");
} break;
case GPU_PRIM_TRIS:
@@ -527,4 +527,4 @@ void MTLIndexBuf::strip_restart_indices()
/** \} */
} // blender::gpu
} // namespace blender::gpu

View File

@@ -128,7 +128,7 @@ gpu::MTLBuffer *MTLBufferPool::allocate_aligned(uint64_t size,
found_size <= (aligned_alloc_size * mtl_buffer_size_threshold_factor_))
{
MTL_LOG_INFO(
"[MemoryAllocator] Suitable Buffer of size %lld found, for requested size: %lld\n",
"[MemoryAllocator] Suitable Buffer of size %lld found, for requested size: %lld",
found_size,
aligned_alloc_size);
@@ -141,8 +141,7 @@ gpu::MTLBuffer *MTLBufferPool::allocate_aligned(uint64_t size,
else {
MTL_LOG_INFO(
"[MemoryAllocator] Buffer of size %lld found, but was incompatible with requested "
"size: "
"%lld\n",
"size: %lld",
found_size,
aligned_alloc_size);
new_buffer = nullptr;
@@ -307,19 +306,18 @@ void MTLBufferPool::update_memory_pools()
deletion_time_threshold_s = 2;
}
else
/* Spare pool memory >= 1GB. */
if (allocations_in_pool_ >= MEMORY_SIZE_1GB)
{
deletion_time_threshold_s = 4;
}
/* Spare pool memory >= 512MB.*/
else if (allocations_in_pool_ >= MEMORY_SIZE_512MB) {
deletion_time_threshold_s = 15;
}
/* Spare pool memory >= 256MB. */
else if (allocations_in_pool_ >= MEMORY_SIZE_256MB) {
deletion_time_threshold_s = 60;
}
/* Spare pool memory >= 1GB. */
if (allocations_in_pool_ >= MEMORY_SIZE_1GB) {
deletion_time_threshold_s = 4;
}
/* Spare pool memory >= 512MB.*/
else if (allocations_in_pool_ >= MEMORY_SIZE_512MB) {
deletion_time_threshold_s = 15;
}
/* Spare pool memory >= 256MB. */
else if (allocations_in_pool_ >= MEMORY_SIZE_256MB) {
deletion_time_threshold_s = 60;
}
if (time_passed > deletion_time_threshold_s) {
@@ -786,7 +784,7 @@ void MTLScratchBufferManager::ensure_increment_scratch_buffer()
active_scratch_buf = scratch_buffers_[current_scratch_buffer_];
active_scratch_buf->reset();
BLI_assert(&active_scratch_buf->own_context_ == &context_);
MTL_LOG_INFO("Scratch buffer %d reset - (ctx %p)(Frame index: %d)\n",
MTL_LOG_INFO("Scratch buffer %d reset - (ctx %p)(Frame index: %d)",
current_scratch_buffer_,
&context_,
context_.get_current_frame_index());
@@ -873,12 +871,11 @@ MTLTemporaryBuffer MTLCircularBuffer::allocate_range_aligned(uint64_t alloc_size
* maximum */
if (aligned_alloc_size > MTLScratchBufferManager::mtl_scratch_buffer_max_size_) {
new_size = aligned_alloc_size;
MTL_LOG_INFO("Temporarily growing Scratch buffer to %d MB\n",
(int)new_size / 1024 / 1024);
MTL_LOG_INFO("Temporarily growing Scratch buffer to %d MB", (int)new_size / 1024 / 1024);
}
else {
new_size = MTLScratchBufferManager::mtl_scratch_buffer_max_size_;
MTL_LOG_INFO("Shrinking Scratch buffer back to %d MB\n", (int)new_size / 1024 / 1024);
MTL_LOG_INFO("Shrinking Scratch buffer back to %d MB", (int)new_size / 1024 / 1024);
}
}
BLI_assert(aligned_alloc_size <= new_size);
@@ -901,7 +898,7 @@ MTLTemporaryBuffer MTLCircularBuffer::allocate_range_aligned(uint64_t alloc_size
else {
MTL_LOG_WARNING(
"Performance Warning: Reached the end of circular buffer of size: %llu, but cannot "
"resize. Starting new buffer\n",
"resize. Starting new buffer",
cbuffer_->get_size());
BLI_assert(aligned_alloc_size <= new_size);
@@ -931,7 +928,7 @@ MTLTemporaryBuffer MTLCircularBuffer::allocate_range_aligned(uint64_t alloc_size
if (G.debug & G_DEBUG_GPU) {
cbuffer_->set_label(@"Circular Scratch Buffer");
}
MTL_LOG_INFO("Resized Metal circular buffer to %llu bytes\n", new_size);
MTL_LOG_INFO("Resized Metal circular buffer to %llu bytes", new_size);
/* Reset allocation Status. */
aligned_current_offset = 0;
@@ -988,4 +985,4 @@ void MTLCircularBuffer::reset()
/** \} */
} // blender::gpu
} // namespace blender::gpu

View File

@@ -188,7 +188,7 @@ void MTLShader::vertex_shader_from_glsl(MutableSpan<const char *> sources)
void MTLShader::geometry_shader_from_glsl(MutableSpan<const char *> sources)
{
MTL_LOG_ERROR("MTLShader::geometry_shader_from_glsl - Geometry shaders unsupported!\n");
MTL_LOG_ERROR("MTLShader::geometry_shader_from_glsl - Geometry shaders unsupported!");
}
void MTLShader::fragment_shader_from_glsl(MutableSpan<const char *> sources)
@@ -229,7 +229,7 @@ bool MTLShader::finalize(const shader::ShaderCreateInfo *info)
{
/* Check if Shader has already been finalized. */
if (this->is_valid()) {
MTL_LOG_ERROR("Shader (%p) '%s' has already been finalized!\n", this, this->name_get());
MTL_LOG_ERROR("Shader (%p) '%s' has already been finalized!", this, this->name_get());
}
/* Compute shaders. */
@@ -338,7 +338,8 @@ bool MTLShader::finalize(const shader::ShaderCreateInfo *info)
if (error) {
/* Only exit out if genuine error and not warning. */
if ([[error localizedDescription] rangeOfString:@"Compilation succeeded"].location ==
NSNotFound) {
NSNotFound)
{
const char *errors_c_str = [[error localizedDescription] UTF8String];
const char *sources_c_str = shd_builder_->glsl_fragment_source_.c_str();
@@ -472,7 +473,7 @@ void MTLShader::bind()
if (interface == nullptr || !this->is_valid()) {
MTL_LOG_WARNING(
"MTLShader::bind - Shader '%s' has no valid implementation in Metal, draw calls will be "
"skipped.\n",
"skipped.",
this->name_get());
}
ctx->pipeline_state.active_shader = this;
@@ -492,7 +493,7 @@ void MTLShader::uniform_float(int location, int comp_len, int array_size, const
}
MTLShaderInterface *mtl_interface = get_interface();
if (location < 0 || location >= mtl_interface->get_total_uniforms()) {
MTL_LOG_WARNING("Uniform location %d is not valid in Shader %s\n", location, this->name_get());
MTL_LOG_WARNING("Uniform location %d is not valid in Shader %s", location, this->name_get());
return;
}
@@ -601,14 +602,13 @@ void MTLShader::uniform_int(int location, int comp_len, int array_size, const in
{
MTL_LOG_WARNING(
"Texture uniform location re-mapping unsupported in Metal. (Possibly also bad uniform "
"location %d)\n",
"location %d)",
location);
return;
}
if (location < 0 || location >= mtl_interface->get_total_uniforms()) {
MTL_LOG_WARNING(
"Uniform is not valid at location %d - Shader %s\n", location, this->name_get());
MTL_LOG_WARNING("Uniform is not valid at location %d - Shader %s", location, this->name_get());
return;
}
@@ -877,7 +877,8 @@ MTLRenderPipelineStateInstance *MTLShader::bake_pipeline_state(
}
else {
for (const uint i :
IndexRange(pipeline_descriptor.vertex_descriptor.max_attribute_value + 1)) {
IndexRange(pipeline_descriptor.vertex_descriptor.max_attribute_value + 1))
{
/* Metal back-end attribute descriptor state. */
const MTLVertexAttributeDescriptorPSO &attribute_desc =
@@ -898,7 +899,7 @@ MTLRenderPipelineStateInstance *MTLShader::bake_pipeline_state(
/* If attributes are non-contiguous, we can skip over gaps. */
MTL_LOG_WARNING(
"MTLShader: baking pipeline state for '%s'- skipping input attribute at "
"index '%d' but none was specified in the current vertex state\n",
"index '%d' but none was specified in the current vertex state",
mtl_interface->get_name(),
i);
@@ -995,7 +996,7 @@ MTLRenderPipelineStateInstance *MTLShader::bake_pipeline_state(
}
using_null_buffer = true;
#if MTL_DEBUG_SHADER_ATTRIBUTES == 1
MTL_LOG_INFO("Setting up buffer binding for null attribute with buffer index %d\n",
MTL_LOG_INFO("Setting up buffer binding for null attribute with buffer index %d",
null_buffer_index);
#endif
}
@@ -1070,7 +1071,8 @@ MTLRenderPipelineStateInstance *MTLShader::bake_pipeline_state(
bool null_pointsize = true;
float MTL_pointsize = pipeline_descriptor.point_size;
if (pipeline_descriptor.vertex_descriptor.prim_topology_class ==
MTLPrimitiveTopologyClassPoint) {
MTLPrimitiveTopologyClassPoint)
{
/* `if pointsize is > 0.0`, PROGRAM_POINT_SIZE is enabled, and `gl_PointSize` shader keyword
* overrides the value. Otherwise, if < 0.0, use global constant point size. */
if (MTL_pointsize < 0.0) {
@@ -1142,7 +1144,8 @@ MTLRenderPipelineStateInstance *MTLShader::bake_pipeline_state(
/* Setup pixel format state */
for (int color_attachment = 0; color_attachment < GPU_FB_MAX_COLOR_ATTACHMENT;
color_attachment++) {
color_attachment++)
{
/* Fetch color attachment pixel format in back-end pipeline state. */
MTLPixelFormat pixel_format = pipeline_descriptor.color_attachment_format[color_attachment];
/* Populate MTL API PSO attachment descriptor. */
@@ -1383,7 +1386,8 @@ bool MTLShader::bake_compute_pipeline_state(MTLContext *ctx)
/* Only exit out if genuine error and not warning */
if ([[error localizedDescription] rangeOfString:@"Compilation succeeded"].location ==
NSNotFound) {
NSNotFound)
{
BLI_assert(false);
return false;
}
@@ -1560,7 +1564,7 @@ void MTLShader::ssbo_vertex_fetch_bind_attributes_end(id<MTLRenderCommandEncoder
MTL_LOG_WARNING(
"SSBO Vertex Fetch missing attribute with index: %d. Shader: %s, Attr "
"Name: "
"%s - Null buffer bound\n",
"%s - Null buffer bound",
i,
this->name_get(),
mtl_shader_attribute->name);
@@ -1571,7 +1575,7 @@ void MTLShader::ssbo_vertex_fetch_bind_attributes_end(id<MTLRenderCommandEncoder
ssbo_vertex_fetch_bind_attribute(ssbo_attr);
MTL_LOG_WARNING(
"Unassigned Shader attribute: %s, Attr Name: %s -- Binding NULL BUFFER to "
"slot %d\n",
"slot %d",
this->name_get(),
mtl_interface->get_name_at_offset(mtl_shader_attribute->name_offset),
null_attr_buffer_slot);

View File

@@ -474,7 +474,7 @@ static void extract_global_scope_constants(std::string &str, std::stringstream &
if (c_expr_end != nullptr && balanced_braces(c, c_expr_end)) {
MTL_LOG_INFO(
"[PERFORMANCE WARNING] Global scope constant expression found - These get allocated "
"per-thread in METAL - Best to use Macro's or uniforms to avoid overhead: '%.*s'\n",
"per-thread in METAL - Best to use Macro's or uniforms to avoid overhead: '%.*s'",
(int)(c_expr_end + 1 - c),
c);
@@ -851,7 +851,7 @@ bool MTLShader::generate_msl_from_glsl(const shader::ShaderCreateInfo *info)
* manual reflection. */
bool uses_create_info = info != nullptr;
if (!uses_create_info) {
MTL_LOG_WARNING("Unable to compile shader %p '%s' as no create-info was provided!\n",
MTL_LOG_WARNING("Unable to compile shader %p '%s' as no create-info was provided!",
this,
this->name_get());
valid_ = false;
@@ -1961,7 +1961,7 @@ bool MSLGeneratorInterface::use_argument_buffer_for_samplers() const
MTL_LOG_WARNING(
"Compiled Shader '%s' is falling back to bindless via argument buffers due to having a "
"texture sampler of Index: %u Which exceeds the limit of 15+1. However shader only uses "
"%d textures. Consider optimising bind points with .auto_resource_location(true).\n",
"%d textures. Consider optimising bind points with .auto_resource_location(true).",
parent_shader_.name_get(),
max_tex_bind_index,
(int)texture_samplers.size());
@@ -3294,7 +3294,7 @@ void MSLGeneratorInterface::resolve_input_attribute_locations()
}
/* Error if could not assign attribute. */
MTL_LOG_ERROR("Could not assign attribute location to attribute %s for shader %s\n",
MTL_LOG_ERROR("Could not assign attribute location to attribute %s for shader %s",
attr.name.c_str(),
this->parent_shader_.name_get());
}

View File

@@ -175,8 +175,8 @@ void MTLShaderInterface::add_uniform(uint32_t name_offset, eMTLDataType type, in
BLI_assert(total_uniforms_ < MTL_MAX_UNIFORMS_PER_BLOCK);
if (total_uniforms_ >= MTL_MAX_UNIFORMS_PER_BLOCK) {
MTL_LOG_WARNING(
"[Warning] Cannot add uniform '%s' to shader interface '%s' as the uniform limit of %d "
"has been reached.\n",
"Cannot add uniform '%s' to shader interface '%s' as the uniform limit of %d has been "
"reached.",
name,
name,
MTL_MAX_UNIFORMS_PER_BLOCK);
@@ -246,7 +246,7 @@ void MTLShaderInterface::add_texture(uint32_t name_offset,
BLI_assert_msg(false, "Exceeding maximum supported texture count.");
MTL_LOG_WARNING(
"Could not add additional texture with index %d to shader interface. Maximum "
"supported texture count is %d\n",
"supported texture count is %d",
texture_slot,
GPU_max_textures());
}
@@ -269,7 +269,7 @@ void MTLShaderInterface::map_builtins()
BLI_assert(uni->location >= 0);
if (uni->location >= 0) {
builtins_[u] = uni->location;
MTL_LOG_INFO("Mapped builtin uniform '%s' NB: '%s' to location: %d\n",
MTL_LOG_INFO("Mapped builtin uniform '%s' NB: '%s' to location: %d",
builtin_uniform_name((GPUUniformBuiltin)u),
get_name_at_offset(uni->name_offset),
uni->location);
@@ -285,7 +285,7 @@ void MTLShaderInterface::map_builtins()
BLI_assert(uni->location >= 0);
if (uni->location >= 0) {
builtin_blocks_[u] = uni->binding;
MTL_LOG_INFO("Mapped builtin uniform block '%s' to location %d\n",
MTL_LOG_INFO("Mapped builtin uniform block '%s' to location %d",
builtin_uniform_block_name((GPUUniformBlockBuiltin)u),
uni->location);
}

View File

@@ -228,7 +228,7 @@ void MTLStorageBuf::clear(uint32_t clear_value)
void MTLStorageBuf::copy_sub(VertBuf *src_, uint dst_offset, uint src_offset, uint copy_size)
{
/* TODO(Metal): Support Copy sub operation. */
MTL_LOG_WARNING("MTLStorageBuf::copy_sub not yet supported.\n");
MTL_LOG_WARNING("MTLStorageBuf::copy_sub not yet supported.");
}
void MTLStorageBuf::read(void *data)

View File

@@ -192,7 +192,7 @@ void gpu::MTLTexture::bake_mip_swizzle_view()
slices:NSMakeRange(mip_texture_base_layer_, num_slices)
swizzle:mtl_swizzle_mask_];
MTL_LOG_INFO(
"Updating texture view - MIP TEXTURE BASE LEVEL: %d, MAX LEVEL: %d (Range len: %d)\n",
"Updating texture view - MIP TEXTURE BASE LEVEL: %d, MAX LEVEL: %d (Range len: %d)",
mip_texture_base_level_,
min_ii(mip_texture_max_level_, (int)texture_.mipmapLevelCount),
range_len);
@@ -215,7 +215,7 @@ id<MTLTexture> gpu::MTLTexture::get_metal_handle()
if (buf != vert_buffer_mtl_) {
MTL_LOG_INFO(
"MTLTexture '%p' using MTL_TEXTURE_MODE_VBO requires re-generation due to updated "
"Vertex-Buffer.\n",
"Vertex-Buffer.",
this);
/* Clear state. */
this->reset();
@@ -305,8 +305,8 @@ void gpu::MTLTexture::blit(id<MTLBlitCommandEncoder> blit_encoder,
if (this->format_get() != dest->format_get()) {
MTL_LOG_WARNING(
"[Warning] gpu::MTLTexture: Cannot copy between two textures of different types using a "
"blit encoder. TODO: Support this operation\n");
"gpu::MTLTexture: Cannot copy between two textures of different types using a "
"blit encoder. TODO: Support this operation");
return;
}
@@ -484,8 +484,8 @@ void gpu::MTLTexture::update_sub(
return;
default:
MTL_LOG_ERROR(
"[Error] gpu::MTLTexture::update_sub not yet supported for other depth "
"configurations\n");
"gpu::MTLTexture::update_sub not yet supported for other depth "
"configurations");
return;
}
}
@@ -524,7 +524,7 @@ void gpu::MTLTexture::update_sub(
if (totalsize <= 0 || extent[0] <= 0) {
MTL_LOG_WARNING(
"MTLTexture::update_sub called with extent size of zero for one or more dimensions. "
"(%d, %d, %d) - DimCount: %u\n",
"(%d, %d, %d) - DimCount: %u",
extent[0],
extent[1],
extent[2],
@@ -575,7 +575,7 @@ void gpu::MTLTexture::update_sub(
if (format_ == GPU_SRGB8_A8 && !can_use_direct_blit) {
MTL_LOG_WARNING(
"SRGB data upload does not work correctly using compute upload. "
"texname '%s'\n",
"texname '%s'",
name_);
}
@@ -591,7 +591,7 @@ void gpu::MTLTexture::update_sub(
MTL_LOG_WARNING(
"gpu::MTLTexture::update_sub supplied bpp is %lu bytes (%d components per "
"pixel), but backing texture bpp is %lu bytes (%d components per pixel) "
"(TODO(Metal): Channel Conversion needed) (w: %d, h: %d, d: %d)\n",
"(TODO(Metal): Channel Conversion needed) (w: %d, h: %d, d: %d)",
input_bytes_per_pixel,
num_channels,
expected_dst_bytes_per_pixel,
@@ -603,7 +603,7 @@ void gpu::MTLTexture::update_sub(
/* Check mip compatibility. */
if (mip != 0) {
MTL_LOG_ERROR(
"[Error]: Updating texture layers other than mip=0 when data is mismatched is not "
"Updating texture layers other than mip=0 when data is mismatched is not "
"possible in METAL on macOS using texture->write\n");
return;
}
@@ -611,7 +611,7 @@ void gpu::MTLTexture::update_sub(
/* Check Format write-ability. */
if (mtl_format_get_writeable_view_format(destination_format) == MTLPixelFormatInvalid) {
MTL_LOG_ERROR(
"[Error]: Updating texture -- destination MTLPixelFormat '%d' does not support write "
"Updating texture -- destination MTLPixelFormat '%d' does not support write "
"operations, and no suitable TextureView format exists.\n",
*(int *)(&destination_format));
return;
@@ -1167,7 +1167,7 @@ void gpu::MTLTexture::ensure_mipmaps(int miplvl)
"Texture requires a higher mipmap level count. Please specify the required "
"amount upfront.");
is_dirty_ = true;
MTL_LOG_WARNING("Texture requires regenerating due to increase in mip-count\n");
MTL_LOG_WARNING("Texture requires regenerating due to increase in mip-count");
}
}
this->mip_range_set(0, mipmaps_);
@@ -1193,7 +1193,7 @@ void gpu::MTLTexture::generate_mipmap()
BLI_assert_msg(is_baked_ && texture_, "MTLTexture is not valid");
if (mipmaps_ == 1 || mtl_max_mips_ == 1) {
MTL_LOG_WARNING("Call to generate mipmaps on texture with 'mipmaps_=1\n'");
MTL_LOG_WARNING("Call to generate mipmaps on texture with 'mipmaps_=1'");
return;
}
@@ -1202,7 +1202,7 @@ void gpu::MTLTexture::generate_mipmap()
format_ == GPU_DEPTH_COMPONENT16 || format_ == GPU_DEPTH32F_STENCIL8 ||
format_ == GPU_DEPTH24_STENCIL8)
{
MTL_LOG_WARNING("Cannot generate mipmaps for textures using DEPTH formats\n");
MTL_LOG_WARNING("Cannot generate mipmaps for textures using DEPTH formats");
return;
}
@@ -1398,7 +1398,7 @@ void *gpu::MTLTexture::read(int mip, eGPUDataFormat type)
}
else {
/* Clear return values? */
MTL_LOG_WARNING("MTLTexture::read - reading from texture with no image data\n");
MTL_LOG_WARNING("MTLTexture::read - reading from texture with no image data");
}
return data;
@@ -1419,7 +1419,7 @@ void gpu::MTLTexture::read_internal(int mip,
{
/* Verify textures are baked. */
if (!is_baked_) {
MTL_LOG_WARNING("gpu::MTLTexture::read_internal - Trying to read from a non-baked texture!\n");
MTL_LOG_WARNING("gpu::MTLTexture::read_internal - Trying to read from a non-baked texture!");
return;
}
/* Fetch active context. */
@@ -1654,7 +1654,7 @@ void gpu::MTLTexture::read_internal(int mip,
texture_array_relative_offset += bytes_per_image;
}
MTL_LOG_INFO("Copying texture data to buffer GPU_TEXTURE_CUBE_ARRAY\n");
MTL_LOG_INFO("Copying texture data to buffer GPU_TEXTURE_CUBE_ARRAY");
copy_successful = true;
}
else {
@@ -1664,8 +1664,8 @@ void gpu::MTLTexture::read_internal(int mip,
default:
MTL_LOG_WARNING(
"[Warning] gpu::MTLTexture::read_internal simple-copy not yet supported for texture "
"type: %d\n",
"gpu::MTLTexture::read_internal simple-copy not yet supported for texture "
"type: %d",
(int)type_);
break;
}
@@ -1686,13 +1686,13 @@ void gpu::MTLTexture::read_internal(int mip,
/* Copy data from Shared Memory into ptr. */
memcpy(r_data, destination_buffer_host_ptr, total_bytes);
MTL_LOG_INFO("gpu::MTLTexture::read_internal success! %lu bytes read\n", total_bytes);
MTL_LOG_INFO("gpu::MTLTexture::read_internal success! %lu bytes read", total_bytes);
}
else {
MTL_LOG_WARNING(
"[Warning] gpu::MTLTexture::read_internal not yet supported for this config -- data "
"gpu::MTLTexture::read_internal not yet supported for this config -- data "
"format different (src %lu bytes, dst %lu bytes) (src format: %d, dst format: %d), or "
"varying component counts (src %d, dst %d)\n",
"varying component counts (src %d, dst %d)",
image_bpp,
desired_output_bpp,
(int)data_format,
@@ -1746,7 +1746,7 @@ bool gpu::MTLTexture::init_internal(GPUVertBuf *vbo)
/* Verify size. */
if (w_ <= 0) {
MTL_LOG_WARNING("Allocating texture buffer of width 0!\n");
MTL_LOG_WARNING("Allocating texture buffer of width 0!");
w_ = 1;
}
@@ -2070,8 +2070,7 @@ void gpu::MTLTexture::ensure_baked()
void gpu::MTLTexture::reset()
{
MTL_LOG_INFO("Texture %s reset. Size %d, %d, %d\n", this->get_name(), w_, h_, d_);
MTL_LOG_INFO("Texture %s reset. Size %d, %d, %d", this->get_name(), w_, h_, d_);
/* Delete associated METAL resources. */
if (texture_ != nil) {
[texture_ release];

View File

@@ -98,7 +98,7 @@ void MTLUniformBuf::clear_to_zero()
void MTLUniformBuf::bind(int slot)
{
if (slot < 0) {
MTL_LOG_WARNING("Failed to bind UBO %p. uniform location %d invalid.\n", this, slot);
MTL_LOG_WARNING("Failed to bind UBO %p. uniform location %d invalid.", this, slot);
return;
}
@@ -130,7 +130,7 @@ void MTLUniformBuf::bind(int slot)
void MTLUniformBuf::bind_as_ssbo(int slot)
{
if (slot < 0) {
MTL_LOG_WARNING("Failed to bind UBO %p as SSBO. uniform location %d invalid.\n", this, slot);
MTL_LOG_WARNING("Failed to bind UBO %p as SSBO. uniform location %d invalid.", this, slot);
return;
}
@@ -196,4 +196,4 @@ size_t MTLUniformBuf::get_size()
return size_in_bytes_;
}
} // blender::gpu
} // namespace blender::gpu

View File

@@ -128,7 +128,7 @@ void MTLVertBuf::bind()
uint64_t required_size = max_ulul(required_size_raw, 128);
if (required_size_raw == 0) {
MTL_LOG_WARNING("Warning: Vertex buffer required_size = 0\n");
MTL_LOG_INFO("Vertex buffer required_size = 0");
}
/* If the vertex buffer has already been allocated, but new data is ready,