| Index: gpu/command_buffer/service/texture_manager.h
|
| diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h
|
| index 2f118de18f0d3bd8d3f047740ccf13bcdfb4bb11..c97d6ba57f2d5b20a60eba838eba20f902965a91 100644
|
| --- a/gpu/command_buffer/service/texture_manager.h
|
| +++ b/gpu/command_buffer/service/texture_manager.h
|
| @@ -16,6 +16,7 @@
|
| #include "gpu/command_buffer/service/feature_info.h"
|
| #include "gpu/command_buffer/service/gl_utils.h"
|
| #include "gpu/command_buffer/service/memory_tracking.h"
|
| +#include "gpu/command_buffer/service/sampler_manager.h"
|
| #include "gpu/gpu_export.h"
|
| #include "ui/gfx/geometry/rect.h"
|
| #include "ui/gl/gl_image.h"
|
| @@ -57,24 +58,28 @@ class GPU_EXPORT Texture {
|
|
|
| explicit Texture(GLuint service_id);
|
|
|
| + const SamplerState& sampler_state() const {
|
| + return sampler_state_;
|
| + }
|
| +
|
| GLenum min_filter() const {
|
| - return min_filter_;
|
| + return sampler_state_.min_filter;
|
| }
|
|
|
| GLenum mag_filter() const {
|
| - return mag_filter_;
|
| + return sampler_state_.mag_filter;
|
| }
|
|
|
| GLenum wrap_r() const {
|
| - return wrap_r_;
|
| + return sampler_state_.wrap_r;
|
| }
|
|
|
| GLenum wrap_s() const {
|
| - return wrap_s_;
|
| + return sampler_state_.wrap_s;
|
| }
|
|
|
| GLenum wrap_t() const {
|
| - return wrap_t_;
|
| + return sampler_state_.wrap_t;
|
| }
|
|
|
| GLenum usage() const {
|
| @@ -82,19 +87,19 @@ class GPU_EXPORT Texture {
|
| }
|
|
|
| GLenum compare_func() const {
|
| - return compare_func_;
|
| + return sampler_state_.compare_func;
|
| }
|
|
|
| GLenum compare_mode() const {
|
| - return compare_mode_;
|
| + return sampler_state_.compare_mode;
|
| }
|
|
|
| GLfloat max_lod() const {
|
| - return max_lod_;
|
| + return sampler_state_.max_lod;
|
| }
|
|
|
| GLfloat min_lod() const {
|
| - return min_lod_;
|
| + return sampler_state_.min_lod;
|
| }
|
|
|
| GLint base_level() const {
|
| @@ -245,7 +250,7 @@ class GPU_EXPORT Texture {
|
| enum CanRenderCondition {
|
| CAN_RENDER_ALWAYS,
|
| CAN_RENDER_NEVER,
|
| - CAN_RENDER_ONLY_IF_NPOT
|
| + CAN_RENDER_NEEDS_VALIDATION,
|
| };
|
|
|
| struct LevelInfo {
|
| @@ -340,12 +345,15 @@ class GPU_EXPORT Texture {
|
| bool MarkMipmapsGenerated(const FeatureInfo* feature_info);
|
|
|
| bool NeedsMips() const {
|
| - return min_filter_ != GL_NEAREST && min_filter_ != GL_LINEAR;
|
| + return sampler_state_.min_filter != GL_NEAREST &&
|
| + sampler_state_.min_filter != GL_LINEAR;
|
| }
|
|
|
| // True if this texture meets all the GLES2 criteria for rendering.
|
| // See section 3.8.2 of the GLES2 spec.
|
| bool CanRender(const FeatureInfo* feature_info) const;
|
| + bool CanRenderWithSampler(const FeatureInfo* feature_info,
|
| + const SamplerState& sampler_state) const;
|
|
|
| // Returns true if mipmaps can be generated by GL.
|
| bool CanGenerateMipmaps(const FeatureInfo* feature_info) const;
|
| @@ -452,16 +460,8 @@ class GPU_EXPORT Texture {
|
| GLenum target_;
|
|
|
| // Texture parameters.
|
| - GLenum min_filter_;
|
| - GLenum mag_filter_;
|
| - GLenum wrap_r_;
|
| - GLenum wrap_s_;
|
| - GLenum wrap_t_;
|
| + SamplerState sampler_state_;
|
| GLenum usage_;
|
| - GLenum compare_func_;
|
| - GLenum compare_mode_;
|
| - GLfloat max_lod_;
|
| - GLfloat min_lod_;
|
| GLint base_level_;
|
| GLint max_level_;
|
|
|
| @@ -678,6 +678,12 @@ class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
|
| return ref->texture()->CanRender(feature_info_.get());
|
| }
|
|
|
| + bool CanRenderWithSampler(
|
| + const TextureRef* ref, const SamplerState& sampler_state) const {
|
| + return ref->texture()->CanRenderWithSampler(
|
| + feature_info_.get(), sampler_state);
|
| + }
|
| +
|
| // Returns true if mipmaps can be generated by GL.
|
| bool CanGenerateMipmaps(const TextureRef* ref) const {
|
| return ref->texture()->CanGenerateMipmaps(feature_info_.get());
|
| @@ -774,10 +780,6 @@ class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
|
| }
|
| }
|
|
|
| - bool HaveUnrenderableTextures() const {
|
| - return num_unrenderable_textures_ > 0;
|
| - }
|
| -
|
| bool HaveUnsafeTextures() const {
|
| return num_unsafe_textures_ > 0;
|
| }
|
| @@ -986,7 +988,6 @@ class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
|
|
|
| const bool use_default_textures_;
|
|
|
| - int num_unrenderable_textures_;
|
| int num_unsafe_textures_;
|
| int num_uncleared_mips_;
|
| int num_images_;
|
|
|