Skip to content

Commit

Permalink
Merge branch 'v3-0'
Browse files Browse the repository at this point in the history
  • Loading branch information
darksylinc committed Jun 19, 2024
2 parents e81f95b + deb1836 commit 003cddf
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 13 deletions.
3 changes: 2 additions & 1 deletion Components/Hlms/Pbs/include/OgreHlmsPbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ namespace Ogre

void calculateHashFor( Renderable *renderable, uint32 &outHash, uint32 &outCasterHash ) override;
void calculateHashForPreCreate( Renderable *renderable, PiecesMap *inOutPieces ) override;
void calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces ) override;
void calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces,
const PiecesMap *normalPassPieces ) override;

void notifyPropertiesMergedPreGenerationStep( size_t tid ) override;

Expand Down
3 changes: 2 additions & 1 deletion Components/Hlms/Pbs/src/OgreHlmsPbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,8 @@ namespace Ogre
setProperty( kNoTid, PbsProperty::MaterialsPerBuffer, static_cast<int>( mSlotsPerPool ) );
}
//-----------------------------------------------------------------------------------
void HlmsPbs::calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces )
void HlmsPbs::calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces,
const PiecesMap * )
{
HlmsPbsDatablock *datablock = static_cast<HlmsPbsDatablock *>( renderable->getDatablock() );
const bool hasAlphaTest = datablock->getAlphaTest() != CMPF_ALWAYS_PASS;
Expand Down
3 changes: 2 additions & 1 deletion Components/Hlms/Unlit/include/OgreHlmsUnlit.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ namespace Ogre

void calculateHashFor( Renderable *renderable, uint32 &outHash, uint32 &outCasterHash ) override;
void calculateHashForPreCreate( Renderable *renderable, PiecesMap *inOutPieces ) override;
void calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces ) override;
void calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces,
const PiecesMap *normalPassPieces ) override;

void notifyPropertiesMergedPreGenerationStep( size_t tid ) override;

Expand Down
10 changes: 8 additions & 2 deletions Components/Hlms/Unlit/src/OgreHlmsUnlit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,8 @@ namespace Ogre
setProperty( kNoTid, UnlitProperty::MaterialsPerBuffer, static_cast<int>( mSlotsPerPool ) );
}
//-----------------------------------------------------------------------------------
void HlmsUnlit::calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces )
void HlmsUnlit::calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces,
const PiecesMap *normalPassPieces )
{
// HlmsUnlitDatablock *datablock = static_cast<HlmsUnlitDatablock*>(
// renderable->getDatablock() );
Expand Down Expand Up @@ -537,6 +538,11 @@ namespace Ogre
}
}
}
else
{
inOutPieces[VertexShader] = normalPassPieces[VertexShader];
inOutPieces[PixelShader] = normalPassPieces[PixelShader];
}

if( mFastShaderBuildHack )
setProperty( kNoTid, UnlitProperty::MaterialsPerBuffer, static_cast<int>( 2 ) );
Expand Down Expand Up @@ -1019,7 +1025,7 @@ namespace Ogre
// ---- PIXEL SHADER ----
//---------------------------------------------------------------------------

if( !casterPass )
if( !casterPass || datablock->getAlphaTest() != CMPF_ALWAYS_PASS )
{
if( datablock->mTexturesDescSet != mLastDescTexture )
{
Expand Down
5 changes: 4 additions & 1 deletion OgreMain/include/OgreHlms.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,10 @@ namespace Ogre
uint16 calculateHashForV2( Renderable *renderable );

virtual void calculateHashForPreCreate( Renderable *renderable, PiecesMap *inOutPieces ) {}
virtual void calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces ) {}
virtual void calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces,
const PiecesMap *normalPassPieces )
{
}

HlmsCache preparePassHashBase( const Ogre::CompositorShadowNode *shadowNode, bool casterPass,
bool dualParaboloid, SceneManager *sceneManager );
Expand Down
2 changes: 1 addition & 1 deletion OgreMain/src/OgreHlms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2774,7 +2774,7 @@ namespace Ogre
VertexArrayObject *vao = renderable->getVaos( VpShadow )[0];
setProperty( kNoTid, HlmsPsoProp::InputLayoutId, vao->getInputLayoutId() );
}
calculateHashForPreCaster( renderable, piecesCaster );
calculateHashForPreCaster( renderable, piecesCaster, pieces );
setProperty( kNoTid, HlmsPsoProp::Macroblock,
renderable->getDatablock()->getMacroblock( true )->mLifetimeId );
setProperty( kNoTid, HlmsPsoProp::Blendblock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ namespace Ogre

void calculateHashFor( Renderable *renderable, uint32 &outHash, uint32 &outCasterHash ) override;
void calculateHashForPreCreate( Renderable *renderable, PiecesMap *inOutPieces ) override;
void calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces ) override;
void calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces,
const PiecesMap *normalPassPieces ) override;

void notifyPropertiesMergedPreGenerationStep( size_t tid ) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ namespace Ogre
#endif
}
//-----------------------------------------------------------------------------------
void HlmsTerra::calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces )
void HlmsTerra::calculateHashForPreCaster( Renderable *renderable, PiecesMap *inOutPieces,
const PiecesMap * )
{
// Override, since shadow casting is very basic
mT[kNoTid].setProperties.clear();
Expand Down
6 changes: 4 additions & 2 deletions Samples/Media/Hlms/Unlit/Any/500.StructsUnlit_piece_all.any
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
@pset( texcoord, 0 )

@piece( VStoPS_block )
@property( !hlms_shadowcaster )
@property( !hlms_shadowcaster || alpha_test )
@property( syntax != metal )
FLAT_INTERPOLANT( uint drawId, @counter(texcoord) );
@else
Expand All @@ -103,7 +103,9 @@
@end
@foreach( out_uv_half_count, n )
INTERPOLANT( float@value( out_uv_half_count@n ) uv@n, @counter(texcoord) );@end
@else
@end

@property( hlms_shadowcaster )
@property( (!hlms_shadow_uses_depth_texture || exponential_shadow_maps) && !hlms_shadowcaster_point )
INTERPOLANT( float depth, @counter(texcoord) );
@end
Expand Down
2 changes: 1 addition & 1 deletion Samples/Media/Hlms/Unlit/GLSL/PixelShader_ps.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ layout(location = FRAG_COLOR, index = 0) out midf outColour;
// START UNIFORM DECLARATION
@insertpiece( custom_ps_uniformDeclaration )
// END UNIFORM DECLARATION
@property( !hlms_shadowcaster || !hlms_shadow_uses_depth_texture || exponential_shadow_maps )
@property( !hlms_shadowcaster || !hlms_shadow_uses_depth_texture || alpha_test || exponential_shadow_maps )
vulkan_layout( location = 0 ) in block
{
@insertpiece( VStoPS_block )
Expand Down
2 changes: 1 addition & 1 deletion Samples/Media/Hlms/Unlit/GLSL/VertexShader_vs.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ vulkan_layout( OGRE_POSITION ) in vec4 vertex;

@insertpiece( custom_vs_attributes )

@property( !hlms_shadowcaster || !hlms_shadow_uses_depth_texture || exponential_shadow_maps )
@property( !hlms_shadowcaster || !hlms_shadow_uses_depth_texture || alpha_test || exponential_shadow_maps )
vulkan_layout( location = 0 ) out block
{
@insertpiece( VStoPS_block )
Expand Down

0 comments on commit 003cddf

Please sign in to comment.