Add label to the trace events for pipeline and shader module creation

This patch adds the object label to the trace events for the creation
of pipeline and shader module so that we can easily know which shader
module or pipeline creation task the trace event belongs to.

BUG=dawn:1167

Change-Id: Ic2de4542d0167437eea2fd600d0f0be3bdd225f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70041
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Jiawei Shao
2021-11-21 11:18:19 +00:00
committed by Dawn LUCI CQ
parent bd3e042383
commit 4e3ddbd955
5 changed files with 60 additions and 30 deletions

View File

@@ -840,20 +840,18 @@ namespace dawn_platform { namespace TraceEvent {
// Define setTraceValue for each allowed type. It stores the type and
// value in the return arguments. This allows this API to avoid declaring any
// structures so that it is portable to third_party libraries.
#define INTERNAL_DECLARE_SET_TRACE_VALUE(actual_type, union_member, value_type_id) \
static inline void setTraceValue(actual_type arg, unsigned char* type, \
unsigned long long* value) { \
TraceValueUnion typeValue; \
typeValue.union_member = arg; \
*type = value_type_id; \
*value = typeValue.m_uint; \
#define INTERNAL_DECLARE_SET_TRACE_VALUE(actual_type, union_member, value_type_id) \
static inline void setTraceValue(actual_type arg, unsigned char* type, uint64_t* value) { \
TraceValueUnion typeValue; \
typeValue.union_member = arg; \
*type = value_type_id; \
*value = typeValue.m_uint; \
}
// Simpler form for int types that can be safely casted.
#define INTERNAL_DECLARE_SET_TRACE_VALUE_INT(actual_type, value_type_id) \
static inline void setTraceValue(actual_type arg, unsigned char* type, \
unsigned long long* value) { \
*type = value_type_id; \
*value = static_cast<unsigned long long>(arg); \
#define INTERNAL_DECLARE_SET_TRACE_VALUE_INT(actual_type, value_type_id) \
static inline void setTraceValue(actual_type arg, unsigned char* type, uint64_t* value) { \
*type = value_type_id; \
*value = static_cast<unsigned long long>(arg); \
}
INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned long long, TRACE_VALUE_TYPE_UINT)
@@ -877,7 +875,7 @@ namespace dawn_platform { namespace TraceEvent {
static inline void setTraceValue(const std::string& arg,
unsigned char* type,
unsigned long long* value) {
uint64_t* value) {
TraceValueUnion typeValue;
typeValue.m_string = arg.data();
*type = TRACE_VALUE_TYPE_COPY_STRING;