Skip to content

Commit 2a24f3b

Browse files
emaschinorpavlik
authored andcommitted
[hello_xr] Delete dead code.
1 parent 2b9c0bb commit 2a24f3b

4 files changed

Lines changed: 0 additions & 84 deletions

File tree

src/tests/hello_xr/graphicsplugin_d3d11.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,6 @@ struct D3D11GraphicsPlugin : public IGraphicsPlugin {
352352
ComPtr<ID3D11Buffer> m_viewProjectionCBuffer;
353353
ComPtr<ID3D11Buffer> m_cubeVertexBuffer;
354354
ComPtr<ID3D11Buffer> m_cubeIndexBuffer;
355-
356-
// Map color buffer to associated depth buffer. This map is populated on demand.
357-
std::map<ID3D11Texture2D*, ComPtr<ID3D11DepthStencilView>> m_colorToDepthMap;
358355
std::array<float, 4> m_clearColor;
359356
};
360357
} // namespace

src/tests/hello_xr/graphicsplugin_d3d12.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@ class SwapchainImageContext {
9494
return bases;
9595
}
9696

97-
uint32_t ImageIndex(const XrSwapchainImageBaseHeader* swapchainImageHeader) {
98-
auto p = reinterpret_cast<const XrSwapchainImageD3D12KHR*>(swapchainImageHeader);
99-
return (uint32_t)(p - &m_swapchainImages[0]);
100-
}
101-
10297
ID3D12Resource* GetDepthStencilTexture(ID3D12Resource* colorTexture) {
10398
if (!m_depthStencilTexture) {
10499
// This back-buffer has no corresponding depth-stencil texture, so create one with matching dimensions.

src/tests/hello_xr/graphicsplugin_opengl.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,6 @@ struct OpenGLGraphicsPlugin : public IGraphicsPlugin {
116116
glDeleteBuffers(1, &m_cubeIndexBuffer);
117117
}
118118

119-
for (auto& colorToDepth : m_colorToDepthMap) {
120-
if (colorToDepth.second != 0) {
121-
glDeleteTextures(1, &colorToDepth.second);
122-
}
123-
}
124-
125119
ksGpuWindow_Destroy(&window);
126120
}
127121

@@ -412,35 +406,6 @@ struct OpenGLGraphicsPlugin : public IGraphicsPlugin {
412406
return ret;
413407
}
414408

415-
uint32_t GetDepthTexture(uint32_t colorTexture) {
416-
// If a depth-stencil view has already been created for this back-buffer, use it.
417-
auto depthBufferIt = m_colorToDepthMap.find(colorTexture);
418-
if (depthBufferIt != m_colorToDepthMap.end()) {
419-
return depthBufferIt->second;
420-
}
421-
422-
// This back-buffer has no corresponding depth-stencil texture, so create one with matching dimensions.
423-
424-
GLint width;
425-
GLint height;
426-
glBindTexture(GL_TEXTURE_2D, colorTexture);
427-
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
428-
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height);
429-
430-
uint32_t depthTexture;
431-
glGenTextures(1, &depthTexture);
432-
glBindTexture(GL_TEXTURE_2D, depthTexture);
433-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
434-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
435-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
436-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
437-
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, nullptr);
438-
439-
m_colorToDepthMap.insert(std::make_pair(colorTexture, depthTexture));
440-
441-
return depthTexture;
442-
}
443-
444409
void RenderView(const XrCompositionLayerProjectionView& layerView, const XrSwapchainImageBaseHeader* swapchainImage,
445410
int64_t swapchainFormat, const std::vector<Cube>& cubes) override {
446411
CHECK(layerView.subImage.imageArrayIndex == 0); // Texture arrays not supported.
@@ -535,9 +500,6 @@ struct OpenGLGraphicsPlugin : public IGraphicsPlugin {
535500
GLuint m_vao{0};
536501
GLuint m_cubeVertexBuffer{0};
537502
GLuint m_cubeIndexBuffer{0};
538-
539-
// Map color buffer to associated depth buffer. This map is populated on demand.
540-
std::map<uint32_t, uint32_t> m_colorToDepthMap;
541503
std::array<float, 4> m_clearColor;
542504
};
543505
} // namespace

src/tests/hello_xr/graphicsplugin_opengles.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)