summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-04-14 18:45:23 +0200
committerSubv <subv2112@gmail.com>2018-04-15 05:54:23 +0200
commit1957640ea25b34bec9e356a06dadf5937933c4ef (patch)
tree62fb25a03d53e032bfada62a525e2d23be1570e8 /src
parentGPU: Added a function to determine whether a shader stage is enabled or not. (diff)
downloadyuzu-1957640ea25b34bec9e356a06dadf5937933c4ef.tar
yuzu-1957640ea25b34bec9e356a06dadf5937933c4ef.tar.gz
yuzu-1957640ea25b34bec9e356a06dadf5937933c4ef.tar.bz2
yuzu-1957640ea25b34bec9e356a06dadf5937933c4ef.tar.lz
yuzu-1957640ea25b34bec9e356a06dadf5937933c4ef.tar.xz
yuzu-1957640ea25b34bec9e356a06dadf5937933c4ef.tar.zst
yuzu-1957640ea25b34bec9e356a06dadf5937933c4ef.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp8
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h2
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp14
-rw-r--r--src/video_core/renderer_opengl/gl_state.h6
4 files changed, 30 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index adc684f9e..71b862114 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -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++) {
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 71c21c69b..527866e8a 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -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;
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index 6da3a7781..7b8a15ed2 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -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());
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index b18af14bb..6a80e6a7d 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -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 {