summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp68
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h5
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp9
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.cpp38
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp63
-rw-r--r--src/video_core/renderer_opengl/gl_state.h13
6 files changed, 116 insertions, 80 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index ff3f69ba3..aa95ef21d 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -28,6 +28,9 @@ MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(100, 100, 255));
MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100));
RasterizerOpenGL::RasterizerOpenGL() : shader_dirty(true) {
+ // Clipping plane 0 is always enabled for PICA fixed clip plane z <= 0
+ state.clip_distance[0] = true;
+
// Create sampler objects
for (size_t i = 0; i < texture_samplers.size(); ++i) {
texture_samplers[i].Create();
@@ -117,48 +120,53 @@ RasterizerOpenGL::RasterizerOpenGL() : shader_dirty(true) {
// Setup the noise LUT for proctex
proctex_noise_lut.Create();
- state.proctex_noise_lut.texture_1d = proctex_noise_lut.handle;
+ state.proctex_noise_lut.texture_buffer = proctex_noise_lut.handle;
state.Apply();
+ proctex_noise_lut_buffer.Create();
+ glBindBuffer(GL_TEXTURE_BUFFER, proctex_noise_lut_buffer.handle);
+ glBufferData(GL_TEXTURE_BUFFER, sizeof(GLfloat) * 2 * 128, nullptr, GL_DYNAMIC_DRAW);
glActiveTexture(TextureUnits::ProcTexNoiseLUT.Enum());
- glTexImage1D(GL_TEXTURE_1D, 0, GL_RG32F, 128, 0, GL_RG, GL_FLOAT, nullptr);
- glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexBuffer(GL_TEXTURE_BUFFER, GL_RG32F, proctex_noise_lut_buffer.handle);
// Setup the color map for proctex
proctex_color_map.Create();
- state.proctex_color_map.texture_1d = proctex_color_map.handle;
+ state.proctex_color_map.texture_buffer = proctex_color_map.handle;
state.Apply();
+ proctex_color_map_buffer.Create();
+ glBindBuffer(GL_TEXTURE_BUFFER, proctex_color_map_buffer.handle);
+ glBufferData(GL_TEXTURE_BUFFER, sizeof(GLfloat) * 2 * 128, nullptr, GL_DYNAMIC_DRAW);
glActiveTexture(TextureUnits::ProcTexColorMap.Enum());
- glTexImage1D(GL_TEXTURE_1D, 0, GL_RG32F, 128, 0, GL_RG, GL_FLOAT, nullptr);
- glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexBuffer(GL_TEXTURE_BUFFER, GL_RG32F, proctex_color_map_buffer.handle);
// Setup the alpha map for proctex
proctex_alpha_map.Create();
- state.proctex_alpha_map.texture_1d = proctex_alpha_map.handle;
+ state.proctex_alpha_map.texture_buffer = proctex_alpha_map.handle;
state.Apply();
+ proctex_alpha_map_buffer.Create();
+ glBindBuffer(GL_TEXTURE_BUFFER, proctex_alpha_map_buffer.handle);
+ glBufferData(GL_TEXTURE_BUFFER, sizeof(GLfloat) * 2 * 128, nullptr, GL_DYNAMIC_DRAW);
glActiveTexture(TextureUnits::ProcTexAlphaMap.Enum());
- glTexImage1D(GL_TEXTURE_1D, 0, GL_RG32F, 128, 0, GL_RG, GL_FLOAT, nullptr);
- glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexBuffer(GL_TEXTURE_BUFFER, GL_RG32F, proctex_alpha_map_buffer.handle);
// Setup the LUT for proctex
proctex_lut.Create();
- state.proctex_lut.texture_1d = proctex_lut.handle;
+ state.proctex_lut.texture_buffer = proctex_lut.handle;
state.Apply();
+ proctex_lut_buffer.Create();
+ glBindBuffer(GL_TEXTURE_BUFFER, proctex_lut_buffer.handle);
+ glBufferData(GL_TEXTURE_BUFFER, sizeof(GLfloat) * 4 * 256, nullptr, GL_DYNAMIC_DRAW);
glActiveTexture(TextureUnits::ProcTexLUT.Enum());
- glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA32F, 256, 0, GL_RGBA, GL_FLOAT, nullptr);
- glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, proctex_lut_buffer.handle);
// Setup the difference LUT for proctex
proctex_diff_lut.Create();
- state.proctex_diff_lut.texture_1d = proctex_diff_lut.handle;
+ state.proctex_diff_lut.texture_buffer = proctex_diff_lut.handle;
state.Apply();
+ proctex_diff_lut_buffer.Create();
+ glBindBuffer(GL_TEXTURE_BUFFER, proctex_diff_lut_buffer.handle);
+ glBufferData(GL_TEXTURE_BUFFER, sizeof(GLfloat) * 4 * 256, nullptr, GL_DYNAMIC_DRAW);
glActiveTexture(TextureUnits::ProcTexDiffLUT.Enum());
- glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA32F, 256, 0, GL_RGBA, GL_FLOAT, nullptr);
- glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32F, proctex_diff_lut_buffer.handle);
// Sync fixed function OpenGL state
SyncCullMode();
@@ -1387,7 +1395,7 @@ void RasterizerOpenGL::SyncProcTexNoise() {
// helper function for SyncProcTexNoiseLUT/ColorMap/AlphaMap
static void SyncProcTexValueLUT(const std::array<Pica::State::ProcTex::ValueEntry, 128>& lut,
- std::array<GLvec2, 128>& lut_data, GLenum texture) {
+ std::array<GLvec2, 128>& lut_data, GLuint buffer) {
std::array<GLvec2, 128> new_data;
std::transform(lut.begin(), lut.end(), new_data.begin(), [](const auto& entry) {
return GLvec2{entry.ToFloat(), entry.DiffToFloat()};
@@ -1395,24 +1403,24 @@ static void SyncProcTexValueLUT(const std::array<Pica::State::ProcTex::ValueEntr
if (new_data != lut_data) {
lut_data = new_data;
- glActiveTexture(texture);
- glTexSubImage1D(GL_TEXTURE_1D, 0, 0, 128, GL_RG, GL_FLOAT, lut_data.data());
+ glBindBuffer(GL_TEXTURE_BUFFER, buffer);
+ glBufferSubData(GL_TEXTURE_BUFFER, 0, new_data.size() * sizeof(GLvec2), new_data.data());
}
}
void RasterizerOpenGL::SyncProcTexNoiseLUT() {
SyncProcTexValueLUT(Pica::g_state.proctex.noise_table, proctex_noise_lut_data,
- TextureUnits::ProcTexNoiseLUT.Enum());
+ proctex_noise_lut_buffer.handle);
}
void RasterizerOpenGL::SyncProcTexColorMap() {
SyncProcTexValueLUT(Pica::g_state.proctex.color_map_table, proctex_color_map_data,
- TextureUnits::ProcTexColorMap.Enum());
+ proctex_color_map_buffer.handle);
}
void RasterizerOpenGL::SyncProcTexAlphaMap() {
SyncProcTexValueLUT(Pica::g_state.proctex.alpha_map_table, proctex_alpha_map_data,
- TextureUnits::ProcTexAlphaMap.Enum());
+ proctex_alpha_map_buffer.handle);
}
void RasterizerOpenGL::SyncProcTexLUT() {
@@ -1427,8 +1435,8 @@ void RasterizerOpenGL::SyncProcTexLUT() {
if (new_data != proctex_lut_data) {
proctex_lut_data = new_data;
- glActiveTexture(TextureUnits::ProcTexLUT.Enum());
- glTexSubImage1D(GL_TEXTURE_1D, 0, 0, 256, GL_RGBA, GL_FLOAT, proctex_lut_data.data());
+ glBindBuffer(GL_TEXTURE_BUFFER, proctex_lut_buffer.handle);
+ glBufferSubData(GL_TEXTURE_BUFFER, 0, new_data.size() * sizeof(GLvec4), new_data.data());
}
}
@@ -1444,8 +1452,8 @@ void RasterizerOpenGL::SyncProcTexDiffLUT() {
if (new_data != proctex_diff_lut_data) {
proctex_diff_lut_data = new_data;
- glActiveTexture(TextureUnits::ProcTexDiffLUT.Enum());
- glTexSubImage1D(GL_TEXTURE_1D, 0, 0, 256, GL_RGBA, GL_FLOAT, proctex_diff_lut_data.data());
+ glBindBuffer(GL_TEXTURE_BUFFER, proctex_diff_lut_buffer.handle);
+ glBufferSubData(GL_TEXTURE_BUFFER, 0, new_data.size() * sizeof(GLvec4), new_data.data());
}
}
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index a433c1d4a..78e218efe 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -287,18 +287,23 @@ private:
OGLTexture fog_lut;
std::array<GLvec2, 128> fog_lut_data{};
+ OGLBuffer proctex_noise_lut_buffer;
OGLTexture proctex_noise_lut;
std::array<GLvec2, 128> proctex_noise_lut_data{};
+ OGLBuffer proctex_color_map_buffer;
OGLTexture proctex_color_map;
std::array<GLvec2, 128> proctex_color_map_data{};
+ OGLBuffer proctex_alpha_map_buffer;
OGLTexture proctex_alpha_map;
std::array<GLvec2, 128> proctex_alpha_map_data{};
+ OGLBuffer proctex_lut_buffer;
OGLTexture proctex_lut;
std::array<GLvec4, 256> proctex_lut_data{};
+ OGLBuffer proctex_diff_lut_buffer;
OGLTexture proctex_diff_lut;
std::array<GLvec4, 256> proctex_diff_lut_data{};
};
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 8b717e43d..f37894e7a 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -542,10 +542,11 @@ RasterizerCacheOpenGL::GetFramebufferSurfaces(
config.GetDepthBufferPhysicalAddress(),
fb_area * Pica::FramebufferRegs::BytesPerDepthPixel(config.depth_format));
bool using_color_fb = config.GetColorBufferPhysicalAddress() != 0;
- bool using_depth_fb =
- config.GetDepthBufferPhysicalAddress() != 0 &&
- (regs.framebuffer.output_merger.depth_test_enable ||
- regs.framebuffer.output_merger.depth_write_enable || !framebuffers_overlap);
+ bool depth_write_enable = regs.framebuffer.output_merger.depth_write_enable &&
+ regs.framebuffer.framebuffer.allow_depth_stencil_write;
+ bool using_depth_fb = config.GetDepthBufferPhysicalAddress() != 0 &&
+ (regs.framebuffer.output_merger.depth_test_enable || depth_write_enable ||
+ !framebuffers_overlap);
if (framebuffers_overlap && using_color_fb && using_depth_fb) {
LOG_CRITICAL(Render_OpenGL, "Color and depth framebuffer memory regions overlap; "
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp
index c93b108fb..015e69da9 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp
@@ -525,11 +525,12 @@ static void WriteLighting(std::string& out, const PicaShaderConfig& config) {
"float geo_factor = 1.0;\n";
// Compute fragment normals and tangents
- const std::string pertubation =
- "2.0 * (" + SampleTexture(config, lighting.bump_selector) + ").rgb - 1.0";
+ auto Perturbation = [&]() {
+ return "2.0 * (" + SampleTexture(config, lighting.bump_selector) + ").rgb - 1.0";
+ };
if (lighting.bump_mode == LightingRegs::LightingBumpMode::NormalMap) {
// Bump mapping is enabled using a normal map
- out += "vec3 surface_normal = " + pertubation + ";\n";
+ out += "vec3 surface_normal = " + Perturbation() + ";\n";
// Recompute Z-component of perturbation if 'renorm' is enabled, this provides a higher
// precision result
@@ -543,7 +544,7 @@ static void WriteLighting(std::string& out, const PicaShaderConfig& config) {
out += "vec3 surface_tangent = vec3(1.0, 0.0, 0.0);\n";
} else if (lighting.bump_mode == LightingRegs::LightingBumpMode::TangentMap) {
// Bump mapping is enabled using a tangent map
- out += "vec3 surface_tangent = " + pertubation + ";\n";
+ out += "vec3 surface_tangent = " + Perturbation() + ";\n";
// Mathematically, recomputing Z-component of the tangent vector won't affect the relevant
// computation below, which is also confirmed on 3DS. So we don't bother recomputing here
// even if 'renorm' is enabled.
@@ -886,12 +887,12 @@ void AppendProcTexSampler(std::string& out, const PicaShaderConfig& config) {
// coord=1.0 is lut[127]+lut_diff[127]. For other indices, the result is interpolated using
// value entries and difference entries.
out += R"(
-float ProcTexLookupLUT(sampler1D lut, float coord) {
+float ProcTexLookupLUT(samplerBuffer lut, float coord) {
coord *= 128;
float index_i = clamp(floor(coord), 0.0, 127.0);
float index_f = coord - index_i; // fract() cannot be used here because 128.0 needs to be
// extracted as index_i = 127.0 and index_f = 1.0
- vec2 entry = texelFetch(lut, int(index_i), 0).rg;
+ vec2 entry = texelFetch(lut, int(index_i)).rg;
return clamp(entry.r + entry.g * index_f, 0.0, 1.0);
}
)";
@@ -979,14 +980,14 @@ float ProcTexNoiseCoef(vec2 x) {
out += "int lut_index_i = int(lut_coord) + " +
std::to_string(config.state.proctex.lut_offset) + ";\n";
out += "float lut_index_f = fract(lut_coord);\n";
- out += "vec4 final_color = texelFetch(proctex_lut, lut_index_i, 0) + lut_index_f * "
- "texelFetch(proctex_diff_lut, lut_index_i, 0);\n";
+ out += "vec4 final_color = texelFetch(proctex_lut, lut_index_i) + lut_index_f * "
+ "texelFetch(proctex_diff_lut, lut_index_i);\n";
break;
case ProcTexFilter::Nearest:
case ProcTexFilter::NearestMipmapLinear:
case ProcTexFilter::NearestMipmapNearest:
out += "lut_coord += " + std::to_string(config.state.proctex.lut_offset) + ";\n";
- out += "vec4 final_color = texelFetch(proctex_lut, int(round(lut_coord)), 0);\n";
+ out += "vec4 final_color = texelFetch(proctex_lut, int(round(lut_coord)));\n";
break;
}
@@ -1053,11 +1054,11 @@ layout (std140) uniform shader_data {
uniform sampler2D tex[3];
uniform samplerBuffer lighting_lut;
uniform samplerBuffer fog_lut;
-uniform sampler1D proctex_noise_lut;
-uniform sampler1D proctex_color_map;
-uniform sampler1D proctex_alpha_map;
-uniform sampler1D proctex_lut;
-uniform sampler1D proctex_diff_lut;
+uniform samplerBuffer proctex_noise_lut;
+uniform samplerBuffer proctex_color_map;
+uniform samplerBuffer proctex_alpha_map;
+uniform samplerBuffer proctex_lut;
+uniform samplerBuffer proctex_diff_lut;
// Rotate the vector v by the quaternion q
vec3 quaternion_rotate(vec4 q, vec3 v) {
@@ -1111,7 +1112,10 @@ vec4 secondary_fragment_color = vec4(0.0);
"gl_FragCoord.y < scissor_y2)) discard;\n";
}
- out += "float z_over_w = 1.0 - gl_FragCoord.z * 2.0;\n";
+ // After perspective divide, OpenGL transform z_over_w from [-1, 1] to [near, far]. Here we use
+ // default near = 0 and far = 1, and undo the transformation to get the original z_over_w, then
+ // do our own transformation according to PICA specification.
+ out += "float z_over_w = 2.0 * gl_FragCoord.z - 1.0;\n";
out += "float depth = z_over_w * depth_scale + depth_offset;\n";
if (state.depthmap_enable == RasterizerRegs::DepthBuffering::WBuffering) {
out += "depth /= gl_FragCoord.w;\n";
@@ -1194,7 +1198,9 @@ void main() {
texcoord0_w = vert_texcoord0_w;
normquat = vert_normquat;
view = vert_view;
- gl_Position = vec4(vert_position.x, vert_position.y, -vert_position.z, vert_position.w);
+ gl_Position = vert_position;
+ gl_ClipDistance[0] = -vert_position.z; // fixed PICA clipping plane z <= 0
+ // TODO (wwylele): calculate gl_ClipDistance[1] from user-defined clipping plane
}
)";
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index eface2dea..06a905766 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -56,11 +56,11 @@ OpenGLState::OpenGLState() {
fog_lut.texture_buffer = 0;
- proctex_lut.texture_1d = 0;
- proctex_diff_lut.texture_1d = 0;
- proctex_color_map.texture_1d = 0;
- proctex_alpha_map.texture_1d = 0;
- proctex_noise_lut.texture_1d = 0;
+ proctex_lut.texture_buffer = 0;
+ proctex_diff_lut.texture_buffer = 0;
+ proctex_color_map.texture_buffer = 0;
+ proctex_alpha_map.texture_buffer = 0;
+ proctex_noise_lut.texture_buffer = 0;
draw.read_framebuffer = 0;
draw.draw_framebuffer = 0;
@@ -68,6 +68,8 @@ OpenGLState::OpenGLState() {
draw.vertex_buffer = 0;
draw.uniform_buffer = 0;
draw.shader_program = 0;
+
+ clip_distance = {};
}
void OpenGLState::Apply() const {
@@ -204,33 +206,33 @@ void OpenGLState::Apply() const {
}
// ProcTex Noise LUT
- if (proctex_noise_lut.texture_1d != cur_state.proctex_noise_lut.texture_1d) {
+ if (proctex_noise_lut.texture_buffer != cur_state.proctex_noise_lut.texture_buffer) {
glActiveTexture(TextureUnits::ProcTexNoiseLUT.Enum());
- glBindTexture(GL_TEXTURE_1D, proctex_noise_lut.texture_1d);
+ glBindTexture(GL_TEXTURE_BUFFER, proctex_noise_lut.texture_buffer);
}
// ProcTex Color Map
- if (proctex_color_map.texture_1d != cur_state.proctex_color_map.texture_1d) {
+ if (proctex_color_map.texture_buffer != cur_state.proctex_color_map.texture_buffer) {
glActiveTexture(TextureUnits::ProcTexColorMap.Enum());
- glBindTexture(GL_TEXTURE_1D, proctex_color_map.texture_1d);
+ glBindTexture(GL_TEXTURE_BUFFER, proctex_color_map.texture_buffer);
}
// ProcTex Alpha Map
- if (proctex_alpha_map.texture_1d != cur_state.proctex_alpha_map.texture_1d) {
+ if (proctex_alpha_map.texture_buffer != cur_state.proctex_alpha_map.texture_buffer) {
glActiveTexture(TextureUnits::ProcTexAlphaMap.Enum());
- glBindTexture(GL_TEXTURE_1D, proctex_alpha_map.texture_1d);
+ glBindTexture(GL_TEXTURE_BUFFER, proctex_alpha_map.texture_buffer);
}
// ProcTex LUT
- if (proctex_lut.texture_1d != cur_state.proctex_lut.texture_1d) {
+ if (proctex_lut.texture_buffer != cur_state.proctex_lut.texture_buffer) {
glActiveTexture(TextureUnits::ProcTexLUT.Enum());
- glBindTexture(GL_TEXTURE_1D, proctex_lut.texture_1d);
+ glBindTexture(GL_TEXTURE_BUFFER, proctex_lut.texture_buffer);
}
// ProcTex Diff LUT
- if (proctex_diff_lut.texture_1d != cur_state.proctex_diff_lut.texture_1d) {
+ if (proctex_diff_lut.texture_buffer != cur_state.proctex_diff_lut.texture_buffer) {
glActiveTexture(TextureUnits::ProcTexDiffLUT.Enum());
- glBindTexture(GL_TEXTURE_1D, proctex_diff_lut.texture_1d);
+ glBindTexture(GL_TEXTURE_BUFFER, proctex_diff_lut.texture_buffer);
}
// Framebuffer
@@ -261,6 +263,17 @@ void OpenGLState::Apply() const {
glUseProgram(draw.shader_program);
}
+ // Clip distance
+ for (size_t i = 0; i < clip_distance.size(); ++i) {
+ if (clip_distance[i] != cur_state.clip_distance[i]) {
+ if (clip_distance[i]) {
+ glEnable(GL_CLIP_DISTANCE0 + i);
+ } else {
+ glDisable(GL_CLIP_DISTANCE0 + i);
+ }
+ }
+ }
+
cur_state = *this;
}
@@ -274,16 +287,16 @@ void OpenGLState::ResetTexture(GLuint handle) {
cur_state.lighting_lut.texture_buffer = 0;
if (cur_state.fog_lut.texture_buffer == handle)
cur_state.fog_lut.texture_buffer = 0;
- if (cur_state.proctex_noise_lut.texture_1d == handle)
- cur_state.proctex_noise_lut.texture_1d = 0;
- if (cur_state.proctex_color_map.texture_1d == handle)
- cur_state.proctex_color_map.texture_1d = 0;
- if (cur_state.proctex_alpha_map.texture_1d == handle)
- cur_state.proctex_alpha_map.texture_1d = 0;
- if (cur_state.proctex_lut.texture_1d == handle)
- cur_state.proctex_lut.texture_1d = 0;
- if (cur_state.proctex_diff_lut.texture_1d == handle)
- cur_state.proctex_diff_lut.texture_1d = 0;
+ if (cur_state.proctex_noise_lut.texture_buffer == handle)
+ cur_state.proctex_noise_lut.texture_buffer = 0;
+ if (cur_state.proctex_color_map.texture_buffer == handle)
+ cur_state.proctex_color_map.texture_buffer = 0;
+ if (cur_state.proctex_alpha_map.texture_buffer == handle)
+ cur_state.proctex_alpha_map.texture_buffer = 0;
+ if (cur_state.proctex_lut.texture_buffer == handle)
+ cur_state.proctex_lut.texture_buffer = 0;
+ if (cur_state.proctex_diff_lut.texture_buffer == handle)
+ cur_state.proctex_diff_lut.texture_buffer = 0;
}
void OpenGLState::ResetSampler(GLuint handle) {
diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h
index 1efcf0811..437fe34c4 100644
--- a/src/video_core/renderer_opengl/gl_state.h
+++ b/src/video_core/renderer_opengl/gl_state.h
@@ -4,6 +4,7 @@
#pragma once
+#include <array>
#include <glad/glad.h>
namespace TextureUnits {
@@ -95,23 +96,23 @@ public:
} fog_lut;
struct {
- GLuint texture_1d; // GL_TEXTURE_BINDING_1D
+ GLuint texture_buffer; // GL_TEXTURE_BINDING_BUFFER
} proctex_noise_lut;
struct {
- GLuint texture_1d; // GL_TEXTURE_BINDING_1D
+ GLuint texture_buffer; // GL_TEXTURE_BINDING_BUFFER
} proctex_color_map;
struct {
- GLuint texture_1d; // GL_TEXTURE_BINDING_1D
+ GLuint texture_buffer; // GL_TEXTURE_BINDING_BUFFER
} proctex_alpha_map;
struct {
- GLuint texture_1d; // GL_TEXTURE_BINDING_1D
+ GLuint texture_buffer; // GL_TEXTURE_BINDING_BUFFER
} proctex_lut;
struct {
- GLuint texture_1d; // GL_TEXTURE_BINDING_1D
+ GLuint texture_buffer; // GL_TEXTURE_BINDING_BUFFER
} proctex_diff_lut;
struct {
@@ -123,6 +124,8 @@ public:
GLuint shader_program; // GL_CURRENT_PROGRAM
} draw;
+ std::array<bool, 2> clip_distance; // GL_CLIP_DISTANCE
+
OpenGLState();
/// Get the currently active OpenGL state