Skia
2DGraphicsLibrary
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GrBufferAccess.h
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 
18 class GrBufferAccess : public SkNoncopyable {
19 public:
23  void reset(GrPixelConfig texelConfig, GrBuffer* buffer,
24  GrShaderFlags visibility = kFragment_GrShaderFlag) {
25  fTexelConfig = texelConfig;
26  fBuffer.set(SkRef(buffer), kRead_GrIOType);
27  fVisibility = visibility;
28  }
29 
30  bool operator==(const GrBufferAccess& that) const {
31  return fTexelConfig == that.fTexelConfig &&
32  this->buffer() == that.buffer() &&
33  fVisibility == that.fVisibility;
34  }
35 
36  bool operator!=(const GrBufferAccess& that) const { return !(*this == that); }
37 
38  GrPixelConfig texelConfig() const { return fTexelConfig; }
39  GrBuffer* buffer() const { return fBuffer.get(); }
40  GrShaderFlags visibility() const { return fVisibility; }
41 
45  const GrGpuResourceRef* getProgramBuffer() const { return &fBuffer;}
46 
47 private:
48  GrPixelConfig fTexelConfig;
50  GrShaderFlags fVisibility;
51 
52  typedef SkNoncopyable INHERITED;
53 };
54 
55 #endif
Used to represent a texel buffer that will be read in a GrProcessor.
Definition: GrBufferAccess.h:18
void set(T *resource, GrIOType ioType)
Adopts a ref from the caller.
Definition: GrGpuResourceRef.h:103
const GrGpuResourceRef * getProgramBuffer() const
For internal use by GrProcessor.
Definition: GrBufferAccess.h:45
void reset(GrPixelConfig texelConfig, GrBuffer *buffer, GrShaderFlags visibility=kFragment_GrShaderFlag)
Must be initialized before adding to a GrProcessor's buffer access list.
Definition: GrBufferAccess.h:23
Definition: GrBuffer.h:15
This class is intended only for internal use in core Gr code.
Definition: GrGpuResourceRef.h:37