Fix misuse of glTexImage2D.

Per the OpenGL documentation:
> GL_INVALID_VALUE may be generated if level is greater than
> log2(max), where max is the returned value of GL_MAX_TEXTURE_SIZE.

Although we always passed `log2(max) + 1` as `level`, for some reason
none of the GL implementations we run on ever returned an error.
It also appears there is a bug in ANGLE that crashes the process
instead in this case if the C++ runtime performs bound checks on
vector::operator[]=.
This commit is contained in:
whitequark 2019-11-22 02:11:00 +00:00
parent 5d78f993ce
commit 74aa80b645

View File

@ -390,7 +390,7 @@ GLuint Generate(const std::vector<double> &pattern) {
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size);
RgbaColor *textureData = new RgbaColor[size];
int mipCount = (int)log2(size) + 1;
int mipCount = (int)log2(size);
for(int mip = 0; mip < mipCount; mip++) {
int dashI = 0;
double dashT = 0.0;