Make dawn_platform a component.
Bug: None Change-Id: I29c20cd3dac759afee23bdaf5a4391081e29cbaa Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31900 Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
parent
2b6b0f45ff
commit
973d145df8
|
@ -14,11 +14,16 @@
|
||||||
|
|
||||||
import("../../scripts/dawn_overrides_with_defaults.gni")
|
import("../../scripts/dawn_overrides_with_defaults.gni")
|
||||||
|
|
||||||
source_set("dawn_platform") {
|
import("${dawn_root}/scripts/dawn_component.gni")
|
||||||
configs += [ "${dawn_root}/src/common:dawn_internal" ]
|
|
||||||
|
dawn_component("dawn_platform") {
|
||||||
|
DEFINE_PREFIX = "DAWN_PLATFORM"
|
||||||
|
|
||||||
|
configs = [ "${dawn_root}/src/common:dawn_internal" ]
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
"${dawn_root}/src/include/dawn_platform/DawnPlatform.h",
|
"${dawn_root}/src/include/dawn_platform/DawnPlatform.h",
|
||||||
|
"${dawn_root}/src/include/dawn_platform/dawn_platform_export.h",
|
||||||
"DawnPlatform.cpp",
|
"DawnPlatform.cpp",
|
||||||
"tracing/EventTracer.cpp",
|
"tracing/EventTracer.cpp",
|
||||||
"tracing/EventTracer.h",
|
"tracing/EventTracer.h",
|
||||||
|
|
|
@ -12,9 +12,16 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
add_library(dawn_platform STATIC ${DAWN_DUMMY_FILE})
|
add_library(dawn_platform ${DAWN_DUMMY_FILE})
|
||||||
|
|
||||||
|
target_compile_definitions(dawn_platform PRIVATE "DAWN_PLATFORM_IMPLEMENTATION")
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
target_compile_definitions(dawn_platform PRIVATE "DAWN_PLATFORM_SHARED_LIBRARY")
|
||||||
|
endif()
|
||||||
|
|
||||||
target_sources(dawn_platform PRIVATE
|
target_sources(dawn_platform PRIVATE
|
||||||
"${DAWN_INCLUDE_DIR}/dawn_platform/DawnPlatform.h"
|
"${DAWN_INCLUDE_DIR}/dawn_platform/DawnPlatform.h"
|
||||||
|
"${DAWN_INCLUDE_DIR}/dawn_platform/dawn_platform_export.h"
|
||||||
"DawnPlatform.cpp"
|
"DawnPlatform.cpp"
|
||||||
"tracing/EventTracer.cpp"
|
"tracing/EventTracer.cpp"
|
||||||
"tracing/EventTracer.h"
|
"tracing/EventTracer.h"
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
#ifndef DAWNPLATFORM_TRACING_EVENTTRACER_H_
|
#ifndef DAWNPLATFORM_TRACING_EVENTTRACER_H_
|
||||||
#define DAWNPLATFORM_TRACING_EVENTTRACER_H_
|
#define DAWNPLATFORM_TRACING_EVENTTRACER_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include "dawn_platform/dawn_platform_export.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
namespace dawn_platform {
|
namespace dawn_platform {
|
||||||
|
|
||||||
|
@ -26,20 +28,22 @@ namespace dawn_platform {
|
||||||
|
|
||||||
using TraceEventHandle = uint64_t;
|
using TraceEventHandle = uint64_t;
|
||||||
|
|
||||||
const unsigned char* GetTraceCategoryEnabledFlag(Platform* platform,
|
DAWN_PLATFORM_EXPORT const unsigned char* GetTraceCategoryEnabledFlag(
|
||||||
TraceCategory category);
|
Platform* platform,
|
||||||
|
TraceCategory category);
|
||||||
|
|
||||||
// TODO(enga): Simplify this API.
|
// TODO(enga): Simplify this API.
|
||||||
TraceEventHandle AddTraceEvent(Platform* platform,
|
DAWN_PLATFORM_EXPORT TraceEventHandle
|
||||||
char phase,
|
AddTraceEvent(Platform* platform,
|
||||||
const unsigned char* categoryGroupEnabled,
|
char phase,
|
||||||
const char* name,
|
const unsigned char* categoryGroupEnabled,
|
||||||
uint64_t id,
|
const char* name,
|
||||||
int numArgs,
|
uint64_t id,
|
||||||
const char** argNames,
|
int numArgs,
|
||||||
const unsigned char* argTypes,
|
const char** argNames,
|
||||||
const uint64_t* argValues,
|
const unsigned char* argTypes,
|
||||||
unsigned char flags);
|
const uint64_t* argValues,
|
||||||
|
unsigned char flags);
|
||||||
|
|
||||||
} // namespace tracing
|
} // namespace tracing
|
||||||
} // namespace dawn_platform
|
} // namespace dawn_platform
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
#ifndef DAWNPLATFORM_DAWNPLATFORM_H_
|
#ifndef DAWNPLATFORM_DAWNPLATFORM_H_
|
||||||
#define DAWNPLATFORM_DAWNPLATFORM_H_
|
#define DAWNPLATFORM_DAWNPLATFORM_H_
|
||||||
|
|
||||||
#include <dawn_native/dawn_native_export.h>
|
#include "dawn_platform/dawn_platform_export.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace dawn_platform {
|
namespace dawn_platform {
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace dawn_platform {
|
||||||
GPUWork, // Actual GPU work
|
GPUWork, // Actual GPU work
|
||||||
};
|
};
|
||||||
|
|
||||||
class Platform {
|
class DAWN_PLATFORM_EXPORT Platform {
|
||||||
public:
|
public:
|
||||||
Platform();
|
Platform();
|
||||||
virtual ~Platform();
|
virtual ~Platform();
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
// Copyright 2020 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 DAWNPLATFORM_EXPORT_H_
|
||||||
|
#define DAWNPLATFORM_EXPORT_H_
|
||||||
|
|
||||||
|
#if defined(DAWN_PLATFORM_SHARED_LIBRARY)
|
||||||
|
# if defined(_WIN32)
|
||||||
|
# if defined(DAWN_PLATFORM_IMPLEMENTATION)
|
||||||
|
# define DAWN_PLATFORM_EXPORT __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define DAWN_PLATFORM_EXPORT __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
# else // defined(_WIN32)
|
||||||
|
# if defined(DAWN_PLATFORM_IMPLEMENTATION)
|
||||||
|
# define DAWN_PLATFORM_EXPORT __attribute__((visibility("default")))
|
||||||
|
# else
|
||||||
|
# define DAWN_PLATFORM_EXPORT
|
||||||
|
# endif
|
||||||
|
# endif // defined(_WIN32)
|
||||||
|
#else // defined(DAWN_PLATFORM_SHARED_LIBRARY)
|
||||||
|
# define DAWN_PLATFORM_EXPORT
|
||||||
|
#endif // defined(DAWN_PLATFORM_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
#endif // DAWNPLATFORM_EXPORT_H_
|
Loading…
Reference in New Issue