mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-03 13:11:34 +00:00
The functionality of the dawn_headers and libdawn targets are split into the following targets: - dawn_headers: the new version only exposes the "dawn.h" C API and no longer includes the C++ API. - dawncpp: the header and implementation of the C++ API that wraps the C API. This is unbundled from the rest so the C++ API can be used with libdawn_proc or other libraries implementing the C API. - libdawn_proc: A DawnProcTable-backend implementation of the C API. This is needed because in follow-up commit there will be three libraries implementing the C API: libdawn_proc that trampolines where we want, and libdawn_native/wire that don't have trampolines for better perf. BUG=dawn:22 Change-Id: I5d941f0d98e5a4b633e14d67eb5269f7924f0647 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12160 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
108 lines
3.7 KiB
C
108 lines
3.7 KiB
C
//* 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 DAWN_DAWN_H_
|
|
#define DAWN_DAWN_H_
|
|
|
|
#include "dawn/dawn_export.h"
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <stdbool.h>
|
|
|
|
const uint64_t DAWN_WHOLE_SIZE = 0xffffffffffffffffULL; // UINT64_MAX
|
|
|
|
{% for type in by_category["object"] %}
|
|
typedef struct {{as_cType(type.name)}}Impl* {{as_cType(type.name)}};
|
|
{% endfor %}
|
|
|
|
{% for type in by_category["enum"] + by_category["bitmask"] %}
|
|
typedef enum {{as_cType(type.name)}} {
|
|
{% for value in type.values %}
|
|
{{as_cEnum(type.name, value.name)}} = 0x{{format(value.value, "08X")}},
|
|
{% endfor %}
|
|
{{as_cEnum(type.name, Name("force32"))}} = 0x7FFFFFFF
|
|
} {{as_cType(type.name)}};
|
|
|
|
{% endfor %}
|
|
|
|
{% for type in by_category["structure"] %}
|
|
typedef struct {{as_cType(type.name)}} {
|
|
{% if type.extensible %}
|
|
void const * nextInChain;
|
|
{% endif %}
|
|
{% for member in type.members %}
|
|
{{as_annotated_cType(member)}};
|
|
{% endfor %}
|
|
} {{as_cType(type.name)}};
|
|
|
|
{% endfor %}
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// Custom types depending on the target language
|
|
typedef void (*DawnErrorCallback)(DawnErrorType type, const char* message, void* userdata);
|
|
typedef void (*DawnBufferCreateMappedCallback)(DawnBufferMapAsyncStatus status,
|
|
DawnCreateBufferMappedResult result,
|
|
void* userdata);
|
|
typedef void (*DawnBufferMapReadCallback)(DawnBufferMapAsyncStatus status,
|
|
const void* data,
|
|
uint64_t dataLength,
|
|
void* userdata);
|
|
typedef void (*DawnBufferMapWriteCallback)(DawnBufferMapAsyncStatus status,
|
|
void* data,
|
|
uint64_t dataLength,
|
|
void* userdata);
|
|
typedef void (*DawnFenceOnCompletionCallback)(DawnFenceCompletionStatus status, void* userdata);
|
|
|
|
#if !defined(DAWN_SKIP_PROCS)
|
|
|
|
{% for type in by_category["object"] %}
|
|
// Procs of {{type.name.CamelCase()}}
|
|
{% for method in native_methods(type) %}
|
|
typedef {{as_cType(method.return_type.name)}} (*{{as_cProc(type.name, method.name)}})(
|
|
{{-as_cType(type.name)}} {{as_varName(type.name)}}
|
|
{%- for arg in method.arguments -%}
|
|
, {{as_annotated_cType(arg)}}
|
|
{%- endfor -%}
|
|
);
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
#endif // !defined(DAWN_SKIP_PROCS)
|
|
|
|
#if !defined(DAWN_SKIP_DECLARATIONS)
|
|
|
|
{% for type in by_category["object"] %}
|
|
// Methods of {{type.name.CamelCase()}}
|
|
{% for method in native_methods(type) %}
|
|
DAWN_EXPORT {{as_cType(method.return_type.name)}} {{as_cMethod(type.name, method.name)}}(
|
|
{{-as_cType(type.name)}} {{as_varName(type.name)}}
|
|
{%- for arg in method.arguments -%}
|
|
, {{as_annotated_cType(arg)}}
|
|
{%- endfor -%}
|
|
);
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
#endif // !defined(DAWN_SKIP_DECLARATIONS)
|
|
|
|
#ifdef __cplusplus
|
|
} // extern "C"
|
|
#endif
|
|
|
|
#endif // DAWN_DAWN_H_
|