summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_rasterizer.h
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-09-18 02:38:01 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-09-18 02:38:01 +0200
commitdc8479928c5aee4c6ad6fe4f59006fb604cee701 (patch)
tree569a7f13128450bbab973236615587ff00bced5f /src/video_core/renderer_opengl/gl_rasterizer.h
parentTravis: Import Dolphin’s clang-format hook. (diff)
downloadyuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.gz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.bz2
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.lz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.xz
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.zst
yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h50
1 files changed, 29 insertions, 21 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index c5029432b..70e9e64ef 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -8,8 +8,8 @@
#include <cstddef>
#include <cstring>
#include <memory>
-#include <vector>
#include <unordered_map>
+#include <vector>
#include <glad/glad.h>
@@ -40,10 +40,13 @@ struct ScreenInfo;
* Pica state is not being captured in the shader cache key, thereby resulting in (what should be)
* two separate shaders sharing the same key.
*
- * We use a union because "implicitly-defined copy/move constructor for a union X copies the object representation of X."
- * and "implicitly-defined copy assignment operator for a union X copies the object representation (3.9) of X."
+ * We use a union because "implicitly-defined copy/move constructor for a union X copies the object
+ * representation of X."
+ * and "implicitly-defined copy assignment operator for a union X copies the object representation
+ * (3.9) of X."
* = Bytewise copy instead of memberwise copy.
- * This is important because the padding bytes are included in the hash and comparison between objects.
+ * This is important because the padding bytes are included in the hash and comparison between
+ * objects.
*/
union PicaShaderConfig {
@@ -60,8 +63,9 @@ union PicaShaderConfig {
state.depthmap_enable = regs.depthmap_enable;
- state.alpha_test_func = regs.output_merger.alpha_test.enable ?
- regs.output_merger.alpha_test.func.Value() : Pica::Regs::CompareFunc::Always;
+ state.alpha_test_func = regs.output_merger.alpha_test.enable
+ ? regs.output_merger.alpha_test.func.Value()
+ : Pica::Regs::CompareFunc::Always;
state.texture0_type = regs.texture0.type;
@@ -81,9 +85,8 @@ union PicaShaderConfig {
state.fog_mode = regs.fog_mode;
state.fog_flip = regs.fog_flip;
- state.combiner_buffer_input =
- regs.tev_combiner_buffer_input.update_mask_rgb.Value() |
- regs.tev_combiner_buffer_input.update_mask_a.Value() << 4;
+ state.combiner_buffer_input = regs.tev_combiner_buffer_input.update_mask_rgb.Value() |
+ regs.tev_combiner_buffer_input.update_mask_a.Value() << 4;
// Fragment lighting
@@ -95,8 +98,10 @@ union PicaShaderConfig {
const auto& light = regs.lighting.light[num];
state.lighting.light[light_index].num = num;
state.lighting.light[light_index].directional = light.config.directional != 0;
- state.lighting.light[light_index].two_sided_diffuse = light.config.two_sided_diffuse != 0;
- state.lighting.light[light_index].dist_atten_enable = !regs.lighting.IsDistAttenDisabled(num);
+ state.lighting.light[light_index].two_sided_diffuse =
+ light.config.two_sided_diffuse != 0;
+ state.lighting.light[light_index].dist_atten_enable =
+ !regs.lighting.IsDistAttenDisabled(num);
}
state.lighting.lut_d0.enable = regs.lighting.config1.disable_lut_d0 == 0;
@@ -147,7 +152,7 @@ union PicaShaderConfig {
return (stage_index < 4) && ((state.combiner_buffer_input >> 4) & (1 << stage_index));
}
- bool operator ==(const PicaShaderConfig& o) const {
+ bool operator==(const PicaShaderConfig& o) const {
return std::memcmp(&state, &o.state, sizeof(PicaShaderConfig::State)) == 0;
};
@@ -212,7 +217,8 @@ union PicaShaderConfig {
} state;
};
#if (__GNUC__ >= 5) || defined(__clang__) || defined(_MSC_VER)
-static_assert(std::is_trivially_copyable<PicaShaderConfig::State>::value, "PicaShaderConfig::State must be trivially copyable");
+static_assert(std::is_trivially_copyable<PicaShaderConfig::State>::value,
+ "PicaShaderConfig::State must be trivially copyable");
#endif
namespace std {
@@ -228,12 +234,10 @@ struct hash<PicaShaderConfig> {
class RasterizerOpenGL : public VideoCore::RasterizerInterface {
public:
-
RasterizerOpenGL();
~RasterizerOpenGL() override;
- void AddTriangle(const Pica::Shader::OutputVertex& v0,
- const Pica::Shader::OutputVertex& v1,
+ void AddTriangle(const Pica::Shader::OutputVertex& v0, const Pica::Shader::OutputVertex& v1,
const Pica::Shader::OutputVertex& v2) override;
void DrawTriangles() override;
void NotifyPicaRegisterChanged(u32 id) override;
@@ -242,7 +246,8 @@ public:
void FlushAndInvalidateRegion(PAddr addr, u32 size) override;
bool AccelerateDisplayTransfer(const GPU::Regs::DisplayTransferConfig& config) override;
bool AccelerateFill(const GPU::Regs::MemoryFillConfig& config) override;
- bool AccelerateDisplay(const GPU::Regs::FramebufferConfig& config, PAddr framebuffer_addr, u32 pixel_stride, ScreenInfo& screen_info) override;
+ bool AccelerateDisplay(const GPU::Regs::FramebufferConfig& config, PAddr framebuffer_addr,
+ u32 pixel_stride, ScreenInfo& screen_info) override;
/// OpenGL shader generated for a given Pica register state
struct PicaShader {
@@ -251,13 +256,13 @@ public:
};
private:
-
struct SamplerInfo {
using TextureConfig = Pica::Regs::TextureConfig;
OGLSampler sampler;
- /// Creates the sampler object, initializing its state so that it's in sync with the SamplerInfo struct.
+ /// Creates the sampler object, initializing its state so that it's in sync with the
+ /// SamplerInfo struct.
void Create();
/// Syncs the sampler object with the config, updating any necessary state.
void SyncWithConfig(const TextureConfig& config);
@@ -343,8 +348,11 @@ private:
alignas(16) GLvec4 tev_combiner_buffer_color;
};
- static_assert(sizeof(UniformData) == 0x3C0, "The size of the UniformData structure has changed, update the structure in the shader");
- static_assert(sizeof(UniformData) < 16384, "UniformData structure must be less than 16kb as per the OpenGL spec");
+ static_assert(
+ sizeof(UniformData) == 0x3C0,
+ "The size of the UniformData structure has changed, update the structure in the shader");
+ static_assert(sizeof(UniformData) < 16384,
+ "UniformData structure must be less than 16kb as per the OpenGL spec");
/// Sets the OpenGL shader in accordance with the current PICA register state
void SetShader();