Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8262936: Add tighter checks while creating MTLRenderPipelineDescriptors
  • Loading branch information
jayathirthrao committed Mar 3, 2021
1 parent d3d1daa commit 41df642df1da9a9c31dd198d7c05edbf22aeddb8
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLPaints.m
@@ -59,7 +59,9 @@
jfloat extraAlpha, const SurfaceRasterFlags *srcFlags, const SurfaceRasterFlags *dstFlags, int mode);

static void initTemplatePipelineDescriptors() {
if (templateRenderPipelineDesc != nil && templateTexturePipelineDesc != nil)
if (templateRenderPipelineDesc != nil && templateTexturePipelineDesc != nil &&
templateAATexturePipelineDesc != nil && templateLCDPipelineDesc != nil &&
templateAAPipelineDesc != nil)
return;

MTLVertexDescriptor *vertDesc = [[MTLVertexDescriptor new] autorelease];
@@ -402,6 +404,7 @@ - (void)setXorModePipelineState:(id)encoder
{
// This block is not reached in current implementation.
// Gradient paint XOR mode rendering uses a tile based rendering using a SW pipe (similar to OGL)
initTemplatePipelineDescriptors();
NSString* vertShader = @"vert_grad_xorMode";
NSString* fragShader = @"frag_grad_xorMode";
MTLRenderPipelineDescriptor *rpDesc = [[templateRenderPipelineDesc copy] autorelease];
@@ -499,6 +502,7 @@ - (void)setPipelineState:(id)encoder
pipelineStateStorage:(MTLPipelineStatesStorage *)pipelineStateStorage

{
initTemplatePipelineDescriptors();
MTLRenderPipelineDescriptor *rpDesc = nil;

NSString *vertShader = @"vert_grad";
@@ -662,6 +666,7 @@ - (void)setPipelineState:(id)encoder
renderOptions:(const RenderOptions *)renderOptions
pipelineStateStorage:(MTLPipelineStatesStorage *)pipelineStateStorage
{
initTemplatePipelineDescriptors();
MTLRenderPipelineDescriptor *rpDesc = nil;

NSString *vertShader = @"vert_grad";
@@ -803,6 +808,7 @@ - (void)setXorModePipelineState:(id)encoder
renderOptions:(const RenderOptions *)renderOptions
pipelineStateStorage:(MTLPipelineStatesStorage *)pipelineStateStorage
{
initTemplatePipelineDescriptors();
// This block is not reached in current implementation.
// Texture paint XOR mode rendering uses a tile based rendering using a SW pipe (similar to OGL)
NSString* vertShader = @"vert_tp_xorMode";
@@ -953,8 +959,8 @@ - (void)setXorModePipelineState:(id <MTLRenderCommandEncoder>)encoder
renderOptions:(const RenderOptions *)renderOptions
pipelineStateStorage:(MTLPipelineStatesStorage *)pipelineStateStorage
{
initTemplatePipelineDescriptors();
if (renderOptions->isTexture) {
initTemplatePipelineDescriptors();
jint xorColor = (jint) [mtlc.composite getXorColor];
NSString * vertShader = @"vert_txt_xorMode";
NSString * fragShader = @"frag_txt_xorMode";

0 comments on commit 41df642

Please sign in to comment.