gpu: unify scissor handling

This commit is contained in:
luboslenco
2026-03-12 18:06:30 +01:00
parent aea25f2406
commit 2cbe7c0baf
3 changed files with 11 additions and 4 deletions
+3
View File
@@ -546,6 +546,9 @@ void gpu_viewport(int x, int y, int width, int height) {
}
void gpu_scissor(int x, int y, int width, int height) {
if (width < 0 || height < 0) {
return;
}
current_scissor = (D3D12_RECT){
.left = x,
.top = y,
+5 -4
View File
@@ -309,12 +309,13 @@ void gpu_viewport(int x, int y, int width, int height) {
}
void gpu_scissor(int x, int y, int width, int height) {
if (width < 0 || height < 0) {
return;
}
current_scissor.x = x;
current_scissor.y = y;
int target_w = current_render_targets[0]->width;
int target_h = current_render_targets[0]->height;
current_scissor.width = (x + width <= target_w) ? width : target_w - x;
current_scissor.height = (y + height <= target_h) ? height : target_h - y;
current_scissor.width = width;
current_scissor.height = height;
[command_encoder setScissorRect:current_scissor];
}
+3
View File
@@ -414,6 +414,9 @@ void gpu_viewport(int x, int y, int width, int height) {
}
void gpu_scissor(int x, int y, int width, int height) {
if (width < 0 || height < 0) {
return;
}
wgpuRenderPassEncoderSetScissorRect(render_pass_encoder, (uint32_t)x, (uint32_t)y, (uint32_t)width, (uint32_t)height);
}