metal: set texture usage flags

This commit is contained in:
Samuliak 2024-04-09 19:59:27 +02:00
parent f5830983be
commit 2f9fd5d69c
No known key found for this signature in database
2 changed files with 3 additions and 1 deletions

View File

@ -63,6 +63,8 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info, GPUVAddr gpu_
texture_descriptor->setPixelFormat(MaxwellToMTL::GetPixelFormat(info.format));
texture_descriptor->setWidth(info.size.width);
texture_descriptor->setHeight(info.size.height);
texture_descriptor->setDepth(info.size.depth);
texture_descriptor->setUsage(MTL::TextureUsageShaderRead | MTL::TextureUsageRenderTarget);
// TODO: set other parameters
texture = runtime->device.GetDevice()->newTexture(texture_descriptor);

View File

@ -122,7 +122,7 @@ void RendererMetal::CreateBlitPipelineState() {
pipeline_descriptor->setVertexFunction(vertex_function);
pipeline_descriptor->setFragmentFunction(fragment_function);
// TODO: get the pixel format from metal layer
pipeline_descriptor->colorAttachments()->object(0)->setPixelFormat(MTL::PixelFormatRGBA8Unorm);
pipeline_descriptor->colorAttachments()->object(0)->setPixelFormat(MTL::PixelFormatBGRA8Unorm);
error = nullptr;
blit_pipeline_state = device.GetDevice()->newRenderPipelineState(pipeline_descriptor, &error);