Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8260681: Lanai: Refactor MTLBlitLoops.m, common.h, shaders.metal
  • Loading branch information
Alexey Ushakov committed Jan 30, 2021
1 parent 162fbcd commit b8f99e1fa2a20aa5b6f94898f4f77b9e01674834
@@ -891,7 +891,7 @@ endif
################################################################################

ifeq ($(call isTargetOs, macosx), true)
SHADERS_SRC := $(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt/shaders.metal
SHADERS_SRC := $(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/shaders.metal
SHADERS_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/native/java.desktop/libosxui
SHADERS_AIR := $(SHADERS_SUPPORT_DIR)/shaders.air
SHADERS_LIB := $(INSTALL_LIBRARIES_HERE)/shaders.metallib
@@ -49,7 +49,7 @@
//#define DEBUG_BLIT

typedef struct {
MTLPixelFormat format; // Consider deleting this field, since it's always MTLPixelFormatBGRA8Unorm
// Consider deleting this field, since it's always MTLPixelFormatBGRA8Unorm
jboolean hasAlpha;
jboolean isPremult;
NSString* swizzleKernel;
@@ -63,12 +63,12 @@
* an Metal surface
*/
MTLRasterFormatInfo RasterFormatInfos[] = {
{ MTLPixelFormatBGRA8Unorm, 1, 0, nil }, /* 0 - IntArgb */ // Argb (in java notation)
{ MTLPixelFormatBGRA8Unorm, 1, 1, nil }, /* 1 - IntArgbPre */
{ MTLPixelFormatBGRA8Unorm, 0, 1, @"rgb_to_rgba" }, /* 2 - IntRgb */
{ MTLPixelFormatBGRA8Unorm, 0, 1, @"xrgb_to_rgba" }, /* 3 - IntRgbx */
{ MTLPixelFormatBGRA8Unorm, 0, 1, @"bgr_to_rgba" }, /* 4 - IntBgr */
{ MTLPixelFormatBGRA8Unorm, 0, 1, @"xbgr_to_rgba" }, /* 5 - IntBgrx */
{ 1, 0, nil }, /* 0 - IntArgb */ // Argb (in java notation)
{ 1, 1, nil }, /* 1 - IntArgbPre */
{ 0, 1, @"rgb_to_rgba" }, /* 2 - IntRgb */
{ 0, 1, @"xrgb_to_rgba" }, /* 3 - IntRgbx */
{ 0, 1, @"bgr_to_rgba" }, /* 4 - IntBgr */
{ 0, 1, @"xbgr_to_rgba" }, /* 5 - IntBgrx */

// TODO: support 2-byte formats
// { GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV,
@@ -238,7 +238,7 @@ void drawTex2Tex(MTLContext *mtlc,

id<MTLTexture> dest = bmtlsdOps->pTexture;

MTLPooledTextureHandle * texHandle = [mtlc.texturePool getTexture:sw height:sh format:rfi->format];
MTLPooledTextureHandle * texHandle = [mtlc.texturePool getTexture:sw height:sh format:MTLPixelFormatBGRA8Unorm];
if (texHandle == nil) {
J2dTraceLn(J2D_TRACE_ERROR, "MTLBlitSwToTextureViaPooledTexture: can't obtain temporary texture object from pool");
return;
@@ -27,7 +27,6 @@
#define MTLPaints_h_Included

#import <Metal/Metal.h>
#import <awt/common.h>
#include "RenderOptions.h"

#define sun_java2d_SunGraphics2D_PAINT_UNDEFINED -1
@@ -26,7 +26,7 @@
#ifndef COMMON_H
#define COMMON_H

#include <simd/SIMD.h>
#include <simd/simd.h>

#define PGRAM_VERTEX_COUNT 6
#define QUAD_VERTEX_COUNT 4

0 comments on commit b8f99e1

Please sign in to comment.