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

8260681: Lanai: Refactor MTLBlitLoops.m, common.h, shaders.metal #168

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
2 changes: 1 addition & 1 deletion make/modules/java.desktop/lib/Awt2dLibraries.gmk
Expand Up @@ -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
Expand Down
Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down