Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 32 additions & 12 deletions BuildTools/CMake/BuildUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,21 @@ function(set_common_target_properties TARGET)
custom_post_configure_target(${TARGET})
endif()

# Mark generated files as such to avoid "file not found" warnings in some IDEs in configuration stage
if (WEBGPU_SUPPORTED AND (NOT PLATFORM_WEB))
set(DAWN_GENERATED_HEADERS
${DAWN_BUILD_GEN_DIR}/include/dawn/webgpu.h
${DAWN_BUILD_GEN_DIR}/include/dawn/webgpu_cpp.h
${DAWN_BUILD_GEN_DIR}/include/dawn/webgpu_cpp_print.h
${DAWN_BUILD_GEN_DIR}/include/dawn/wire/client/webgpu.h
${DAWN_BUILD_GEN_DIR}/include/dawn/wire/client/webgpu_cpp.h
${DAWN_BUILD_GEN_DIR}/include/dawn/wire/client/webgpu_cpp_print.h
${DAWN_BUILD_GEN_DIR}/include/dawn/dawn_proc_table.h
${DAWN_BUILD_GEN_DIR}/include/webgpu/webgpu_cpp_chained_struct.h
)
set_source_files_properties(${DAWN_GENERATED_HEADERS} PROPERTIES GENERATED TRUE)
endif()

endfunction()

function(find_targets_in_directory _RESULT _DIR)
Expand Down Expand Up @@ -466,24 +481,29 @@ function(add_format_validation_target MODULE_NAME MODULE_ROOT_PATH IDE_FOLDER)

endfunction()

# FetchContent's GIT_SHALLOW option is buggy and does not actually do a shallow
# clone. This macro takes care of it.
macro(FetchContent_DeclareShallowGit Name GIT_REPOSITORY GitRepository GIT_TAG GitTag)
# The GIT_SHALLOW option in FetchContent is buggy and does not actually perform
# a shallow clone. This macro fixes that. Also, we do not want to clone all
# submodules to reduce download time, therefore we add an option GIT_SUBMODULES
# to specify which submodules should be cloned (if any).
macro(FetchContent_DeclareShallowGit Name GIT_REPOSITORY GitRepository GIT_TAG GitTag GIT_SUBMODULES GitSubmodules)
include(FetchContent)
FetchContent_Declare(
"${Name}"

# This is what it'd look like if GIT_SHALLOW was indeed working:
#GIT_REPOSITORY "${GitRepository}"
#GIT_TAG "${GitTag}"
#GIT_SHALLOW ON
# This is what it'd look like if GIT_SHALLOW was indeed working:
#GIT_REPOSITORY "${GitRepository}"
#GIT_TAG "${GitTag}"
#GIT_SHALLOW ON
#GIT_SUBMODULES "${GitSubmodules}"

# Manual download mode instead:
# Manual download mode instead:
FetchContent_Declare(
${Name}
DOWNLOAD_COMMAND
cd "${FETCHCONTENT_BASE_DIR}/${Name}-src" &&
git init &&
git fetch --depth=1 "${GitRepository}" "${GitTag}" &&
git reset --hard FETCH_HEAD
git remote add origin "${GitRepository}" &&
git fetch --depth=1 origin "${GitTag}" &&
git checkout FETCH_HEAD &&
git submodule update --init --recursive --depth=1 ${GitSubmodules}
)
endmacro()

Expand Down
1 change: 0 additions & 1 deletion Common/interface/ParsingTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,6 @@ TokenIterType FindMatchingBracket(const TokenIterType& Start,
ClosingBracketType = TokenType::OpenSquareBracket;
SearchForward = false;
break;

case TokenType::ClosingAngleBracket:
ClosingBracketType = TokenType::OpenAngleBracket;
SearchForward = false;
Expand Down
7 changes: 6 additions & 1 deletion Graphics/GraphicsEngineWebGPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ PRIVATE
)

if (PLATFORM_WEB)
target_link_options(Diligent-GraphicsEngineWebGPU-static PUBLIC "SHELL: -s USE_WEBGPU=1 -s USE_PTHREADS=1")
target_link_options(Diligent-GraphicsEngineWebGPU-static PUBLIC "SHELL: --use-port=emdawnwebgpu -s USE_PTHREADS=1")
target_compile_options(Diligent-GraphicsEngineWebGPU-static PUBLIC "--use-port=emdawnwebgpu")
# This is required only for IntelliSense to detect webgpu.h.
target_include_directories(Diligent-GraphicsEngineWebGPU-static PUBLIC
${EMSCRIPTEN_ROOT_PATH}/cache/ports/emdawnwebgpu/emdawnwebgpu_pkg/webgpu/include
)
endif()

target_compile_definitions(Diligent-GraphicsEngineWebGPU-shared PUBLIC DILIGENT_WEBGPU_SHARED=1)
Expand Down
11 changes: 0 additions & 11 deletions Graphics/GraphicsEngineWebGPU/include/WebGPUStubs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,5 @@
#if PLATFORM_WEB

inline constexpr WGPUFeatureName WGPUFeatureName_ChromiumExperimentalTimestampQueryInsidePasses = static_cast<WGPUFeatureName>(0x000003EE);
inline constexpr WGPUFeatureName WGPUFeatureName_Unorm16TextureFormats = static_cast<WGPUFeatureName>(0x000003FB);
inline constexpr WGPUFeatureName WGPUFeatureName_Snorm16TextureFormats = static_cast<WGPUFeatureName>(0x000003FC);

inline constexpr WGPUTextureFormat WGPUTextureFormat_R16Unorm = static_cast<WGPUTextureFormat>(0x00000060);
inline constexpr WGPUTextureFormat WGPUTextureFormat_R16Snorm = static_cast<WGPUTextureFormat>(0x00000063);
inline constexpr WGPUTextureFormat WGPUTextureFormat_RG16Unorm = static_cast<WGPUTextureFormat>(0x00000061);
inline constexpr WGPUTextureFormat WGPUTextureFormat_RG16Snorm = static_cast<WGPUTextureFormat>(0x00000064);
inline constexpr WGPUTextureFormat WGPUTextureFormat_RGBA16Unorm = static_cast<WGPUTextureFormat>(0x00000062);
inline constexpr WGPUTextureFormat WGPUTextureFormat_RGBA16Snorm = static_cast<WGPUTextureFormat>(0x00000065);

inline constexpr WGPUSurfaceGetCurrentTextureStatus WGPUSurfaceGetCurrentTextureStatus_Error = static_cast<WGPUSurfaceGetCurrentTextureStatus>(0x00000007);

#endif
42 changes: 3 additions & 39 deletions Graphics/GraphicsEngineWebGPU/include/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,45 +37,11 @@

#if PLATFORM_WEB

using WGPUOptionalBool = bool;
using WGPUShaderSourceWGSL = WGPUShaderModuleWGSLDescriptor;
using WGPUStringView = const char*;
using WGPUSurfaceSourceCanvasHTMLSelector_Emscripten = WGPUSurfaceDescriptorFromCanvasHTMLSelector;
using WGPUSurfaceSourceCanvasHTMLSelector_Emscripten = WGPUEmscriptenSurfaceSourceCanvasHTMLSelector;

constexpr bool WGPUOptionalBool_True = true;
constexpr bool WGPUOptionalBool_False = false;
constexpr WGPUSType WGPUSType_SurfaceSourceCanvasHTMLSelector_Emscripten = WGPUSType_EmscriptenSurfaceSourceCanvasHTMLSelector;

constexpr WGPUSType WGPUSType_ShaderSourceWGSL = WGPUSType_ShaderModuleWGSLDescriptor;
constexpr WGPUSType WGPUSType_SurfaceSourceCanvasHTMLSelector_Emscripten = WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector;

constexpr WGPUBufferBindingType WGPUBufferBindingType_BindingNotUsed = WGPUBufferBindingType_Undefined;
constexpr WGPUSamplerBindingType WGPUSamplerBindingType_BindingNotUsed = WGPUSamplerBindingType_Undefined;
constexpr WGPUTextureSampleType WGPUTextureSampleType_BindingNotUsed = WGPUTextureSampleType_Undefined;
constexpr WGPUStorageTextureAccess WGPUStorageTextureAccess_BindingNotUsed = WGPUStorageTextureAccess_Undefined;

constexpr WGPUFeatureName WGPUFeatureName_DualSourceBlending = static_cast<WGPUFeatureName>(0x00050008);

inline bool WGPUStringViewValid(WGPUStringView Str)
{
return Str != nullptr && Str[0] != '\0';
}

inline const char* WGPUStringViewToString(WGPUStringView Str)
{
return Str;
}

inline WGPUStringView GetWGPUStringView(const std::string& Str)
{
return Str.c_str();
}

inline WGPUStringView GetWGPUStringView(const char* Str)
{
return Str;
}

#else
#endif

inline bool WGPUStringViewValid(const WGPUStringView& Str)
{
Expand All @@ -102,5 +68,3 @@ inline WGPUStringView GetWGPUStringView(const char* Str)
{
return {Str, Str ? strlen(Str) : 0};
}

#endif
Loading