mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-12-26 01:31:56 +01:00
Pica: Make PicaShaderConfig trivially_copyable and clear it before use
This commit is contained in:
parent
678d15761f
commit
f3f7018c9e
@ -41,9 +41,12 @@ struct ScreenInfo;
|
|||||||
* two separate shaders sharing the same key.
|
* two separate shaders sharing the same key.
|
||||||
*/
|
*/
|
||||||
struct PicaShaderConfig {
|
struct PicaShaderConfig {
|
||||||
|
|
||||||
/// Construct a PicaShaderConfig with the current Pica register configuration.
|
/// Construct a PicaShaderConfig with the current Pica register configuration.
|
||||||
static PicaShaderConfig CurrentConfig() {
|
static PicaShaderConfig CurrentConfig() {
|
||||||
PicaShaderConfig res;
|
PicaShaderConfig res;
|
||||||
|
std::memset(&res, 0, sizeof(PicaShaderConfig));
|
||||||
|
|
||||||
const auto& regs = Pica::g_state.regs;
|
const auto& regs = Pica::g_state.regs;
|
||||||
|
|
||||||
res.alpha_test_func = regs.output_merger.alpha_test.enable ?
|
res.alpha_test_func = regs.output_merger.alpha_test.enable ?
|
||||||
@ -134,38 +137,42 @@ struct PicaShaderConfig {
|
|||||||
return std::memcmp(this, &o, sizeof(PicaShaderConfig)) == 0;
|
return std::memcmp(this, &o, sizeof(PicaShaderConfig)) == 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pica::Regs::CompareFunc alpha_test_func = Pica::Regs::CompareFunc::Never;
|
Pica::Regs::CompareFunc alpha_test_func;
|
||||||
std::array<Pica::Regs::TevStageConfig, 6> tev_stages = {};
|
std::array<Pica::Regs::TevStageConfig, 6> tev_stages;
|
||||||
u8 combiner_buffer_input = 0;
|
u8 combiner_buffer_input;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct {
|
struct {
|
||||||
unsigned num = 0;
|
unsigned num;
|
||||||
bool directional = false;
|
bool directional;
|
||||||
bool two_sided_diffuse = false;
|
bool two_sided_diffuse;
|
||||||
bool dist_atten_enable = false;
|
bool dist_atten_enable;
|
||||||
GLfloat dist_atten_scale = 0.0f;
|
GLfloat dist_atten_scale;
|
||||||
GLfloat dist_atten_bias = 0.0f;
|
GLfloat dist_atten_bias;
|
||||||
} light[8];
|
} light[8];
|
||||||
|
|
||||||
bool enable = false;
|
bool enable;
|
||||||
unsigned src_num = 0;
|
unsigned src_num;
|
||||||
Pica::Regs::LightingBumpMode bump_mode = Pica::Regs::LightingBumpMode::None;
|
Pica::Regs::LightingBumpMode bump_mode;
|
||||||
unsigned bump_selector = 0;
|
unsigned bump_selector;
|
||||||
bool bump_renorm = false;
|
bool bump_renorm;
|
||||||
bool clamp_highlights = false;
|
bool clamp_highlights;
|
||||||
|
|
||||||
Pica::Regs::LightingConfig config = Pica::Regs::LightingConfig::Config0;
|
Pica::Regs::LightingConfig config;
|
||||||
Pica::Regs::LightingFresnelSelector fresnel_selector = Pica::Regs::LightingFresnelSelector::None;
|
Pica::Regs::LightingFresnelSelector fresnel_selector;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool enable = false;
|
bool enable;
|
||||||
bool abs_input = false;
|
bool abs_input;
|
||||||
Pica::Regs::LightingLutInput type = Pica::Regs::LightingLutInput::NH;
|
Pica::Regs::LightingLutInput type;
|
||||||
float scale = 1.0f;
|
float scale;
|
||||||
} lut_d0, lut_d1, lut_fr, lut_rr, lut_rg, lut_rb;
|
} lut_d0, lut_d1, lut_fr, lut_rr, lut_rg, lut_rb;
|
||||||
} lighting;
|
} lighting;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
#if (__GNUC__ >= 5) || defined(__clang__) || defined(_MSC_VER)
|
||||||
|
static_assert(std::is_trivially_copyable<PicaShaderConfig>::value, "PicaShaderConfig must be trivially copyable");
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user