mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-18 04:53:06 +01:00
Cleanup.
This commit is contained in:
@@ -116,14 +116,6 @@ struct BgfxSampler2DMS
|
||||
Texture2DMS m_texture;
|
||||
};
|
||||
|
||||
vec4 bgfxTexture2DMS(BgfxSampler2DMS _sampler, vec2 _coord, int _sampleIdx)
|
||||
{
|
||||
ivec2 size;
|
||||
int numSamples;
|
||||
_sampler.m_texture.GetDimensions(size.x, size.y, numSamples);
|
||||
return _sampler.m_texture.Load(ivec2(_coord * size), _sampleIdx);
|
||||
}
|
||||
|
||||
struct BgfxSampler2DShadow
|
||||
{
|
||||
SamplerComparisonState m_sampler;
|
||||
|
||||
@@ -170,6 +170,7 @@ typedef void (GL_APIENTRYP PFNGLREADBUFFERPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);
|
||||
@@ -182,7 +183,9 @@ typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face,
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat* param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
|
||||
@@ -356,6 +359,7 @@ GL_IMPORT______(true, PFNGLREADBUFFERPROC, glReadBuffer)
|
||||
GL_IMPORT______(false, PFNGLREADPIXELSPROC, glReadPixels);
|
||||
GL_IMPORT______(true, PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage);
|
||||
GL_IMPORT______(true, PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample);
|
||||
GL_IMPORT______(true, PFNGLSAMPLEMASKIPROC, glSampleMaskI);
|
||||
GL_IMPORT______(true, PFNGLSAMPLERPARAMETERIPROC, glSamplerParameteri);
|
||||
GL_IMPORT______(true, PFNGLSAMPLERPARAMETERFPROC, glSamplerParameterf);
|
||||
GL_IMPORT______(true, PFNGLSAMPLERPARAMETERFVPROC, glSamplerParameterfv);
|
||||
@@ -368,7 +372,9 @@ GL_IMPORT______(true, PFNGLSTENCILMASKSEPARATEPROC, glStencilMask
|
||||
GL_IMPORT______(false, PFNGLSTENCILOPPROC, glStencilOp);
|
||||
GL_IMPORT______(true, PFNGLSTENCILOPSEPARATEPROC, glStencilOpSeparate);
|
||||
GL_IMPORT______(false, PFNGLTEXIMAGE2DPROC, glTexImage2D);
|
||||
GL_IMPORT______(true, PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample);
|
||||
GL_IMPORT______(true, PFNGLTEXIMAGE3DPROC, glTexImage3D);
|
||||
GL_IMPORT______(true, PFNGLTEXIMAGE3DMULTISAMPLEPROC, glTexImage3DMultisample);
|
||||
GL_IMPORT______(false, PFNGLTEXPARAMETERIPROC, glTexParameteri);
|
||||
GL_IMPORT______(false, PFNGLTEXPARAMETERIVPROC, glTexParameteriv);
|
||||
GL_IMPORT______(false, PFNGLTEXPARAMETERFPROC, glTexParameterf);
|
||||
|
||||
@@ -910,6 +910,14 @@ namespace bgfx { namespace gl
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char* s_ARB_texture_multisample[] =
|
||||
{
|
||||
"sampler2DMS",
|
||||
"isampler2DMS",
|
||||
"usampler2DMS",
|
||||
NULL
|
||||
};
|
||||
|
||||
static void GL_APIENTRY stubVertexAttribDivisor(GLuint /*_index*/, GLuint /*_divisor*/)
|
||||
{
|
||||
}
|
||||
@@ -4836,9 +4844,10 @@ namespace bgfx { namespace gl
|
||||
;
|
||||
const bool usesIUsamplers = !!bx::findIdentifierMatch(code, s_uisamplers);
|
||||
const bool usesTexelFetch = !!bx::findIdentifierMatch(code, s_texelFetch);
|
||||
const bool usesTextureMS = !!bx::findIdentifierMatch(code, s_ARB_texture_multisample);
|
||||
|
||||
uint32_t version =
|
||||
usesTexelFetch || usesIUsamplers ? 130
|
||||
usesIUsamplers || usesTexelFetch || usesTextureMS ? 130
|
||||
: usesTextureLod ? 120
|
||||
: 0
|
||||
;
|
||||
@@ -4856,6 +4865,11 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
}
|
||||
|
||||
if (usesTextureMS)
|
||||
{
|
||||
writeString(&writer, "#extension GL_ARB_texture_multisample : enable\n");
|
||||
}
|
||||
|
||||
if (130 <= version)
|
||||
{
|
||||
if (m_type == GL_FRAGMENT_SHADER)
|
||||
|
||||
@@ -98,6 +98,14 @@ namespace bgfx
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char* s_ARB_texture_multisample[] =
|
||||
{
|
||||
"sampler2DMS",
|
||||
"isampler2DMS",
|
||||
"usampler2DMS",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char* s_uniformTypeName[UniformType::Count] =
|
||||
{
|
||||
"int",
|
||||
@@ -1725,6 +1733,7 @@ namespace bgfx
|
||||
const bool hasTextureLod = NULL != bx::findIdentifierMatch(input, s_ARB_shader_texture_lod /*EXT_shader_texture_lod*/);
|
||||
const bool hasShader5 = NULL != bx::findIdentifierMatch(input, s_ARB_gpu_shader5);
|
||||
const bool hasShaderPacking = NULL != bx::findIdentifierMatch(input, s_ARB_shading_language_packing);
|
||||
const bool hasTextureMS = NULL != bx::findIdentifierMatch(input, s_ARB_texture_multisample);
|
||||
|
||||
if (0 == essl)
|
||||
{
|
||||
@@ -1767,6 +1776,13 @@ namespace bgfx
|
||||
, "#extension GL_ARB_shader_texture_lod : enable\n"
|
||||
);
|
||||
}
|
||||
|
||||
if (hasTextureMS)
|
||||
{
|
||||
bx::stringPrintf(code
|
||||
, "#extension GL_ARB_texture_multisample : enable\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user