Add Depth compare / shadow sampler support. Officially this is only supported in glsl3 shaders.

- Add Texture:setDepthSampleMode(comparemode). Only works on textures with depth pixel formats. A texture with the depth sample mode set will only work with a depth sampler.
- Add DepthImage, DepthArrayImage, and DepthCubeImage sampler keywords to glsl3.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-04-12 20:26:06 -03:00
parent 0001b4695e
commit a0ef2ac28b
25 changed files with 444 additions and 151 deletions
+10
View File
@@ -380,6 +380,8 @@ void Image::replacePixels(love::image::ImageDataBase *d, int slice, int mipmap,
if (w != oldd->getWidth() || h != oldd->getHeight())
throw love::Exception("Dimensions must match the texture's dimensions for the specified mipmap level.");
Graphics::flushStreamDrawsGlobal();
d->retain();
oldd->release();
@@ -397,6 +399,8 @@ void Image::replacePixels(love::image::ImageDataBase *d, int slice, int mipmap,
void Image::replacePixels(const void *data, size_t size, const Rect &rect, int slice, int mipmap, bool reloadmipmaps)
{
Graphics::flushStreamDrawsGlobal();
OpenGL::TempDebugGroup debuggroup("Image replace pixels");
gl.bindTextureToUnit(this, 0, false);
@@ -422,6 +426,8 @@ void Image::setFilter(const Texture::Filter &f)
throw love::Exception("Invalid texture filter.");
}
Graphics::flushStreamDrawsGlobal();
filter = f;
if (!OpenGL::hasTextureFilteringSupport(getPixelFormat()))
@@ -445,6 +451,8 @@ void Image::setFilter(const Texture::Filter &f)
bool Image::setWrap(const Texture::Wrap &w)
{
Graphics::flushStreamDrawsGlobal();
bool success = true;
bool forceclamp = texType == TEXTURE_CUBE;
wrap = w;
@@ -483,6 +491,8 @@ bool Image::setMipmapSharpness(float sharpness)
if (!GLAD_VERSION_1_4)
return false;
Graphics::flushStreamDrawsGlobal();
// LOD bias has the range (-maxbias, maxbias)
mipmapSharpness = std::min(std::max(sharpness, -maxMipmapSharpness + 0.01f), maxMipmapSharpness - 0.01f);