• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 The Dawn Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "dawn_wire/server/Server.h"
16 
17 #include <memory>
18 
19 namespace dawn_wire { namespace server {
20 
DoShaderModuleGetCompilationInfo(ObjectId shaderModuleId,uint64_t requestSerial)21     bool Server::DoShaderModuleGetCompilationInfo(ObjectId shaderModuleId, uint64_t requestSerial) {
22         auto* shaderModule = ShaderModuleObjects().Get(shaderModuleId);
23         if (shaderModule == nullptr) {
24             return false;
25         }
26 
27         auto userdata = MakeUserdata<ShaderModuleGetCompilationInfoUserdata>();
28         userdata->shaderModule = ObjectHandle{shaderModuleId, shaderModule->generation};
29         userdata->requestSerial = requestSerial;
30 
31         mProcs.shaderModuleGetCompilationInfo(
32             shaderModule->handle,
33             ForwardToServer<decltype(&Server::OnShaderModuleGetCompilationInfo)>::Func<
34                 &Server::OnShaderModuleGetCompilationInfo>(),
35             userdata.release());
36         return true;
37     }
38 
OnShaderModuleGetCompilationInfo(WGPUCompilationInfoRequestStatus status,const WGPUCompilationInfo * info,ShaderModuleGetCompilationInfoUserdata * data)39     void Server::OnShaderModuleGetCompilationInfo(WGPUCompilationInfoRequestStatus status,
40                                                   const WGPUCompilationInfo* info,
41                                                   ShaderModuleGetCompilationInfoUserdata* data) {
42         ReturnShaderModuleGetCompilationInfoCallbackCmd cmd;
43         cmd.shaderModule = data->shaderModule;
44         cmd.requestSerial = data->requestSerial;
45         cmd.status = status;
46         cmd.info = info;
47 
48         SerializeCommand(cmd);
49     }
50 
51 }}  // namespace dawn_wire::server
52