webgpu: implement the scissor backend function (#9783)

also enable ScissorViewportRegion backend test.
It was previously skipped, now it is passing.

BUGS=474393992
This commit is contained in:
Run Yu
2026-03-13 21:37:54 +00:00
committed by GitHub
parent b2531fff15
commit 256a494cd0
2 changed files with 13 additions and 4 deletions
+13 -3
View File
@@ -1970,9 +1970,19 @@ void WebGPUDriver::dispatchCompute(Handle<HwProgram> program, math::uint3 workGr
//todo
}
void WebGPUDriver::scissor(
Viewport scissor) {
//todo
void WebGPUDriver::scissor(Viewport scissor) {
assert_invariant(mRenderPassEncoder);
assert_invariant(mCurrentRenderTarget);
// The WebGPU scissor starts from the top-left corner
assert_invariant(scissor.left >= 0 &&
mCurrentRenderTarget->height >= scissor.bottom + scissor.height /*top >= 0*/ &&
scissor.width <= mCurrentRenderTarget->width &&
scissor.height <= mCurrentRenderTarget->height);
mRenderPassEncoder.SetScissorRect(scissor.left,
mCurrentRenderTarget->height - scissor.bottom - scissor.height /*top*/, scissor.width,
scissor.height);
}
void WebGPUDriver::beginTimerQuery(Handle<HwTimerQuery> tqh) {
-1
View File
@@ -32,7 +32,6 @@ using namespace filament;
using namespace filament::backend;
TEST_F(BackendTest, ScissorViewportRegion) {
SKIP_IF(Backend::WEBGPU, "test cases fail in WebGPU, see b/424157731");
auto& api = getDriverApi();
constexpr int kSrcTexWidth = 1024;