mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-26 09:29:45 +00:00
Adds a fallback route for the array builder if it can't map a buffer.
This commit is contained in:
parent
bf4ed57f68
commit
9bb9cb4a65
@ -125,9 +125,13 @@ std::size_t ArrayBuilder::Buffer::submit(bool is_input) {
|
||||
} else {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
uint8_t *destination = static_cast<uint8_t *>(glMapBufferRange(GL_ARRAY_BUFFER, 0, (GLsizeiptr)length, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_FLUSH_EXPLICIT_BIT));
|
||||
std::memcpy(destination, data.data(), length);
|
||||
glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, (GLsizeiptr)length);
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
if(false) {
|
||||
std::memcpy(destination, data.data(), length);
|
||||
glFlushMappedBufferRange(GL_ARRAY_BUFFER, 0, (GLsizeiptr)length);
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
} else {
|
||||
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)length, data.data(), GL_STREAM_DRAW);
|
||||
}
|
||||
}
|
||||
submitted_data = flushed_data;
|
||||
return length;
|
||||
|
@ -8,12 +8,9 @@
|
||||
|
||||
#include "TextureTarget.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace OpenGL;
|
||||
|
||||
TextureTarget::TextureTarget(GLsizei width, GLsizei height, GLenum texture_unit, GLint mag_filter) :
|
||||
@ -33,7 +30,6 @@ TextureTarget::TextureTarget(GLsizei width, GLsizei height, GLenum texture_unit,
|
||||
glBindTexture(GL_TEXTURE_2D, texture_);
|
||||
|
||||
std::vector<uint8_t> blank_buffer(static_cast<size_t>(expanded_width_ * expanded_height_ * 4), 0);
|
||||
std::cout << blank_buffer.size() << std::endl;
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, static_cast<GLsizei>(expanded_width_), static_cast<GLsizei>(expanded_height_), 0, GL_RGBA, GL_UNSIGNED_BYTE, blank_buffer.data());
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
Loading…
Reference in New Issue
Block a user