Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

8247772: Lanai: Several jtreg tests fails with assertion validateText… #59

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -77,4 +77,10 @@ typedef struct _MTLGraphicsConfigInfo {
MTLContext *context;
} MTLGraphicsConfigInfo;

// From "Metal Feature Set Tables"
// There are 2 GPU families for mac - MTLGPUFamilyMac1 and MTLGPUFamilyMac2
// Both of them support "Maximum 2D texture width and height" of 16384 pixels
// Note : there is no API to get this value, hence hardcoding by reading from the table
#define MaxTextureSize 16384

#endif /* MTLGraphicsConfig_h_Included */
Expand Up @@ -218,11 +218,5 @@ + (void) _getMTLConfigInfo: (NSMutableArray *)argValue {
{
J2dTraceLn(J2D_TRACE_INFO, "MTLGraphicsConfig_nativeGetMaxTextureSize");

// From "Metal Feature Set Tables"
// There are 2 GPU families for mac - MTLGPUFamilyMac1 and MTLGPUFamilyMac2
// Both of them support "Maximum 2D texture width and height" of 16384 pixels
// Note : there is no API to get this value, hence hardcoding by reading from the table
__block int max = 16384;

return (jint)max;
return (jint)MaxTextureSize;
}
Expand Up @@ -68,6 +68,9 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque

MTLContext* ctx = mtlsdo->configInfo->context;

if (width > MaxTextureSize) {
width = MaxTextureSize;
}
MTLTextureDescriptor *textureDescriptor = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat: MTLPixelFormatBGRA8Unorm width: width height: height mipmapped: NO];
textureDescriptor.usage = MTLTextureUsageUnknown;
bmtlsdo->pTexture = [ctx.device newTextureWithDescriptor: textureDescriptor];
Expand Down