texture_definition.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
1// Copyright (c) 2012 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#ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ 6#define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ 7 8#include <vector> 9 10#include "base/callback.h" 11#include "gpu/command_buffer/service/gl_utils.h" 12#include "gpu/gpu_export.h" 13 14namespace gpu { 15namespace gles2 { 16 17// A saved definition of a texture that still exists in the underlying 18// GLShareGroup and can be used to redefine a client visible texture in any 19// context using the same GLShareGroup with the corresponding service ID. 20class GPU_EXPORT TextureDefinition { 21 public: 22 struct LevelInfo { 23 LevelInfo(GLenum target, 24 GLenum internal_format, 25 GLsizei width, 26 GLsizei height, 27 GLsizei depth, 28 GLint border, 29 GLenum format, 30 GLenum type, 31 bool cleared); 32 GLenum target; 33 GLenum internal_format; 34 GLsizei width; 35 GLsizei height; 36 GLsizei depth; 37 GLint border; 38 GLenum format; 39 GLenum type; 40 bool cleared; 41 }; 42 43 typedef std::vector<std::vector<LevelInfo> > LevelInfos; 44 45 typedef base::Callback<void(TextureDefinition*)> DestroyCallback; 46 47 TextureDefinition(GLenum target, 48 GLuint service_id, 49 bool immutable, 50 const LevelInfos& level_infos); 51 ~TextureDefinition(); 52 53 GLenum target() const { 54 return target_; 55 } 56 57 GLuint ReleaseServiceId(); 58 59 bool immutable() const { return immutable_; } 60 61 const LevelInfos& level_infos() const { 62 return level_infos_; 63 } 64 65 private: 66 GLenum target_; 67 GLuint service_id_; 68 bool immutable_; 69 std::vector<std::vector<LevelInfo> > level_infos_; 70 71 DISALLOW_COPY_AND_ASSIGN(TextureDefinition); 72}; 73 74} // namespage gles2 75} // namespace gpu 76 77#endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ 78