I am/was having problems with the correct syntax. I tried following some of the shaders updated in the media and the following link helped.
https://git.root3287.site/Sudo-Team/SPI ... 9abaf9ce91
The following works but I'm still not sure it is correct.
Code: Select all
// @code
// #define ogre_P0 set = 0, binding = 0 // Params buffer
// #define ogre_B2 set = 0, binding = 1 // Const buffer at slot 2
// #define ogre_B3 set = 0, binding = 2
// #define ogre_T0 set = 0, binding = 3 // Tex buffer at slot 0
// #define ogre_t1 set = 0, binding = 4 // Texture at slot 1
// // (other APIs share tex buffer & texture slots)
// #define ogre_s1 set = 0, binding = 5 // Sampler at slot 1
// @endcode
Code: Select all
#version 450
#extension GL_ARB_separate_shader_objects : enable
vulkan_layout( OGRE_POSITION ) in vec3 vertex;
vulkan_layout( OGRE_NORMAL ) in vec3 normal;
vulkan_layout( OGRE_TEXCOORD0 ) in vec2 uv0;
vulkan( layout( ogre_P0 ) uniform Params { )
gl_uniform mat4 worldViewProj;
gl_uniform vec4 zoom;
vulkan( }; )
out gl_PerVertex {
vec4 gl_Position;
};
vulkan_layout( location = 0 )
out block
{
vec2 texCoord;
} outVs;
void main(void)
{
gl_Position = worldViewProj*vec4(vertex.xyz,1.0)*zoom.xyzw;
outVs.texCoord = uv0;
}
Code: Select all
#version 450
#extension GL_ARB_separate_shader_objects : enable
vulkan_layout( ogre_t0 ) uniform texture2D videotex;
vulkan( layout( ogre_s0 ) uniform sampler texSampler );
vulkan_layout( location = 0 )
in block
{
vec2 texCoord;
} inPs;
vulkan_layout( location = 0 ) out vec4 outputColor;
void ellipse(in float radius, in vec2 uvcoords, in float border, in vec3 borderColour, inout vec4 outColour, vec2 centre)
{
float dpos = dot(fract(uvcoords) - centre, fract(uvcoords) - centre);
if (dpos > radius * radius) {
if (dpos > radius*(1.0+border) * radius*(1.0+border)) { discard;}
else { outColour = vec4(borderColour ,1); }
}
}
void main() {
outputColor = vec4( texture( sampler2D( videotex, texSampler ),vec2( inPs.texCoord.xy )) );
ellipse(0.48, fract(inPs.texCoord.xy), 0.0065, vec3(0.49,0.49,0.49), outputColor,vec2(0.5,0.5));
}
[Edit] Loading the Vulkan Renderer failed due to missing symbols, needed to link to X11-xcb.