Metal renderer & iOS frontend fixes

This commit is contained in:
wheremyfoodat 2025-06-29 23:20:35 +03:00
parent 630952f36b
commit adcd03d31e
8 changed files with 71 additions and 36 deletions

View file

@ -40,7 +40,13 @@ namespace PICA {
};
void checkForMTLPixelFormatSupport(MTL::Device* device) {
if (!device->supportsFamily(MTL::GPUFamilyApple1)) {
#ifndef PANDA3DS_IOS_SIMULATOR
const bool supportsApple1 = device->supportsFamily(MTL::GPUFamilyApple1);
#else
// iOS simulator claims to support Apple1, yet doesn't support a bunch of texture formats from it...
const bool supportsApple1 = false;
#endif
if (!supportsApple1) {
mtlPixelFormatInfos[2] = {MTL::PixelFormatRGBA8Unorm, 4, decodeTexelA1BGR5ToRGBA8};
mtlPixelFormatInfos[3] = {MTL::PixelFormatRGBA8Unorm, 4, decodeTexelB5G6R5ToRGBA8};
mtlPixelFormatInfos[4] = {MTL::PixelFormatRGBA8Unorm, 4, decodeTexelABGR4ToRGBA8};

View file

@ -130,7 +130,7 @@ void RendererMTL::display() {
// Top screen
if (topScreen) {
renderCommandEncoder->setViewport(
MTL::Viewport{blitInfo.topScreenX, blitInfo.topScreenY + 240 * blitInfo.scale, 400 * blitInfo.scale, 240 * blitInfo.scale, 0.0f, 1.0f}
MTL::Viewport{blitInfo.topScreenX, blitInfo.topScreenY, 400 * blitInfo.scale, 240 * blitInfo.scale, 0.0f, 1.0f}
);
renderCommandEncoder->setFragmentTexture(topScreen->get().texture, 0);
renderCommandEncoder->drawPrimitives(MTL::PrimitiveTypeTriangleStrip, NS::UInteger(0), NS::UInteger(4));