summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service/texture_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/command_buffer/service/texture_manager.h')
-rw-r--r--gpu/command_buffer/service/texture_manager.h57
1 files changed, 23 insertions, 34 deletions
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h
index 2ec46c1..182e0d1 100644
--- a/gpu/command_buffer/service/texture_manager.h
+++ b/gpu/command_buffer/service/texture_manager.h
@@ -15,6 +15,8 @@
namespace gpu {
namespace gles2 {
+class FeatureInfo;
+
// This class keeps track of the textures and their sizes so we can do NPOT and
// texture complete checking.
//
@@ -43,7 +45,7 @@ class TextureManager {
// True if this texture meets all the GLES2 criteria for rendering.
// See section 3.8.2 of the GLES2 spec.
- bool CanRender(const TextureManager* manager) const;
+ bool CanRender(const FeatureInfo* feature_info) const;
// The service side OpenGL id of the texture.
GLuint service_id() const {
@@ -76,7 +78,7 @@ class TextureManager {
}
// Returns true if mipmaps can be generated by GL.
- bool CanGenerateMipmaps(const TextureManager* manager) const;
+ bool CanGenerateMipmaps(const FeatureInfo* feature_info) const;
// Get the width and height for a particular level. Returns false if level
// does not exist.
@@ -133,7 +135,7 @@ class TextureManager {
// Set the info for a particular level.
void SetLevelInfo(
- const TextureManager* manager,
+ const FeatureInfo* feature_info,
GLenum target,
GLint level,
GLenum internal_format,
@@ -146,10 +148,11 @@ class TextureManager {
// Sets a texture parameter.
// TODO(gman): Expand to SetParameteri,f,iv,fv
- void SetParameter(const TextureManager* manager, GLenum pname, GLint param);
+ void SetParameter(
+ const FeatureInfo* feature_info, GLenum pname, GLint param);
// Makes each of the mip levels as though they were generated.
- bool MarkMipmapsGenerated(const TextureManager* manager);
+ bool MarkMipmapsGenerated(const FeatureInfo* feature_info);
void MarkAsDeleted() {
service_id_ = 0;
@@ -175,7 +178,7 @@ class TextureManager {
}
// Update info about this texture.
- void Update(const TextureManager* manager);
+ void Update(const FeatureInfo* feature_info);
// Info about each face and level of texture.
std::vector<std::vector<LevelInfo> > level_infos_;
@@ -210,10 +213,7 @@ class TextureManager {
DISALLOW_COPY_AND_ASSIGN(TextureInfo);
};
- TextureManager(bool npot_ok,
- bool enable_float_linear,
- bool enable_half_float_linear,
- GLsizei max_texture_size,
+ TextureManager(GLsizei max_texture_size,
GLsizei max_cube_map_texture_size);
~TextureManager();
@@ -223,21 +223,6 @@ class TextureManager {
// Must call before destruction.
void Destroy(bool have_context);
- // Whether or not npot textures can render.
- bool npot_ok() const {
- return npot_ok_;
- }
-
- // Whether float textures can have linear filtering.
- bool enable_float_linear() const {
- return enable_float_linear_;
- }
-
- // Whether half float textures can have linear filtering.
- bool enable_half_float_linear() const {
- return enable_half_float_linear_;
- }
-
// Returns the maximum number of levels.
GLint MaxLevelsForTarget(GLenum target) const {
return (target == GL_TEXTURE_2D) ? max_levels_ : max_cube_map_levels_;
@@ -251,6 +236,7 @@ class TextureManager {
// Checks if a dimensions are valid for a given target.
bool ValidForTarget(
+ const FeatureInfo* feature_info,
GLenum target, GLint level,
GLsizei width, GLsizei height, GLsizei depth);
@@ -265,6 +251,7 @@ class TextureManager {
// Set the info for a particular level in a TexureInfo.
void SetLevelInfo(
+ const FeatureInfo* feature_info,
TextureInfo* info,
GLenum target,
GLint level,
@@ -278,20 +265,25 @@ class TextureManager {
// Sets a texture parameter of a TextureInfo
// TODO(gman): Expand to SetParameteri,f,iv,fv
- void SetParameter(TextureInfo* info, GLenum pname, GLint param);
+ void SetParameter(
+ const FeatureInfo* feature_info,
+ TextureInfo* info, GLenum pname, GLint param);
// Makes each of the mip levels as though they were generated.
// Returns false if that's not allowed for the given texture.
- bool MarkMipmapsGenerated(TextureManager::TextureInfo* info);
+ bool MarkMipmapsGenerated(
+ const FeatureInfo* feature_info,
+ TextureManager::TextureInfo* info);
// Creates a new texture info.
- TextureInfo* CreateTextureInfo(GLuint client_id, GLuint service_id);
+ TextureInfo* CreateTextureInfo(
+ const FeatureInfo* feature_info, GLuint client_id, GLuint service_id);
// Gets the texture info for the given texture.
TextureInfo* GetTextureInfo(GLuint client_id);
// Removes a texture info.
- void RemoveTextureInfo(GLuint client_id);
+ void RemoveTextureInfo(const FeatureInfo* feature_info, GLuint client_id);
// Gets a client id for a given service id.
bool GetClientId(GLuint service_id, GLuint* client_id) const;
@@ -306,8 +298,8 @@ class TextureManager {
}
GLuint black_texture_id(GLenum target) const {
- return target == GL_SAMPLER_2D ? black_2d_texture_id_ :
- black_cube_texture_id_;
+ return target == GL_SAMPLER_2D ? black_2d_texture_id_ :
+ black_cube_texture_id_;
}
private:
@@ -316,9 +308,6 @@ class TextureManager {
typedef std::map<GLuint, TextureInfo::Ref> TextureInfoMap;
TextureInfoMap texture_infos_;
- bool npot_ok_;
- bool enable_float_linear_;
- bool enable_half_float_linear_;
GLsizei max_texture_size_;
GLsizei max_cube_map_texture_size_;
GLint max_levels_;