@@ -81,7 +81,15 @@ - (void) setRTT:(MetalRTTexture*)rttPtr
81
81
rtt = rttPtr;
82
82
CTX_LOG (@" -> Native: MetalContext.setRTT() %lu , %lu " ,
83
83
[rtt getTexture ].width , [rtt getTexture ].height );
84
- rttPassDesc.colorAttachments [0 ].texture = [rtt getTexture ];
84
+ if ([rttPtr isMSAAEnabled ]) {
85
+ rttPassDesc.colorAttachments [0 ].storeAction = MTLStoreActionStoreAndMultisampleResolve ;
86
+ rttPassDesc.colorAttachments [0 ].texture = [rtt getMSAATexture ];
87
+ rttPassDesc.colorAttachments [0 ].resolveTexture = [rtt getTexture ];
88
+ } else {
89
+ rttPassDesc.colorAttachments [0 ].storeAction = MTLStoreActionStore ;
90
+ rttPassDesc.colorAttachments [0 ].texture = [rtt getTexture ];
91
+ rttPassDesc.colorAttachments [0 ].resolveTexture = nil ;
92
+ }
85
93
[self resetClip ];
86
94
}
87
95
@@ -510,21 +518,9 @@ - (NSInteger) setDeviceParametersFor3D
510
518
CTX_LOG (@" MetalContext_setDeviceParametersFor3D()" );
511
519
id <MTLCommandBuffer > commandBuffer = [self getCurrentCommandBuffer ];
512
520
phongRPD = [MTLRenderPassDescriptor new ];
513
- if (!rttCleared) {
514
- phongRPD.colorAttachments [0 ].loadAction = MTLLoadActionClear ;
515
- }
516
- if (clearDepthTexture &&
517
- depthEnabled) {
518
- phongRPD.depthAttachment .loadAction = MTLLoadActionClear ;
519
- }
520
- phongRPD.colorAttachments [0 ].clearColor =
521
- MTLClearColorMake (clearColor[0 ],
522
- clearColor[1 ],
523
- clearColor[2 ],
524
- clearColor[3 ]);
521
+ phongRPD.colorAttachments [0 ].loadAction = MTLLoadActionLoad ;
525
522
526
523
if ([[self getRTT ] isMSAAEnabled ]) {
527
- phongRPD.colorAttachments [0 ].loadAction = MTLLoadActionClear ;
528
524
phongRPD.colorAttachments [0 ].storeAction = MTLStoreActionStoreAndMultisampleResolve ;
529
525
phongRPD.colorAttachments [0 ].texture = [rtt getMSAATexture ];
530
526
phongRPD.colorAttachments [0 ].resolveTexture = [rtt getTexture ];
@@ -535,8 +531,12 @@ - (NSInteger) setDeviceParametersFor3D
535
531
}
536
532
if (depthEnabled) {
537
533
phongRPD.depthAttachment .clearDepth = 1.0 ;
538
- if ([[ self getRTT ] isMSAAEnabled ] ) {
534
+ if (clearDepthTexture ) {
539
535
phongRPD.depthAttachment .loadAction = MTLLoadActionClear ;
536
+ } else {
537
+ phongRPD.depthAttachment .loadAction = MTLLoadActionLoad ;
538
+ }
539
+ if ([[self getRTT ] isMSAAEnabled ]) {
540
540
phongRPD.depthAttachment .storeAction = MTLStoreActionStoreAndMultisampleResolve ;
541
541
phongRPD.depthAttachment .texture = [rtt getDepthMSAATexture ];
542
542
phongRPD.depthAttachment .resolveTexture = [rtt getDepthTexture ];
@@ -583,11 +583,21 @@ - (vector_float4) getCameraPosition
583
583
return cPos;
584
584
}
585
585
586
+ - (MTLScissorRect ) getScissorRect
587
+ {
588
+ return scissorRect;
589
+ }
590
+
586
591
- (bool ) isDepthEnabled
587
592
{
588
593
return depthEnabled;
589
594
}
590
595
596
+ - (bool ) isScissorEnabled
597
+ {
598
+ return isScissorEnabled;
599
+ }
600
+
591
601
// TODO: MTL: This was copied from GlassHelper, and could be moved to a utility class.
592
602
+ (NSString *) nsStringWithJavaString : (jstring)javaString withEnv : (JNIEnv*)env
593
603
{
0 commit comments