1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-25 05:49:34 +00:00

Fix issues with shader storage and HW lighting in Android

The cause was that we were loading the shader cache before we loaded any
microcodes through GBI. With this change, shader storage will now store
wether it's possible to do HW lighting based on GBI status.
This commit is contained in:
Francisco Zurita 2016-08-09 02:27:41 -04:00 committed by Sergey Lipskiy
parent 69720ba7f8
commit bd04064b6b
6 changed files with 8 additions and 3 deletions

View File

@ -384,7 +384,7 @@ Storage format:
uint32 - number of shaders
shaders in binary form
*/
static const u32 ShaderStorageFormatVersion = 0x08U;
static const u32 ShaderStorageFormatVersion = 0x09U;
void CombinerInfo::_saveShadersStorage() const
{
if (m_shadersLoaded >= m_combiners.size())

View File

@ -87,6 +87,7 @@
#define ONE 19
#define ZERO 20
#define LIGHT 21
#define HW_LIGHT 22
struct CombinerOp
{

View File

@ -37,6 +37,7 @@ public:
bool usesLOD() const { return (m_nInputs & (1 << LOD_FRACTION)) != 0; }
bool usesShade() const { return (m_nInputs & ((1 << SHADE) | (1 << SHADE_ALPHA))) != 0; }
bool usesShadeColor() const { return (m_nInputs & (1 << SHADE)) != 0; }
bool usesHwLighting() const { return (m_nInputs & (1 << HW_LIGHT)) != 0; }
friend std::ostream & operator<< (std::ostream & _os, const ShaderCombiner & _combiner);
friend std::istream & operator>> (std::istream & _os, ShaderCombiner & _combiner);

View File

@ -125,7 +125,7 @@ void UniformBlock::bindWithShaderCombiner(ShaderCombiner * _pCombiner)
glUniformBlockBinding(program, blockIndex, m_colorsBlock.m_blockBindingPoint);
}
if (_pCombiner->usesShadeColor() && config.generalEmulation.enableHWLighting != 0) {
if (_pCombiner->usesHwLighting()) {
if (m_lightBlock.m_buffer == 0)
_initLightBuffer(program);
else {

View File

@ -42,7 +42,7 @@ void UniformSet::bindWithShaderCombiner(ShaderCombiner * _pCombiner)
_updateColorUniforms(location, true);
// Lights
if (config.generalEmulation.enableHWLighting != 0 && GBI.isHWLSupported() && _pCombiner->usesShadeColor()) {
if (_pCombiner->usesHwLighting()) {
// locate lights uniforms
char buf[32];
for (s32 i = 0; i < 8; ++i) {

View File

@ -305,6 +305,9 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
const bool bUseLod = usesLOD();
const bool bUseHWLight = config.generalEmulation.enableHWLighting != 0 && GBI.isHWLSupported() && usesShadeColor();
if( bUseHWLight )
m_nInputs |= 1 << HW_LIGHT;
if (usesTexture()) {
strFragmentShader.assign(fragment_shader_header_common_variables);
if (gDP.otherMode.cycleType == G_CYC_2CYCLE && config.generalEmulation.enableLegacyBlending == 0)