| 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 e33df33059c682db9fe944bcb90ca76aaa834838..c026769746b3429f68a50ff131172a9e8a8109c4 100644
|
| --- a/gpu/command_buffer/service/texture_manager.h
|
| +++ b/gpu/command_buffer/service/texture_manager.h
|
| @@ -19,6 +19,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"
|
| @@ -60,24 +61,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 {
|
| @@ -85,19 +90,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 {
|
| @@ -252,7 +257,7 @@ class GPU_EXPORT Texture {
|
| enum CanRenderCondition {
|
| CAN_RENDER_ALWAYS,
|
| CAN_RENDER_NEVER,
|
| - CAN_RENDER_ONLY_IF_NPOT
|
| + CAN_RENDER_NEEDS_VALIDATION,
|
| };
|
|
|
| struct LevelInfo {
|
| @@ -347,12 +352,15 @@ class GPU_EXPORT Texture {
|
| void 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;
|
| @@ -477,16 +485,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_;
|
|
|
| @@ -703,6 +703,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());
|
| @@ -798,10 +804,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;
|
| }
|
| @@ -1015,7 +1017,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_;
|
|
|