GPU: Allow configuring ssbos in the opengl state manager.
This commit is contained in:
parent
ae58e46036
commit
1957640ea2
|
@ -46,6 +46,14 @@ RasterizerOpenGL::RasterizerOpenGL() {
|
|||
state.texture_units[i].sampler = texture_samplers[i].sampler.handle;
|
||||
}
|
||||
|
||||
// Create SSBOs
|
||||
for (size_t stage = 0; stage < ssbos.size(); ++stage) {
|
||||
for (size_t buffer = 0; buffer < ssbos[stage].size(); ++buffer) {
|
||||
ssbos[stage][buffer].Create();
|
||||
state.draw.const_buffers[stage][buffer].ssbo = ssbos[stage][buffer].handle;
|
||||
}
|
||||
}
|
||||
|
||||
GLint ext_num;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &ext_num);
|
||||
for (GLint i = 0; i < ext_num; i++) {
|
||||
|
|
|
@ -129,6 +129,8 @@ private:
|
|||
std::array<bool, 16> hw_vao_enabled_attributes;
|
||||
|
||||
std::array<SamplerInfo, GLShader::NumTextureSamplers> texture_samplers;
|
||||
std::array<std::array<OGLBuffer, 16>, 5> ssbos;
|
||||
|
||||
static constexpr size_t VERTEX_BUFFER_SIZE = 128 * 1024 * 1024;
|
||||
std::unique_ptr<OGLStreamBuffer> vertex_buffer;
|
||||
OGLBuffer uniform_buffer;
|
||||
|
|
|
@ -202,6 +202,20 @@ void OpenGLState::Apply() const {
|
|||
}
|
||||
}
|
||||
|
||||
// Constbuffers
|
||||
for (u32 stage = 0; stage < draw.const_buffers.size(); ++stage) {
|
||||
for (u32 buffer_id = 0; buffer_id < draw.const_buffers[stage].size(); ++buffer_id) {
|
||||
auto& current = cur_state.draw.const_buffers[stage][buffer_id];
|
||||
auto& new_state = draw.const_buffers[stage][buffer_id];
|
||||
if (current.enabled != new_state.enabled || current.bindpoint != new_state.bindpoint ||
|
||||
current.ssbo != new_state.ssbo) {
|
||||
if (new_state.enabled) {
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, new_state.bindpoint, new_state.ssbo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lighting LUTs
|
||||
if (lighting_lut.texture_buffer != cur_state.lighting_lut.texture_buffer) {
|
||||
glActiveTexture(TextureUnits::LightingLUT.Enum());
|
||||
|
|
|
@ -123,6 +123,12 @@ public:
|
|||
GLuint uniform_buffer; // GL_UNIFORM_BUFFER_BINDING
|
||||
GLuint shader_program; // GL_CURRENT_PROGRAM
|
||||
GLuint program_pipeline; // GL_PROGRAM_PIPELINE_BINDING
|
||||
struct ConstBufferConfig {
|
||||
bool enabled;
|
||||
GLuint bindpoint;
|
||||
GLuint ssbo;
|
||||
};
|
||||
std::array<std::array<ConstBufferConfig, 16>, 5> const_buffers{};
|
||||
} draw;
|
||||
|
||||
struct {
|
||||
|
|
Loading…
Reference in a new issue