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")
|
||||
|
||||
source_set("dawn_platform") {
|
||||
configs += [ "${dawn_root}/src/common:dawn_internal" ]
|
||||
import("${dawn_root}/scripts/dawn_component.gni")
|
||||
|
||||
dawn_component("dawn_platform") {
|
||||
DEFINE_PREFIX = "DAWN_PLATFORM"
|
||||
|
||||
configs = [ "${dawn_root}/src/common:dawn_internal" ]
|
||||
|
||||
sources = [
|
||||
"${dawn_root}/src/include/dawn_platform/DawnPlatform.h",
|
||||
"${dawn_root}/src/include/dawn_platform/dawn_platform_export.h",
|
||||
"DawnPlatform.cpp",
|
||||
"tracing/EventTracer.cpp",
|
||||
"tracing/EventTracer.h",
|
||||
|
|
|
@ -12,9 +12,16 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# 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
|
||||
"${DAWN_INCLUDE_DIR}/dawn_platform/DawnPlatform.h"
|
||||
"${DAWN_INCLUDE_DIR}/dawn_platform/dawn_platform_export.h"
|
||||
"DawnPlatform.cpp"
|
||||
"tracing/EventTracer.cpp"
|
||||
"tracing/EventTracer.h"
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
#ifndef DAWNPLATFORM_TRACING_EVENTTRACER_H_
|
||||
#define DAWNPLATFORM_TRACING_EVENTTRACER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "dawn_platform/dawn_platform_export.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace dawn_platform {
|
||||
|
||||
|
@ -26,20 +28,22 @@ namespace dawn_platform {
|
|||
|
||||
using TraceEventHandle = uint64_t;
|
||||
|
||||
const unsigned char* GetTraceCategoryEnabledFlag(Platform* platform,
|
||||
TraceCategory category);
|
||||
DAWN_PLATFORM_EXPORT const unsigned char* GetTraceCategoryEnabledFlag(
|
||||
Platform* platform,
|
||||
TraceCategory category);
|
||||
|
||||
// TODO(enga): Simplify this API.
|
||||
TraceEventHandle AddTraceEvent(Platform* platform,
|
||||
char phase,
|
||||
const unsigned char* categoryGroupEnabled,
|
||||
const char* name,
|
||||
uint64_t id,
|
||||
int numArgs,
|
||||
const char** argNames,
|
||||
const unsigned char* argTypes,
|
||||
const uint64_t* argValues,
|
||||
unsigned char flags);
|
||||
DAWN_PLATFORM_EXPORT TraceEventHandle
|
||||
AddTraceEvent(Platform* platform,
|
||||
char phase,
|
||||
const unsigned char* categoryGroupEnabled,
|
||||
const char* name,
|
||||
uint64_t id,
|
||||
int numArgs,
|
||||
const char** argNames,
|
||||
const unsigned char* argTypes,
|
||||
const uint64_t* argValues,
|
||||
unsigned char flags);
|
||||
|
||||
} // namespace tracing
|
||||
} // namespace dawn_platform
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
#ifndef 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 {
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace dawn_platform {
|
|||
GPUWork, // Actual GPU work
|
||||
};
|
||||
|
||||
class Platform {
|
||||
class DAWN_PLATFORM_EXPORT Platform {
|
||||
public:
|
||||
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