This commit is contained in:
wheremyfoodat
2025-03-14 12:38:09 +02:00
parent 67f0388eae
commit c061bb7b47
7 changed files with 182 additions and 180 deletions

View File

@@ -102,19 +102,16 @@ void RendererMTL::display() {
renderCommandEncoder->setRenderPipelineState(displayPipeline);
renderCommandEncoder->setFragmentSamplerState(nearestSampler, 0);
const int xMultiplier = 2;
const int yMultiplier = 2;
// Top screen
if (topScreen) {
renderCommandEncoder->setViewport(MTL::Viewport{0, 0, 400 * xMultiplier, 240 * yMultiplier, 0.0f, 1.0f});
renderCommandEncoder->setViewport(MTL::Viewport{0, 0, 400, 240, 0.0f, 1.0f});
renderCommandEncoder->setFragmentTexture(topScreen->get().texture, 0);
renderCommandEncoder->drawPrimitives(MTL::PrimitiveTypeTriangleStrip, NS::UInteger(0), NS::UInteger(4));
}
// Bottom screen
if (bottomScreen) {
renderCommandEncoder->setViewport(MTL::Viewport{40 * xMultiplier, 240 * yMultiplier, 320 * xMultiplier, 240 * yMultiplier, 0.0f, 1.0f});
renderCommandEncoder->setViewport(MTL::Viewport{40, 240, 320, 240, 0.0f, 1.0f});
renderCommandEncoder->setFragmentTexture(bottomScreen->get().texture, 0);
renderCommandEncoder->drawPrimitives(MTL::PrimitiveTypeTriangleStrip, NS::UInteger(0), NS::UInteger(4));
}
@@ -141,7 +138,7 @@ void RendererMTL::initGraphicsContext(SDL_Window* window) {
device = MTL::CreateSystemDefaultDevice();
metalLayer->setDevice(device);
#endif
checkForPixelFormatSupport(device);
checkForMTLPixelFormatSupport(device);
commandQueue = device->newCommandQueue();