Add support for GL_ARB_shading_language_420pack so we don't have to binding sampler locations. Also add support for GL_ARB_separate_shader_objects which doesn't currently work for some reason....investigating.

This commit is contained in:
Ryan Houdek
2011-12-08 01:51:08 -06:00
parent f77d54ff52
commit 1201988fe4
7 changed files with 252 additions and 91 deletions

View File

@ -26,6 +26,7 @@
#include "PixelShaderGen.h"
#include "BPMemory.h"
#include "RenderBase.h"
#include "VideoConfig.h"
#define WRITE p+=sprintf
@ -92,6 +93,8 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
}
else if (ApiType == API_GLSL)
{
if (g_ActiveConfig.backend_info.bSupportsGLSLBinding)
WRITE(p, "layout(binding = 0) ");
WRITE(p, "uniform sampler2DRect samp0;\n");
}
else if (ApiType & API_D3D9)
@ -177,6 +180,8 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType)
}
else if (ApiType == API_GLSL)
{
if (g_ActiveConfig.backend_info.bSupportsGLSLBinding)
WRITE(p, "layout(binding = 0) ");
WRITE(p, "uniform sampler2DRect samp0;\n");
}
else if (ApiType & API_D3D9)
@ -834,7 +839,13 @@ const char *GenerateEncodingShader(u32 format,API_TYPE ApiType)
if(ApiType == API_GLSL)
{
// A few required defines and ones that will make our lives a lot easier
WRITE(p, "#version 120\n");
if (g_ActiveConfig.backend_info.bSupportsGLSLBinding)
{
WRITE(p, "#version 330 compatibility\n");
WRITE(p, "#extension GL_ARB_shading_language_420pack : enable\n");
}
else
WRITE(p, "#version 120\n");
// Silly differences
WRITE(p, "#define float2 vec2\n");
WRITE(p, "#define float3 vec3\n");