mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-05-06 23:06:22 +09:00
Dont use glGetTexLevelParameteriv, it's only available in opengl es 3.1
This commit is contained in:
@@ -12,6 +12,7 @@ typedef struct {
|
||||
gsr_video_encoder_nvenc_params params;
|
||||
|
||||
unsigned int target_textures[2];
|
||||
vec2i target_texture_size[2];
|
||||
|
||||
AVBufferRef *device_ctx;
|
||||
|
||||
@@ -95,7 +96,8 @@ static bool gsr_video_encoder_nvenc_setup_textures(gsr_video_encoder_nvenc *self
|
||||
const int div[2] = {1, 2}; // divide UV texture size by 2 because chroma is half size
|
||||
|
||||
for(int i = 0; i < 2; ++i) {
|
||||
self->target_textures[i] = gl_create_texture(self->params.egl, video_codec_context->width / div[i], video_codec_context->height / div[i], self->params.color_depth == GSR_COLOR_DEPTH_8_BITS ? internal_formats_nv12[i] : internal_formats_p010[i], formats[i], GL_NEAREST);
|
||||
self->target_texture_size[i] = (vec2i){ video_codec_context->width / div[i], video_codec_context->height / div[i] };
|
||||
self->target_textures[i] = gl_create_texture(self->params.egl, self->target_texture_size[i].x, self->target_texture_size[i].y, self->params.color_depth == GSR_COLOR_DEPTH_8_BITS ? internal_formats_nv12[i] : internal_formats_p010[i], formats[i], GL_NEAREST);
|
||||
if(self->target_textures[i] == 0) {
|
||||
fprintf(stderr, "gsr error: gsr_video_encoder_nvenc_setup_textures: failed to create opengl texture\n");
|
||||
return false;
|
||||
@@ -198,10 +200,12 @@ static void gsr_video_encoder_nvenc_copy_textures_to_frame(gsr_video_encoder *en
|
||||
self->cuda.cuStreamSynchronize(self->cuda_stream);
|
||||
}
|
||||
|
||||
static void gsr_video_encoder_nvenc_get_textures(gsr_video_encoder *encoder, unsigned int *textures, int *num_textures, gsr_destination_color *destination_color) {
|
||||
static void gsr_video_encoder_nvenc_get_textures(gsr_video_encoder *encoder, unsigned int *textures, vec2i *texture_sizes, int *num_textures, gsr_destination_color *destination_color) {
|
||||
gsr_video_encoder_nvenc *self = encoder->priv;
|
||||
textures[0] = self->target_textures[0];
|
||||
textures[1] = self->target_textures[1];
|
||||
texture_sizes[0] = self->target_texture_size[0];
|
||||
texture_sizes[1] = self->target_texture_size[1];
|
||||
*num_textures = 2;
|
||||
*destination_color = self->params.color_depth == GSR_COLOR_DEPTH_10_BITS ? GSR_DESTINATION_COLOR_P010 : GSR_DESTINATION_COLOR_NV12;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user