Skip to content

Commit 3b8f38a

Browse files
emaschinorpavlik
authored andcommitted
[hello_xr] Fix OpenGL ES plugin to work with depth layer submission code introduced in commit 58e026e.
1 parent c75b087 commit 3b8f38a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/tests/hello_xr/graphicsplugin_opengles.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,14 @@ struct OpenGLESGraphicsPlugin : public IGraphicsPlugin {
375375
CHECK(layerView.subImage.imageArrayIndex == 0); // Texture arrays not supported.
376376
UNUSED_PARM(swapchainFormat); // Not used in this function for now.
377377

378+
OpenGLESSwapchainImageData* swapchainData;
379+
uint32_t imageIndex;
380+
std::tie(swapchainData, imageIndex) = m_swapchainImageDataMap.GetDataAndIndexFromBasePointer(swapchainImage);
381+
378382
glBindFramebuffer(GL_FRAMEBUFFER, m_swapchainFramebuffer);
379383

380384
const uint32_t colorTexture = reinterpret_cast<const XrSwapchainImageOpenGLESKHR*>(swapchainImage)->image;
385+
const uint32_t depthTexture = swapchainData->GetDepthImageForColorIndex(imageIndex).image;
381386

382387
glViewport(static_cast<GLint>(layerView.subImage.imageRect.offset.x),
383388
static_cast<GLint>(layerView.subImage.imageRect.offset.y),
@@ -389,8 +394,6 @@ struct OpenGLESGraphicsPlugin : public IGraphicsPlugin {
389394
glEnable(GL_CULL_FACE);
390395
glEnable(GL_DEPTH_TEST);
391396

392-
const uint32_t depthTexture = GetDepthTexture(colorTexture);
393-
394397
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTexture, 0);
395398
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTexture, 0);
396399

0 commit comments

Comments
 (0)