texture_image_factory.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #ifndef GPU_COMMAND_BUFFER_TESTS_TEXTURE_IMAGE_FACTORY_H_
  5. #define GPU_COMMAND_BUFFER_TESTS_TEXTURE_IMAGE_FACTORY_H_
  6. #include "gpu/command_buffer/service/image_factory.h"
  7. namespace gpu {
  8. // The images created by this factory have no inherent storage. When the image
  9. // is bound to a texture, storage is allocated for the texture via glTexImage2D.
  10. class TextureImageFactory : public gpu::ImageFactory {
  11. public:
  12. scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer(
  13. gfx::GpuMemoryBufferHandle handle,
  14. const gfx::Size& size,
  15. gfx::BufferFormat format,
  16. const gfx::ColorSpace& color_space,
  17. gfx::BufferPlane plane,
  18. int client_id,
  19. SurfaceHandle surface_handle) override;
  20. bool SupportsCreateAnonymousImage() const override;
  21. scoped_refptr<gl::GLImage> CreateAnonymousImage(const gfx::Size& size,
  22. gfx::BufferFormat format,
  23. gfx::BufferUsage usage,
  24. SurfaceHandle surface_handle,
  25. bool* is_cleared) override;
  26. unsigned RequiredTextureType() override;
  27. bool SupportsFormatRGB() override;
  28. void SetRequiredTextureType(unsigned type);
  29. private:
  30. unsigned required_texture_type_ = 0;
  31. };
  32. } // namespace gpu
  33. #endif // GPU_COMMAND_BUFFER_TESTS_TEXTURE_IMAGE_FACTORY_H_