Show compile errors and go back to GLSL V120.
This commit is contained in:
parent
9df7626e31
commit
6a5744adb1
|
@ -60,18 +60,18 @@ const char kicad_vertex_shader[] = R"SHADER_SOURCE(
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#version 130
|
#version 120
|
||||||
|
|
||||||
// Shader types
|
// Shader types
|
||||||
const int SHADER_FILLED_CIRCLE = 2;
|
const float SHADER_FILLED_CIRCLE = 2.0;
|
||||||
const int SHADER_STROKED_CIRCLE = 3;
|
const float SHADER_STROKED_CIRCLE = 3.0;
|
||||||
const int SHADER_FONT = 4;
|
const float SHADER_FONT = 4.0;
|
||||||
const int SHADER_LINE_A = 5;
|
const float SHADER_LINE_A = 5.0;
|
||||||
const int SHADER_LINE_B = 6;
|
const float SHADER_LINE_B = 6.0;
|
||||||
const int SHADER_LINE_C = 7;
|
const float SHADER_LINE_C = 7.0;
|
||||||
const int SHADER_LINE_D = 8;
|
const float SHADER_LINE_D = 8.0;
|
||||||
const int SHADER_LINE_E = 9;
|
const float SHADER_LINE_E = 9.0;
|
||||||
const int SHADER_LINE_F = 10;
|
const float SHADER_LINE_F = 10.0;
|
||||||
|
|
||||||
// Minimum line width
|
// Minimum line width
|
||||||
const float MIN_WIDTH = 1.0;
|
const float MIN_WIDTH = 1.0;
|
||||||
|
@ -103,7 +103,7 @@ void computeLineCoords( bool posture, vec2 offset, vec2 texcoord, vec2 dir )
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
int mode = int( attrShaderParams[0] );
|
float mode = attrShaderParams[0];
|
||||||
|
|
||||||
// Pass attributes to the fragment shader
|
// Pass attributes to the fragment shader
|
||||||
shaderParams = attrShaderParams;
|
shaderParams = attrShaderParams;
|
||||||
|
@ -113,16 +113,20 @@ void main()
|
||||||
vec2 vp = vec2(-vs.y, vs.x);
|
vec2 vp = vec2(-vs.y, vs.x);
|
||||||
bool posture = abs( vs.x ) < abs(vs.y);
|
bool posture = abs( vs.x ) < abs(vs.y);
|
||||||
|
|
||||||
switch( mode )
|
if( mode == SHADER_LINE_A )
|
||||||
{
|
computeLineCoords( posture, vp - vs, vec2( -aspect, -1 ), vec2( -1, 0 ) );
|
||||||
case SHADER_LINE_A: computeLineCoords( posture, vp - vs, vec2( -aspect, -1 ), vec2(-1,0) ); break;
|
else if( mode == SHADER_LINE_B )
|
||||||
case SHADER_LINE_B: computeLineCoords( posture, -vp - vs, vec2( -aspect, 1 ), vec2(1,0) ); break;
|
computeLineCoords( posture, -vp - vs, vec2( -aspect, 1 ), vec2( 1, 0 ) );
|
||||||
case SHADER_LINE_C: computeLineCoords( posture, -vp + vs, vec2( aspect, 1 ), vec2(1,0) ); break;
|
else if( mode == SHADER_LINE_C )
|
||||||
case SHADER_LINE_D: computeLineCoords( posture, -vp + vs, vec2( -aspect, -1), vec2(1,0) ); break;
|
computeLineCoords( posture, -vp + vs, vec2( aspect, 1 ), vec2( 1, 0 ) );
|
||||||
case SHADER_LINE_E: computeLineCoords( posture, vp + vs, vec2( -aspect, 1 ), vec2(-1,0) ); break;
|
else if( mode == SHADER_LINE_D )
|
||||||
case SHADER_LINE_F: computeLineCoords( posture, vp - vs, vec2( aspect, 1 ), vec2(-1,0) ); break;
|
computeLineCoords( posture, -vp + vs, vec2( -aspect, -1 ), vec2( 1, 0 ) );
|
||||||
case SHADER_STROKED_CIRCLE:
|
else if( mode == SHADER_LINE_E )
|
||||||
case SHADER_FILLED_CIRCLE:
|
computeLineCoords( posture, vp + vs, vec2( -aspect, 1 ), vec2( -1, 0 ) );
|
||||||
|
else if( mode == SHADER_LINE_F )
|
||||||
|
computeLineCoords( posture, vp - vs, vec2( aspect, 1 ), vec2( -1, 0 ) );
|
||||||
|
else if( mode == SHADER_STROKED_CIRCLE ||
|
||||||
|
mode == SHADER_FILLED_CIRCLE )
|
||||||
{
|
{
|
||||||
// Compute relative circle coordinates basing on indices
|
// Compute relative circle coordinates basing on indices
|
||||||
// Circle
|
// Circle
|
||||||
|
@ -149,14 +153,11 @@ void main()
|
||||||
shaderParams[3] = shaderParams[3] / ( worldScale * lineWidth );
|
shaderParams[3] = shaderParams[3] / ( worldScale * lineWidth );
|
||||||
|
|
||||||
gl_Position = ftransform();
|
gl_Position = ftransform();
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default:
|
else
|
||||||
{
|
{
|
||||||
|
// Pass through the coordinates like in the fixed pipeline
|
||||||
gl_Position = ftransform();
|
gl_Position = ftransform();
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_FrontColor = gl_Color;
|
gl_FrontColor = gl_Color;
|
||||||
|
@ -193,7 +194,7 @@ const char kicad_fragment_shader[] = R"SHADER_SOURCE(
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#version 130
|
#version 120
|
||||||
|
|
||||||
// Multi-channel signed distance field
|
// Multi-channel signed distance field
|
||||||
#define USE_MSDF
|
#define USE_MSDF
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include <gal/opengl/shader.h>
|
#include <gal/opengl/shader.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
using namespace KIGFX;
|
using namespace KIGFX;
|
||||||
|
|
||||||
|
@ -258,7 +259,19 @@ bool SHADER::loadShaderFromStringArray( SHADER_TYPE aShaderType, const char** aA
|
||||||
if( status != GL_TRUE )
|
if( status != GL_TRUE )
|
||||||
{
|
{
|
||||||
shaderInfo( shaderNumber );
|
shaderInfo( shaderNumber );
|
||||||
throw std::runtime_error( "Shader compilation error" );
|
|
||||||
|
GLint maxLength = 0;
|
||||||
|
glGetShaderiv( shaderNumber, GL_INFO_LOG_LENGTH, &maxLength );
|
||||||
|
|
||||||
|
// The maxLength includes the NULL character
|
||||||
|
std::vector<GLchar> errorLog( (size_t) maxLength );
|
||||||
|
glGetShaderInfoLog( shaderNumber, maxLength, &maxLength, &errorLog[0] );
|
||||||
|
|
||||||
|
// Provide the infolog in whatever manor you deem best.
|
||||||
|
// Exit with failure.
|
||||||
|
glDeleteShader( shaderNumber ); // Don't leak the shader.
|
||||||
|
|
||||||
|
throw std::runtime_error( &errorLog[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
glAttachShader( programNumber, shaderNumber );
|
glAttachShader( programNumber, shaderNumber );
|
||||||
|
|
|
@ -108,7 +108,7 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
|
||||||
|
|
||||||
void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
|
void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
|
||||||
{
|
{
|
||||||
wxWindowUpdateLocker dummy( this );
|
//wxWindowUpdateLocker dummy( this );
|
||||||
wxStaticText* text;
|
wxStaticText* text;
|
||||||
|
|
||||||
if( !m_auxiliaryToolBar )
|
if( !m_auxiliaryToolBar )
|
||||||
|
|
|
@ -177,10 +177,10 @@ public:
|
||||||
* @param aParam2 is the optional parameter for a shader.
|
* @param aParam2 is the optional parameter for a shader.
|
||||||
* @param aParam3 is the optional parameter for a shader.
|
* @param aParam3 is the optional parameter for a shader.
|
||||||
*/
|
*/
|
||||||
inline void Shader( int aShaderType, GLfloat aParam1 = 0.0f,
|
inline void Shader( GLfloat aShaderType, GLfloat aParam1 = 0.0f,
|
||||||
GLfloat aParam2 = 0.0f, GLfloat aParam3 = 0.0f )
|
GLfloat aParam2 = 0.0f, GLfloat aParam3 = 0.0f )
|
||||||
{
|
{
|
||||||
m_shader[0] = (float) aShaderType;
|
m_shader[0] = aShaderType;
|
||||||
m_shader[1] = aParam1;
|
m_shader[1] = aParam1;
|
||||||
m_shader[2] = aParam2;
|
m_shader[2] = aParam2;
|
||||||
m_shader[3] = aParam3;
|
m_shader[3] = aParam3;
|
||||||
|
|
|
@ -234,7 +234,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
wxWindowUpdateLocker dummy( this );
|
//wxWindowUpdateLocker dummy( this );
|
||||||
|
|
||||||
if( m_mainToolBar )
|
if( m_mainToolBar )
|
||||||
m_mainToolBar->Clear();
|
m_mainToolBar->Clear();
|
||||||
|
@ -337,7 +337,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::ReCreateOptToolbar()
|
void PCB_EDIT_FRAME::ReCreateOptToolbar()
|
||||||
{
|
{
|
||||||
wxWindowUpdateLocker dummy( this );
|
//wxWindowUpdateLocker dummy( this );
|
||||||
|
|
||||||
if( m_optionsToolBar )
|
if( m_optionsToolBar )
|
||||||
m_optionsToolBar->Clear();
|
m_optionsToolBar->Clear();
|
||||||
|
@ -425,7 +425,7 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::ReCreateVToolbar()
|
void PCB_EDIT_FRAME::ReCreateVToolbar()
|
||||||
{
|
{
|
||||||
wxWindowUpdateLocker dummy( this );
|
//wxWindowUpdateLocker dummy( this );
|
||||||
|
|
||||||
if( m_drawToolBar )
|
if( m_drawToolBar )
|
||||||
m_drawToolBar->Clear();
|
m_drawToolBar->Clear();
|
||||||
|
@ -516,7 +516,7 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
|
||||||
*/
|
*/
|
||||||
void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar()
|
void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar()
|
||||||
{
|
{
|
||||||
wxWindowUpdateLocker dummy(this);
|
//wxWindowUpdateLocker dummy(this);
|
||||||
|
|
||||||
if( m_microWaveToolBar )
|
if( m_microWaveToolBar )
|
||||||
m_microWaveToolBar->Clear();
|
m_microWaveToolBar->Clear();
|
||||||
|
@ -559,7 +559,7 @@ void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar()
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
|
void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
|
||||||
{
|
{
|
||||||
wxWindowUpdateLocker dummy( this );
|
//wxWindowUpdateLocker dummy( this );
|
||||||
|
|
||||||
if( m_auxiliaryToolBar )
|
if( m_auxiliaryToolBar )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue