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

Side by Side Diff: include/gpu/GrBufferAccess.h

Issue 1870893002: Implement texel buffers (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_texelfetch
Patch Set: GrBuffer(Access) into include/gpu Created 4 years, 8 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 | « include/gpu/GrBuffer.h ('k') | include/gpu/GrFragmentProcessor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef GrBufferAccess_DEFINED
9 #define GrBufferAccess_DEFINED
10
11 #include "GrBuffer.h"
12 #include "GrGpuResourceRef.h"
13
14 /**
15 * Used to represent a texel buffer that will be read in a GrProcessor. It holds a GrBuffer along
16 * with an associated offset and texel config.
17 */
18 class GrBufferAccess : public SkNoncopyable {
19 public:
20 /**
21 * Must be initialized before adding to a GrProcessor's buffer access list.
22 */
23 void reset(intptr_t offsetInBytes, GrPixelConfig texelConfig, GrBuffer* buff er,
24 GrShaderFlags visibility = kFragment_GrShaderFlag) {
25 fOffsetInBytes = offsetInBytes;
26 fTexelConfig = texelConfig;
27 fBuffer.set(SkRef(buffer), kRead_GrIOType);
28 fVisibility = visibility;
29 }
30
31 bool operator==(const GrBufferAccess& that) const {
32 return fOffsetInBytes == that.fOffsetInBytes &&
33 fTexelConfig == that.fTexelConfig &&
34 this->buffer() == that.buffer() &&
35 fVisibility == that.fVisibility;
36 }
37
38 bool operator!=(const GrBufferAccess& that) const { return !(*this == that); }
39
40 intptr_t offsetInBytes() const { return fOffsetInBytes; }
41 GrPixelConfig texelConfig() const { return fTexelConfig; }
42 GrBuffer* buffer() const { return fBuffer.get(); }
43 GrShaderFlags visibility() const { return fVisibility; }
44
45 /**
46 * For internal use by GrProcessor.
47 */
48 const GrGpuResourceRef* getProgramBuffer() const { return &fBuffer;}
49
50 private:
51 intptr_t fOffsetInBytes;
52 GrPixelConfig fTexelConfig;
53 GrTGpuResourceRef<GrBuffer> fBuffer;
54 GrShaderFlags fVisibility;
55
56 typedef SkNoncopyable INHERITED;
57 };
58
59 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrBuffer.h ('k') | include/gpu/GrFragmentProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698