remove (ATTR|VARY)(IN|OUT) macros

This commit is contained in:
degasus 2014-02-25 15:52:22 +01:00
parent 1d0b6a1156
commit aaaa5af0b2
7 changed files with 34 additions and 40 deletions

View File

@ -452,12 +452,6 @@ void ProgramShaderCache::CreateHeader ( void )
// Precision defines for GLSLES3
"%s\n"
"\n"// A few required defines and ones that will make our lives a lot easier
"#define ATTRIN in\n"
"#define ATTROUT out\n"
"#define VARYIN %s\n"
"#define VARYOUT %s\n"
// Silly differences
"#define float2 vec2\n"
"#define float3 vec3\n"
@ -472,6 +466,7 @@ void ProgramShaderCache::CreateHeader ( void )
// Terrible hack, look at DriverDetails.h
"%s\n"
"%s\n"
, v==GLSLES3 ? "#version 300 es" : v==GLSL_130 ? "#version 130" : v==GLSL_140 ? "#version 140" : "#version 150"
, v<GLSL_140 ? "#extension GL_ARB_uniform_buffer_object : enable" : ""
@ -480,9 +475,8 @@ void ProgramShaderCache::CreateHeader ( void )
, v==GLSLES3 ? "precision highp float;" : ""
, DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "in" : "centroid in"
, DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "out" : "centroid out"
, DriverDetails::HasBug(DriverDetails::BUG_BROKENTEXTURESIZE) ? "#define textureSize(x, y) ivec2(1, 1)" : ""
, DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "#define centroid" : ""
);
}

View File

@ -115,9 +115,9 @@ const u8 rasters[char_count][char_height] = {
static const char *s_vertexShaderSrc =
"uniform vec2 charSize;\n"
"ATTRIN vec2 rawpos;\n"
"ATTRIN vec2 tex0;\n"
"VARYOUT vec2 uv0;\n"
"in vec2 rawpos;\n"
"in vec2 tex0;\n"
"out vec2 uv0;\n"
"void main(void) {\n"
" gl_Position = vec4(rawpos,0,1);\n"
" uv0 = tex0 * charSize;\n"
@ -126,7 +126,7 @@ static const char *s_vertexShaderSrc =
static const char *s_fragmentShaderSrc =
"uniform sampler2D samp8;\n"
"uniform vec4 color;\n"
"VARYIN vec2 uv0;\n"
"in vec2 uv0;\n"
"out vec4 ocol0;\n"
"void main(void) {\n"
" ocol0 = texture(samp8,uv0) * color;\n"

View File

@ -652,14 +652,14 @@ void Renderer::Init()
s_pfont = new RasterFont();
ProgramShaderCache::CompileShader(s_ShowEFBCopyRegions,
"ATTRIN vec2 rawpos;\n"
"ATTRIN vec3 color0;\n"
"VARYOUT vec4 c;\n"
"in vec2 rawpos;\n"
"in vec3 color0;\n"
"out vec4 c;\n"
"void main(void) {\n"
" gl_Position = vec4(rawpos, 0.0, 1.0);\n"
" c = vec4(color0, 1.0);\n"
"}\n",
"VARYIN vec4 c;\n"
"in vec4 c;\n"
"out vec4 ocol0;\n"
"void main(void) {\n"
" ocol0 = c;\n"

View File

@ -346,7 +346,7 @@ TextureCache::TextureCache()
const char *pColorMatrixProg =
"uniform sampler2D samp9;\n"
"uniform vec4 colmat[7];\n"
"VARYIN vec2 uv0;\n"
"in vec2 uv0;\n"
"out vec4 ocol0;\n"
"\n"
"void main(){\n"
@ -358,7 +358,7 @@ TextureCache::TextureCache()
const char *pDepthMatrixProg =
"uniform sampler2D samp9;\n"
"uniform vec4 colmat[5];\n"
"VARYIN vec2 uv0;\n"
"in vec2 uv0;\n"
"out vec4 ocol0;\n"
"\n"
"void main(){\n"
@ -369,7 +369,7 @@ TextureCache::TextureCache()
"}\n";
const char *VProgram =
"VARYOUT vec2 uv0;\n"
"out vec2 uv0;\n"
"uniform sampler2D samp9;\n"
"uniform vec4 copy_position;\n" // left, top, right, bottom
"void main()\n"

View File

@ -68,7 +68,7 @@ void CreatePrograms()
*/
// Output is BGRA because that is slightly faster than RGBA.
const char *VProgramRgbToYuyv =
"VARYOUT vec2 uv0;\n"
"out vec2 uv0;\n"
"uniform vec4 copy_position;\n" // left, top, right, bottom
"uniform sampler2D samp9;\n"
"void main()\n"
@ -79,7 +79,7 @@ void CreatePrograms()
"}\n";
const char *FProgramRgbToYuyv =
"uniform sampler2D samp9;\n"
"VARYIN vec2 uv0;\n"
"in vec2 uv0;\n"
"out vec4 ocol0;\n"
"void main()\n"
"{\n"
@ -110,7 +110,7 @@ void CreatePrograms()
"}\n";
const char *FProgramYuyvToRgb =
"uniform sampler2D samp9;\n"
"VARYIN vec2 uv0;\n"
"in vec2 uv0;\n"
"out vec4 ocol0;\n"
"void main()\n"
"{\n"

View File

@ -311,19 +311,19 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
if (per_pixel_depth)
out.Write("#define depth gl_FragDepth\n");
out.Write("VARYIN float4 colors_02;\n");
out.Write("VARYIN float4 colors_12;\n");
out.Write("centroid in float4 colors_02;\n");
out.Write("centroid in float4 colors_12;\n");
// compute window position if needed because binding semantic WPOS is not widely supported
// Let's set up attributes
for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i)
{
out.Write("VARYIN float3 uv%d_2;\n", i);
out.Write("centroid in float3 uv%d_2;\n", i);
}
out.Write("VARYIN float4 clipPos_2;\n");
out.Write("centroid in float4 clipPos_2;\n");
if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{
out.Write("VARYIN float4 Normal_2;\n");
out.Write("centroid in float4 Normal_2;\n");
}
if (forced_early_z)

View File

@ -106,26 +106,26 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
if(api_type == API_OPENGL)
{
out.Write("ATTRIN float4 rawpos; // ATTR%d,\n", SHADER_POSITION_ATTRIB);
out.Write("in float4 rawpos; // ATTR%d,\n", SHADER_POSITION_ATTRIB);
if (components & VB_HAS_POSMTXIDX)
out.Write("ATTRIN float fposmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB);
out.Write("in float fposmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB);
if (components & VB_HAS_NRM0)
out.Write("ATTRIN float3 rawnorm0; // ATTR%d,\n", SHADER_NORM0_ATTRIB);
out.Write("in float3 rawnorm0; // ATTR%d,\n", SHADER_NORM0_ATTRIB);
if (components & VB_HAS_NRM1)
out.Write("ATTRIN float3 rawnorm1; // ATTR%d,\n", SHADER_NORM1_ATTRIB);
out.Write("in float3 rawnorm1; // ATTR%d,\n", SHADER_NORM1_ATTRIB);
if (components & VB_HAS_NRM2)
out.Write("ATTRIN float3 rawnorm2; // ATTR%d,\n", SHADER_NORM2_ATTRIB);
out.Write("in float3 rawnorm2; // ATTR%d,\n", SHADER_NORM2_ATTRIB);
if (components & VB_HAS_COL0)
out.Write("ATTRIN float4 color0; // ATTR%d,\n", SHADER_COLOR0_ATTRIB);
out.Write("in float4 color0; // ATTR%d,\n", SHADER_COLOR0_ATTRIB);
if (components & VB_HAS_COL1)
out.Write("ATTRIN float4 color1; // ATTR%d,\n", SHADER_COLOR1_ATTRIB);
out.Write("in float4 color1; // ATTR%d,\n", SHADER_COLOR1_ATTRIB);
for (int i = 0; i < 8; ++i)
{
u32 hastexmtx = (components & (VB_HAS_TEXMTXIDX0<<i));
if ((components & (VB_HAS_UV0<<i)) || hastexmtx)
out.Write("ATTRIN float%d tex%d; // ATTR%d,\n", hastexmtx ? 3 : 2, i, SHADER_TEXTURE0_ATTRIB + i);
out.Write("in float%d tex%d; // ATTR%d,\n", hastexmtx ? 3 : 2, i, SHADER_TEXTURE0_ATTRIB + i);
}
// Let's set up attributes
@ -133,15 +133,15 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
{
if (i < xfregs.numTexGen.numTexGens)
{
out.Write("VARYOUT float3 uv%d_2;\n", i);
out.Write("centroid out float3 uv%d_2;\n", i);
}
}
out.Write("VARYOUT float4 clipPos_2;\n");
out.Write("centroid out float4 clipPos_2;\n");
if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
out.Write("VARYOUT float4 Normal_2;\n");
out.Write("centroid out float4 Normal_2;\n");
out.Write("VARYOUT float4 colors_02;\n");
out.Write("VARYOUT float4 colors_12;\n");
out.Write("centroid out float4 colors_02;\n");
out.Write("centroid out float4 colors_12;\n");
out.Write("void main()\n{\n");
}