v2-2 shader refactor Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

v2-2 shader refactor

Post by dermont »

Ogre Version: :2.2-WIP
Operating System: :Ubuntu 18.10 / g++ 8.2/ NVidia driver 410.73
Render System: : OpenGL3

1) I'm updating python-ogre for v2.2.

I'm having trouble importing the python module with undefined symbols from TextureBox member functions whose definitions are defined in source files, namely getColourAt / setColourAt.

Code: Select all

nm /media/sdb11/THISITPYTHONOGRE4/v2-2/root/usr/lib/libOgreMain.so | grep setColourAt
000000000047ace0 t _ZN4Ogre10TextureBox11setColourAtERKNS_11ColourValueEmmmNS_14PixelFormatGpuE
...
Adding "_OgreExport" to TextureBox resolves the issue.

2) How does the microcodeCodeCache work in relation to NVidias' shader cache?

3) Is there any info on what's changed with the latest updates, e.g an item without a datablock:

Code: Select all

GLSL compile log: 100000000VertexShader_vs
0(121) : error C0000: syntax error, unexpected '}' at token "}"
0(125) : error C7524: OpenGL requires uniform variables to be declared in global scope
0(125) : error C5056: 'uniform' not allowed on local variable 'worldMatBuf'
0(129) : error C1004: in and out only apply to formal parameters "main"
(0) : error C0000: syntax error, unexpected $end at token "<EOF>"
OGRE EXCEPTION(3:RenderingAPIException): Vertex Program 100000000VertexShader_vs failed to compile. See compile log above for details. in GLSLShader::compile at /media/sdb11/THISITPYTHONOGRE4/v2-2/downloads/ogre-v2-2/RenderSystems/GL3Plus/src/GLSL/OgreGLSLShader.cpp (line 312)

Code: Select all

#if 0
	***	[Hash 0x010d84dd]	2
	***	[Hash 0x06285893]	0
	***	[Hash 0x086bb3a6]	0
	***	[Hash 0x0b4678e4]	1
	***	[Hash 0x1185e86f]	0
	***	[Hash 0x123606a9]	0
	***	[Hash 0x15cb74a1]	0
	***	[Hash 0x1af900a2]	1
	***	[Hash 0x1bab8cdd]	0
	***	[Hash 0x201f84c0]	0
	***	[Hash 0x22caa76a]	0
	***	[Hash 0x25dc73c6]	635204550
	***	[Hash 0x2dd3a2cd]	0
	***	[Hash 0x359e8062]	0
	***	[Hash 0x38942648]	1
	***	[Hash 0x3b038020]	0
	***	[Hash 0x3dde9817]	1
	***	[Hash 0x3fcb60f1]	1070293233
	***	[Hash 0x415a738b]	0
	***	[Hash 0x4508a85c]	1
	***	[Hash 0x46bba485]	0
	***	[Hash 0x4feb7b6e]	1
	***	[Hash 0x549bb006]	0
	***	[Hash 0x5cb4719a]	1
	***	[Hash 0x61e63948]	1
	***	[Hash 0x66ac9d57]	0
	***	[Hash 0x675280f4]	0
	***	[Hash 0x717564b5]	0
	***	[Hash 0x790cdbbe]	0
	***	[Hash 0x7e8dec1c]	0
	***	[Hash 0x7e934f0e]	0
	***	[Hash 0x840f5b80]	0
	***	[Hash 0x8421366d]	256
	***	[Hash 0x86319b9f]	1
	***	[Hash 0x875516cf]	0
	***	[Hash 0x93f2327b]	635204550
	***	[Hash 0x962aeb1a]	1
	***	[Hash 0x9abd84b5]	-1698855755
	***	[Hash 0xa1b3cd70]	1
	***	[Hash 0xa461daa9]	1
	***	[Hash 0xa62cee23]	0
	***	[Hash 0xa69f72d5]	0
	***	[Hash 0xa6ac776b]	0
	***	[Hash 0xa82a8e1f]	1
	***	[Hash 0xa90324bb]	0
	***	[Hash 0xafaf1bb3]	450
	***	[Hash 0xb22f037a]	0
	***	[Hash 0xb967bb7b]	0
	***	[Hash 0xbc128c23]	0
	***	[Hash 0xc5ed03e2]	1
	***	[Hash 0xcb33bcfe]	0
	***	[Hash 0xd17f1d1c]	1
	***	[Hash 0xdf16de3a]	1
	***	[Hash 0xe7bd0fde]	0
	***	[Hash 0xea1519fa]	1
	***	[Hash 0xec133132]	-334286542
	***	[Hash 0xf6eb512d]	0
	***	[Hash 0xf742ff75]	1
	DONE DUMPING PROPERTIES
	DONE DUMPING PIECES
#endif

#version 430 core


    #extension GL_ARB_shading_language_420pack: require
    #define layout_constbuffer(x) layout( std140, x )

	#define bufferFetch texelFetch

	#define min3( a, b, c ) min( a, min( b, c ) )
	#define max3( a, b, c ) max( a, max( b, c ) )

#define float2 vec2
#define float3 vec3
#define float4 vec4

#define int2 ivec2
#define int3 ivec3
#define int4 ivec4

#define uint2 uvec2
#define uint3 uvec3
#define uint4 uvec4

#define float2x2 mat2
#define float3x3 mat3
#define float4x4 mat4
#define ogre_float4x3 mat3x4

#define ushort uint

//Short used for read operations. It's an int in GLSL & HLSL. An ushort in Metal
#define rshort2 int2
//Short used for write operations. It's an int in GLSL. An ushort in HLSL & Metal
#define wshort2 int2

#define toFloat3x3( x ) mat3( x )
#define buildFloat3x3( row0, row1, row2 ) mat3( row0, row1, row2 )

#define mul( x, y ) ((x) * (y))
#define saturate(x) clamp( (x), 0.0, 1.0 )
#define lerp mix
#define rsqrt inversesqrt
#define INLINE
#define NO_INTERPOLATION_PREFIX flat
#define NO_INTERPOLATION_SUFFIX

#define finalDrawId drawId
#define PARAMS_ARG_DECL
#define PARAMS_ARG

#define inVs_vertex vertex
#define inVs_blendWeights blendWeights
#define inVs_blendIndices blendIndices
#define inVs_qtangent qtangent
#define inVs_drawId drawId

	#define inVs_uv0 uv0
#define outVs_Position gl_Position
#define outVs_clipDistance0 gl_ClipDistance[0]

#define gl_SampleMaskIn0 gl_SampleMaskIn[0]

#define outPs_colour0 outColour
#define OGRE_Sample( tex, sampler, uv ) texture( tex, uv )
#define OGRE_SampleLevel( tex, sampler, uv, lod ) textureLod( tex, uv, lod )
#define OGRE_SampleArray2D( tex, sampler, uv, arrayIdx ) texture( tex, vec3( uv, arrayIdx ) )
#define OGRE_SampleArray2DLevel( tex, sampler, uv, arrayIdx, lod ) textureLod( tex, vec3( uv, arrayIdx ), lod )
#define OGRE_SampleArrayCubeLevel( tex, sampler, uv, arrayIdx, lod ) textureLod( tex, vec4( uv, arrayIdx ), lod )
#define OGRE_SampleGrad( tex, sampler, uv, ddx, ddy ) textureGrad( tex, uv, ddx, ddy )
#define OGRE_SampleArray2DGrad( tex, sampler, uv, arrayIdx, ddx, ddy ) textureGrad( tex, vec3( uv, arrayIdx ), ddx, ddy )
#define OGRE_ddx( val ) dFdx( val )
#define OGRE_ddy( val ) dFdy( val )
#define OGRE_Load2D( tex, iuv, lod ) texelFetch( tex, iuv, lod )
#define OGRE_Load2DMS( tex, iuv, subsample ) texelFetch( tex, iuv, subsample )

#define bufferFetch1( buffer, idx ) texelFetch( buffer, idx ).x

#define CONST_BUFFER( bufferName, bindingPoint ) layout_constbuffer(binding = bindingPoint) uniform bufferName
#define CONST_BUFFER_STRUCT_BEGIN( structName, bindingPoint ) layout_constbuffer(binding = bindingPoint) uniform structName
#define CONST_BUFFER_STRUCT_END( variableName, v ) variableName

#define FLAT_INTERPOLANT( decl, bindingPoint ) flat decl
#define INTERPOLANT( decl, bindingPoint ) decl



out gl_PerVertex
{
	vec4 gl_Position;

};

layout(std140) uniform;


in vec4 vertex;
in vec4 qtangent;
in vec2 uv0;
in uint drawId;
out block
{
		
} outVs;


// START UNIFORM GL DECLARATION
/*layout(binding = 0) */uniform samplerBuffer worldMatBuf;

// END UNIFORM GL DECLARATION

void main()
{

}
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5299
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: v2-2 shader refactor

Post by dark_sylinc »

I love your vigilant watch :)
dermont wrote: Fri Nov 30, 2018 8:59 am 1) I'm updating python-ogre for v2.2.

I'm having trouble importing the python module with undefined symbols from TextureBox member functions whose definitions are defined in source files, namely getColourAt / setColourAt.

Code: Select all

nm /media/sdb11/THISITPYTHONOGRE4/v2-2/root/usr/lib/libOgreMain.so | grep setColourAt
000000000047ace0 t _ZN4Ogre10TextureBox11setColourAtERKNS_11ColourValueEmmmNS_14PixelFormatGpuE
...
Adding "_OgreExport" to TextureBox resolves the issue.
Fixed. Thanks
2) How does the microcodeCodeCache work in relation to NVidias' shader cache?
I don't think NVIDIA has made public how their shader cache works exactly.

But if I have to guess, they cache the compiled microcode -> PSO conversion for D3D11, and for GL they could cache the preprocessed shader -> microcode -> PSO. See OgreHlmsDiskCache.h comments for an explanation.

For D3D11, in order to cache more than just the microcode -> PSO (i.e. cache as well shader -> microcode), NVIDIA driver would have to hack some DirectX DLLs (which is not entirely impossible TBH...)
3) Is there any info on what's changed with the latest updates, e.g an item without a datablock:
I cannot repro. Is there a quick way by modifying a simple sample (e.g. like Tutorial02_VariableFramerate) in order to test this? Thanks

Cheers
Matias
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: v2-2 shader refactor

Post by dermont »

dark_sylinc wrote: Fri Nov 30, 2018 11:50 pm ...
Fixed. Thanks
Thanks.
dark_sylinc wrote: Fri Nov 30, 2018 11:50 pm
2) How does the microcodeCodeCache work in relation to NVidias' shader cache?
I don't think NVIDIA has made public how their shader cache works exactly.

But if I have to guess, they cache the compiled microcode -> PSO conversion for D3D11, and for GL they could cache the preprocessed shader -> microcode -> PSO. See OgreHlmsDiskCache.h comments for an explanation.

For D3D11, in order to cache more than just the microcode -> PSO (i.e. cache as well shader -> microcode), NVIDIA driver would have to hack some DirectX DLLs (which is not entirely impossible TBH...)
Thanks for the feedback.
dark_sylinc wrote: Fri Nov 30, 2018 11:50 pm
3) Is there any info on what's changed with the latest updates, e.g an item without a datablock:
I cannot repro. Is there a quick way by modifying a simple sample (e.g. like Tutorial02_VariableFramerate) in order to test this? Thanks
I didn't update the HlmsPbs paths to include "Hlms/Pbs/Any/Main", sorry for the noise.
Post Reply