Showing the changes to tests/gpu/src/TextureTest.cpp (1 of 2 files). Show all
Unified · Split
| @@ -38,11 +38,11 @@ std::string vertexShaderSource = R"SHADER( · 37 unmodified lines | |||
| 38 | layout(location = 0) out vec2 outTexCoord0; | 38 | layout(location = 0) out vec2 outTexCoord0; |
| 39 | 39 | ||
| 40 | const vec4 VERTICES[] = vec4[]( | 40 | const vec4 VERTICES[] = vec4[]( |
| 41 | vec4(-1.0, -1.0, 0.0, 1.0), | 41 | vec4(-1.0, -1.0, 0.0, 1.0), |
| 42 | vec4( 1.0, -1.0, 0.0, 1.0), | 42 | vec4( 1.0, -1.0, 0.0, 1.0), |
| 43 | vec4(-1.0, 1.0, 0.0, 1.0), | 43 | vec4(-1.0, 1.0, 0.0, 1.0), |
| 44 | vec4( 1.0, 1.0, 0.0, 1.0) | 44 | vec4( 1.0, 1.0, 0.0, 1.0) |
| 45 | ); | 45 | ); |
| 46 | 46 | ||
| 47 | void main() { | 47 | void main() { |
| 48 | outTexCoord0 = VERTICES[gl_VertexID].xy; | 48 | outTexCoord0 = VERTICES[gl_VertexID].xy; |
| @@ -110,8 +110,8 @@ void TextureTest::initTestCase() { · 61 unmodified lines | |||
| 110 | 110 | ||
| 111 | _canvas.makeCurrent(); | 111 | _canvas.makeCurrent(); |
| 112 | { | 112 | { |
| 113 | auto VS = gpu::Shader::createVertex(vertexShaderSource); | 113 | auto VS = gpu::Shader::createVertex(shader::Source::generate(vertexShaderSource)); |
| 114 | auto PS = gpu::Shader::createPixel(fragmentShaderSource); | 114 | auto PS = gpu::Shader::createPixel(shader::Source::generate(fragmentShaderSource)); |
| 115 | auto program = gpu::Shader::createProgram(VS, PS); | 115 | auto program = gpu::Shader::createProgram(VS, PS); |
| 116 | // If the pipeline did not exist, make it | 116 | // If the pipeline did not exist, make it |
| 117 | auto state = std::make_shared<gpu::State>(); | 117 | auto state = std::make_shared<gpu::State>(); |
| @@ -144,9 +144,9 @@ void TextureTest::cleanupTestCase() { · 26 unmodified lines | |||
| 144 | _gpuContext.reset(); | 144 | _gpuContext.reset(); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | std::vector<gpu::TexturePointer> TextureTest::loadTestTextures() const { | 147 | std::vector<std::pair<gpu::TexturePointer, glm::ivec2>> TextureTest::loadTestTextures() const { |
| 148 | // Load the test textures | 148 | // Load the test textures |
| 149 | std::vector<gpu::TexturePointer> result; | 149 | std::vector<std::pair<gpu::TexturePointer, glm::ivec2>> result; |
| 150 | size_t newTextureCount = std::min<size_t>(_textureFiles.size(), LOAD_TEXTURE_COUNT); | 150 | size_t newTextureCount = std::min<size_t>(_textureFiles.size(), LOAD_TEXTURE_COUNT); |
| 151 | for (size_t i = 0; i < newTextureCount; ++i) { | 151 | for (size_t i = 0; i < newTextureCount; ++i) { |
| 152 | const auto& textureFile = _textureFiles[i]; | 152 | const auto& textureFile = _textureFiles[i]; |
| @@ -193,14 +193,14 @@ void TextureTest::testTextureLoading() { · 40 unmodified lines | |||
| 193 | auto renderTexturesLamdba = [&](gpu::Batch& batch) { | 193 | auto renderTexturesLamdba = [&](gpu::Batch& batch) { |
| 194 | batch.setPipeline(_pipeline); | 194 | batch.setPipeline(_pipeline); |
| 195 | for (const auto& texture : textures) { | 195 | for (const auto& texture : textures) { |
| 196 | batch.setResourceTexture(0, texture); | 196 | batch.setResourceTexture(0, texture.first); |
| 197 | batch.draw(gpu::TRIANGLE_STRIP, 4, 0); | 197 | batch.draw(gpu::TRIANGLE_STRIP, 4, 0); |
| 198 | } | 198 | } |
| 199 | }; | 199 | }; |
| 200 | 200 | ||
| 201 | size_t expectedAllocation = 0; | 201 | size_t expectedAllocation = 0; |
| 202 | for (const auto& texture : textures) { | 202 | for (const auto& texture : textures) { |
| 203 | expectedAllocation += texture->evalTotalSize(); | 203 | expectedAllocation += texture.first->evalTotalSize(); |
| 204 | } | 204 | } |
| 205 | QVERIFY(textures.size() > 0); | 205 | QVERIFY(textures.size() > 0); |
| 206 | 206 | ||