@@ -82,12 +82,6 @@ struct OpenGLESGraphicsPlugin : public IGraphicsPlugin {
8282 glDeleteBuffers (1 , &m_cubeIndexBuffer);
8383 }
8484
85- for (auto & colorToDepth : m_colorToDepthMap) {
86- if (colorToDepth.second != 0 ) {
87- glDeleteTextures (1 , &colorToDepth.second );
88- }
89- }
90-
9185 ksGpuWindow_Destroy (&window);
9286 }
9387
@@ -341,35 +335,6 @@ struct OpenGLESGraphicsPlugin : public IGraphicsPlugin {
341335 return ret;
342336 }
343337
344- uint32_t GetDepthTexture (uint32_t colorTexture) {
345- // If a depth-stencil view has already been created for this back-buffer, use it.
346- auto depthBufferIt = m_colorToDepthMap.find (colorTexture);
347- if (depthBufferIt != m_colorToDepthMap.end ()) {
348- return depthBufferIt->second ;
349- }
350-
351- // This back-buffer has no corresponding depth-stencil texture, so create one with matching dimensions.
352-
353- GLint width;
354- GLint height;
355- glBindTexture (GL_TEXTURE_2D, colorTexture);
356- glGetTexLevelParameteriv (GL_TEXTURE_2D, 0 , GL_TEXTURE_WIDTH, &width);
357- glGetTexLevelParameteriv (GL_TEXTURE_2D, 0 , GL_TEXTURE_HEIGHT, &height);
358-
359- uint32_t depthTexture;
360- glGenTextures (1 , &depthTexture);
361- glBindTexture (GL_TEXTURE_2D, depthTexture);
362- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
363- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
364- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
365- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
366- glTexImage2D (GL_TEXTURE_2D, 0 , GL_DEPTH_COMPONENT24, width, height, 0 , GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr );
367-
368- m_colorToDepthMap.insert (std::make_pair (colorTexture, depthTexture));
369-
370- return depthTexture;
371- }
372-
373338 void RenderView (const XrCompositionLayerProjectionView& layerView, const XrSwapchainImageBaseHeader* swapchainImage,
374339 int64_t swapchainFormat, const std::vector<Cube>& cubes) override {
375340 CHECK (layerView.subImage .imageArrayIndex == 0 ); // Texture arrays not supported.
@@ -455,9 +420,6 @@ struct OpenGLESGraphicsPlugin : public IGraphicsPlugin {
455420 GLuint m_cubeVertexBuffer{0 };
456421 GLuint m_cubeIndexBuffer{0 };
457422 GLint m_contextApiMajorVersion{0 };
458-
459- // Map color buffer to associated depth buffer. This map is populated on demand.
460- std::map<uint32_t , uint32_t > m_colorToDepthMap;
461423 std::array<float , 4 > m_clearColor;
462424};
463425} // namespace
0 commit comments