Converted remaining shaders.

This commit is contained in:
hiker 2015-05-08 08:30:51 +10:00
parent 5070531ad7
commit a16bbf71a4
4 changed files with 128 additions and 67 deletions

View File

@ -1653,7 +1653,7 @@ namespace FullScreenShader
GL_COMPUTE_SHADER, "gaussian6h.comp"); GL_COMPUTE_SHADER, "gaussian6h.comp");
TU_dest = 1; TU_dest = 1;
assignUniforms("pixel", "weights"); assignUniforms("pixel", "weights");
assignSamplerNames(m_program, 0, "source"); assignSamplerNames(m_program, 0, "source", ST_BILINEAR_CLAMPED_FILTERED);
assignTextureUnit(TU_dest, "dest"); assignTextureUnit(TU_dest, "dest");
} }
@ -1663,7 +1663,7 @@ namespace FullScreenShader
GL_COMPUTE_SHADER, "blurshadowH.comp"); GL_COMPUTE_SHADER, "blurshadowH.comp");
TU_dest = 1; TU_dest = 1;
assignUniforms("pixel", "weights"); assignUniforms("pixel", "weights");
assignSamplerNames(m_program, 0, "source"); assignSamplerNames(m_program, 0, "source", ST_NEARED_CLAMPED_FILTERED);
assignTextureUnit(TU_dest, "dest"); assignTextureUnit(TU_dest, "dest");
} }
@ -1674,7 +1674,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "gaussian6h.frag"); GL_FRAGMENT_SHADER, "gaussian6h.frag");
assignUniforms("pixel", "sigma"); assignUniforms("pixel", "sigma");
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_CLAMPED_FILTERED);
} }
HorizontalBlurShader::HorizontalBlurShader() HorizontalBlurShader::HorizontalBlurShader()
@ -1684,7 +1684,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "gaussian6h.frag"); GL_FRAGMENT_SHADER, "gaussian6h.frag");
assignUniforms("pixel"); assignUniforms("pixel");
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_CLAMPED_FILTERED);
} }
Gaussian3HBlurShader::Gaussian3HBlurShader() Gaussian3HBlurShader::Gaussian3HBlurShader()
@ -1694,7 +1694,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "gaussian3h.frag"); GL_FRAGMENT_SHADER, "gaussian3h.frag");
assignUniforms("pixel"); assignUniforms("pixel");
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_CLAMPED_FILTERED);
} }
Gaussian17TapVShader::Gaussian17TapVShader() Gaussian17TapVShader::Gaussian17TapVShader()
@ -1704,7 +1704,8 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "bilateralV.frag"); GL_FRAGMENT_SHADER, "bilateralV.frag");
assignUniforms("pixel"); assignUniforms("pixel");
assignSamplerNames(m_program, 0, "tex", 1, "depth"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_CLAMPED_FILTERED,
1, "depth", ST_BILINEAR_CLAMPED_FILTERED);
} }
ComputeGaussian17TapVShader::ComputeGaussian17TapVShader() ComputeGaussian17TapVShader::ComputeGaussian17TapVShader()
@ -1713,7 +1714,8 @@ namespace FullScreenShader
GL_COMPUTE_SHADER, "bilateralV.comp"); GL_COMPUTE_SHADER, "bilateralV.comp");
TU_dest = 2; TU_dest = 2;
assignUniforms("pixel"); assignUniforms("pixel");
assignSamplerNames(m_program, 0, "source", 1, "depth"); assignSamplerNames(m_program, 0, "source", ST_NEARED_CLAMPED_FILTERED,
1, "depth", ST_NEARED_CLAMPED_FILTERED);
assignTextureUnit(TU_dest, "dest"); assignTextureUnit(TU_dest, "dest");
} }
@ -1723,7 +1725,7 @@ namespace FullScreenShader
GL_COMPUTE_SHADER, "gaussian6v.comp"); GL_COMPUTE_SHADER, "gaussian6v.comp");
TU_dest = 1; TU_dest = 1;
assignUniforms("pixel", "weights"); assignUniforms("pixel", "weights");
assignSamplerNames(m_program, 0, "source"); assignSamplerNames(m_program, 0, "source", ST_BILINEAR_CLAMPED_FILTERED);
assignTextureUnit(TU_dest, "dest"); assignTextureUnit(TU_dest, "dest");
} }
@ -1733,7 +1735,7 @@ namespace FullScreenShader
GL_COMPUTE_SHADER, "blurshadowV.comp"); GL_COMPUTE_SHADER, "blurshadowV.comp");
TU_dest = 1; TU_dest = 1;
assignUniforms("pixel", "weights"); assignUniforms("pixel", "weights");
assignSamplerNames(m_program, 0, "source"); assignSamplerNames(m_program, 0, "source", ST_NEARED_CLAMPED_FILTERED);
assignTextureUnit(TU_dest, "dest"); assignTextureUnit(TU_dest, "dest");
} }
@ -1744,7 +1746,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "gaussian6v.frag"); GL_FRAGMENT_SHADER, "gaussian6v.frag");
assignUniforms("pixel", "sigma"); assignUniforms("pixel", "sigma");
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_CLAMPED_FILTERED);
} }
Gaussian3VBlurShader::Gaussian3VBlurShader() Gaussian3VBlurShader::Gaussian3VBlurShader()
@ -1754,7 +1756,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "gaussian3v.frag"); GL_FRAGMENT_SHADER, "gaussian3v.frag");
assignUniforms("pixel"); assignUniforms("pixel");
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_CLAMPED_FILTERED);
} }
PassThroughShader::PassThroughShader() PassThroughShader::PassThroughShader()
@ -1764,7 +1766,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "passthrough.frag"); GL_FRAGMENT_SHADER, "passthrough.frag");
assignUniforms("width", "height"); assignUniforms("width", "height");
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_FILTERED);
} }
LayerPassThroughShader::LayerPassThroughShader() LayerPassThroughShader::LayerPassThroughShader()
@ -1785,7 +1787,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "linearizedepth.frag"); GL_FRAGMENT_SHADER, "linearizedepth.frag");
assignUniforms("zn", "zf"); assignUniforms("zn", "zf");
assignSamplerNames(m_program, 0, "texture"); assignSamplerNames(m_program, 0, "texture", ST_BILINEAR_FILTERED);
} }
@ -1794,7 +1796,7 @@ namespace FullScreenShader
loadProgram(OBJECT, loadProgram(OBJECT,
GL_COMPUTE_SHADER, "Lightspaceboundingbox.comp", GL_COMPUTE_SHADER, "Lightspaceboundingbox.comp",
GL_COMPUTE_SHADER, "utils/getPosFromUVDepth.frag"); GL_COMPUTE_SHADER, "utils/getPosFromUVDepth.frag");
assignSamplerNames(m_program, 0, "depth"); assignSamplerNames(m_program, 0, "depth", ST_NEAREST_FILTERED);
assignUniforms("SunCamMatrix", "split0", "split1", "split2", "splitmax"); assignUniforms("SunCamMatrix", "split0", "split1", "split2", "splitmax");
GLuint block_idx = glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK, "BoundingBoxes"); GLuint block_idx = glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK, "BoundingBoxes");
glShaderStorageBlockBinding(m_program, block_idx, 2); glShaderStorageBlockBinding(m_program, block_idx, 2);
@ -1816,7 +1818,7 @@ namespace FullScreenShader
loadProgram(OBJECT, loadProgram(OBJECT,
GL_COMPUTE_SHADER, "depthhistogram.comp", GL_COMPUTE_SHADER, "depthhistogram.comp",
GL_COMPUTE_SHADER, "utils/getPosFromUVDepth.frag"); GL_COMPUTE_SHADER, "utils/getPosFromUVDepth.frag");
assignSamplerNames(m_program, 0, "depth"); assignSamplerNames(m_program, 0, "depth", ST_NEAREST_FILTERED);
GLuint block_idx = glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK, "Histogram"); GLuint block_idx = glGetProgramResourceIndex(m_program, GL_SHADER_STORAGE_BLOCK, "Histogram");
glShaderStorageBlockBinding(m_program, block_idx, 1); glShaderStorageBlockBinding(m_program, block_idx, 1);
@ -1829,7 +1831,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "glow.frag"); GL_FRAGMENT_SHADER, "glow.frag");
assignUniforms(); assignUniforms();
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_FILTERED);
vao = createVAO(m_program); vao = createVAO(m_program);
} }
@ -1842,7 +1844,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "ssao.frag"); GL_FRAGMENT_SHADER, "ssao.frag");
assignUniforms("radius", "k", "sigma"); assignUniforms("radius", "k", "sigma");
assignSamplerNames(m_program, 0, "dtex"); assignSamplerNames(m_program, 0, "dtex", ST_SEMI_TRILINEAR);
} }
FogShader::FogShader() FogShader::FogShader()
@ -1853,7 +1855,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "fog.frag"); GL_FRAGMENT_SHADER, "fog.frag");
assignUniforms("density", "col"); assignUniforms("density", "col");
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_NEAREST_FILTERED);
} }
MotionBlurShader::MotionBlurShader() MotionBlurShader::MotionBlurShader()
@ -1863,7 +1865,8 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag", GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
GL_FRAGMENT_SHADER, "motion_blur.frag"); GL_FRAGMENT_SHADER, "motion_blur.frag");
assignUniforms("previous_viewproj", "center", "boost_amount", "mask_radius"); assignUniforms("previous_viewproj", "center", "boost_amount", "mask_radius");
assignSamplerNames(m_program, 0, "color_buffer", 1, "dtex"); assignSamplerNames(m_program, 0, "color_buffer", ST_BILINEAR_CLAMPED_FILTERED,
1, "dtex", ST_NEAREST_FILTERED);
} }
GodFadeShader::GodFadeShader() GodFadeShader::GodFadeShader()
@ -1873,7 +1876,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "godfade.frag"); GL_FRAGMENT_SHADER, "godfade.frag");
assignUniforms("col"); assignUniforms("col");
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_FILTERED);
} }
GodRayShader::GodRayShader() GodRayShader::GodRayShader()
@ -1883,7 +1886,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "godray.frag"); GL_FRAGMENT_SHADER, "godray.frag");
assignUniforms("sunpos"); assignUniforms("sunpos");
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_FILTERED);
} }
MLAAColorEdgeDetectionSHader::MLAAColorEdgeDetectionSHader() MLAAColorEdgeDetectionSHader::MLAAColorEdgeDetectionSHader()
@ -1893,7 +1896,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "mlaa_color1.frag"); GL_FRAGMENT_SHADER, "mlaa_color1.frag");
assignUniforms("PIXEL_SIZE"); assignUniforms("PIXEL_SIZE");
assignSamplerNames(m_program, 0, "colorMapG"); assignSamplerNames(m_program, 0, "colorMapG", ST_NEAREST_FILTERED);
} }
MLAABlendWeightSHader::MLAABlendWeightSHader() MLAABlendWeightSHader::MLAABlendWeightSHader()
@ -1903,7 +1906,8 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "mlaa_blend2.frag"); GL_FRAGMENT_SHADER, "mlaa_blend2.frag");
assignUniforms("PIXEL_SIZE"); assignUniforms("PIXEL_SIZE");
assignSamplerNames(m_program, 0, "edgesMap", 1, "areaMap"); assignSamplerNames(m_program, 0, "edgesMap", ST_BILINEAR_FILTERED,
1, "areaMap", ST_NEAREST_FILTERED);
} }
MLAAGatherSHader::MLAAGatherSHader() MLAAGatherSHader::MLAAGatherSHader()
@ -1913,7 +1917,8 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, "mlaa_neigh3.frag"); GL_FRAGMENT_SHADER, "mlaa_neigh3.frag");
assignUniforms("PIXEL_SIZE"); assignUniforms("PIXEL_SIZE");
assignSamplerNames(m_program, 0, "blendMap", 1, "colorMap"); assignSamplerNames(m_program, 0, "blendMap", ST_NEAREST_FILTERED,
1, "colorMap", ST_NEAREST_FILTERED);
} }
} }
@ -1926,7 +1931,7 @@ namespace UIShader
GL_VERTEX_SHADER, "primitive2dlist.vert", GL_VERTEX_SHADER, "primitive2dlist.vert",
GL_FRAGMENT_SHADER, "transparent.frag"); GL_FRAGMENT_SHADER, "transparent.frag");
assignUniforms(); assignUniforms();
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_FILTERED);
} }
TextureRectShader::TextureRectShader() TextureRectShader::TextureRectShader()
@ -1936,7 +1941,7 @@ namespace UIShader
GL_FRAGMENT_SHADER, "texturedquad.frag"); GL_FRAGMENT_SHADER, "texturedquad.frag");
assignUniforms("center", "size", "texcenter", "texsize"); assignUniforms("center", "size", "texcenter", "texsize");
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_FILTERED);
} }
UniformColoredTextureRectShader::UniformColoredTextureRectShader() UniformColoredTextureRectShader::UniformColoredTextureRectShader()
@ -1947,7 +1952,7 @@ namespace UIShader
assignUniforms("center", "size", "texcenter", "texsize", "color"); assignUniforms("center", "size", "texcenter", "texsize", "color");
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_FILTERED);
} }
ColoredTextureRectShader::ColoredTextureRectShader() ColoredTextureRectShader::ColoredTextureRectShader()
@ -1957,7 +1962,7 @@ namespace UIShader
GL_FRAGMENT_SHADER, "colortexturedquad.frag"); GL_FRAGMENT_SHADER, "colortexturedquad.frag");
assignUniforms("center", "size", "texcenter", "texsize"); assignUniforms("center", "size", "texcenter", "texsize");
assignSamplerNames(m_program, 0, "tex"); assignSamplerNames(m_program, 0, "tex", ST_BILINEAR_FILTERED);
glGenVertexArrays(1, &vao); glGenVertexArrays(1, &vao);
glBindVertexArray(vao); glBindVertexArray(vao);

View File

@ -543,45 +543,52 @@ public:
ComputeGaussian17TapHShader(); ComputeGaussian17TapHShader();
}; };
class ComputeGaussian6HBlurShader : public Shader<ComputeGaussian6HBlurShader, core::vector2df, std::vector<float> >, public TextureRead<Bilinear_Clamped_Filtered> class ComputeGaussian6HBlurShader : public Shader<ComputeGaussian6HBlurShader, core::vector2df, std::vector<float> >,
public TextureReadNew<ST_BILINEAR_CLAMPED_FILTERED>
{ {
public: public:
GLuint TU_dest; GLuint TU_dest;
ComputeGaussian6HBlurShader(); ComputeGaussian6HBlurShader();
}; };
class ComputeShadowBlurHShader : public Shader<ComputeShadowBlurHShader, core::vector2df, std::vector<float> >, public TextureRead<Neared_Clamped_Filtered> class ComputeShadowBlurHShader : public Shader<ComputeShadowBlurHShader, core::vector2df, std::vector<float> >,
public TextureReadNew<ST_NEARED_CLAMPED_FILTERED>
{ {
public: public:
GLuint TU_dest; GLuint TU_dest;
ComputeShadowBlurHShader(); ComputeShadowBlurHShader();
}; };
class Gaussian6HBlurShader : public Shader<Gaussian6HBlurShader, core::vector2df, float>, public TextureRead<Bilinear_Clamped_Filtered> class Gaussian6HBlurShader : public Shader<Gaussian6HBlurShader, core::vector2df, float>,
public TextureReadNew<ST_BILINEAR_CLAMPED_FILTERED>
{ {
public: public:
Gaussian6HBlurShader(); Gaussian6HBlurShader();
}; };
class HorizontalBlurShader : public Shader<HorizontalBlurShader, core::vector2df>, public TextureRead<Bilinear_Clamped_Filtered> class HorizontalBlurShader : public Shader<HorizontalBlurShader, core::vector2df>,
public TextureReadNew<ST_BILINEAR_CLAMPED_FILTERED>
{ {
public: public:
HorizontalBlurShader(); HorizontalBlurShader();
}; };
class Gaussian3HBlurShader : public Shader<Gaussian3HBlurShader, core::vector2df>, public TextureRead<Bilinear_Clamped_Filtered> class Gaussian3HBlurShader : public Shader<Gaussian3HBlurShader, core::vector2df>,
public TextureReadNew<ST_BILINEAR_CLAMPED_FILTERED>
{ {
public: public:
Gaussian3HBlurShader(); Gaussian3HBlurShader();
}; };
class Gaussian17TapVShader : public Shader<Gaussian17TapVShader, core::vector2df>, public TextureRead<Bilinear_Clamped_Filtered, Bilinear_Clamped_Filtered> class Gaussian17TapVShader : public Shader<Gaussian17TapVShader, core::vector2df>,
public TextureReadNew<ST_BILINEAR_CLAMPED_FILTERED, ST_BILINEAR_CLAMPED_FILTERED>
{ {
public: public:
Gaussian17TapVShader(); Gaussian17TapVShader();
}; };
class ComputeGaussian17TapVShader : public Shader<ComputeGaussian17TapVShader, core::vector2df>, public TextureRead<Neared_Clamped_Filtered, Neared_Clamped_Filtered> class ComputeGaussian17TapVShader : public Shader<ComputeGaussian17TapVShader, core::vector2df>,
public TextureReadNew<ST_NEARED_CLAMPED_FILTERED, ST_NEARED_CLAMPED_FILTERED>
{ {
public: public:
GLuint TU_dest; GLuint TU_dest;
@ -589,33 +596,38 @@ public:
ComputeGaussian17TapVShader(); ComputeGaussian17TapVShader();
}; };
class ComputeGaussian6VBlurShader : public Shader<ComputeGaussian6VBlurShader, core::vector2df, std::vector<float> >, public TextureRead<Bilinear_Clamped_Filtered> class ComputeGaussian6VBlurShader : public Shader<ComputeGaussian6VBlurShader, core::vector2df, std::vector<float> >,
public TextureReadNew<ST_BILINEAR_CLAMPED_FILTERED>
{ {
public: public:
GLuint TU_dest; GLuint TU_dest;
ComputeGaussian6VBlurShader(); ComputeGaussian6VBlurShader();
}; };
class ComputeShadowBlurVShader : public Shader<ComputeShadowBlurVShader, core::vector2df, std::vector<float> >, public TextureRead<Neared_Clamped_Filtered> class ComputeShadowBlurVShader : public Shader<ComputeShadowBlurVShader, core::vector2df, std::vector<float> >,
public TextureReadNew<ST_NEARED_CLAMPED_FILTERED>
{ {
public: public:
GLuint TU_dest; GLuint TU_dest;
ComputeShadowBlurVShader(); ComputeShadowBlurVShader();
}; };
class Gaussian6VBlurShader : public Shader<Gaussian6VBlurShader, core::vector2df, float>, public TextureRead<Bilinear_Clamped_Filtered> class Gaussian6VBlurShader : public Shader<Gaussian6VBlurShader, core::vector2df, float>,
public TextureReadNew<ST_BILINEAR_CLAMPED_FILTERED>
{ {
public: public:
Gaussian6VBlurShader(); Gaussian6VBlurShader();
}; };
class Gaussian3VBlurShader : public Shader<Gaussian3VBlurShader, core::vector2df>, public TextureRead<Bilinear_Clamped_Filtered> class Gaussian3VBlurShader : public Shader<Gaussian3VBlurShader, core::vector2df>,
public TextureReadNew<ST_BILINEAR_CLAMPED_FILTERED>
{ {
public: public:
Gaussian3VBlurShader(); Gaussian3VBlurShader();
}; };
class PassThroughShader : public Shader<PassThroughShader, int, int>, public TextureRead<Bilinear_Filtered> class PassThroughShader : public Shader<PassThroughShader, int, int>,
public TextureReadNew<ST_BILINEAR_FILTERED>
{ {
public: public:
PassThroughShader(); PassThroughShader();
@ -630,13 +642,17 @@ public:
LayerPassThroughShader(); LayerPassThroughShader();
}; };
class LinearizeDepthShader : public Shader<LinearizeDepthShader, float, float>, public TextureRead<Bilinear_Filtered> class LinearizeDepthShader : public Shader<LinearizeDepthShader, float, float>,
public TextureReadNew<ST_BILINEAR_FILTERED>
{ {
public: public:
LinearizeDepthShader(); LinearizeDepthShader();
}; };
class LightspaceBoundingBoxShader : public Shader<LightspaceBoundingBoxShader, core::matrix4, float, float, float, float>, public TextureRead < Nearest_Filtered > class LightspaceBoundingBoxShader : public Shader<LightspaceBoundingBoxShader,
core::matrix4, float, float,
float, float>,
public TextureReadNew<ST_NEAREST_FILTERED >
{ {
public: public:
LightspaceBoundingBoxShader(); LightspaceBoundingBoxShader();
@ -648,13 +664,15 @@ public:
ShadowMatrixesGenerationShader(); ShadowMatrixesGenerationShader();
}; };
class DepthHistogramShader : public Shader<DepthHistogramShader>, public TextureRead <Nearest_Filtered> class DepthHistogramShader : public Shader<DepthHistogramShader>,
public TextureReadNew<ST_NEAREST_FILTERED>
{ {
public: public:
DepthHistogramShader(); DepthHistogramShader();
}; };
class GlowShader : public Shader<GlowShader>, public TextureRead<Bilinear_Filtered> class GlowShader : public Shader<GlowShader>,
public TextureReadNew<ST_BILINEAR_FILTERED>
{ {
public: public:
GLuint vao; GLuint vao;
@ -662,49 +680,57 @@ public:
GlowShader(); GlowShader();
}; };
class SSAOShader : public Shader<SSAOShader, float, float, float>, public TextureRead<Semi_trilinear> class SSAOShader : public Shader<SSAOShader, float, float, float>,
public TextureReadNew<ST_SEMI_TRILINEAR>
{ {
public: public:
SSAOShader(); SSAOShader();
}; };
class FogShader : public Shader<FogShader, float, core::vector3df>, public TextureRead<Nearest_Filtered> class FogShader : public Shader<FogShader, float, core::vector3df>,
public TextureReadNew<ST_NEAREST_FILTERED>
{ {
public: public:
FogShader(); FogShader();
}; };
class MotionBlurShader : public Shader<MotionBlurShader, core::matrix4, core::vector2df, float, float>, public TextureRead<Bilinear_Clamped_Filtered, Nearest_Filtered> class MotionBlurShader : public Shader<MotionBlurShader, core::matrix4, core::vector2df, float, float>,
public TextureReadNew<ST_BILINEAR_CLAMPED_FILTERED, ST_NEAREST_FILTERED>
{ {
public: public:
MotionBlurShader(); MotionBlurShader();
}; };
class GodFadeShader : public Shader<GodFadeShader, video::SColorf>, public TextureRead<Bilinear_Filtered> class GodFadeShader : public Shader<GodFadeShader, video::SColorf>,
public TextureReadNew<ST_BILINEAR_FILTERED>
{ {
public: public:
GodFadeShader(); GodFadeShader();
}; };
class GodRayShader : public Shader<GodRayShader, core::vector2df>, public TextureRead<Bilinear_Filtered> class GodRayShader : public Shader<GodRayShader, core::vector2df>,
public TextureReadNew<ST_BILINEAR_FILTERED>
{ {
public: public:
GodRayShader(); GodRayShader();
}; };
class MLAAColorEdgeDetectionSHader : public Shader<MLAAColorEdgeDetectionSHader, core::vector2df>, public TextureRead<Nearest_Filtered> class MLAAColorEdgeDetectionSHader : public Shader<MLAAColorEdgeDetectionSHader, core::vector2df>,
public TextureReadNew<ST_NEAREST_FILTERED>
{ {
public: public:
MLAAColorEdgeDetectionSHader(); MLAAColorEdgeDetectionSHader();
}; };
class MLAABlendWeightSHader : public Shader<MLAABlendWeightSHader, core::vector2df>, public TextureRead<Bilinear_Filtered, Nearest_Filtered> class MLAABlendWeightSHader : public Shader<MLAABlendWeightSHader, core::vector2df>,
public TextureReadNew<ST_BILINEAR_FILTERED, ST_NEAREST_FILTERED>
{ {
public: public:
MLAABlendWeightSHader(); MLAABlendWeightSHader();
}; };
class MLAAGatherSHader : public Shader<MLAAGatherSHader, core::vector2df>, public TextureRead<Nearest_Filtered, Nearest_Filtered> class MLAAGatherSHader : public Shader<MLAAGatherSHader, core::vector2df>,
public TextureReadNew<ST_NEAREST_FILTERED, ST_NEAREST_FILTERED>
{ {
public: public:
MLAAGatherSHader(); MLAAGatherSHader();
@ -715,25 +741,36 @@ public:
namespace UIShader namespace UIShader
{ {
class Primitive2DList : public Shader<Primitive2DList>, public TextureRead < Bilinear_Filtered > class Primitive2DList : public Shader<Primitive2DList>,
public TextureReadNew<ST_BILINEAR_FILTERED >
{ {
public: public:
Primitive2DList(); Primitive2DList();
}; };
class TextureRectShader : public Shader<TextureRectShader, core::vector2df, core::vector2df, core::vector2df, core::vector2df>, public TextureRead<Bilinear_Filtered> class TextureRectShader : public Shader<TextureRectShader, core::vector2df,
core::vector2df, core::vector2df,
core::vector2df>,
public TextureReadNew<ST_BILINEAR_FILTERED>
{ {
public: public:
TextureRectShader(); TextureRectShader();
}; };
class UniformColoredTextureRectShader : public Shader<UniformColoredTextureRectShader, core::vector2df, core::vector2df, core::vector2df, core::vector2df, video::SColor>, public TextureRead<Bilinear_Filtered> class UniformColoredTextureRectShader : public Shader<UniformColoredTextureRectShader,
core::vector2df, core::vector2df,
core::vector2df, core::vector2df,
video::SColor>,
public TextureReadNew<ST_BILINEAR_FILTERED>
{ {
public: public:
UniformColoredTextureRectShader(); UniformColoredTextureRectShader();
}; };
class ColoredTextureRectShader : public Shader<ColoredTextureRectShader, core::vector2df, core::vector2df, core::vector2df, core::vector2df>, public TextureRead<Bilinear_Filtered> class ColoredTextureRectShader : public Shader<ColoredTextureRectShader, core::vector2df,
core::vector2df, core::vector2df,
core::vector2df>,
public TextureReadNew<ST_BILINEAR_FILTERED>
{ {
public: public:
GLuint colorvbo; GLuint colorvbo;
@ -742,7 +779,8 @@ public:
ColoredTextureRectShader(); ColoredTextureRectShader();
}; };
class ColoredRectShader : public Shader<ColoredRectShader, core::vector2df, core::vector2df, video::SColor> class ColoredRectShader : public Shader<ColoredRectShader, core::vector2df,
core::vector2df, video::SColor>
{ {
public: public:
ColoredRectShader(); ColoredRectShader();

View File

@ -30,6 +30,7 @@ TextureReadBaseNew::BindFunction TextureReadBaseNew::m_all_bind_functions[] =
/* ST_VOLUME_LINEAR_FILTERED */ &TextureReadBaseNew::bindTextureVolume, /* ST_VOLUME_LINEAR_FILTERED */ &TextureReadBaseNew::bindTextureVolume,
/* ST_NEARED_CLAMPED_FILTERED */ &TextureReadBaseNew::bindTextureNearestClamped, /* ST_NEARED_CLAMPED_FILTERED */ &TextureReadBaseNew::bindTextureNearestClamped,
/* ST_BILINEAR_CLAMPED_FILTERED */ &TextureReadBaseNew::bindTextureBilinearClamped, /* ST_BILINEAR_CLAMPED_FILTERED */ &TextureReadBaseNew::bindTextureBilinearClamped,
/* ST_SEMI_TRILINEAR */ &TextureReadBaseNew::bindTextureSemiTrilinear
}; };
GLuint TextureReadBaseNew::m_all_texture_types[] = GLuint TextureReadBaseNew::m_all_texture_types[] =
@ -42,6 +43,7 @@ GLuint TextureReadBaseNew::m_all_texture_types[] =
/* ST_VOLUME_LINEAR_FILTERED */ GL_TEXTURE_3D, /* ST_VOLUME_LINEAR_FILTERED */ GL_TEXTURE_3D,
/* ST_NEARED_CLAMPED_FILTERED */ GL_TEXTURE_2D, /* ST_NEARED_CLAMPED_FILTERED */ GL_TEXTURE_2D,
/* ST_BILINEAR_CLAMPED_FILTERED */ GL_TEXTURE_2D, /* ST_BILINEAR_CLAMPED_FILTERED */ GL_TEXTURE_2D,
/* ST_SEMI_TRILINEAR */ GL_TEXTURE_2D
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -181,6 +183,7 @@ void TextureReadBaseNew::bindTextureVolume(unsigned tex_unit, unsigned tex_id)
} // bindTextureVolume } // bindTextureVolume
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
GLuint TextureReadBaseNew::createSamplers(SamplerTypeNew sampler_type) GLuint TextureReadBaseNew::createSamplers(SamplerTypeNew sampler_type)
{ {
switch (sampler_type) switch (sampler_type)
@ -213,6 +216,8 @@ GLuint TextureReadBaseNew::createSamplers(SamplerTypeNew sampler_type)
} }
case ST_BILINEAR_CLAMPED_FILTERED: case ST_BILINEAR_CLAMPED_FILTERED:
return createBilinearClampedSampler(); return createBilinearClampedSampler();
case ST_SEMI_TRILINEAR:
return createSemiTrilinearSampler();
default: default:
assert(false); assert(false);
return 0; return 0;
@ -316,6 +321,20 @@ GLuint TextureReadBaseNew::createTrilinearClampedArray()
#endif #endif
} // createTrilinearClampedArray } // createTrilinearClampedArray
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
GLuint TextureReadBaseNew::createSemiTrilinearSampler()
{
#ifdef GL_VERSION_3_3
unsigned id;
glGenSamplers(1, &id);
glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
return id;
#endif
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -34,17 +34,15 @@ enum SamplerTypeNew {
ST_VOLUME_LINEAR_FILTERED, ST_VOLUME_LINEAR_FILTERED,
ST_NEARED_CLAMPED_FILTERED, ST_NEARED_CLAMPED_FILTERED,
ST_BILINEAR_CLAMPED_FILTERED, ST_BILINEAR_CLAMPED_FILTERED,
ST_MAX = ST_BILINEAR_CLAMPED_FILTERED, ST_SEMI_TRILINEAR,
ST_MAX = ST_SEMI_TRILINEAR
XST_SEMI_TRILINEAR,
XST_TRILINEAR_CLAMPED_ARRAY2D
}; };
class TextureReadBaseNew class TextureReadBaseNew
{ {
public: public:
typedef std::function<void(unsigned, unsigned)> BindFunction; typedef std::function<void(GLuint, GLuint)> BindFunction;
protected: protected:
static void bindTextureNearest(GLuint tex_unit, GLuint tex_id); static void bindTextureNearest(GLuint tex_unit, GLuint tex_id);
@ -53,10 +51,11 @@ protected:
static void bindTextureNearestClamped(GLuint tex_unit, GLuint tex_id); static void bindTextureNearestClamped(GLuint tex_unit, GLuint tex_id);
static void bindTextureTrilinearAnisotropic(GLuint tex_unit, GLuint tex_id); static void bindTextureTrilinearAnisotropic(GLuint tex_unit, GLuint tex_id);
static void bindTextureSemiTrilinear(GLuint tex_unit, GLuint tex_id); static void bindTextureSemiTrilinear(GLuint tex_unit, GLuint tex_id);
static void bindCubemapTrilinear(unsigned tex_unit, unsigned tex_id); static void bindCubemapTrilinear(GLuint tex_unit, GLuint tex_id);
static void bindTextureShadow(unsigned tex_unit, unsigned tex_id); static void bindTextureShadow(GLuint tex_unit, GLuint tex_id);
static void bindTrilinearClampedArrayTexture(unsigned tex_unit, unsigned tex_id); static void bindTrilinearClampedArrayTexture(GLuint tex_unit, GLuint tex_id);
static void bindTextureVolume(unsigned tex_unit, unsigned tex_id); static void bindTextureVolume(GLuint tex_unit, GLuint tex_id);
GLuint createSamplers(SamplerTypeNew sampler_type); GLuint createSamplers(SamplerTypeNew sampler_type);
private: private:
@ -66,7 +65,7 @@ private:
static GLuint createShadowSampler(); static GLuint createShadowSampler();
static GLuint createTrilinearClampedArray(); static GLuint createTrilinearClampedArray();
static GLuint createBilinearClampedSampler(); static GLuint createBilinearClampedSampler();
static GLuint createSemiTrilinearSampler();
protected: protected:
static BindFunction m_all_bind_functions[]; static BindFunction m_all_bind_functions[];
std::vector<BindFunction> m_bind_functions; std::vector<BindFunction> m_bind_functions;