GPU: Fix memory corruption in GPU_debug on GTX1080

Number of texture formats is 51, which is greater than allowed size of 32.
This commit is contained in:
Sergey Sharybin 2017-10-17 11:51:05 +02:00
parent b53918be39
commit b65fecd9a0
Notes: blender-bot 2023-02-14 06:42:53 +01:00
Referenced by issue #53683, 2.79a release
1 changed files with 6 additions and 2 deletions

View File

@ -425,9 +425,11 @@ void GPU_assert_no_gl_errors(const char *file, int line, const char *str)
static void gpu_state_print_fl_ex(const char *name, GLenum type)
{
#define MAX_ARRAY_SIZE 64
const unsigned char err_mark[4] = {0xff, 0xff, 0xff, 0xff};
float value[32];
float value[MAX_ARRAY_SIZE];
int a;
memset(value, 0xff, sizeof(value));
@ -435,7 +437,7 @@ static void gpu_state_print_fl_ex(const char *name, GLenum type)
if (glGetError() == GL_NO_ERROR) {
printf("%s: ", name);
for (a = 0; a < 32; a++) {
for (a = 0; a < MAX_ARRAY_SIZE; a++) {
if (memcmp(&value[a], err_mark, sizeof(value[a])) == 0) {
break;
}
@ -443,6 +445,8 @@ static void gpu_state_print_fl_ex(const char *name, GLenum type)
}
printf("\n");
}
#undef MAX_ARRAY_SIZE
}
#define gpu_state_print_fl(val) gpu_state_print_fl_ex(#val, val)