diff --git a/CHANGELOG.md b/CHANGELOG.md index ce884dc..e3f392a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.31.0] - 2026-08-30 + +### Changed + +- **`TextureRegionUpdater.UpdateRegion` — strided upload** (#484) — added `bytesPerRow` parameter (pre-v1.0 signature change). `0` = tightly packed rows (`w * bytesPerPixel`), matching WebGPU `ImageDataLayout.bytesPerRow`. Enables zero-copy dirty-band uploads from full-frame buffers (geckty, ggcanvas) without `extractRegion` memcpy. + ## [0.30.0] - 2026-08-30 ### Added diff --git a/ROADMAP.md b/ROADMAP.md index f836a1c..bfa35ba 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -4,8 +4,10 @@ `gpucontext` is the shared foundation for the [gogpu](https://github.com/gogpu) ecosystem, providing interfaces and utilities for GPU resource sharing without circular dependencies. -## Current: v0.29.0 +## Current: v0.31.0 +- `TextureRegionUpdater.UpdateRegion` strided upload (`bytesPerRow`, #484) +- `DeviceProvider.DownlevelCapabilities()` (ADR-071) - `DeviceProvider.Features()` — query device capabilities (FeatureRayQuery, etc.) - SurfaceCompositor interface (ADR-067) - MouseButton/Modifiers stringers @@ -19,6 +21,12 @@ ## Released +### v0.31.0 (2026-08-30) +- `TextureRegionUpdater.UpdateRegion` — `bytesPerRow` parameter (pre-v1.0, #484) + +### v0.30.0 (2026-08-30) +- `DeviceProvider.DownlevelCapabilities()` (ADR-071) + ### v0.29.0 (2026-08-27) - `DeviceProvider.Features()` — gputypes.Features bitfield for capability queries diff --git a/texture.go b/texture.go index d9b6bc5..cd84f80 100644 --- a/texture.go +++ b/texture.go @@ -45,11 +45,18 @@ type TextureRegionUpdater interface { // UpdateRegion uploads a sub-rectangle of pixel data to the texture. // x, y is the top-left corner of the region in the texture. // w, h is the size of the region. - // data must be exactly w * h * bytesPerPixel bytes (densely packed RGBA rows). + // bytesPerRow is the stride in bytes between consecutive rows in data. + // Pass 0 for tightly packed rows (w * bytesPerPixel) — WebGPU + // ImageDataLayout.bytesPerRow semantics. This eliminates the need for + // callers to extractRegion-copy dirty bands from a full-frame buffer. + // + // When bytesPerRow is 0, data must be exactly w * h * bytesPerPixel bytes. + // When bytesPerRow > 0, data must be at least + // bytesPerRow*(h-1) + w*bytesPerPixel bytes (last row need not be padded). // // Returns error if the region exceeds texture bounds, data size is invalid, - // or the texture has been destroyed. - UpdateRegion(x, y, w, h int, data []byte) error + // bytesPerRow is too small, or the texture has been destroyed. + UpdateRegion(x, y, w, h, bytesPerRow int, data []byte) error } // TextureDrawer provides texture drawing capabilities for 2D rendering.