mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 05:27:49 +00:00
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:
committed by
Corentin Wallez
parent
012c149fd9
commit
bdc867713a
@@ -389,7 +389,7 @@ def debug(text):
|
||||
print(text)
|
||||
|
||||
def main():
|
||||
targets = ['dawn_headers', 'libdawn', 'mock_dawn', 'opengl', 'metal', 'd3d12', 'null', 'wire', "dawn_native_utils"]
|
||||
targets = ['dawn_headers', 'libdawn', 'mock_dawn', 'opengl', 'metal', 'd3d12', 'null', 'dawn_wire', "dawn_native_utils"]
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description = 'Generates code for various target for Dawn.',
|
||||
@@ -482,11 +482,11 @@ def main():
|
||||
renders.append(FileRender('dawn_native/api_structs.h', 'dawn_native/dawn_structs_autogen.h', base_backend_params))
|
||||
renders.append(FileRender('dawn_native/api_structs.cpp', 'dawn_native/dawn_structs_autogen.cpp', base_backend_params))
|
||||
|
||||
if 'wire' in targets:
|
||||
renders.append(FileRender('wire/WireCmd.h', 'wire/WireCmd_autogen.h', base_backend_params))
|
||||
renders.append(FileRender('wire/WireCmd.cpp', 'wire/WireCmd_autogen.cpp', base_backend_params))
|
||||
renders.append(FileRender('wire/WireClient.cpp', 'wire/WireClient.cpp', base_backend_params))
|
||||
renders.append(FileRender('wire/WireServer.cpp', 'wire/WireServer.cpp', base_backend_params))
|
||||
if 'dawn_wire' in targets:
|
||||
renders.append(FileRender('dawn_wire/WireCmd.h', 'dawn_wire/WireCmd_autogen.h', base_backend_params))
|
||||
renders.append(FileRender('dawn_wire/WireCmd.cpp', 'dawn_wire/WireCmd_autogen.cpp', base_backend_params))
|
||||
renders.append(FileRender('dawn_wire/WireClient.cpp', 'dawn_wire/WireClient.cpp', base_backend_params))
|
||||
renders.append(FileRender('dawn_wire/WireServer.cpp', 'dawn_wire/WireServer.cpp', base_backend_params))
|
||||
|
||||
output_separator = '\n' if args.gn else ';'
|
||||
if args.print_dependencies:
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
//* See the License for the specific language governing permissions and
|
||||
//* limitations under the License.
|
||||
|
||||
#include "wire/Wire.h"
|
||||
#include "wire/WireCmd.h"
|
||||
#include "dawn_wire/Wire.h"
|
||||
#include "dawn_wire/WireCmd.h"
|
||||
|
||||
#include "common/Assert.h"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace dawn { namespace wire {
|
||||
namespace dawn_wire {
|
||||
|
||||
//* Client side implementation of the API, will serialize everything to memory to send to the server side.
|
||||
namespace client {
|
||||
@@ -194,7 +194,7 @@ namespace dawn { namespace wire {
|
||||
|
||||
//* The client wire uses the global Dawn device to store its global data such as the serializer
|
||||
//* and the object id allocators.
|
||||
class Device : public ObjectBase, public wire::ObjectIdProvider {
|
||||
class Device : public ObjectBase, public ObjectIdProvider {
|
||||
public:
|
||||
Device(CommandSerializer* serializer)
|
||||
: ObjectBase(this, 1, 1),
|
||||
@@ -247,7 +247,7 @@ namespace dawn { namespace wire {
|
||||
) {
|
||||
{{as_backendType(type)}} self = reinterpret_cast<{{as_backendType(type)}}>(cSelf);
|
||||
Device* device = self->device;
|
||||
wire::{{Suffix}}Cmd cmd;
|
||||
{{Suffix}}Cmd cmd;
|
||||
|
||||
//* Create the structure going on the wire on the stack and fill it with the value
|
||||
//* arguments so it can compute its size.
|
||||
@@ -306,7 +306,7 @@ namespace dawn { namespace wire {
|
||||
|
||||
obj->builderCallback.Call(DAWN_BUILDER_ERROR_STATUS_UNKNOWN, "Unknown");
|
||||
|
||||
wire::{{as_MethodSuffix(type.name, Name("destroy"))}}Cmd cmd;
|
||||
{{as_MethodSuffix(type.name, Name("destroy"))}}Cmd cmd;
|
||||
cmd.objectId = obj->id;
|
||||
|
||||
auto allocCmd = static_cast<decltype(cmd)*>(obj->device->GetCmdSpace(sizeof(cmd)));
|
||||
@@ -332,7 +332,7 @@ namespace dawn { namespace wire {
|
||||
request.isWrite = false;
|
||||
buffer->requests[serial] = request;
|
||||
|
||||
wire::BufferMapAsyncCmd cmd;
|
||||
BufferMapAsyncCmd cmd;
|
||||
cmd.bufferId = buffer->id;
|
||||
cmd.requestSerial = serial;
|
||||
cmd.start = start;
|
||||
@@ -354,7 +354,7 @@ namespace dawn { namespace wire {
|
||||
request.isWrite = true;
|
||||
buffer->requests[serial] = request;
|
||||
|
||||
wire::BufferMapAsyncCmd cmd;
|
||||
BufferMapAsyncCmd cmd;
|
||||
cmd.bufferId = buffer->id;
|
||||
cmd.requestSerial = serial;
|
||||
cmd.start = start;
|
||||
@@ -379,7 +379,7 @@ namespace dawn { namespace wire {
|
||||
|
||||
// If the buffer was mapped for writing, send the update to the data to the server
|
||||
if (buffer->isWriteMapped) {
|
||||
wire::BufferUpdateMappedDataCmd cmd;
|
||||
BufferUpdateMappedDataCmd cmd;
|
||||
cmd.bufferId = buffer->id;
|
||||
cmd.dataLength = static_cast<uint32_t>(buffer->mappedDataSize);
|
||||
|
||||
@@ -673,4 +673,4 @@ namespace dawn { namespace wire {
|
||||
return new client::Client(clientDevice);
|
||||
}
|
||||
|
||||
}} // namespace dawn::wire
|
||||
} // namespace dawn_wire
|
||||
@@ -12,7 +12,7 @@
|
||||
//* See the License for the specific language governing permissions and
|
||||
//* limitations under the License.
|
||||
|
||||
#include "wire/WireCmd.h"
|
||||
#include "dawn_wire/WireCmd.h"
|
||||
|
||||
#include "common/Assert.h"
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
struct {{name}}Transfer {
|
||||
{% if is_method %}
|
||||
//* Start the transfer structure with the command ID, so that casting to WireCmd gives the ID.
|
||||
wire::{{Return}}WireCmd commandId;
|
||||
{{Return}}WireCmd commandId;
|
||||
|
||||
//* Methods always have an implicit "self" argument.
|
||||
ObjectId self;
|
||||
@@ -150,7 +150,7 @@
|
||||
transfer->resultSerial = record.resultSerial;
|
||||
{% endif %}
|
||||
|
||||
transfer->commandId = wire::{{Return}}WireCmd::{{name}};
|
||||
transfer->commandId = {{Return}}WireCmd::{{name}};
|
||||
transfer->self = provider.GetId(record.self);
|
||||
{% endif %}
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
record->resultSerial = transfer->resultSerial;
|
||||
{% endif %}
|
||||
|
||||
ASSERT(transfer->commandId == wire::{{Return}}WireCmd::{{name}});
|
||||
ASSERT(transfer->commandId == {{Return}}WireCmd::{{name}});
|
||||
|
||||
record->selfId = transfer->self;
|
||||
//* This conversion is done after the copying of result* and selfId: Deserialize
|
||||
@@ -258,7 +258,7 @@
|
||||
}
|
||||
{% endmacro %}
|
||||
|
||||
namespace dawn { namespace wire {
|
||||
namespace dawn_wire {
|
||||
|
||||
// Macro to simplify error handling, similar to DAWN_TRY but for DeserializeResult.
|
||||
#define DESERIALIZE_TRY(EXPR) \
|
||||
@@ -344,4 +344,4 @@ namespace dawn { namespace wire {
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
}} // namespace dawn::wire
|
||||
} // namespace dawn_wire
|
||||
@@ -12,10 +12,10 @@
|
||||
//* See the License for the specific language governing permissions and
|
||||
//* limitations under the License.
|
||||
|
||||
#ifndef WIRE_WIRECMD_AUTOGEN_H_
|
||||
#define WIRE_WIRECMD_AUTOGEN_H_
|
||||
#ifndef DAWNWIRE_WIRECMD_AUTOGEN_H_
|
||||
#define DAWNWIRE_WIRECMD_AUTOGEN_H_
|
||||
|
||||
namespace dawn { namespace wire {
|
||||
namespace dawn_wire {
|
||||
|
||||
using ObjectId = uint32_t;
|
||||
using ObjectSerial = uint32_t;
|
||||
@@ -131,7 +131,7 @@ namespace dawn { namespace wire {
|
||||
//* Command for the server calling a builder status callback.
|
||||
{% for type in by_category["object"] if type.is_builder %}
|
||||
struct Return{{type.name.CamelCase()}}ErrorCallbackCmd {
|
||||
wire::ReturnWireCmd commandId = ReturnWireCmd::{{type.name.CamelCase()}}ErrorCallback;
|
||||
ReturnWireCmd commandId = ReturnWireCmd::{{type.name.CamelCase()}}ErrorCallback;
|
||||
|
||||
ObjectId builtObjectId;
|
||||
ObjectSerial builtObjectSerial;
|
||||
@@ -140,6 +140,6 @@ namespace dawn { namespace wire {
|
||||
};
|
||||
{% endfor %}
|
||||
|
||||
}} // namespace dawn::wire
|
||||
} // namespace dawn_wire
|
||||
|
||||
#endif // WIRE_WIRECMD_AUTOGEN_H_
|
||||
#endif // DAWNWIRE_WIRECMD_AUTOGEN_H_
|
||||
@@ -12,8 +12,8 @@
|
||||
//* See the License for the specific language governing permissions and
|
||||
//* limitations under the License.
|
||||
|
||||
#include "wire/Wire.h"
|
||||
#include "wire/WireCmd.h"
|
||||
#include "dawn_wire/Wire.h"
|
||||
#include "dawn_wire/WireCmd.h"
|
||||
|
||||
#include "common/Assert.h"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
namespace dawn { namespace wire {
|
||||
namespace dawn_wire {
|
||||
|
||||
namespace server {
|
||||
class Server;
|
||||
@@ -626,4 +626,4 @@ namespace dawn { namespace wire {
|
||||
return new server::Server(device, procs, serializer);
|
||||
}
|
||||
|
||||
}} // namespace dawn::wire
|
||||
} // namespace dawn_wire
|
||||
Reference in New Issue
Block a user