mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-03-31 17:17:16 +09:00
Compute shader: nvidia: render full image (incorrect dispatch size)
This commit is contained in:
@@ -251,7 +251,6 @@ int gsr_color_conversion_init(gsr_color_conversion *self, const gsr_color_conver
|
||||
int max_compute_work_group_invocations = 256;
|
||||
self->params.egl->glGetIntegerv(GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS, &max_compute_work_group_invocations);
|
||||
self->max_local_size_dim = sqrt(max_compute_work_group_invocations);
|
||||
fprintf(stderr, "max local size: %d, max_local_size_dim: %d\n", max_compute_work_group_invocations, self->max_local_size_dim);
|
||||
|
||||
switch(params->destination_color) {
|
||||
case GSR_DESTINATION_COLOR_NV12:
|
||||
@@ -435,8 +434,8 @@ void gsr_color_conversion_draw(gsr_color_conversion *self, unsigned int texture_
|
||||
self->params.egl->glUniform2i(uniform->target_position, destination_pos.x, destination_pos.y);
|
||||
self->params.egl->glUniform2f(uniform->scale, scale.x, scale.y);
|
||||
self->params.egl->glBindImageTexture(0, self->params.destination_textures[0], 0, GL_FALSE, 0, GL_WRITE_ONLY, use_16bit_colors ? GL_R16 : GL_R8);
|
||||
const double num_groups_x = (double)texture_size.x/(double)self->max_local_size_dim + 0.5;
|
||||
const double num_groups_y = (double)texture_size.y/(double)self->max_local_size_dim + 0.5;
|
||||
const double num_groups_x = ceil((double)texture_size.x/(double)self->max_local_size_dim);
|
||||
const double num_groups_y = ceil((double)texture_size.y/(double)self->max_local_size_dim);
|
||||
self->params.egl->glDispatchCompute(max_int(1, num_groups_x), max_int(1, num_groups_y), 1);
|
||||
}
|
||||
|
||||
@@ -453,8 +452,8 @@ void gsr_color_conversion_draw(gsr_color_conversion *self, unsigned int texture_
|
||||
self->params.egl->glUniform2i(uniform->target_position, destination_pos.x, destination_pos.y);
|
||||
self->params.egl->glUniform2f(uniform->scale, scale.x, scale.y);
|
||||
self->params.egl->glBindImageTexture(0, self->params.destination_textures[1], 0, GL_FALSE, 0, GL_WRITE_ONLY, use_16bit_colors ? GL_RG16 : GL_RG8);
|
||||
const double num_groups_x = (double)texture_size.x*0.5/(double)self->max_local_size_dim + 0.5;
|
||||
const double num_groups_y = (double)texture_size.y*0.5/(double)self->max_local_size_dim + 0.5;
|
||||
const double num_groups_x = ceil((double)texture_size.x*0.5/(double)self->max_local_size_dim);
|
||||
const double num_groups_y = ceil((double)texture_size.y*0.5/(double)self->max_local_size_dim);
|
||||
self->params.egl->glDispatchCompute(max_int(1, num_groups_x), max_int(1, num_groups_y), 1);
|
||||
}
|
||||
break;
|
||||
@@ -473,8 +472,8 @@ void gsr_color_conversion_draw(gsr_color_conversion *self, unsigned int texture_
|
||||
self->params.egl->glUniform2i(uniform->target_position, destination_pos.x, destination_pos.y);
|
||||
self->params.egl->glUniform2f(uniform->scale, scale.x, scale.y);
|
||||
self->params.egl->glBindImageTexture(0, self->params.destination_textures[0], 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA8);
|
||||
const double num_groups_x = (double)texture_size.x/(double)self->max_local_size_dim + 0.5;
|
||||
const double num_groups_y = (double)texture_size.y/(double)self->max_local_size_dim + 0.5;
|
||||
const double num_groups_x = ceil((double)texture_size.x/(double)self->max_local_size_dim);
|
||||
const double num_groups_y = ceil((double)texture_size.y/(double)self->max_local_size_dim);
|
||||
self->params.egl->glDispatchCompute(max_int(1, num_groups_x), max_int(1, num_groups_y), 1);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user