8265062: Remove duplication constant MaxTextureSize

This commit is contained in:
Denis Konoplev
2021-04-15 19:43:34 +03:00
committed by Alexey Ushakov
parent 904a5c3dd4
commit 71e97816b7
3 changed files with 4 additions and 10 deletions

View File

@@ -47,10 +47,4 @@ 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 */

View File

@@ -225,5 +225,5 @@ Java_sun_java2d_metal_MTLGraphicsConfig_nativeGetMaxTextureSize
{
J2dTraceLn(J2D_TRACE_INFO, "MTLGraphicsConfig_nativeGetMaxTextureSize");
return (jint)MaxTextureSize;
return (jint)MTL_GPU_FAMILY_MAC_TXT_SIZE;
}

View File

@@ -68,11 +68,11 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque
MTLContext* ctx = mtlsdo->configInfo->context;
width = (width <= MaxTextureSize) ? width : 0;
height = (height <= MaxTextureSize) ? height : 0;
width = (width <= MTL_GPU_FAMILY_MAC_TXT_SIZE) ? width : 0;
height = (height <= MTL_GPU_FAMILY_MAC_TXT_SIZE) ? height : 0;
J2dTraceLn3(J2D_TRACE_VERBOSE, " desired texture dimensions: w=%d h=%d max=%d",
width, height, MaxTextureSize);
width, height, MTL_GPU_FAMILY_MAC_TXT_SIZE);
// if either dimension is 0, we cannot allocate a texture with the
// requested dimensions