Merge pull request #471 from Sonicadvance1/sampler_binding
Support Sampler binding in the shader.
This commit is contained in:
commit
5646ffdacd
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
// 0. You just DO WHAT THE FUCK YOU WANT TO.
|
// 0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||||
|
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//dummy shader:
|
//dummy shader:
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// textures
|
// textures
|
||||||
uniform sampler2D samp8;
|
SAMPLER_BINDING(8) uniform sampler2D samp8;
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
const int char_width = 8;
|
const int char_width = 8;
|
||||||
const int char_height = 13;
|
const int char_height = 13;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Omega's 3D Stereoscopic filtering
|
// Omega's 3D Stereoscopic filtering
|
||||||
// TODO: Need depth info!
|
// TODO: Need depth info!
|
||||||
|
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Omega's 3D Stereoscopic filtering (Amber/Blue)
|
// Omega's 3D Stereoscopic filtering (Amber/Blue)
|
||||||
// TODO: Need depth info!
|
// TODO: Need depth info!
|
||||||
|
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
uniform sampler2D samp9;
|
SAMPLER_BINDING(9) uniform sampler2D samp9;
|
||||||
|
|
||||||
out vec4 ocol0;
|
out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
|
@ -169,7 +169,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
|
||||||
{
|
{
|
||||||
// non-msaa, so just fetch the pixel
|
// non-msaa, so just fetch the pixel
|
||||||
sampler =
|
sampler =
|
||||||
"uniform sampler2D samp9;\n"
|
"SAMPLER_BINDING(9) uniform sampler2D samp9;\n"
|
||||||
"vec4 sampleEFB(ivec2 pos) {\n"
|
"vec4 sampleEFB(ivec2 pos) {\n"
|
||||||
" return texelFetch(samp9, pos, 0);\n"
|
" return texelFetch(samp9, pos, 0);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
@ -180,7 +180,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
|
||||||
// This will lead to sample shading, but it's the only way to not loose
|
// This will lead to sample shading, but it's the only way to not loose
|
||||||
// the values of each sample.
|
// the values of each sample.
|
||||||
sampler =
|
sampler =
|
||||||
"uniform sampler2DMS samp9;\n"
|
"SAMPLER_BINDING(9) uniform sampler2DMS samp9;\n"
|
||||||
"vec4 sampleEFB(ivec2 pos) {\n"
|
"vec4 sampleEFB(ivec2 pos) {\n"
|
||||||
" return texelFetch(samp9, pos, gl_SampleID);\n"
|
" return texelFetch(samp9, pos, gl_SampleID);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
@ -191,7 +191,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
|
||||||
std::stringstream samples;
|
std::stringstream samples;
|
||||||
samples << m_msaaSamples;
|
samples << m_msaaSamples;
|
||||||
sampler =
|
sampler =
|
||||||
"uniform sampler2DMS samp9;\n"
|
"SAMPLER_BINDING(9) uniform sampler2DMS samp9;\n"
|
||||||
"vec4 sampleEFB(ivec2 pos) {\n"
|
"vec4 sampleEFB(ivec2 pos) {\n"
|
||||||
" vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n"
|
" vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n"
|
||||||
" for(int i=0; i<" + samples.str() + "; i++)\n"
|
" for(int i=0; i<" + samples.str() + "; i++)\n"
|
||||||
|
|
|
@ -61,12 +61,12 @@ static std::string GetGLSLVersionString()
|
||||||
|
|
||||||
void SHADER::SetProgramVariables()
|
void SHADER::SetProgramVariables()
|
||||||
{
|
{
|
||||||
// glsl shader must be bind to set samplers
|
// Bind UBO and texture samplers
|
||||||
Bind();
|
|
||||||
|
|
||||||
// Bind UBO
|
|
||||||
if (!g_ActiveConfig.backend_info.bSupportsBindingLayout)
|
if (!g_ActiveConfig.backend_info.bSupportsBindingLayout)
|
||||||
{
|
{
|
||||||
|
// glsl shader must be bind to set samplers if we don't support binding layout
|
||||||
|
Bind();
|
||||||
|
|
||||||
GLint PSBlock_id = glGetUniformBlockIndex(glprogid, "PSBlock");
|
GLint PSBlock_id = glGetUniformBlockIndex(glprogid, "PSBlock");
|
||||||
GLint VSBlock_id = glGetUniformBlockIndex(glprogid, "VSBlock");
|
GLint VSBlock_id = glGetUniformBlockIndex(glprogid, "VSBlock");
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ void SHADER::SetProgramVariables()
|
||||||
glUniformBlockBinding(glprogid, PSBlock_id, 1);
|
glUniformBlockBinding(glprogid, PSBlock_id, 1);
|
||||||
if (VSBlock_id != -1)
|
if (VSBlock_id != -1)
|
||||||
glUniformBlockBinding(glprogid, VSBlock_id, 2);
|
glUniformBlockBinding(glprogid, VSBlock_id, 2);
|
||||||
}
|
|
||||||
|
|
||||||
// Bind Texture Sampler
|
// Bind Texture Sampler
|
||||||
for (int a = 0; a <= 9; ++a)
|
for (int a = 0; a <= 9; ++a)
|
||||||
|
@ -87,7 +86,7 @@ void SHADER::SetProgramVariables()
|
||||||
if (loc != -1)
|
if (loc != -1)
|
||||||
glUniform1i(loc, a);
|
glUniform1i(loc, a);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHADER::SetProgramBindings()
|
void SHADER::SetProgramBindings()
|
||||||
|
@ -479,6 +478,7 @@ void ProgramShaderCache::CreateHeader ( void )
|
||||||
"%s\n" // 420pack
|
"%s\n" // 420pack
|
||||||
"%s\n" // msaa
|
"%s\n" // msaa
|
||||||
"%s\n" // sample shading
|
"%s\n" // sample shading
|
||||||
|
"%s\n" // Sampler binding
|
||||||
|
|
||||||
// Precision defines for GLSL ES
|
// Precision defines for GLSL ES
|
||||||
"%s\n"
|
"%s\n"
|
||||||
|
@ -509,6 +509,7 @@ void ProgramShaderCache::CreateHeader ( void )
|
||||||
, (g_ActiveConfig.backend_info.bSupportsBindingLayout && v < GLSLES_310) ? "#extension GL_ARB_shading_language_420pack : enable" : ""
|
, (g_ActiveConfig.backend_info.bSupportsBindingLayout && v < GLSLES_310) ? "#extension GL_ARB_shading_language_420pack : enable" : ""
|
||||||
, (g_ogl_config.bSupportsMSAA && v < GLSL_150) ? "#extension GL_ARB_texture_multisample : enable" : ""
|
, (g_ogl_config.bSupportsMSAA && v < GLSL_150) ? "#extension GL_ARB_texture_multisample : enable" : ""
|
||||||
, (g_ogl_config.bSupportSampleShading) ? "#extension GL_ARB_sample_shading : enable" : ""
|
, (g_ogl_config.bSupportSampleShading) ? "#extension GL_ARB_sample_shading : enable" : ""
|
||||||
|
, g_ActiveConfig.backend_info.bSupportsBindingLayout ? "#define SAMPLER_BINDING(x) layout(binding = x)" : "#define SAMPLER_BINDING(x)"
|
||||||
|
|
||||||
, v>=GLSLES_300 ? "precision highp float;" : ""
|
, v>=GLSLES_300 ? "precision highp float;" : ""
|
||||||
, v>=GLSLES_300 ? "precision highp int;" : ""
|
, v>=GLSLES_300 ? "precision highp int;" : ""
|
||||||
|
|
|
@ -124,7 +124,7 @@ static const char *s_vertexShaderSrc =
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
static const char *s_fragmentShaderSrc =
|
static const char *s_fragmentShaderSrc =
|
||||||
"uniform sampler2D samp8;\n"
|
"SAMPLER_BINDING(8) uniform sampler2D samp8;\n"
|
||||||
"uniform vec4 color;\n"
|
"uniform vec4 color;\n"
|
||||||
"in vec2 uv0;\n"
|
"in vec2 uv0;\n"
|
||||||
"out vec4 ocol0;\n"
|
"out vec4 ocol0;\n"
|
||||||
|
|
|
@ -346,7 +346,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
||||||
TextureCache::TextureCache()
|
TextureCache::TextureCache()
|
||||||
{
|
{
|
||||||
const char *pColorMatrixProg =
|
const char *pColorMatrixProg =
|
||||||
"uniform sampler2D samp9;\n"
|
"SAMPLER_BINDING(9) uniform sampler2D samp9;\n"
|
||||||
"uniform vec4 colmat[7];\n"
|
"uniform vec4 colmat[7];\n"
|
||||||
"in vec2 uv0;\n"
|
"in vec2 uv0;\n"
|
||||||
"out vec4 ocol0;\n"
|
"out vec4 ocol0;\n"
|
||||||
|
@ -358,7 +358,7 @@ TextureCache::TextureCache()
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
const char *pDepthMatrixProg =
|
const char *pDepthMatrixProg =
|
||||||
"uniform sampler2D samp9;\n"
|
"SAMPLER_BINDING(9) uniform sampler2D samp9;\n"
|
||||||
"uniform vec4 colmat[5];\n"
|
"uniform vec4 colmat[5];\n"
|
||||||
"in vec2 uv0;\n"
|
"in vec2 uv0;\n"
|
||||||
"out vec4 ocol0;\n"
|
"out vec4 ocol0;\n"
|
||||||
|
@ -372,7 +372,7 @@ TextureCache::TextureCache()
|
||||||
|
|
||||||
const char *VProgram =
|
const char *VProgram =
|
||||||
"out vec2 uv0;\n"
|
"out vec2 uv0;\n"
|
||||||
"uniform sampler2D samp9;\n"
|
"SAMPLER_BINDING(9) uniform sampler2D samp9;\n"
|
||||||
"uniform vec4 copy_position;\n" // left, top, right, bottom
|
"uniform vec4 copy_position;\n" // left, top, right, bottom
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
|
@ -72,7 +72,7 @@ static void CreatePrograms()
|
||||||
const char *VProgramRgbToYuyv =
|
const char *VProgramRgbToYuyv =
|
||||||
"out vec2 uv0;\n"
|
"out vec2 uv0;\n"
|
||||||
"uniform vec4 copy_position;\n" // left, top, right, bottom
|
"uniform vec4 copy_position;\n" // left, top, right, bottom
|
||||||
"uniform sampler2D samp9;\n"
|
"SAMPLER_BINDING(9) uniform sampler2D samp9;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" vec2 rawpos = vec2(gl_VertexID&1, gl_VertexID&2);\n"
|
" vec2 rawpos = vec2(gl_VertexID&1, gl_VertexID&2);\n"
|
||||||
|
@ -80,7 +80,7 @@ static void CreatePrograms()
|
||||||
" uv0 = mix(copy_position.xy, copy_position.zw, rawpos) / vec2(textureSize(samp9, 0));\n"
|
" uv0 = mix(copy_position.xy, copy_position.zw, rawpos) / vec2(textureSize(samp9, 0));\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *FProgramRgbToYuyv =
|
const char *FProgramRgbToYuyv =
|
||||||
"uniform sampler2D samp9;\n"
|
"SAMPLER_BINDING(9) uniform sampler2D samp9;\n"
|
||||||
"in vec2 uv0;\n"
|
"in vec2 uv0;\n"
|
||||||
"out vec4 ocol0;\n"
|
"out vec4 ocol0;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
|
@ -111,7 +111,7 @@ static void CreatePrograms()
|
||||||
" gl_Position = vec4(rawpos*2.0-1.0, 0.0, 1.0);\n"
|
" gl_Position = vec4(rawpos*2.0-1.0, 0.0, 1.0);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
const char *FProgramYuyvToRgb =
|
const char *FProgramYuyvToRgb =
|
||||||
"uniform sampler2D samp9;\n"
|
"SAMPLER_BINDING(9) uniform sampler2D samp9;\n"
|
||||||
"in vec2 uv0;\n"
|
"in vec2 uv0;\n"
|
||||||
"out vec4 ocol0;\n"
|
"out vec4 ocol0;\n"
|
||||||
"void main()\n"
|
"void main()\n"
|
||||||
|
|
|
@ -204,7 +204,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
||||||
{
|
{
|
||||||
// Declare samplers
|
// Declare samplers
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
out.Write("uniform sampler2D samp%d;\n", i);
|
out.Write("SAMPLER_BINDING(%d) uniform sampler2D samp%d;\n", i, i);
|
||||||
}
|
}
|
||||||
else // D3D
|
else // D3D
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,7 +70,7 @@ static void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
||||||
if (ApiType == API_OPENGL)
|
if (ApiType == API_OPENGL)
|
||||||
{
|
{
|
||||||
WRITE(p, "#define samp0 samp9\n");
|
WRITE(p, "#define samp0 samp9\n");
|
||||||
WRITE(p, "uniform sampler2D samp0;\n");
|
WRITE(p, "SAMPLER_BINDING(9) uniform sampler2D samp0;\n");
|
||||||
|
|
||||||
WRITE(p, " out vec4 ocol0;\n");
|
WRITE(p, " out vec4 ocol0;\n");
|
||||||
WRITE(p, "void main()\n");
|
WRITE(p, "void main()\n");
|
||||||
|
|
Loading…
Reference in New Issue