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

Side by Side Diff: src/gpu/gl/GrGLTexture.h

Issue 1403123002: Store texture target on GrGLTexture. This is in preparation for using texture targets other than 2D. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: working Created 5 years, 2 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
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | src/gpu/gl/GrGLTexture.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #ifndef GrGLTexture_DEFINED 9 #ifndef GrGLTexture_DEFINED
10 #define GrGLTexture_DEFINED 10 #define GrGLTexture_DEFINED
(...skipping 10 matching lines...) Expand all
21 struct TexParams { 21 struct TexParams {
22 GrGLenum fMinFilter; 22 GrGLenum fMinFilter;
23 GrGLenum fMagFilter; 23 GrGLenum fMagFilter;
24 GrGLenum fWrapS; 24 GrGLenum fWrapS;
25 GrGLenum fWrapT; 25 GrGLenum fWrapT;
26 GrGLenum fSwizzleRGBA[4]; 26 GrGLenum fSwizzleRGBA[4];
27 void invalidate() { memset(this, 0xff, sizeof(TexParams)); } 27 void invalidate() { memset(this, 0xff, sizeof(TexParams)); }
28 }; 28 };
29 29
30 struct IDDesc { 30 struct IDDesc {
31 GrGLenum fTarget;
31 GrGLuint fTextureID; 32 GrGLuint fTextureID;
32 GrGpuResource::LifeCycle fLifeCycle; 33 GrGpuResource::LifeCycle fLifeCycle;
33 }; 34 };
34 35
35 GrGLTexture(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&); 36 GrGLTexture(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&);
36 37
37 GrBackendObject getTextureHandle() const override; 38 GrBackendObject getTextureHandle() const override;
38 39
39 void textureParamsModified() override { fTexParams.invalidate(); } 40 void textureParamsModified() override { fTexParams.invalidate(); }
40 41
41 // These functions are used to track the texture parameters associated with the texture. 42 // These functions are used to track the texture parameters associated with the texture.
42 const TexParams& getCachedTexParams(GrGpu::ResetTimestamp* timestamp) const { 43 const TexParams& getCachedTexParams(GrGpu::ResetTimestamp* timestamp) const {
43 *timestamp = fTexParamsTimestamp; 44 *timestamp = fTexParamsTimestamp;
44 return fTexParams; 45 return fTexParams;
45 } 46 }
46 47
47 void setCachedTexParams(const TexParams& texParams, 48 void setCachedTexParams(const TexParams& texParams,
48 GrGpu::ResetTimestamp timestamp) { 49 GrGpu::ResetTimestamp timestamp) {
49 fTexParams = texParams; 50 fTexParams = texParams;
50 fTexParamsTimestamp = timestamp; 51 fTexParamsTimestamp = timestamp;
51 } 52 }
52 53
53 GrGLuint textureID() const { return fTextureID; } 54 GrGLuint textureID() const { return fTextureID; }
54 55
56 GrGLenum target() const { return fTarget; }
57
55 protected: 58 protected:
56 // The public constructor registers this object with the cache. However, onl y the most derived 59 // The public constructor registers this object with the cache. However, onl y the most derived
57 // class should register with the cache. This constructor does not do the re gistration and 60 // class should register with the cache. This constructor does not do the re gistration and
58 // rather moves that burden onto the derived class. 61 // rather moves that burden onto the derived class.
59 enum Derived { kDerived }; 62 enum Derived { kDerived };
60 GrGLTexture(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived); 63 GrGLTexture(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived);
61 64
62 void init(const GrSurfaceDesc&, const IDDesc&); 65 void init(const GrSurfaceDesc&, const IDDesc&);
63 66
64 void onAbandon() override; 67 void onAbandon() override;
65 void onRelease() override; 68 void onRelease() override;
66 void setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, 69 void setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
67 const SkString& dumpName) const override; 70 const SkString& dumpName) const override;
68 71
69 private: 72 private:
70 TexParams fTexParams; 73 TexParams fTexParams;
71 GrGpu::ResetTimestamp fTexParamsTimestamp; 74 GrGpu::ResetTimestamp fTexParamsTimestamp;
75 GrGLenum fTarget;
72 GrGLuint fTextureID; 76 GrGLuint fTextureID;
73 77
74 // We track this separately from GrGpuResource because this may be both a te xture and a render 78 // We track this separately from GrGpuResource because this may be both a te xture and a render
75 // target, and the texture may be wrapped while the render target is not. 79 // target, and the texture may be wrapped while the render target is not.
76 LifeCycle fTextureIDLifecycle; 80 LifeCycle fTextureIDLifecycle;
77 81
78 typedef GrTexture INHERITED; 82 typedef GrTexture INHERITED;
79 }; 83 };
80 84
81 #endif 85 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | src/gpu/gl/GrGLTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698