Merge branch 'master' of github.com:bkaradzic/bgfx
This commit is contained in:
commit
93f7fcbfec
2
3rdparty/fcpp/cpp6.c
vendored
2
3rdparty/fcpp/cpp6.c
vendored
@ -1084,7 +1084,7 @@ void domsg(struct Global *global,
|
||||
;
|
||||
tp = file ? file->filename : 0;
|
||||
Error(global, "%s\"%s\", line %d: %s: ",
|
||||
MSG_PREFIX, tp, global->infile->fp?global->line:file->line, severity);
|
||||
MSG_PREFIX, tp, global->infile?global->line:(file?file->line:0), severity);
|
||||
if(global->error)
|
||||
global->error(global->userdata, ErrorMessage[error], arg);
|
||||
#if defined(UNIX)
|
||||
|
@ -825,6 +825,7 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
|
||||
glsl_sampler_dim sampler_dim = (glsl_sampler_dim)ir->sampler->type->sampler_dimensionality;
|
||||
const bool is_shadow = ir->sampler->type->sampler_shadow;
|
||||
const bool is_array = ir->sampler->type->sampler_array;
|
||||
const bool is_msaa = ir->op == ir_txf_ms;
|
||||
const glsl_type* uv_type = ir->coordinate->type;
|
||||
const int uv_dim = uv_type->vector_elements;
|
||||
int sampler_uv_dim = tex_sampler_dim_size[sampler_dim];
|
||||
@ -832,6 +833,8 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
|
||||
sampler_uv_dim += 1;
|
||||
if (is_array)
|
||||
sampler_uv_dim += 1;
|
||||
if (is_msaa)
|
||||
sampler_uv_dim += 1;
|
||||
const bool is_proj = (uv_dim > sampler_uv_dim);
|
||||
const bool is_lod = (ir->op == ir_txl);
|
||||
|
||||
@ -876,8 +879,10 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ir->op == ir_txf)
|
||||
if (ir->op == ir_txf
|
||||
|| ir->op == ir_txf_ms) {
|
||||
buffer.asprintf_append ("texelFetch");
|
||||
}
|
||||
else
|
||||
buffer.asprintf_append ("texture");
|
||||
}
|
||||
@ -885,7 +890,7 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
|
||||
if (is_array && state->EXT_texture_array_enable)
|
||||
buffer.asprintf_append ("Array");
|
||||
|
||||
if (is_proj)
|
||||
if (ir->op == ir_tex && is_proj)
|
||||
buffer.asprintf_append ("Proj");
|
||||
if (ir->op == ir_txl)
|
||||
buffer.asprintf_append ("Lod");
|
||||
@ -921,12 +926,12 @@ void ir_print_glsl_visitor::visit(ir_texture *ir)
|
||||
ir->coordinate->accept(this);
|
||||
|
||||
// lod
|
||||
if (ir->op == ir_txl || ir->op == ir_txf)
|
||||
if (ir->op == ir_txl || ir->op == ir_txf || ir->op == ir_txf_ms)
|
||||
{
|
||||
buffer.asprintf_append (", ");
|
||||
ir->lod_info.lod->accept(this);
|
||||
}
|
||||
|
||||
|
||||
// grad
|
||||
if (ir->op == ir_txd)
|
||||
{
|
||||
|
1
3rdparty/ocornut-imgui/imgui_internal.h
vendored
1
3rdparty/ocornut-imgui/imgui_internal.h
vendored
@ -716,6 +716,7 @@ namespace ImGui
|
||||
|
||||
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
||||
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0);
|
||||
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius);
|
||||
|
||||
IMGUI_API bool SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags = 0);
|
||||
IMGUI_API bool SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* display_format, float power);
|
||||
|
@ -72,7 +72,7 @@ struct Mouse
|
||||
struct Keyboard
|
||||
{
|
||||
Keyboard()
|
||||
: m_ring(BX_COUNTOF(m_char) )
|
||||
: m_ring(BX_COUNTOF(m_char)-4)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -487,6 +487,7 @@ GL_IMPORT_OES__(true, PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC, glCompressedT
|
||||
|
||||
GL_IMPORT_EXT__(true, PFNGLTEXSTORAGE2DPROC, glTexStorage2D);
|
||||
GL_IMPORT_EXT__(true, PFNGLTEXSTORAGE3DPROC, glTexStorage3D);
|
||||
GL_IMPORT______(true, PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample);
|
||||
|
||||
GL_IMPORT_EXT__(true, PFNGLINSERTEVENTMARKEREXTPROC, glInsertEventMarker);
|
||||
GL_IMPORT_EXT__(true, PFNGLPUSHGROUPMARKEREXTPROC, glPushGroupMarker);
|
||||
@ -567,6 +568,7 @@ GL_IMPORT______(true, PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC, glCompressedT
|
||||
|
||||
GL_IMPORT______(true, PFNGLTEXSTORAGE2DPROC, glTexStorage2D);
|
||||
GL_IMPORT______(true, PFNGLTEXSTORAGE3DPROC, glTexStorage3D);
|
||||
GL_IMPORT______(true, PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample);
|
||||
|
||||
GL_IMPORT______(true, PFNGLINSERTEVENTMARKEREXTPROC, glInsertEventMarker);
|
||||
GL_IMPORT______(true, PFNGLPUSHGROUPMARKEREXTPROC, glPushGroupMarker);
|
||||
|
@ -3410,7 +3410,6 @@ namespace bgfx { namespace gl
|
||||
GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT) );
|
||||
GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR) );
|
||||
GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) );
|
||||
|
||||
GL_CHECK(glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LEVEL, 0) );
|
||||
}
|
||||
}
|
||||
@ -3580,6 +3579,10 @@ namespace bgfx { namespace gl
|
||||
GLSL_TYPE(GL_INT_SAMPLER_CUBE);
|
||||
GLSL_TYPE(GL_UNSIGNED_INT_SAMPLER_CUBE);
|
||||
|
||||
GLSL_TYPE(GL_SAMPLER_2D_MULTISAMPLE);
|
||||
GLSL_TYPE(GL_INT_SAMPLER_2D_MULTISAMPLE);
|
||||
GLSL_TYPE(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE);
|
||||
|
||||
GLSL_TYPE(GL_SAMPLER_2D_SHADOW);
|
||||
|
||||
GLSL_TYPE(GL_IMAGE_1D);
|
||||
@ -3670,6 +3673,10 @@ namespace bgfx { namespace gl
|
||||
|
||||
case GL_SAMPLER_2D_SHADOW:
|
||||
|
||||
case GL_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
|
||||
|
||||
case GL_IMAGE_1D:
|
||||
case GL_INT_IMAGE_1D:
|
||||
case GL_UNSIGNED_INT_IMAGE_1D:
|
||||
@ -4151,17 +4158,22 @@ namespace bgfx { namespace gl
|
||||
m_vcref.invalidate(s_renderGL->m_vaoStateCache);
|
||||
}
|
||||
|
||||
static void texImage(GLenum _target, GLint _level, GLint _internalFormat, GLsizei _width, GLsizei _height, GLsizei _depth, GLint _border, GLenum _format, GLenum _type, const GLvoid* _data)
|
||||
static void texImage(GLenum _target, uint32_t _msaaQuality, GLint _level, GLint _internalFormat, GLsizei _width, GLsizei _height, GLsizei _depth, GLint _border, GLenum _format, GLenum _type, const GLvoid* _data)
|
||||
{
|
||||
if (_target == GL_TEXTURE_3D)
|
||||
{
|
||||
GL_CHECK(glTexImage3D(_target, _level, _internalFormat, _width, _height, _depth, _border, _format, _type, _data) );
|
||||
}
|
||||
else if (_target == GL_TEXTURE_2D_MULTISAMPLE)
|
||||
{
|
||||
GL_CHECK(glTexImage2DMultisample(_target, _msaaQuality, _internalFormat, _width, _height, false) );
|
||||
}
|
||||
else
|
||||
{
|
||||
BX_UNUSED(_depth);
|
||||
GL_CHECK(glTexImage2D(_target, _level, _internalFormat, _width, _height, _border, _format, _type, _data) );
|
||||
}
|
||||
|
||||
BX_UNUSED(_msaaQuality, _depth, _border, _data);
|
||||
}
|
||||
|
||||
static void texSubImage(GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, GLint _zoffset, GLsizei _width, GLsizei _height, GLsizei _depth, GLenum _format, GLenum _type, const GLvoid* _data)
|
||||
@ -4348,7 +4360,14 @@ namespace bgfx { namespace gl
|
||||
m_requestedFormat = uint8_t(imageContainer.m_format);
|
||||
m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) );
|
||||
|
||||
GLenum target = GL_TEXTURE_2D;
|
||||
const bool computeWrite = 0 != (_flags&BGFX_TEXTURE_COMPUTE_WRITE);
|
||||
const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB);
|
||||
const bool msaaSample = 0 != (_flags&BGFX_TEXTURE_MSAA_SAMPLE);
|
||||
uint32_t msaaQuality = ( (_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT);
|
||||
msaaQuality = bx::uint32_satsub(msaaQuality, 1);
|
||||
msaaQuality = bx::uint32_min(s_renderGL->m_maxMsaa, msaaQuality == 0 ? 0 : 1<<msaaQuality);
|
||||
|
||||
GLenum target = msaaSample ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D;
|
||||
if (imageContainer.m_cubeMap)
|
||||
{
|
||||
target = GL_TEXTURE_CUBE_MAP;
|
||||
@ -4369,9 +4388,6 @@ namespace bgfx { namespace gl
|
||||
return;
|
||||
}
|
||||
|
||||
const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE);
|
||||
const bool srgb = 0 != (m_flags&BGFX_TEXTURE_SRGB);
|
||||
|
||||
target = GL_TEXTURE_CUBE_MAP == m_target ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : m_target;
|
||||
|
||||
const GLenum internalFmt = srgb
|
||||
@ -4461,6 +4477,7 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
|
||||
texImage(target+side
|
||||
, msaaQuality
|
||||
, lod
|
||||
, internalFmt
|
||||
, width
|
||||
@ -4496,6 +4513,7 @@ namespace bgfx { namespace gl
|
||||
else
|
||||
{
|
||||
texImage(target+side
|
||||
, msaaQuality
|
||||
, lod
|
||||
, internalFmt
|
||||
, width
|
||||
@ -4692,8 +4710,9 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (hash != m_currentSamplerHash)
|
||||
{
|
||||
const GLenum target = m_target;
|
||||
const uint8_t numMips = m_numMips;
|
||||
const GLenum target = m_target == GL_TEXTURE_2D_MULTISAMPLE ? GL_TEXTURE_2D : m_target;
|
||||
const GLenum targetMsaa = m_target;
|
||||
const uint8_t numMips = m_numMips;
|
||||
|
||||
GL_CHECK(glTexParameteri(target, GL_TEXTURE_WRAP_S, s_textureAddress[(flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]) );
|
||||
GL_CHECK(glTexParameteri(target, GL_TEXTURE_WRAP_T, s_textureAddress[(flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]) );
|
||||
@ -4701,7 +4720,7 @@ namespace bgfx { namespace gl
|
||||
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30)
|
||||
|| s_extension[Extension::APPLE_texture_max_level].m_supported)
|
||||
{
|
||||
GL_CHECK(glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, numMips-1) );
|
||||
GL_CHECK(glTexParameteri(targetMsaa, GL_TEXTURE_MAX_LEVEL, numMips-1) );
|
||||
}
|
||||
|
||||
if (target == GL_TEXTURE_3D)
|
||||
@ -4736,12 +4755,12 @@ namespace bgfx { namespace gl
|
||||
const uint32_t cmpFunc = (flags&BGFX_TEXTURE_COMPARE_MASK)>>BGFX_TEXTURE_COMPARE_SHIFT;
|
||||
if (0 == cmpFunc)
|
||||
{
|
||||
GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_COMPARE_MODE, GL_NONE) );
|
||||
GL_CHECK(glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_NONE) );
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE) );
|
||||
GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_COMPARE_FUNC, s_cmpFunc[cmpFunc]) );
|
||||
GL_CHECK(glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE) );
|
||||
GL_CHECK(glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC, s_cmpFunc[cmpFunc]) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -640,6 +640,18 @@ typedef uint64_t GLuint64;
|
||||
# define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
|
||||
#endif // GL_UNSIGNED_INT_SAMPLER_CUBE
|
||||
|
||||
#ifndef GL_SAMPLER_2D_MULTISAMPLE
|
||||
# define GL_SAMPLER_2D_MULTISAMPLE 0x9108
|
||||
#endif // GL_SAMPLER_2D_MULTISAMPLE
|
||||
|
||||
#ifndef GL_INT_SAMPLER_2D_MULTISAMPLE
|
||||
# define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
|
||||
#endif // GL_INT_SAMPLER_2D_MULTISAMPLE
|
||||
|
||||
#ifndef GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE
|
||||
# define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
|
||||
#endif // GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE
|
||||
|
||||
#ifndef GL_SAMPLER_2D_SHADOW
|
||||
# define GL_SAMPLER_2D_SHADOW 0x8B62
|
||||
#endif // GL_SAMPLER_2D_SHADOW
|
||||
|
Loading…
Reference in New Issue
Block a user