Compare commits

...

3 Commits

Author SHA1 Message Date
Konrad Piascik
04efb9e18d Fix validation error on gltf_viewer
Inline header defined method to remove compiler warning
2025-06-17 09:23:58 -04:00
Konrad Piascik
c2c744b06d webgpu: Implement driver limits 2025-06-17 09:23:40 -04:00
Konrad Piascik
1e246d1332 webgpu: Remove warning since most samples are now functional 2025-06-17 09:23:40 -04:00
3 changed files with 25 additions and 11 deletions

View File

@@ -172,11 +172,15 @@ SPDPipeline& MipmapGenerator::GetOrCreatePipeline(const PipelineCacheKey& key) {
entry.binding = i;
entry.visibility = wgpu::ShaderStage::Compute;
if (i == 0) {
entry.texture.sampleType = (key.scalarType == SPDScalarType::I32)
? wgpu::TextureSampleType::Sint
: (key.scalarType == SPDScalarType::U32)
? wgpu::TextureSampleType::Uint
: wgpu::TextureSampleType::UnfilterableFloat;
if (key.scalarType == SPDScalarType::I32) {
entry.texture.sampleType = wgpu::TextureSampleType::Sint;
} else if (key.scalarType == SPDScalarType::U32) {
entry.texture.sampleType = wgpu::TextureSampleType::Uint;
} else if (key.scalarType == SPDScalarType::F32 || key.scalarType == SPDScalarType::F16) {
entry.texture.sampleType = wgpu::TextureSampleType::Float;
} else {
entry.texture.sampleType = wgpu::TextureSampleType::UnfilterableFloat;
}
entry.texture.viewDimension = wgpu::TextureViewDimension::e2DArray;
} else {
entry.storageTexture.access = wgpu::StorageTextureAccess::WriteOnly;

View File

@@ -337,9 +337,6 @@ void WebGPUDriver::createSwapChainR(Handle<HwSwapChain> sch, void* nativeWindow,
mDevice, flags);
assert_invariant(mSwapChain);
FWGPU_LOGW << "WebGPU support is highly experimental, in development, and tested for only a "
"small set of simple samples (e.g. hellotriangle and texturedquad), thus issues "
"are likely to be encountered at this stage.";
#if !FWGPU_ENABLED(FWGPU_PRINT_SYSTEM) && !defined(NDEBUG)
char printSystemHex[16];
snprintf(printSystemHex, sizeof(printSystemHex), "%#x", FWGPU_PRINT_SYSTEM);
@@ -612,11 +609,24 @@ size_t WebGPUDriver::getMaxUniformBufferSize() {
}
size_t WebGPUDriver::getMaxTextureSize(const SamplerType target) {
return 2048u;
size_t result = 2048u;
switch (target) {
case SamplerType::SAMPLER_2D:
case SamplerType::SAMPLER_2D_ARRAY:
case SamplerType::SAMPLER_EXTERNAL:
case SamplerType::SAMPLER_CUBEMAP:
case SamplerType::SAMPLER_CUBEMAP_ARRAY:
result = mDeviceLimits.maxTextureDimension2D;
break;
case SamplerType::SAMPLER_3D:
result = mDeviceLimits.maxTextureDimension3D;
break;
}
return result;
}
size_t WebGPUDriver::getMaxArrayTextureLayers() {
return 256u;
return mDeviceLimits.maxTextureArrayLayers;
}
void WebGPUDriver::updateIndexBuffer(Handle<HwIndexBuffer> indexBufferHandle,

View File

@@ -101,7 +101,7 @@ template<typename WebGPUPrintable>
return out.str();
}
[[nodiscard]] std::string adapterInfoToString(wgpu::AdapterInfo const& info) {
[[nodiscard]] inline std::string adapterInfoToString(wgpu::AdapterInfo const& info) {
std::stringstream out;
out << "vendor (" << info.vendorID << ") '" << info.vendor
<< "' device (" << info.deviceID << ") '" << info.device