Skip to content

Commit 4c7aea2

Browse files
generatedunixname89002005287564facebook-github-bot
authored andcommitted
fbsource//xplat/graphics/igl/public/src/igl[batch#3] [A]
Reviewed By: boguscoder Differential Revision: D75786213 fbshipit-source-id: 44abe2d9553d0c65b86ee33f1af5a68960b7d2f8
1 parent 451e002 commit 4c7aea2

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

src/igl/tests/iglu/texture_loader/BaseTextureLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TestTextureLoader : public iglu::textureloader::ITextureLoader {
1818
public:
1919
TestTextureLoader(iglu::textureloader::DataReader reader,
2020
TextureDesc::TextureUsage usage) noexcept :
21-
iglu::textureloader::ITextureLoader(std::move(reader), usage) {}
21+
iglu::textureloader::ITextureLoader(reader, usage) {}
2222

2323
TextureDesc& descriptorRef() noexcept {
2424
return mutableDescriptor();

src/igl/tests/ogl/TextureTarget.cpp

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ class TextureTargetOGLTest : public ::testing::Test {
4343
// Turn off debug breaks, only use in debug mode
4444
igl::setDebugBreakEnabled(false);
4545

46-
device = util::createTestDevice();
47-
ASSERT_TRUE(device != nullptr);
48-
context = &static_cast<opengl::Device&>(*device).getContext();
49-
ASSERT_TRUE(context != nullptr);
46+
device_ = util::createTestDevice();
47+
ASSERT_TRUE(device_ != nullptr);
48+
context_ = &static_cast<opengl::Device&>(*device_).getContext();
49+
ASSERT_TRUE(context_ != nullptr);
5050
}
5151

5252
void TearDown() override {}
5353

5454
// Member variables
5555
protected:
56-
opengl::IContext* context{};
57-
std::shared_ptr<IDevice> device;
56+
opengl::IContext* context_{};
57+
std::shared_ptr<IDevice> device_;
5858
};
5959

6060
//
@@ -64,7 +64,7 @@ class TextureTargetOGLTest : public ::testing::Test {
6464
//
6565
TEST_F(TextureTargetOGLTest, Specifications) {
6666
std::unique_ptr<igl::opengl::TextureTarget> textureTarget =
67-
std::make_unique<igl::opengl::TextureTarget>(*context, TextureFormat::RGBA_UNorm8);
67+
std::make_unique<igl::opengl::TextureTarget>(*context_, TextureFormat::RGBA_UNorm8);
6868
ASSERT_EQ(textureTarget->getType(), TextureType::TwoD);
6969
ASSERT_EQ(textureTarget->getUsage(), TextureDesc::TextureUsageBits::Attachment);
7070
}
@@ -86,27 +86,27 @@ TEST_F(TextureTargetOGLTest, TextureCreation) {
8686
TextureDesc::TextureUsageBits::Sampled);
8787

8888
// kShaderRead not supported by TextureTarget
89-
textureTarget = std::make_unique<igl::opengl::TextureTarget>(*context, texDesc.format);
89+
textureTarget = std::make_unique<igl::opengl::TextureTarget>(*context_, texDesc.format);
9090
ret = textureTarget->create(texDesc, false);
9191
ASSERT_EQ(ret.code, Result::Code::Unsupported);
9292

9393
texDesc.usage = TextureDesc::TextureUsageBits::Attachment;
9494

9595
// TextureTarget only supports TwoD
96-
textureTarget = std::make_unique<igl::opengl::TextureTarget>(*context, texDesc.format);
96+
textureTarget = std::make_unique<igl::opengl::TextureTarget>(*context_, texDesc.format);
9797
texDesc.type = TextureType::ThreeD;
9898
ret = textureTarget->create(texDesc, false);
9999
ASSERT_EQ(ret.code, Result::Code::Unsupported);
100100

101101
// TextureTarget only supports a single mip level
102-
textureTarget = std::make_unique<igl::opengl::TextureTarget>(*context, texDesc.format);
102+
textureTarget = std::make_unique<igl::opengl::TextureTarget>(*context_, texDesc.format);
103103
texDesc.type = TextureType::TwoD;
104104
texDesc.numMipLevels = 2;
105105
ret = textureTarget->create(texDesc, false);
106106
ASSERT_EQ(ret.code, Result::Code::Unsupported);
107107

108108
// TextureTarget only supports a layer
109-
textureTarget = std::make_unique<igl::opengl::TextureTarget>(*context, texDesc.format);
109+
textureTarget = std::make_unique<igl::opengl::TextureTarget>(*context_, texDesc.format);
110110
texDesc.type = TextureType::TwoD;
111111
texDesc.numMipLevels = 1;
112112
texDesc.numLayers = 2;
@@ -115,15 +115,15 @@ TEST_F(TextureTargetOGLTest, TextureCreation) {
115115

116116
// Unsupported texture format
117117
texDesc.format = TextureFormat::Invalid;
118-
textureTarget = std::make_unique<igl::opengl::TextureTarget>(*context, texDesc.format);
118+
textureTarget = std::make_unique<igl::opengl::TextureTarget>(*context_, texDesc.format);
119119
texDesc.numLayers = 1;
120120
ret = textureTarget->create(texDesc, false);
121121
ASSERT_EQ(ret.code, Result::Code::ArgumentInvalid);
122122

123123
// Correct usage of TextureTarget::create with > 1 samples
124124
texDesc.format = TextureFormat::RGBA_UNorm8;
125125
texDesc.numSamples = 2;
126-
textureTarget = std::make_unique<igl::opengl::TextureTarget>(*context, texDesc.format);
126+
textureTarget = std::make_unique<igl::opengl::TextureTarget>(*context_, texDesc.format);
127127
ret = textureTarget->create(texDesc, false);
128128
ASSERT_EQ(ret.code, Result::Code::Ok);
129129
}
@@ -147,9 +147,9 @@ TEST_F(TextureTargetOGLTest, TextureBindAndAttachAndDetach) {
147147
TextureDesc::TextureUsageBits::Attachment);
148148

149149
// Create 3 types of targets
150-
auto colorTarget = std::make_unique<igl::opengl::TextureTarget>(*context, texDesc.format);
151-
auto depthTarget = std::make_unique<igl::opengl::TextureTarget>(*context, texDesc.format);
152-
auto stencilTarget = std::make_unique<igl::opengl::TextureTarget>(*context, texDesc.format);
150+
auto colorTarget = std::make_unique<igl::opengl::TextureTarget>(*context_, texDesc.format);
151+
auto depthTarget = std::make_unique<igl::opengl::TextureTarget>(*context_, texDesc.format);
152+
auto stencilTarget = std::make_unique<igl::opengl::TextureTarget>(*context_, texDesc.format);
153153

154154
// calling create() so that renderBufferID_ is set
155155
ret = colorTarget->create(texDesc, false);
@@ -165,21 +165,21 @@ TEST_F(TextureTargetOGLTest, TextureBindAndAttachAndDetach) {
165165
// depth and stencil, we have to create a new framebuffer before trying
166166
// to attach our renderbuffers
167167
GLuint tmpFb = 0;
168-
context->genFramebuffers(1, &tmpFb);
169-
context->bindFramebuffer(GL_FRAMEBUFFER, tmpFb);
168+
context_->genFramebuffers(1, &tmpFb);
169+
context_->bindFramebuffer(GL_FRAMEBUFFER, tmpFb);
170170

171171
//--------------------------------------------------------------------------
172172
// Test Renderbuffer as Color
173173
//--------------------------------------------------------------------------
174174
GLint colorType = -1, colorRid = -1;
175175

176176
colorTarget->attachAsColor(0, opengl::Texture::AttachmentParams{});
177-
context->getFramebufferAttachmentParameteriv(
177+
context_->getFramebufferAttachmentParameteriv(
178178
GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &colorType);
179179
// Check here that colorType is GL_RENDERBUFFER
180180
ASSERT_EQ(colorType, GL_RENDERBUFFER);
181181

182-
context->getFramebufferAttachmentParameteriv(
182+
context_->getFramebufferAttachmentParameteriv(
183183
GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &colorRid);
184184
// Check here that colorRid is anything other than -1
185185
ASSERT_NE(colorRid, -1);
@@ -193,12 +193,12 @@ TEST_F(TextureTargetOGLTest, TextureBindAndAttachAndDetach) {
193193
GLint depthType = -1, depthRid = -1;
194194

195195
depthTarget->attachAsDepth(opengl::Texture::AttachmentParams{});
196-
context->getFramebufferAttachmentParameteriv(
196+
context_->getFramebufferAttachmentParameteriv(
197197
GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &depthType);
198198
// Check here that depthType is GL_RENDERBUFFER
199199
ASSERT_EQ(depthType, GL_RENDERBUFFER);
200200

201-
context->getFramebufferAttachmentParameteriv(
201+
context_->getFramebufferAttachmentParameteriv(
202202
GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &depthRid);
203203
// Check here that depthRid != -1 and depthRid != colorRid
204204
ASSERT_NE(depthRid, -1);
@@ -210,12 +210,12 @@ TEST_F(TextureTargetOGLTest, TextureBindAndAttachAndDetach) {
210210
GLint stencilType = -1, stencilRid = -1;
211211

212212
stencilTarget->attachAsStencil(opengl::Texture::AttachmentParams{});
213-
context->getFramebufferAttachmentParameteriv(
213+
context_->getFramebufferAttachmentParameteriv(
214214
GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &stencilType);
215215
// Check here that stencilType is GL_RENDERBUFFER
216216
ASSERT_EQ(stencilType, GL_RENDERBUFFER);
217217

218-
context->getFramebufferAttachmentParameteriv(
218+
context_->getFramebufferAttachmentParameteriv(
219219
GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &stencilRid);
220220
// Check here that stencilRid != -1 and stencilRid != colorRid and stencilRid != depthRid
221221
ASSERT_NE(stencilRid, -1);
@@ -229,32 +229,32 @@ TEST_F(TextureTargetOGLTest, TextureBindAndAttachAndDetach) {
229229

230230
colorTarget->bind();
231231
// Get renderBuffer binding and check it is non-zero
232-
context->getIntegerv(GL_RENDERBUFFER_BINDING, &value);
232+
context_->getIntegerv(GL_RENDERBUFFER_BINDING, &value);
233233
ASSERT_NE(value, GL_ZERO);
234234

235235
colorTarget->unbind();
236236
// Get renderBuffer binding and check it is zero
237-
context->getIntegerv(GL_RENDERBUFFER_BINDING, &value);
237+
context_->getIntegerv(GL_RENDERBUFFER_BINDING, &value);
238238
ASSERT_EQ(value, GL_ZERO);
239239

240240
depthTarget->bind();
241241
// Get renderBuffer binding and check it is non-zero
242-
context->getIntegerv(GL_RENDERBUFFER_BINDING, &value);
242+
context_->getIntegerv(GL_RENDERBUFFER_BINDING, &value);
243243
ASSERT_NE(value, GL_ZERO);
244244

245245
depthTarget->unbind();
246246
// Get renderBuffer binding and check it is zero
247-
context->getIntegerv(GL_RENDERBUFFER_BINDING, &value);
247+
context_->getIntegerv(GL_RENDERBUFFER_BINDING, &value);
248248
ASSERT_EQ(value, GL_ZERO);
249249

250250
stencilTarget->bind();
251251
// Get renderBuffer binding and check it is non-zero
252-
context->getIntegerv(GL_RENDERBUFFER_BINDING, &value);
252+
context_->getIntegerv(GL_RENDERBUFFER_BINDING, &value);
253253
ASSERT_NE(value, GL_ZERO);
254254

255255
stencilTarget->unbind();
256256
// Get renderBuffer binding and check it is zero
257-
context->getIntegerv(GL_RENDERBUFFER_BINDING, &value);
257+
context_->getIntegerv(GL_RENDERBUFFER_BINDING, &value);
258258
ASSERT_EQ(value, GL_ZERO);
259259
}
260260

@@ -268,7 +268,7 @@ TEST_F(TextureTargetOGLTest, CreateWithDebugName) {
268268
texDesc.debugName = "test";
269269

270270
// Create 3 types of targets
271-
auto target = std::make_unique<igl::opengl::TextureTarget>(*context, texDesc.format);
271+
auto target = std::make_unique<igl::opengl::TextureTarget>(*context_, texDesc.format);
272272

273273
// calling create() so that renderBufferID_ is set
274274
ret = target->create(texDesc, false);

0 commit comments

Comments
 (0)