OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef GrContext_DEFINED | 10 #ifndef GrContext_DEFINED |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 static GrContext* Create(GrBackend, GrBackendContext); | 50 static GrContext* Create(GrBackend, GrBackendContext); |
51 | 51 |
52 /** | 52 /** |
53 * Returns the number of GrContext instances for the current thread. | 53 * Returns the number of GrContext instances for the current thread. |
54 */ | 54 */ |
55 static int GetThreadInstanceCount(); | 55 static int GetThreadInstanceCount(); |
56 | 56 |
57 virtual ~GrContext(); | 57 virtual ~GrContext(); |
58 | 58 |
59 /** | 59 /** |
60 * We would move below enum to GrType.h if we are going to have multiple | |
61 * sets of flags, such as D3D. | |
62 */ | |
63 enum GLBackendState { | |
bsalomon
2013/06/26 19:03:07
Let's move it now so that we don't have to go back
| |
64 kRenderTarget_GLBackendState = 0x01 << 0, | |
65 kTextureBinding_GLBackendState = 0x01 << 1, | |
66 // View state stands for scissor and viewport | |
67 kView_GLBackendState = 0x01 << 2, | |
68 kBlend_GLBackendState = 0x01 << 3, | |
69 kAA_GLBackendState = 0x01 << 4, | |
70 kVertex_GLBackendState = 0x01 << 5, | |
71 kStencil_GLBackendState = 0x01 << 6, | |
72 kPixelStore_GLBackendState = 0x01 << 7, | |
73 kProgram_GLBackendState = 0x01 << 8, | |
74 kPathStencil_GLBackendState = 0x01 << 9, | |
75 kMisc_GLBackendState = 0x01 << 10, | |
76 kALL_GLBackendState = 0xffff | |
77 }; | |
78 | |
79 /** | |
60 * The GrContext normally assumes that no outsider is setting state | 80 * The GrContext normally assumes that no outsider is setting state |
61 * within the underlying 3D API's context/device/whatever. This call informs | 81 * within the underlying 3D API's context/device/whatever. This call informs |
62 * the context that the state was modified and it should resend. Shouldn't | 82 * the context that the state was modified and it should resend. Shouldn't |
63 * be called frequently for good performance. | 83 * be called frequently for good performance. |
84 * The flag bits, state, is dpendent on which backend is used by the | |
85 * context, either GL or D3D (possible in future). | |
64 */ | 86 */ |
65 void resetContext(); | 87 void resetContext(uint32_t state = kALL_GLBackendState); |
66 | 88 |
67 /** | 89 /** |
68 * Callback function to allow classes to cleanup on GrContext destruction. | 90 * Callback function to allow classes to cleanup on GrContext destruction. |
69 * The 'info' field is filled in with the 'info' passed to addCleanUp. | 91 * The 'info' field is filled in with the 'info' passed to addCleanUp. |
70 */ | 92 */ |
71 typedef void (*PFCleanUpFunc)(const GrContext* context, void* info); | 93 typedef void (*PFCleanUpFunc)(const GrContext* context, void* info); |
72 | 94 |
73 /** | 95 /** |
74 * Add a function to be called from within GrContext's destructor. | 96 * Add a function to be called from within GrContext's destructor. |
75 * This gives classes a chance to free resources held on a per context basis . | 97 * This gives classes a chance to free resources held on a per context basis . |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1020 } | 1042 } |
1021 | 1043 |
1022 GrTexture* texture() { return fTexture; } | 1044 GrTexture* texture() { return fTexture; } |
1023 | 1045 |
1024 private: | 1046 private: |
1025 GrContext* fContext; | 1047 GrContext* fContext; |
1026 GrTexture* fTexture; | 1048 GrTexture* fTexture; |
1027 }; | 1049 }; |
1028 | 1050 |
1029 #endif | 1051 #endif |
OLD | NEW |