This commit is contained in:
connan 2024-12-18 14:27:45 +08:00
parent af699b5c7e
commit c2e1fd6197

View File

@ -30,6 +30,7 @@ public:
virtual void spatialUpScale(void*data);
private:
id <MTLFXSpatialScaler> mfx_spatial_scaler;
id <MTLCommandQueue> commandQueue;
IUnityGraphicsMetal* metal_graphics;
};
@ -97,19 +98,20 @@ void RenderAPI_Metal::spatialUpScale(void* data)
desc.colorProcessingMode = MTLFXSpatialScalerColorProcessingModeLinear;
mfx_spatial_scaler = [desc newSpatialScalerWithDevice:_device];
if (mfx_spatial_scaler == nil)
{
return;
}
commandQueue = [_device newCommandQueue];
}
if (mfx_spatial_scaler == nil || commandQueue == nil)
{
return;
}
mfx_spatial_scaler.colorTexture = srctex;
mfx_spatial_scaler.outputTexture = dsttex;
// if(!cmd)
{
id <MTLCommandQueue> _commandQueue = [_device newCommandQueue];
id <MTLCommandBuffer> upscaleCommandBuffer = [_commandQueue commandBuffer];
id <MTLCommandBuffer> upscaleCommandBuffer = [commandQueue commandBuffer];
upscaleCommandBuffer.label = @"Upscale Command Buffer";
[mfx_spatial_scaler encodeToCommandBuffer:upscaleCommandBuffer];
[upscaleCommandBuffer commit];
}