Metal: Fix a warning and compilation errors

These were oversight when developping without testing on MacOS.
This commit is contained in:
2022-11-24 16:57:46 +01:00
parent 20c1ce3d9b
commit d6d5089c65
3 changed files with 5 additions and 1 deletions

View File

@@ -989,6 +989,9 @@ inline bool mtl_convert_vertex_format(MTLVertexFormat shader_attrib_format,
case GPU_COMP_I10:
out_vert_format = MTLVertexFormatInt1010102Normalized;
break;
case GPU_COMP_MAX:
BLI_assert_unreachable();
break;
}
*r_convertedFormat = out_vert_format;
return (out_vert_format != MTLVertexFormatInvalid);

View File

@@ -37,6 +37,7 @@ class MTLUniformBuf : public UniformBuf {
void bind(int slot) override;
void bind_as_ssbo(int slot) override;
void unbind() override;
void clear_to_zero() override;
id<MTLBuffer> get_metal_buffer(int *r_offset);
int get_size();

View File

@@ -84,7 +84,7 @@ void MTLUniformBuf::update(const void *data)
void MTLUniformBuf::clear_to_zero()
{
/* TODO(fclem): Avoid another allocation and just do the clear on the GPU if possible. */
void *clear_data = calloc(size_in_bytes_);
void *clear_data = calloc(1, size_in_bytes_);
this->update(clear_data);
free(clear_data);
}