@@ -85,7 +85,14 @@ angle::Result SemaphoreVk::wait(gl::Context *context,
8585 if (!bufferBarriers.empty () || !textureBarriers.empty ())
8686 {
8787 // Create one global memory barrier to cover all barriers.
88- contextVk->getCommandGraph ()->syncExternalMemory ();
88+ if (contextVk->commandGraphEnabled ())
89+ {
90+ contextVk->getCommandGraph ()->syncExternalMemory ();
91+ }
92+ else
93+ {
94+ ANGLE_TRY (contextVk->syncExternalMemory ());
95+ }
8996 }
9097
9198 uint32_t rendererQueueFamilyIndex = contextVk->getRenderer ()->getQueueFamilyIndex ();
@@ -98,15 +105,22 @@ angle::Result SemaphoreVk::wait(gl::Context *context,
98105 BufferVk *bufferVk = vk::GetImpl (buffer);
99106 vk::BufferHelper &bufferHelper = bufferVk->getBuffer ();
100107
101- // If there were GL commands using this buffer prior to this call, that's a
102- // synchronization error on behalf of the program.
103- ASSERT (!bufferHelper.hasRecordedCommands ());
108+ vk::CommandBuffer *commandBuffer;
109+ if (contextVk->commandGraphEnabled ())
110+ {
111+ // If there were GL commands using this buffer prior to this call, that's a
112+ // synchronization error on behalf of the program.
113+ ASSERT (!bufferHelper.hasRecordedCommands ());
104114
105- vk::CommandBuffer *queueChange;
106- ANGLE_TRY (bufferHelper.recordCommands (contextVk, &queueChange));
115+ ANGLE_TRY (bufferHelper.recordCommands (contextVk, &commandBuffer));
116+ }
117+ else
118+ {
119+ ANGLE_TRY (contextVk->getOutsideRenderPassCommandBuffer (&commandBuffer));
120+ }
107121
108122 // Queue ownership transfer.
109- bufferHelper.changeQueue (rendererQueueFamilyIndex, queueChange );
123+ bufferHelper.changeQueue (rendererQueueFamilyIndex, commandBuffer );
110124 }
111125 }
112126
@@ -121,19 +135,24 @@ angle::Result SemaphoreVk::wait(gl::Context *context,
121135 vk::ImageHelper &image = textureVk->getImage ();
122136 vk::ImageLayout layout = GetVulkanImageLayout (textureAndLayout.layout );
123137
124- // If there were GL commands using this image prior to this call, that's a
125- // synchronization error on behalf of the program.
126- ASSERT (!image.hasRecordedCommands ());
127-
128138 // Inform the image that the layout has been externally changed.
129139 image.onExternalLayoutChange (layout);
130140
131- vk::CommandBuffer *queueChange;
132- ANGLE_TRY (image.recordCommands (contextVk, &queueChange));
133-
141+ vk::CommandBuffer *commandBuffer;
142+ if (contextVk->commandGraphEnabled ())
143+ {
144+ // If there were GL commands using this image prior to this call, that's a
145+ // synchronization error on behalf of the program.
146+ ASSERT (!image.hasRecordedCommands ());
147+ ANGLE_TRY (image.recordCommands (contextVk, &commandBuffer));
148+ }
149+ else
150+ {
151+ ANGLE_TRY (contextVk->getOutsideRenderPassCommandBuffer (&commandBuffer));
152+ }
134153 // Queue ownership transfer.
135154 image.changeLayoutAndQueue (image.getAspectFlags (), layout, rendererQueueFamilyIndex,
136- queueChange );
155+ commandBuffer );
137156 }
138157 }
139158
@@ -155,11 +174,18 @@ angle::Result SemaphoreVk::signal(gl::Context *context,
155174 BufferVk *bufferVk = vk::GetImpl (buffer);
156175 vk::BufferHelper &bufferHelper = bufferVk->getBuffer ();
157176
158- vk::CommandBuffer *queueChange;
159- ANGLE_TRY (bufferHelper.recordCommands (contextVk, &queueChange));
177+ vk::CommandBuffer *commandBuffer;
178+ if (contextVk->commandGraphEnabled ())
179+ {
180+ ANGLE_TRY (bufferHelper.recordCommands (contextVk, &commandBuffer));
181+ }
182+ else
183+ {
184+ ANGLE_TRY (contextVk->getOutsideRenderPassCommandBuffer (&commandBuffer));
185+ }
160186
161187 // Queue ownership transfer.
162- bufferHelper.changeQueue (VK_QUEUE_FAMILY_EXTERNAL, queueChange );
188+ bufferHelper.changeQueue (VK_QUEUE_FAMILY_EXTERNAL, commandBuffer );
163189 }
164190 }
165191
@@ -181,19 +207,33 @@ angle::Result SemaphoreVk::signal(gl::Context *context,
181207 layout = image.getCurrentImageLayout ();
182208 }
183209
184- vk::CommandBuffer *layoutChange;
185- ANGLE_TRY (image.recordCommands (contextVk, &layoutChange));
210+ vk::CommandBuffer *commandBuffer;
211+ if (contextVk->commandGraphEnabled ())
212+ {
213+ ANGLE_TRY (image.recordCommands (contextVk, &commandBuffer));
214+ }
215+ else
216+ {
217+ ANGLE_TRY (contextVk->getOutsideRenderPassCommandBuffer (&commandBuffer));
218+ }
186219
187220 // Queue ownership transfer and layout transition.
188221 image.changeLayoutAndQueue (image.getAspectFlags (), layout, VK_QUEUE_FAMILY_EXTERNAL,
189- layoutChange );
222+ commandBuffer );
190223 }
191224 }
192225
193226 if (!bufferBarriers.empty () || !textureBarriers.empty ())
194227 {
195228 // Create one global memory barrier to cover all barriers.
196- contextVk->getCommandGraph ()->syncExternalMemory ();
229+ if (contextVk->commandGraphEnabled ())
230+ {
231+ contextVk->getCommandGraph ()->syncExternalMemory ();
232+ }
233+ else
234+ {
235+ ANGLE_TRY (contextVk->syncExternalMemory ());
236+ }
197237 }
198238
199239 return contextVk->flushImpl (&mSemaphore );
0 commit comments