48
48
49
49
extern void MTLGC_DestroyMTLGraphicsConfig (jlong pConfigInfo);
50
50
51
- bool isDrawOp (jint op) {
52
- switch (op) {
53
- case MTL_OP_DRAW_LINE:
54
- case MTL_OP_DRAW_RECT:
55
- case MTL_OP_DRAW_PARALLELOGRAM:
56
- case MTL_OP_FILL_RECT:
57
- case MTL_OP_FILL_PARALLELOGRAM:
58
- return true ;
59
- default : return false ;
60
- }
61
- }
62
-
63
51
void MTLRenderQueue_CheckPreviousOp (jint op) {
64
52
65
53
if (mtlPreviousOp == op) {
66
54
// The op is the same as last time, so we can return immediately.
67
55
return ;
68
56
}
69
57
70
- if (isDrawOp (mtlPreviousOp)) {
71
- // submit the vertex batch
72
- MTLRenderer_SubmitVertexBatch (mtlc, dstOps);
73
- if (isDrawOp (op)) {
74
- // Do not cause endEncoder if we continue with Draw operations
75
- mtlPreviousOp = op;
76
- return ;
77
- }
78
- }
79
-
80
58
if (op == MTL_OP_SET_COLOR) {
81
59
if (mtlPreviousOp != MTL_OP_MASK_OP) {
82
60
return ; // SET_COLOR should not cause endEncoder
@@ -150,7 +128,7 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
150
128
// draw ops
151
129
case sun_java2d_pipe_BufferedOpCodes_DRAW_LINE:
152
130
{
153
- CHECK_PREVIOUS_OP (MTL_OP_DRAW_LINE );
131
+ CHECK_PREVIOUS_OP (MTL_OP_OTHER );
154
132
155
133
if ([mtlc useXORComposite ]) {
156
134
commitEncodedCommands ();
@@ -166,10 +144,9 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
166
144
}
167
145
case sun_java2d_pipe_BufferedOpCodes_DRAW_RECT:
168
146
{
169
- CHECK_PREVIOUS_OP (MTL_OP_DRAW_RECT );
147
+ CHECK_PREVIOUS_OP (MTL_OP_OTHER );
170
148
171
149
if ([mtlc useXORComposite ]) {
172
-
173
150
commitEncodedCommands ();
174
151
J2dTraceLn (J2D_TRACE_VERBOSE,
175
152
" DRAW_RECT in XOR mode - Force commit earlier draw calls before DRAW_RECT." );
@@ -251,7 +228,7 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
251
228
}
252
229
case sun_java2d_pipe_BufferedOpCodes_DRAW_PARALLELOGRAM:
253
230
{
254
- CHECK_PREVIOUS_OP (MTL_OP_DRAW_PARALLELOGRAM );
231
+ CHECK_PREVIOUS_OP (MTL_OP_OTHER );
255
232
256
233
if ([mtlc useXORComposite ]) {
257
234
commitEncodedCommands ();
@@ -299,7 +276,7 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
299
276
// fill ops
300
277
case sun_java2d_pipe_BufferedOpCodes_FILL_RECT:
301
278
{
302
- CHECK_PREVIOUS_OP (MTL_OP_FILL_RECT );
279
+ CHECK_PREVIOUS_OP (MTL_OP_OTHER );
303
280
304
281
if ([mtlc useXORComposite ]) {
305
282
commitEncodedCommands ();
@@ -331,7 +308,7 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
331
308
}
332
309
case sun_java2d_pipe_BufferedOpCodes_FILL_PARALLELOGRAM:
333
310
{
334
- CHECK_PREVIOUS_OP (MTL_OP_FILL_PARALLELOGRAM );
311
+ CHECK_PREVIOUS_OP (MTL_OP_OTHER );
335
312
336
313
if ([mtlc useXORComposite ]) {
337
314
commitEncodedCommands ();
@@ -605,7 +582,6 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
605
582
jlong pDst = NEXT_LONG (b);
606
583
607
584
if (mtlc != NULL ) {
608
- MTLRenderer_SubmitVertexBatch (mtlc, dstOps);
609
585
[mtlc.encoderManager endEncoder ];
610
586
MTLCommandBufferWrapper * cbwrapper = [mtlc pullCommandBufferWrapper ];
611
587
id <MTLCommandBuffer > commandbuf = [cbwrapper getCommandBuffer ];
@@ -633,7 +609,6 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
633
609
634
610
} else {
635
611
if (mtlc != NULL ) {
636
- MTLRenderer_SubmitVertexBatch (mtlc, dstOps);
637
612
[mtlc.encoderManager endEncoder ];
638
613
MTLCommandBufferWrapper * cbwrapper = [mtlc pullCommandBufferWrapper ];
639
614
id <MTLCommandBuffer > commandbuf = [cbwrapper getCommandBuffer ];
@@ -903,8 +878,6 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
903
878
if (mtlPreviousOp == MTL_OP_MASK_OP) {
904
879
MTLVertexCache_DisableMaskCache (mtlc);
905
880
}
906
- MTLRenderer_SubmitVertexBatch (mtlc, dstOps);
907
-
908
881
[mtlc.encoderManager endEncoder ];
909
882
MTLCommandBufferWrapper * cbwrapper = [mtlc pullCommandBufferWrapper ];
910
883
id <MTLCommandBuffer > commandbuf = [cbwrapper getCommandBuffer ];
@@ -950,9 +923,6 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
950
923
* these would be rendered to the back-buffer - which is read in shader while rendering in XOR mode
951
924
*/
952
925
void commitEncodedCommands () {
953
-
954
- MTLRenderer_SubmitVertexBatch (mtlc, dstOps);
955
-
956
926
[mtlc.encoderManager endEncoder ];
957
927
958
928
MTLCommandBufferWrapper *cbwrapper = [mtlc pullCommandBufferWrapper ];
0 commit comments