Make dawn_wire a shared library

Also moves the TerribleCommandBuffer to utils:: because it isn't part of
the implementation of the wire, renames dawn::wire to dawn_wire, moves
src/wire to src/dawn_wire and puts the interface of dawn_wire in
src/include/dawn_wire.
This commit is contained in:
Corentin Wallez
2018-07-26 15:07:57 +02:00
committed by Corentin Wallez
parent 012c149fd9
commit bdc867713a
18 changed files with 154 additions and 112 deletions

View File

@@ -0,0 +1,37 @@
# Copyright 2017 The Dawn Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(DAWN_WIRE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(DAWN_WIRE_INCLUDE_DIR ${INCLUDE_DIR}/dawn_wire)
Generate(
LIB_NAME dawn_wire_autogen
LIB_TYPE OBJECT
FOLDER "wire"
PRINT_NAME "dawn_wire autogenerated files"
COMMAND_LINE_ARGS
${GENERATOR_COMMON_ARGS}
-T dawn_wire
)
target_compile_definitions(dawn_wire_autogen PRIVATE DAWN_WIRE_IMPLEMENTATION)
add_library(dawn_wire SHARED
$<TARGET_OBJECTS:dawn_wire_autogen>
${DAWN_WIRE_DIR}/WireCmd.h
${DAWN_WIRE_INCLUDE_DIR}/Wire.h
${DAWN_WIRE_INCLUDE_DIR}/dawn_wire_export.h
)
target_link_libraries(dawn_wire dawn_common)
target_compile_definitions(dawn_wire PRIVATE DAWN_WIRE_IMPLEMENTATION)
DawnInternalTarget("wire" dawn_wire)

68
src/dawn_wire/WireCmd.h Normal file
View File

@@ -0,0 +1,68 @@
// Copyright 2017 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef DAWNWIRE_WIRECMD_H_
#define DAWNWIRE_WIRECMD_H_
#include <dawn/dawn.h>
#include "dawn_wire/WireCmd_autogen.h"
namespace dawn_wire {
struct ReturnDeviceErrorCallbackCmd {
ReturnWireCmd commandId = ReturnWireCmd::DeviceErrorCallback;
size_t messageStrlen;
};
struct BufferMapAsyncCmd {
WireCmd commandId = WireCmd::BufferMapAsync;
ObjectId bufferId;
ObjectSerial requestSerial;
uint32_t start;
uint32_t size;
bool isWrite;
};
struct ReturnBufferMapReadAsyncCallbackCmd {
ReturnWireCmd commandId = ReturnWireCmd::BufferMapReadAsyncCallback;
ObjectId bufferId;
ObjectSerial bufferSerial;
uint32_t requestSerial;
uint32_t status;
uint32_t dataLength;
};
struct ReturnBufferMapWriteAsyncCallbackCmd {
ReturnWireCmd commandId = ReturnWireCmd::BufferMapWriteAsyncCallback;
ObjectId bufferId;
ObjectSerial bufferSerial;
uint32_t requestSerial;
uint32_t status;
};
struct BufferUpdateMappedDataCmd {
WireCmd commandId = WireCmd::BufferUpdateMappedDataCmd;
ObjectId bufferId;
uint32_t dataLength;
};
} // namespace dawn_wire
#endif // DAWNWIRE_WIRECMD_H_