可篩選的 32 位元浮點紋理
32 位元浮點紋理用於儲存高精確度資料,例如 HDR 圖像和深度地圖。對於用於高階遊戲和專業應用程式的 GPU 而言,這點尤其重要。
可篩選的 32 位元浮點紋理支援說明 GPU 篩選 32 位元浮點紋理的能力。這表示 GPU 可以平滑化浮點紋理的邊緣,減少鋸齒狀效果。這與 WebGL 中的「OES_texture_float_linear」擴充功能類似。
並非所有 GPU 都支援可篩選的 32 位元浮點紋理。如果 "float32-filterable"
功能適用於 GPUAdapter
,您現在可以使用這項功能要求 GPUDevice
,並以「r32float」、「rg32float」和「rgba32float」格式篩選紋理。請參閱以下範例和問題 dawn:1664。
const adapter = await navigator.gpu.requestAdapter();
if (!adapter.features.has("float32-filterable")) {
throw new Error("Filterable 32-bit float textures support is not available");
}
// Explicitly request filterable 32-bit float textures support.
const device = await adapter.requestDevice({
requiredFeatures: ["float32-filterable"],
});
// Create a sampler with linear filtering.
const sampler = device.createSampler({
magFilter: "linear",
});
// Create a texture with rgba32float format.
const texture = device.createTexture({
size: [100, 100],
format: "rgba32float",
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,
});
// Write data to texture, create a bindgroup with sampler and texture and
// send the appropriate commands to the GPU....
unorm10-10-10-2 頂點格式
WebGPU 規格新增了名為「unorm10-10-10-2」(又稱「rgb10a2」) 的新頂點格式。其中包含一個封裝的 32 位元值,以及四個正規化的無正負號整數值,排列方式為 10 位元、10 位元、10 位元和 2 位元。請參閱以下範例和問題 dawn:2044。
// Define the layout of vertex attribute data with unorm10-10-10-2 format.
const buffers = [
{
arrayStride: 0,
attributes: [
{ format: "unorm10-10-10-2", offset: 0, shaderLocation: 0 },
],
},
];
// Describe the vertex shader entry point and its input buffer layouts.
const vertex = {
module: myVertexShaderModule,
entryPoint: "main",
buffers,
};
// Pass vertex to device.createRenderPipeline() and
// use vec4<f32> type in WGSL shader code to manipulate data.
rgb10a2uint 紋理格式
WebGPU 規格新增了名為「rgb10a2uint」的紋理格式。這個格式包含 32 位元封裝像素格式,以及四個無正負號整數元件:10 位元紅色、10 位元綠色、10 位元藍色和 2 位元 Alpha。請參閱以下範例和這個問題。
// Create a texture with rgb10a2uint format.
const texture = device.createTexture({
size: [100, 100],
format: "rgb10a2uint",
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,
});
// Write data to texture, create a bindgroup with texture and
// send the appropriate commands to the GPU....
黎明更新
WebGPU 應用程式可透過時間戳記查詢,精確測量 GPU 指令的執行時間 (精確度達奈秒)。為符合 WebGPU 規格,我們更新了 API 形狀,以便在傳遞開始和結束時擷取時間戳記查詢。請參閱以下範例和問題 dawn:1800。
// Create a timestamp query set that will store the timestamp values.
wgpu::QuerySetDescriptor querySetDescriptor = {
.count = 2,
.type = wgpu::QueryType::Timestamp};
wgpu::QuerySet querySet = device.CreateQuerySet(&querySetDescriptor);
wgpu::RenderPassTimestampWrites timestampWrites = {
.querySet = querySet,
.beginningOfPassWriteIndex = 0,
.endOfPassWriteIndex = 1};
wgpu::ComputePassDescriptor pass{.timestampWrites = ×tampWrites};
// Write the queue timestamp into beginningOfPassWriteIndex and
// endOfPassWriteIndex of myQuerySet respectively before and after the pass
// commands execute.
myEncoder.BeginComputePass(&pass);
這僅涵蓋部分重點。請參閱完整的提交清單。
WebGPU 最新消息
「WebGPU 最新消息」系列涵蓋的所有主題清單。
Chrome 140
- 裝置要求會耗用轉接程式
- 使用紋理檢視畫面時,可使用紋理的簡短形式
- WGSL textureSampleLevel 支援 1D 紋理
- 淘汰 bgra8unorm 唯讀儲存空間紋理用法
- 移除 GPUAdapter isFallbackAdapter 屬性
- Dawn 更新
Chrome 139
Chrome 138
Chrome 137
- 使用紋理檢視區塊進行 externalTexture 繫結
- 複製緩衝區,但不指定位移和大小
- WGSL 工作群組 UniformLoad,使用指標指向原子
- GPUAdapterInfo powerPreference 屬性
- 移除 GPURequestAdapterOptions compatibilityMode 屬性
- Dawn 更新
Chrome 136
Chrome 135
- 允許使用空值繫結群組版面配置建立管道版面配置
- 允許檢視區塊超出算繪目標的邊界
- 在 Android 上更輕鬆存取實驗性相容模式
- 移除 maxInterStageShaderComponents 限制
- Dawn 更新
Chrome 134
Chrome 133
- 額外的 unorm8x4-bgra 和 1 元件頂點格式
- 允許使用未定義的值要求不明限制
- WGSL 對齊規則變更
- 使用 discard 提升 WGSL 效能
- 針對外部紋理使用 VideoFrame displaySize
- 使用 copyExternalImageToTexture 處理方向非預設的圖片
- 提升開發人員體驗
- 使用 featureLevel 啟用相容模式
- 清除實驗性子群組功能
- 淘汰 maxInterStageShaderComponents 限制
- Dawn 更新
Chrome 132
- 紋理檢視畫面使用方式
- 32 位元浮點紋理混合
- GPUDevice adapterInfo 屬性
- 以無效格式設定畫布內容時,會擲回 JavaScript 錯誤
- 紋理的篩選取樣器限制
- 擴大子群組實驗
- 提升開發人員體驗
- 實驗性支援 16 位元標準化紋理格式
- Dawn 更新
Chrome 131
- 在 WGSL 中裁剪距離
- GPUCanvasContext getConfiguration()
- 點和線條圖元不得有深度偏差
- 子群組的內建包容性掃描功能
- 實驗性支援多重繪圖間接
- 著色器模組編譯選項「嚴格的數學」
- 移除 GPUAdapter requestAdapterInfo()
- Dawn 更新
Chrome 130
Chrome 129
Chrome 128
Chrome 127
Chrome 126
Chrome 125
Chrome 124
Chrome 123
Chrome 122
Chrome 121
- 在 Android 上支援 WebGPU
- 在 Windows 上使用 DXC 取代 FXC,編譯著色器
- 運算和算繪傳遞中的時間戳記查詢
- 著色器模組的預設進入點
- 支援將 display-p3 做為 GPUExternalTexture 色彩空間
- 記憶體堆積資訊
- Dawn 更新
Chrome 120
Chrome 119
Chrome 118
copyExternalImageToTexture()
支援 HTMLImageElement 和 ImageData- 實驗性支援讀寫和唯讀儲存空間紋理
- Dawn 更新
Chrome 117
Chrome 116
- 整合 WebCodecs
- GPUAdapter
requestDevice()
傳回的遺失裝置 - 如果呼叫
importExternalTexture()
,請確保影片播放流暢 - 規格一致性
- 提升開發人員體驗
- Dawn 更新
Chrome 115
Chrome 114
Chrome 113
- 在
importExternalTexture()
中使用 WebCodecs VideoFrame 來源