Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLTexture.h

Issue 1684973002: Remove blink side texture status caching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 static WebGLTexture* create(WebGLRenderingContextBase*); 53 static WebGLTexture* create(WebGLRenderingContextBase*);
54 54
55 void setTarget(GLenum target, GLint maxLevel); 55 void setTarget(GLenum target, GLint maxLevel);
56 void setParameteri(GLenum pname, GLint param); 56 void setParameteri(GLenum pname, GLint param);
57 void setParameterf(GLenum pname, GLfloat param); 57 void setParameterf(GLenum pname, GLfloat param);
58 58
59 GLenum getTarget() const { return m_target; } 59 GLenum getTarget() const { return m_target; }
60 60
61 int getMinFilter() const { return m_samplerState.minFilter; } 61 int getMinFilter() const { return m_samplerState.minFilter; }
62 62
63 void setLevelInfo(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum type);
64 void setTexStorageInfo(GLenum target, GLint levels, GLenum internalFormat, G Lsizei width, GLsizei height, GLsizei depth);
65
66 bool canGenerateMipmaps();
67 // Generate all level information.
68 void generateMipmapLevelInfo();
69
70 GLenum getInternalFormat(GLenum target, GLint level) const;
71 GLenum getType(GLenum target, GLint level) const;
72 GLsizei getWidth(GLenum target, GLint level) const;
73 GLsizei getHeight(GLenum target, GLint level) const;
74 GLsizei getDepth(GLenum target, GLint level) const;
75 bool isValid(GLenum target, GLint level) const;
76 bool isImmutable() const { return m_immutable; }
77
78 static GLenum getValidFormatForInternalFormat(GLenum); 63 static GLenum getValidFormatForInternalFormat(GLenum);
79 64
80 bool isCubeComplete() const { return m_isCubeComplete; }
81
82 // Whether width/height is NotPowerOfTwo. 65 // Whether width/height is NotPowerOfTwo.
83 static bool isNPOT(GLsizei, GLsizei); 66 static bool isNPOT(GLsizei, GLsizei);
84 67
85 bool isNPOT() const;
86
87 bool hasEverBeenBound() const { return object() && m_target; } 68 bool hasEverBeenBound() const { return object() && m_target; }
88 69
89 static GLint computeLevelCount(GLsizei width, GLsizei height, GLsizei depth) ; 70 static GLint computeLevelCount(GLsizei width, GLsizei height, GLsizei depth) ;
90 static GLenum getValidTypeForInternalFormat(GLenum); 71 static GLenum getValidTypeForInternalFormat(GLenum);
91 72
92 const WebGLSamplerState* getSamplerState() const { return &m_samplerState; } 73 const WebGLSamplerState* getSamplerState() const { return &m_samplerState; }
93 74
94 private: 75 private:
95 explicit WebGLTexture(WebGLRenderingContextBase*); 76 explicit WebGLTexture(WebGLRenderingContextBase*);
96 77
97 void deleteObjectImpl(WebGraphicsContext3D*) override; 78 void deleteObjectImpl(WebGraphicsContext3D*) override;
98 79
99 class LevelInfo {
100 public:
101 LevelInfo()
102 : valid(false)
103 , internalFormat(0)
104 , width(0)
105 , height(0)
106 , depth(0)
107 , type(0)
108 {
109 }
110
111 void setInfo(GLenum internalFmt, GLsizei w, GLsizei h, GLsizei d, GLenum tp)
112 {
113 valid = true;
114 internalFormat = internalFmt;
115 width = w;
116 height = h;
117 depth = d;
118 type = tp;
119 }
120
121 bool valid;
122 GLenum internalFormat;
123 GLsizei width;
124 GLsizei height;
125 GLsizei depth;
126 GLenum type;
127 };
128
129 bool isTexture() const override { return true; } 80 bool isTexture() const override { return true; }
130 81
131 void update();
132
133 int mapTargetToIndex(GLenum) const; 82 int mapTargetToIndex(GLenum) const;
134 83
135 const LevelInfo* getLevelInfo(GLenum target, GLint level) const;
136
137 GLenum m_target; 84 GLenum m_target;
138 85
139 WebGLSamplerState m_samplerState; 86 WebGLSamplerState m_samplerState;
140 87
141 Vector<Vector<LevelInfo>> m_info;
142
143 bool m_isNPOT;
144 bool m_isCubeComplete;
145 bool m_isComplete;
146 bool m_isFloatType;
147 bool m_isHalfFloatType;
148 bool m_isWebGL2OrHigher; 88 bool m_isWebGL2OrHigher;
149 bool m_immutable;
150 size_t m_baseLevel; 89 size_t m_baseLevel;
151 size_t m_maxLevel; 90 size_t m_maxLevel;
152 }; 91 };
153 92
154 } // namespace blink 93 } // namespace blink
155 94
156 #endif // WebGLTexture_h 95 #endif // WebGLTexture_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698