gpu: unify scissor handling
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user