All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
d3d11PtexTexture.h
Go to the documentation of this file.
1 //
2 //
3 // Copyright 2013 Pixar
4 //
5 // Licensed under the Apache License, Version 2.0 (the "Apache License")
6 // with the following modification; you may not use this file except in
7 // compliance with the Apache License and the following modification to it:
8 // Section 6. Trademarks. is deleted and replaced with:
9 //
10 // 6. Trademarks. This License does not grant permission to use the trade
11 // names, trademarks, service marks, or product names of the Licensor
12 // and its affiliates, except as required to comply with Section 4(c) of
13 // the License and to reproduce the content of the NOTICE file.
14 //
15 // You may obtain a copy of the Apache License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the Apache License with the above modification is
21 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22 // KIND, either express or implied. See the Apache License for the specific
23 // language governing permissions and limitations under the Apache License.
24 //
25 
26 #ifndef OSD_D3D11_PTEX_TEXTURE_H
27 #define OSD_D3D11_PTEX_TEXTURE_H
28 
29 #include "../version.h"
30 
31 #include "../osd/nonCopyable.h"
32 
33 class PtexTexture;
34 struct ID3D11Buffer;
35 struct ID3D11Texture2D;
36 struct ID3D11DeviceContext;
37 
38 namespace OpenSubdiv {
39 namespace OPENSUBDIV_VERSION {
40 
41 namespace Osd {
42 
61 class D3D11PtexTexture : NonCopyable<D3D11PtexTexture> {
62 public:
63  static D3D11PtexTexture * Create(ID3D11DeviceContext *deviceContext,
64  PtexTexture * reader,
65  unsigned long int targetMemory = 0,
66  int gutterWidth = 0,
67  int pageMargin = 0);
68 
71  ID3D11Buffer *GetPagesTextureBuffer() const { return _pages; }
72 
75  ID3D11Buffer *GetLayoutTextureBuffer() const { return _layout; }
76 
78  ID3D11Texture2D *GetTexelsTexture() const { return _texels; }
79 
81 
82 private:
84 
85  int _width, // widht / height / depth of the 3D texel buffer
86  _height,
87  _depth;
88 
89  int _format; // texel color format
90 
91  ID3D11Buffer *_pages, // per-face page indices into the texel array
92  *_layout; // per-face lookup table
93  // (vec4 : top-left corner & width / height)
94  ID3D11Texture2D *_texels; // texel data
95 };
96 
97 } // end namespace Osd
98 
99 } // end namespace OPENSUBDIV_VERSION
100 using namespace OPENSUBDIV_VERSION;
101 
102 } // end namespace OpenSubdiv
103 
104 #endif // OSD_D3D11_PTEX_TEXTURE_H
105 
static D3D11PtexTexture * Create(ID3D11DeviceContext *deviceContext, PtexTexture *reader, unsigned long int targetMemory=0, int gutterWidth=0, int pageMargin=0)
ID3D11Texture2D * GetTexelsTexture() const
Returns the texels texture array.