| 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..cd94843245e750a0f6b1e3bc315dd78579201887 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"
|
| @@ -55,26 +56,30 @@ class GPU_EXPORT Texture {
|
| COPIED
|
| };
|
|
|
| - explicit Texture(GLuint service_id);
|
| + Texture(GLuint service_id, bool is_es3_enabled);
|
| +
|
| + 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 {
|
| @@ -222,6 +227,11 @@ class GPU_EXPORT Texture {
|
| uint64_t client_tracing_id,
|
| const std::string& dump_name) const;
|
|
|
| + // Whether the texture has been defined
|
| + bool IsES3Enabled() const {
|
| + return is_es3_enabled_;
|
| + }
|
| +
|
| private:
|
| friend class MailboxManagerImpl;
|
| friend class MailboxManagerSync;
|
| @@ -245,7 +255,8 @@ class GPU_EXPORT Texture {
|
| enum CanRenderCondition {
|
| CAN_RENDER_ALWAYS,
|
| CAN_RENDER_NEVER,
|
| - CAN_RENDER_ONLY_IF_NPOT
|
| + CAN_RENDER_ONLY_IF_NPOT,
|
| + CAN_RENDER_WITH_VALID_SAMPLER
|
| };
|
|
|
| struct LevelInfo {
|
| @@ -340,12 +351,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 +466,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_;
|
|
|
| @@ -505,6 +511,9 @@ class GPU_EXPORT Texture {
|
| // Whether we have initialized TEXTURE_MAX_ANISOTROPY to 1.
|
| bool texture_max_anisotropy_initialized_;
|
|
|
| + // Whether this texture was created by an ES3 context
|
| + bool is_es3_enabled_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(Texture);
|
| };
|
|
|
| @@ -674,10 +683,17 @@ class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
|
|
|
| // True if this texture meets all the GLES2 criteria for rendering.
|
| // See section 3.8.2 of the GLES2 spec.
|
| - bool CanRender(const TextureRef* ref) const {
|
| + bool CanRender(
|
| + const TextureRef* ref) const {
|
| 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,8 +790,8 @@ class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
|
| }
|
| }
|
|
|
| - bool HaveUnrenderableTextures() const {
|
| - return num_unrenderable_textures_ > 0;
|
| + bool NeedsTextureRenderChecks() const {
|
| + return feature_info_->IsES3Enabled() || num_unrenderable_textures_ > 0;
|
| }
|
|
|
| bool HaveUnsafeTextures() const {
|
|
|