Add **Web platform with Emscripten**
This commit is contained in:
@@ -45,7 +45,9 @@
|
||||
#define GPU_USE_WINDOW_SRV 1
|
||||
|
||||
// True if allow graphics profile events and markers
|
||||
#ifndef GPU_ALLOW_PROFILE_EVENTS
|
||||
#define GPU_ALLOW_PROFILE_EVENTS (!BUILD_RELEASE)
|
||||
#endif
|
||||
|
||||
// True if allow hardware tessellation shaders (Hull and Domain shaders)
|
||||
#ifndef GPU_ALLOW_TESSELLATION_SHADERS
|
||||
@@ -58,7 +60,9 @@
|
||||
#endif
|
||||
|
||||
// Enable/disable creating GPU resources on separate threads (otherwise only the main thread can be used)
|
||||
#ifndef GPU_ENABLE_ASYNC_RESOURCES_CREATION
|
||||
#define GPU_ENABLE_ASYNC_RESOURCES_CREATION 1
|
||||
#endif
|
||||
|
||||
// Enable/disable force shaders recompilation
|
||||
#define GPU_FORCE_RECOMPILE_SHADERS 0
|
||||
|
||||
@@ -96,6 +96,10 @@ public class Graphics : EngineModule
|
||||
else
|
||||
Log.WarningOnce(string.Format("Building for {0} without Vulkan rendering backend (Vulkan SDK is missing)", options.Platform.Target), ref _logMissingVulkanSDK);
|
||||
break;
|
||||
case TargetPlatform.Web:
|
||||
options.PrivateDependencies.Add("GraphicsDeviceNull");
|
||||
// TODO: add WebGPU
|
||||
break;
|
||||
default: throw new InvalidPlatformException(options.Platform.Target);
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ GPUTexture* RenderBuffers::RequestHiZ(GPUContext* context, bool fullRes, int32 m
|
||||
|
||||
// Allocate or resize buffer (with full mip-chain)
|
||||
// TODO: migrate to inverse depth and try using r16 again as default (should have no artifacts anymore)
|
||||
auto format = PLATFORM_ANDROID || PLATFORM_IOS || PLATFORM_SWITCH ? PixelFormat::R16_UInt : PixelFormat::R32_Float;
|
||||
auto format = PLATFORM_WEB || PLATFORM_ANDROID || PLATFORM_IOS || PLATFORM_SWITCH ? PixelFormat::R16_UInt : PixelFormat::R32_Float;
|
||||
auto width = fullRes ? _width : Math::Max(_width >> 1, 1);
|
||||
auto height = fullRes ? _height : Math::Max(_height >> 1, 1);
|
||||
auto desc = GPUTextureDescription::New2D(width, height, mipLevels, format, GPUTextureFlags::ShaderResource);
|
||||
|
||||
Reference in New Issue
Block a user