Metal: use render target height to adjust viewport when blitting (#2610)

This commit is contained in:
Ben Doherty
2020-05-29 16:08:47 -07:00
committed by GitHub
parent 3ef37f8925
commit b1563dabe9
3 changed files with 4 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ A new header is inserted each time a *tag* is created.
- SSAO now has an optional high(er) quality upsampler.
- Tone mappping now uses the real ACES tone mapper, applied in the proper color space.
- Tone mapping is now applied via a LUT, which will later enable color grading capabilities.
- Fixed bug in the Metal backend when SSR and MSAA were turned on
- Fixed Metal issue with `BufferDescriptor` and `PixelBufferDescriptor`s not being called on application thread.
## v1.7.0

View File

@@ -931,12 +931,12 @@ void MetalDriver::blit(TargetBufferFlags buffers,
// coordinates have (0, 0) at bottom-left.
MTLRegion srcRegion = MTLRegionMake2D(
(NSUInteger) srcRect.left,
srcTexture.height - (NSUInteger) srcRect.bottom - srcRect.height,
srcTarget->height - (NSUInteger) srcRect.bottom - srcRect.height,
srcRect.width, srcRect.height);
MTLRegion dstRegion = MTLRegionMake2D(
(NSUInteger) dstRect.left,
dstTexture.height - (NSUInteger) dstRect.bottom - dstRect.height,
dstTarget->height - (NSUInteger) dstRect.bottom - dstRect.height,
dstRect.width, dstRect.height);
const uint8_t srcLevel = srcColorAttachment.level;

View File

@@ -8,7 +8,7 @@ void main() {
// In Vulkan and Metal, texture coords are Y-down. In OpenGL, texture coords are Y-up.
#if defined(TARGET_METAL_ENVIRONMENT) || defined(TARGET_VULKAN_ENVIRONMENT)
inputs.texelCoords.y = frameUniforms.resolution.y - 1.0 - inputs.texelCoords.y;
inputs.texelCoords.y = frameUniforms.resolution.y - inputs.texelCoords.y;
inputs.normalizedUV.y = 1.0 - inputs.normalizedUV.y;
#endif