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

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

Issue 2061743004: Implement native GMB backbuffers in the GLES2 Command Decoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from piman. Created 4 years, 5 months 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "gpu/command_buffer/tests/texture_image_factory.h"
6
7 #include "ui/gl/gl_bindings.h"
8 #include "ui/gl/gl_image.h"
9
10 namespace gpu {
11
12 // An image that allocates storage for the texture using glTexImage2D.
13 class TextureImage : public gl::GLImage {
14 public:
15 explicit TextureImage(const gfx::Size& size) : size_(size) {}
16
17 void Destroy(bool have_context) override {}
18 gfx::Size GetSize() override { return size_; }
19 unsigned GetInternalFormat() override { return GL_RGBA; }
20 bool BindTexImage(unsigned target) override {
21 glTexImage2D(target,
22 0, // mip level
23 GetInternalFormat(), size_.width(), size_.height(),
24 0, // border
25 GetInternalFormat(), GL_UNSIGNED_BYTE, nullptr);
26 return true;
27 }
28 void ReleaseTexImage(unsigned target) override {}
29 bool CopyTexImage(unsigned target) override { return false; }
30 bool CopyTexSubImage(unsigned target,
31 const gfx::Point& offset,
32 const gfx::Rect& rect) override {
33 return false;
34 }
35
36 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
37 int z_order,
38 gfx::OverlayTransform transform,
39 const gfx::Rect& bounds_rect,
40 const gfx::RectF& crop_rect) override {
41 return false;
42 }
43
44 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
45 uint64_t process_tracing_id,
46 const std::string& dump_name) override {}
47
48 private:
49 ~TextureImage() override {}
50 gfx::Size size_;
51 };
52
53 scoped_refptr<gl::GLImage> TextureImageFactory::CreateImageForGpuMemoryBuffer(
54 const gfx::GpuMemoryBufferHandle& handle,
55 const gfx::Size& size,
56 gfx::BufferFormat format,
57 unsigned internalformat,
58 int client_id) {
59 return nullptr;
60 }
61
62 scoped_refptr<gl::GLImage> TextureImageFactory::CreateAnonymousImage(
63 const gfx::Size& size,
64 gfx::BufferFormat format,
65 unsigned internalformat) {
66 return new TextureImage(size);
67 }
68
69 unsigned TextureImageFactory::RequiredTextureType() {
70 return required_texture_type_;
71 }
72
73 bool TextureImageFactory::SupportsFormatRGB() {
74 return false;
75 }
76
77 void TextureImageFactory::SetRequiredTextureType(unsigned type) {
78 required_texture_type_ = type;
79 }
80
81 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/texture_image_factory.h ('k') | gpu/gles2_conform_support/egl/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698