@@ -36,8 +36,8 @@ struct AsyncContext {
36
36
};
37
37
38
38
struct SharedTextureContext {
39
- wgpu::SharedTextureMemory sharedTextureMemory;
40
- wgpu::Texture texture;
39
+ wgpu::SharedTextureMemory sharedTextureMemory;
40
+ wgpu::Texture texture;
41
41
};
42
42
43
43
static void
@@ -111,7 +111,7 @@ class DawnContext {
111
111
int height = static_cast <int >(IOSurfaceGetHeight (ioSurface));
112
112
#else
113
113
wgpu::SharedTextureMemoryAHardwareBufferDescriptor platformDesc;
114
- auto ahb = (AHardwareBuffer*)buffer;
114
+ auto ahb = (AHardwareBuffer *)buffer;
115
115
platformDesc.handle = ahb;
116
116
platformDesc.useExternalFormat = true ;
117
117
AHardwareBuffer_Desc adesc;
@@ -122,13 +122,16 @@ class DawnContext {
122
122
123
123
wgpu::SharedTextureMemoryDescriptor desc = {};
124
124
desc.nextInChain = &platformDesc;
125
- wgpu::SharedTextureMemory memory = backendContext.fDevice .ImportSharedTextureMemory (&desc);
125
+ wgpu::SharedTextureMemory memory =
126
+ backendContext.fDevice .ImportSharedTextureMemory (&desc);
126
127
127
128
wgpu::TextureDescriptor textureDesc;
128
129
textureDesc.format = DawnUtils::PreferredTextureFormat;
129
130
textureDesc.dimension = wgpu::TextureDimension::e2D;
130
- textureDesc.usage = wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopySrc;
131
- textureDesc.size = {static_cast <uint32_t >(width), static_cast <uint32_t >(height), 1 };
131
+ textureDesc.usage =
132
+ wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopySrc;
133
+ textureDesc.size = {static_cast <uint32_t >(width),
134
+ static_cast <uint32_t >(height), 1 };
132
135
133
136
wgpu::Texture texture = memory.CreateTexture (&textureDesc);
134
137
@@ -137,26 +140,23 @@ class DawnContext {
137
140
beginAccessDesc.fenceCount = 0 ;
138
141
bool success = memory.BeginAccess (texture, &beginAccessDesc);
139
142
140
- if (success) {
141
- skgpu::graphite::BackendTexture betFromView = skgpu::graphite::BackendTextures::MakeDawn (texture.Get ());
142
- auto result = SkImages::WrapTexture (
143
- getRecorder (),
144
- betFromView,
145
- DawnUtils::PreferedColorType,
146
- kPremul_SkAlphaType ,
147
- nullptr ,
148
- [](void * context) {
143
+ if (success) {
144
+ skgpu::graphite::BackendTexture betFromView =
145
+ skgpu::graphite::BackendTextures::MakeDawn (texture.Get ());
146
+ auto result = SkImages::WrapTexture (
147
+ getRecorder (), betFromView, DawnUtils::PreferedColorType,
148
+ kPremul_SkAlphaType , nullptr ,
149
+ [](void *context) {
149
150
auto ctx = static_cast <SharedTextureContext *>(context);
150
151
wgpu::SharedTextureMemoryEndAccessState endState = {};
151
152
ctx->sharedTextureMemory .EndAccess (ctx->texture , &endState);
152
153
delete ctx;
153
- },
154
- new SharedTextureContext{memory, texture}
155
- );
156
- return result;
157
- }
154
+ },
155
+ new SharedTextureContext{memory, texture});
156
+ return result;
157
+ }
158
158
if (!success) {
159
- return nullptr ;
159
+ return nullptr ;
160
160
}
161
161
return nullptr ;
162
162
}
0 commit comments