aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-03-21 15:11:13 +0100
committerdec05eba <dec05eba@protonmail.com>2024-03-21 15:11:13 +0100
commitb19f88d769958af067c86f6b98b7d579a10acc29 (patch)
tree7eecff5e88317afd484b0affaeb800a7e97925ba
parentc2af57a978b29e536260b6bf8440827a4d8e01f7 (diff)
Fix missing color range set in color conversion for nvidia window capture
-rw-r--r--src/capture/capture.c4
-rw-r--r--src/capture/kms_cuda.c5
-rw-r--r--src/capture/xcomposite_cuda.c5
-rw-r--r--src/main.cpp3
-rw-r--r--src/shader.c2
5 files changed, 3 insertions, 16 deletions
diff --git a/src/capture/capture.c b/src/capture/capture.c
index a1d2913..cec0b0d 100644
--- a/src/capture/capture.c
+++ b/src/capture/capture.c
@@ -204,14 +204,11 @@ static unsigned int gl_create_texture(gsr_egl *egl, int width, int height, int i
static bool cuda_register_opengl_texture(gsr_cuda *cuda, CUgraphicsResource *cuda_graphics_resource, CUarray *mapped_array, unsigned int texture_id) {
CUresult res;
- CUcontext old_ctx;
- res = cuda->cuCtxPushCurrent_v2(cuda->cu_ctx);
res = cuda->cuGraphicsGLRegisterImage(cuda_graphics_resource, texture_id, GL_TEXTURE_2D, CU_GRAPHICS_REGISTER_FLAGS_NONE);
if (res != CUDA_SUCCESS) {
const char *err_str = "unknown";
cuda->cuGetErrorString(res, &err_str);
fprintf(stderr, "gsr error: cuda_register_opengl_texture: cuGraphicsGLRegisterImage failed, error: %s, texture " "id: %u\n", err_str, texture_id);
- res = cuda->cuCtxPopCurrent_v2(&old_ctx);
return false;
}
@@ -219,7 +216,6 @@ static bool cuda_register_opengl_texture(gsr_cuda *cuda, CUgraphicsResource *cud
res = cuda->cuGraphicsMapResources(1, cuda_graphics_resource, 0);
res = cuda->cuGraphicsSubResourceGetMappedArray(mapped_array, *cuda_graphics_resource, 0, 0);
- res = cuda->cuCtxPopCurrent_v2(&old_ctx);
return true;
}
diff --git a/src/capture/kms_cuda.c b/src/capture/kms_cuda.c
index 0349228..a9f1f8e 100644
--- a/src/capture/kms_cuda.c
+++ b/src/capture/kms_cuda.c
@@ -72,9 +72,6 @@ static bool gsr_capture_kms_cuda_should_stop(gsr_capture *cap, bool *err) {
static void gsr_capture_kms_unload_cuda_graphics(gsr_capture_kms_cuda *cap_kms) {
if(cap_kms->cuda.cu_ctx) {
- CUcontext old_ctx;
- cap_kms->cuda.cuCtxPushCurrent_v2(cap_kms->cuda.cu_ctx);
-
for(int i = 0; i < 2; ++i) {
if(cap_kms->cuda_graphics_resources[i]) {
cap_kms->cuda.cuGraphicsUnmapResources(1, &cap_kms->cuda_graphics_resources[i], 0);
@@ -82,8 +79,6 @@ static void gsr_capture_kms_unload_cuda_graphics(gsr_capture_kms_cuda *cap_kms)
cap_kms->cuda_graphics_resources[i] = 0;
}
}
-
- cap_kms->cuda.cuCtxPopCurrent_v2(&old_ctx);
}
}
diff --git a/src/capture/xcomposite_cuda.c b/src/capture/xcomposite_cuda.c
index e8beb4e..6e13d2a 100644
--- a/src/capture/xcomposite_cuda.c
+++ b/src/capture/xcomposite_cuda.c
@@ -53,9 +53,6 @@ static int gsr_capture_xcomposite_cuda_start(gsr_capture *cap, AVCodecContext *v
static void gsr_capture_xcomposite_unload_cuda_graphics(gsr_capture_xcomposite_cuda *cap_xcomp) {
if(cap_xcomp->cuda.cu_ctx) {
- CUcontext old_ctx;
- cap_xcomp->cuda.cuCtxPushCurrent_v2(cap_xcomp->cuda.cu_ctx);
-
for(int i = 0; i < 2; ++i) {
if(cap_xcomp->cuda_graphics_resources[i]) {
cap_xcomp->cuda.cuGraphicsUnmapResources(1, &cap_xcomp->cuda_graphics_resources[i], 0);
@@ -63,8 +60,6 @@ static void gsr_capture_xcomposite_unload_cuda_graphics(gsr_capture_xcomposite_c
cap_xcomp->cuda_graphics_resources[i] = 0;
}
}
-
- cap_xcomp->cuda.cuCtxPopCurrent_v2(&old_ctx);
}
}
diff --git a/src/main.cpp b/src/main.cpp
index 59adf8c..f28cacb 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1562,8 +1562,9 @@ static gsr_capture* create_capture_impl(const char *window_str, const char *scre
xcomposite_params.base.window = src_window_id;
xcomposite_params.base.follow_focused = follow_focused;
xcomposite_params.base.region_size = region_size;
- xcomposite_params.overclock = overclock;
+ xcomposite_params.base.color_range = color_range;
xcomposite_params.base.record_cursor = record_cursor;
+ xcomposite_params.overclock = overclock;
capture = gsr_capture_xcomposite_cuda_create(&xcomposite_params);
if(!capture)
_exit(1);
diff --git a/src/shader.c b/src/shader.c
index 2e24e07..dcb956b 100644
--- a/src/shader.c
+++ b/src/shader.c
@@ -26,7 +26,7 @@ static unsigned int loader_shader(gsr_egl *egl, unsigned int type, const char *s
if(info_length > 1) {
char info_log[4096];
egl->glGetShaderInfoLog(shader_id, min_int(4096, info_length), NULL, info_log);
- fprintf(stderr, "gsr error: loader shader: failed to compile shader, error:\n%s\n", info_log);
+ fprintf(stderr, "gsr error: loader shader: failed to compile shader, error:\n%s\nshader source:\n%s\n", info_log, source);
}
egl->glDeleteShader(shader_id);