Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: gpu/command_buffer/tests/texture_image_factory.cc

Issue 2388653002: gpu: Add CHROMIUM_texture_from_image spec and fence support.
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/tests/texture_image_factory.h" 5 #include "gpu/command_buffer/tests/texture_image_factory.h"
6 6
7 #include "ui/gl/gl_bindings.h" 7 #include "ui/gl/gl_bindings.h"
8 #include "ui/gl/gl_image.h" 8 #include "ui/gl/gl_image.h"
9 9
10 namespace gpu { 10 namespace gpu {
11 11
12 // An image that allocates storage for the texture using glTexImage2D. 12 // An image that allocates storage for the texture using glTexImage2D.
13 class TextureImage : public gl::GLImage { 13 class TextureImage : public gl::GLImage {
14 public: 14 public:
15 explicit TextureImage(const gfx::Size& size) : size_(size) {} 15 explicit TextureImage(const gfx::Size& size) : size_(size) {}
16 16
17 gfx::Size GetSize() override { return size_; } 17 gfx::Size GetSize() override { return size_; }
18 unsigned GetInternalFormat() override { return GL_RGBA; } 18 unsigned GetInternalFormat() override { return GL_RGBA; }
19 bool BindTexImage(unsigned target) override { 19 bool BindTexImage(unsigned target, gl::GLFence* fence) override {
20 glTexImage2D(target, 20 glTexImage2D(target,
21 0, // mip level 21 0, // mip level
22 GetInternalFormat(), size_.width(), size_.height(), 22 GetInternalFormat(), size_.width(), size_.height(),
23 0, // border 23 0, // border
24 GetInternalFormat(), GL_UNSIGNED_BYTE, nullptr); 24 GetInternalFormat(), GL_UNSIGNED_BYTE, nullptr);
25 return true; 25 return true;
26 } 26 }
27 void ReleaseTexImage(unsigned target) override {} 27 void ReleaseTexImage(unsigned target) override {}
28 bool CopyTexImage(unsigned target) override { return false; } 28 bool CopyTexImage(unsigned target) override { return false; }
29 bool CopyTexSubImage(unsigned target, 29 bool CopyTexSubImage(unsigned target,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 bool TextureImageFactory::SupportsFormatRGB() { 75 bool TextureImageFactory::SupportsFormatRGB() {
76 return false; 76 return false;
77 } 77 }
78 78
79 void TextureImageFactory::SetRequiredTextureType(unsigned type) { 79 void TextureImageFactory::SetRequiredTextureType(unsigned type) {
80 required_texture_type_ = type; 80 required_texture_type_ = type;
81 } 81 }
82 82
83 } // namespace gpu 83 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc ('k') | media/gpu/vaapi_drm_picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698