@@ -34,7 +34,8 @@ namespace
34
34
const gl::InternalFormat &GetReadAttachmentInfo (const gl::Context *context,
35
35
RenderTargetVk *renderTarget)
36
36
{
37
- GLenum implFormat = renderTarget->format ->textureFormat ().fboImplementationInternalFormat ;
37
+ GLenum implFormat =
38
+ renderTarget->image ->getFormat ().textureFormat ().fboImplementationInternalFormat ;
38
39
return gl::GetSizedInternalFormatInfo (implFormat);
39
40
}
40
41
} // anonymous namespace
@@ -149,11 +150,11 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
149
150
150
151
RenderTargetVk *renderTarget = mRenderTargetCache .getDepthStencil ();
151
152
renderTarget->resource ->onWriteResource (writingNode, currentSerial);
152
- renderTarget->image ->changeLayoutWithStages (
153
+ renderTarget->image ->getImage (). changeLayoutWithStages (
153
154
aspectFlags, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
154
155
VK_PIPELINE_STAGE_TRANSFER_BIT, commandBuffer);
155
156
156
- commandBuffer->clearSingleDepthStencilImage (* renderTarget->image , aspectFlags,
157
+ commandBuffer->clearSingleDepthStencilImage (renderTarget->image -> getImage () , aspectFlags,
157
158
clearDepthStencilValue);
158
159
159
160
if ((mask & GL_COLOR_BUFFER_BIT) == 0 )
@@ -188,11 +189,11 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
188
189
ASSERT (colorRenderTarget);
189
190
colorRenderTarget->resource ->onWriteResource (writingNode, currentSerial);
190
191
191
- colorRenderTarget->image ->changeLayoutWithStages (
192
+ colorRenderTarget->image ->getImage (). changeLayoutWithStages (
192
193
VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
193
194
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, commandBuffer);
194
195
195
- commandBuffer->clearSingleColorImage (* colorRenderTarget->image ,
196
+ commandBuffer->clearSingleColorImage (colorRenderTarget->image -> getImage () ,
196
197
contextVk->getClearColorValue ().color );
197
198
}
198
199
@@ -260,10 +261,10 @@ gl::Error FramebufferVk::readPixels(const gl::Context *context,
260
261
RenderTargetVk *renderTarget = mRenderTargetCache .getColorRead (mState );
261
262
ASSERT (renderTarget);
262
263
263
- vk::Image * readImage = renderTarget->image ;
264
+ vk::Image & readImage = renderTarget->image -> getImage () ;
264
265
vk::ImageHelper stagingImage;
265
266
ANGLE_TRY (stagingImage.init2DStaging (
266
- device, renderer->getMemoryProperties (), * renderTarget->format ,
267
+ device, renderer->getMemoryProperties (), renderTarget->image -> getFormat () ,
267
268
gl::Extents (area.width , area.height , 1 ), vk::StagingUsage::Read));
268
269
269
270
vk::CommandBuffer *commandBuffer = nullptr ;
@@ -272,7 +273,7 @@ gl::Error FramebufferVk::readPixels(const gl::Context *context,
272
273
stagingImage.getImage ().changeLayoutTop (VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_GENERAL,
273
274
commandBuffer);
274
275
275
- readImage-> changeLayoutWithStages (
276
+ readImage. changeLayoutWithStages (
276
277
VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
277
278
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, commandBuffer);
278
279
@@ -295,7 +296,7 @@ gl::Error FramebufferVk::readPixels(const gl::Context *context,
295
296
region.extent .height = area.height ;
296
297
region.extent .depth = 1 ;
297
298
298
- commandBuffer->copyImage (* readImage, stagingImage.getImage (), 1 , ®ion);
299
+ commandBuffer->copyImage (readImage, stagingImage.getImage (), 1 , ®ion);
299
300
300
301
// Triggers a full finish.
301
302
// TODO(jmadill): Don't block on asynchronous readback.
@@ -306,7 +307,7 @@ gl::Error FramebufferVk::readPixels(const gl::Context *context,
306
307
ANGLE_TRY (stagingImage.getDeviceMemory ().map (device, 0 , stagingImage.getAllocatedMemorySize (),
307
308
0 , &mapPointer));
308
309
309
- const angle::Format &angleFormat = renderTarget->format -> textureFormat ();
310
+ const angle::Format &angleFormat = renderTarget->image -> getFormat (). textureFormat ();
310
311
311
312
// TODO(jmadill): Use pixel bytes from the ANGLE format directly.
312
313
const auto &glFormat = gl::GetSizedInternalFormatInfo (angleFormat.glInternalFormat );
@@ -384,14 +385,13 @@ const vk::RenderPassDesc &FramebufferVk::getRenderPassDesc(const gl::Context *co
384
385
{
385
386
RenderTargetVk *colorRenderTarget = colorRenderTargets[colorIndex];
386
387
ASSERT (colorRenderTarget);
387
- desc.packColorAttachment (*colorRenderTarget->format , colorRenderTarget-> samples );
388
+ desc.packColorAttachment (*colorRenderTarget->image );
388
389
}
389
390
390
391
RenderTargetVk *depthStencilRenderTarget = mRenderTargetCache .getDepthStencil ();
391
392
if (depthStencilRenderTarget)
392
393
{
393
- desc.packDepthStencilAttachment (*depthStencilRenderTarget->format ,
394
- depthStencilRenderTarget->samples );
394
+ desc.packDepthStencilAttachment (*depthStencilRenderTarget->image );
395
395
}
396
396
397
397
mRenderPassDesc = desc;
@@ -431,17 +431,19 @@ gl::ErrorOrResult<vk::Framebuffer *> FramebufferVk::getFramebuffer(const gl::Con
431
431
ASSERT (colorRenderTarget);
432
432
attachments.push_back (colorRenderTarget->imageView ->getHandle ());
433
433
434
- ASSERT (attachmentsSize.empty () || attachmentsSize == colorRenderTarget->extents );
435
- attachmentsSize = colorRenderTarget->extents ;
434
+ ASSERT (attachmentsSize.empty () ||
435
+ attachmentsSize == colorRenderTarget->image ->getExtents ());
436
+ attachmentsSize = colorRenderTarget->image ->getExtents ();
436
437
}
437
438
438
439
RenderTargetVk *depthStencilRenderTarget = mRenderTargetCache .getDepthStencil ();
439
440
if (depthStencilRenderTarget)
440
441
{
441
442
attachments.push_back (depthStencilRenderTarget->imageView ->getHandle ());
442
443
443
- ASSERT (attachmentsSize.empty () || attachmentsSize == depthStencilRenderTarget->extents );
444
- attachmentsSize = depthStencilRenderTarget->extents ;
444
+ ASSERT (attachmentsSize.empty () ||
445
+ attachmentsSize == depthStencilRenderTarget->image ->getExtents ());
446
+ attachmentsSize = depthStencilRenderTarget->image ->getExtents ();
445
447
}
446
448
447
449
ASSERT (!attachments.empty ());
@@ -547,7 +549,7 @@ gl::Error FramebufferVk::getCommandGraphNodeForDraw(const gl::Context *context,
547
549
ASSERT (colorRenderTarget);
548
550
549
551
// TODO(jmadill): Use automatic layout transition. http://anglebug.com/2361
550
- colorRenderTarget->image ->changeLayoutWithStages (
552
+ colorRenderTarget->image ->getImage (). changeLayoutWithStages (
551
553
VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
552
554
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
553
555
commandBuffer);
@@ -559,11 +561,11 @@ gl::Error FramebufferVk::getCommandGraphNodeForDraw(const gl::Context *context,
559
561
if (depthStencilRenderTarget)
560
562
{
561
563
// TODO(jmadill): Use automatic layout transition. http://anglebug.com/2361
562
- const angle::Format &format = depthStencilRenderTarget->format -> textureFormat ();
564
+ const angle::Format &format = depthStencilRenderTarget->image -> getFormat (). textureFormat ();
563
565
VkImageAspectFlags aspectFlags = (format.depthBits > 0 ? VK_IMAGE_ASPECT_DEPTH_BIT : 0 ) |
564
566
(format.stencilBits > 0 ? VK_IMAGE_ASPECT_STENCIL_BIT : 0 );
565
567
566
- depthStencilRenderTarget->image ->changeLayoutWithStages (
568
+ depthStencilRenderTarget->image ->getImage (). changeLayoutWithStages (
567
569
aspectFlags, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
568
570
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT,
569
571
commandBuffer);
0 commit comments