mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-21 06:13:07 +01:00
Merge branch 'master' of github.com:bkaradzic/bgfx
This commit is contained in:
5
3rdparty/glslang/SPIRV/GlslangToSpv.cpp
vendored
5
3rdparty/glslang/SPIRV/GlslangToSpv.cpp
vendored
@@ -6126,6 +6126,11 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
|
||||
assert(builder.isPointerType(typeId1));
|
||||
typeId1 = builder.getContainedTypeId(typeId1);
|
||||
int width = builder.getScalarTypeWidth(typeId1);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (width == 16)
|
||||
// Using 16-bit exp operand, enable extension SPV_AMD_gpu_shader_int16
|
||||
builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16);
|
||||
#endif
|
||||
if (builder.getNumComponents(operands[0]) == 1)
|
||||
frexpIntType = builder.makeIntegerType(width, true);
|
||||
else
|
||||
|
||||
60
3rdparty/glslang/StandAlone/StandAlone.cpp
vendored
60
3rdparty/glslang/StandAlone/StandAlone.cpp
vendored
@@ -1196,38 +1196,48 @@ int C_DECL main(int argc, char* argv[])
|
||||
// .frag = fragment
|
||||
// .comp = compute
|
||||
//
|
||||
EShLanguage FindLanguage(const std::string& name, bool parseSuffix)
|
||||
// Additionally, the file names may end in .<stage>.glsl and .<stage>.hlsl
|
||||
// where <stage> is one of the stages listed above.
|
||||
//
|
||||
EShLanguage FindLanguage(const std::string& name, bool parseStageName)
|
||||
{
|
||||
size_t ext = 0;
|
||||
std::string suffix;
|
||||
|
||||
std::string stageName;
|
||||
if (shaderStageName)
|
||||
suffix = shaderStageName;
|
||||
else {
|
||||
// Search for a suffix on a filename: e.g, "myfile.frag". If given
|
||||
// the suffix directly, we skip looking for the '.'
|
||||
if (parseSuffix) {
|
||||
ext = name.rfind('.');
|
||||
if (ext == std::string::npos) {
|
||||
usage();
|
||||
return EShLangVertex;
|
||||
}
|
||||
++ext;
|
||||
stageName = shaderStageName;
|
||||
else if (parseStageName) {
|
||||
// Note: "first" extension means "first from the end", i.e.
|
||||
// if the file is named foo.vert.glsl, then "glsl" is first,
|
||||
// "vert" is second.
|
||||
size_t firstExtStart = name.find_last_of(".");
|
||||
bool hasFirstExt = firstExtStart != std::string::npos;
|
||||
size_t secondExtStart = hasFirstExt ? name.find_last_of(".", firstExtStart - 1) : std::string::npos;
|
||||
bool hasSecondExt = secondExtStart != std::string::npos;
|
||||
std::string firstExt = name.substr(firstExtStart + 1, std::string::npos);
|
||||
bool usesUnifiedExt = hasFirstExt && (firstExt == "glsl" || firstExt == "hlsl");
|
||||
if (usesUnifiedExt && firstExt == "hlsl")
|
||||
Options |= EOptionReadHlsl;
|
||||
if (hasFirstExt && !usesUnifiedExt)
|
||||
stageName = firstExt;
|
||||
else if (usesUnifiedExt && hasSecondExt)
|
||||
stageName = name.substr(secondExtStart + 1, firstExtStart - secondExtStart - 1);
|
||||
else {
|
||||
usage();
|
||||
return EShLangVertex;
|
||||
}
|
||||
suffix = name.substr(ext, std::string::npos);
|
||||
}
|
||||
} else
|
||||
stageName = name;
|
||||
|
||||
if (suffix == "vert")
|
||||
if (stageName == "vert")
|
||||
return EShLangVertex;
|
||||
else if (suffix == "tesc")
|
||||
else if (stageName == "tesc")
|
||||
return EShLangTessControl;
|
||||
else if (suffix == "tese")
|
||||
else if (stageName == "tese")
|
||||
return EShLangTessEvaluation;
|
||||
else if (suffix == "geom")
|
||||
else if (stageName == "geom")
|
||||
return EShLangGeometry;
|
||||
else if (suffix == "frag")
|
||||
else if (stageName == "frag")
|
||||
return EShLangFragment;
|
||||
else if (suffix == "comp")
|
||||
else if (stageName == "comp")
|
||||
return EShLangCompute;
|
||||
|
||||
usage();
|
||||
@@ -1298,10 +1308,12 @@ void usage()
|
||||
" .geom for a geometry shader\n"
|
||||
" .frag for a fragment shader\n"
|
||||
" .comp for a compute shader\n"
|
||||
" .glsl for .vert.glsl, .tesc.glsl, ..., .comp.glsl compound suffixes\n"
|
||||
" .hlsl for .vert.hlsl, .tesc.hlsl, ..., .comp.hlsl compound suffixes\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
" -C cascading errors; risk crash from accumulation of error recoveries\n"
|
||||
" -D input is HLSL\n"
|
||||
" -D input is HLSL (default when any suffix is .hlsl)\n"
|
||||
" -D<macro=def>\n"
|
||||
" -D<macro> define a pre-processor macro\n"
|
||||
" -E print pre-processed GLSL; cannot be used with -l;\n"
|
||||
|
||||
2
3rdparty/glslang/Test/310.tese
vendored
2
3rdparty/glslang/Test/310.tese
vendored
@@ -55,7 +55,7 @@ patch sample in vec3 badp4; // ERROR
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
in gl_PerVertex // ERROR, no size
|
||||
in gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
} gl_in[];
|
||||
|
||||
2
3rdparty/glslang/Test/320.tese
vendored
2
3rdparty/glslang/Test/320.tese
vendored
@@ -51,7 +51,7 @@ patch sample in vec3 badp4; // ERROR
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
in gl_PerVertex // ERROR, no size
|
||||
in gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
} gl_in[];
|
||||
|
||||
2
3rdparty/glslang/Test/400.tese
vendored
2
3rdparty/glslang/Test/400.tese
vendored
@@ -51,7 +51,7 @@ patch sample in vec3 badp4; // ERROR
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
|
||||
in gl_PerVertex // ERROR, no size
|
||||
in gl_PerVertex
|
||||
{
|
||||
float gl_ClipDistance[1];
|
||||
} gl_in[];
|
||||
|
||||
@@ -453,7 +453,6 @@ ERROR: 0:47: 'patch' : cannot use interpolation qualifiers with patch
|
||||
ERROR: 0:48: 'patch' : cannot use interpolation qualifiers with patch
|
||||
ERROR: 0:49: 'patch' : cannot use interpolation qualifiers with patch
|
||||
ERROR: 0:50: '' : can only have one auxiliary qualifier (centroid, patch, and sample)
|
||||
ERROR: 0:54: 'gl_PerVertex' : block already declared with size, can't redeclare as unsized
|
||||
ERROR: 0:59: 'gl_PerVertex' : can only redeclare a built-in block once, and before any use
|
||||
ERROR: 0:64: 'quads' : cannot apply to 'out'
|
||||
ERROR: 0:64: 'cw' : can only apply to 'in'
|
||||
@@ -473,7 +472,7 @@ ERROR: 0:99: 'location' : overlapping use of location 24
|
||||
ERROR: 0:101: 'gl_TessLevelOuter' : identifiers starting with "gl_" are reserved
|
||||
ERROR: 0:109: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group
|
||||
ERROR: 0:110: 'gl_ViewIndex' : required extension not requested: GL_EXT_multiview
|
||||
ERROR: 32 compilation errors. No code generated.
|
||||
ERROR: 31 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 400
|
||||
|
||||
@@ -25,7 +25,6 @@ ERROR: 0:53: 'noperspective' : not supported for this version or the enabled ext
|
||||
ERROR: 0:53: 'patch' : cannot use interpolation qualifiers with patch
|
||||
ERROR: 0:54: 'sample' : Reserved word.
|
||||
ERROR: 0:54: '' : can only have one auxiliary qualifier (centroid, patch, and sample)
|
||||
ERROR: 0:58: 'gl_PerVertex' : block already declared with size, can't redeclare as unsized
|
||||
ERROR: 0:63: 'gl_PerVertex' : can only redeclare a built-in block once, and before any use
|
||||
ERROR: 0:68: 'quads' : cannot apply to 'out'
|
||||
ERROR: 0:68: 'cw' : can only apply to 'in'
|
||||
@@ -47,7 +46,7 @@ ERROR: 0:113: 'sample' : Reserved word.
|
||||
ERROR: 0:119: 'gl_PointSize' : no such field in structure
|
||||
ERROR: 0:119: '=' : cannot convert from ' temp block{ in highp 4-component vector of float Position gl_Position}' to ' temp highp float'
|
||||
ERROR: 0:127: 'gl_BoundingBoxOES' : undeclared identifier
|
||||
ERROR: 44 compilation errors. No code generated.
|
||||
ERROR: 43 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 310
|
||||
|
||||
@@ -24,7 +24,6 @@ ERROR: 0:49: 'noperspective' : Reserved word.
|
||||
ERROR: 0:49: 'noperspective' : not supported for this version or the enabled extensions
|
||||
ERROR: 0:49: 'patch' : cannot use interpolation qualifiers with patch
|
||||
ERROR: 0:50: '' : can only have one auxiliary qualifier (centroid, patch, and sample)
|
||||
ERROR: 0:54: 'gl_PerVertex' : block already declared with size, can't redeclare as unsized
|
||||
ERROR: 0:59: 'gl_PerVertex' : can only redeclare a built-in block once, and before any use
|
||||
ERROR: 0:64: 'quads' : cannot apply to 'out'
|
||||
ERROR: 0:64: 'cw' : can only apply to 'in'
|
||||
@@ -43,7 +42,7 @@ ERROR: 0:96: 'location' : overlapping use of location 24
|
||||
ERROR: 0:99: 'location' : overlapping use of location 24
|
||||
ERROR: 0:101: 'gl_TessLevelOuter' : identifiers starting with "gl_" are reserved
|
||||
ERROR: 0:113: 'gl_BoundingBoxOES' : undeclared identifier
|
||||
ERROR: 40 compilation errors. No code generated.
|
||||
ERROR: 39 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 320
|
||||
|
||||
@@ -11,7 +11,6 @@ ERROR: 0:47: 'patch' : cannot use interpolation qualifiers with patch
|
||||
ERROR: 0:48: 'patch' : cannot use interpolation qualifiers with patch
|
||||
ERROR: 0:49: 'patch' : cannot use interpolation qualifiers with patch
|
||||
ERROR: 0:50: '' : can only have one auxiliary qualifier (centroid, patch, and sample)
|
||||
ERROR: 0:54: 'gl_PerVertex' : block already declared with size, can't redeclare as unsized
|
||||
ERROR: 0:59: 'gl_PerVertex' : can only redeclare a built-in block once, and before any use
|
||||
ERROR: 0:64: 'quads' : cannot apply to 'out'
|
||||
ERROR: 0:64: 'cw' : can only apply to 'in'
|
||||
@@ -31,7 +30,7 @@ ERROR: 0:99: 'location' : overlapping use of location 24
|
||||
ERROR: 0:101: 'gl_TessLevelOuter' : identifiers starting with "gl_" are reserved
|
||||
ERROR: 0:109: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group
|
||||
ERROR: 0:110: 'gl_ViewIndex' : required extension not requested: GL_EXT_multiview
|
||||
ERROR: 32 compilation errors. No code generated.
|
||||
ERROR: 31 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 400
|
||||
|
||||
27
3rdparty/glslang/Test/baseResults/compoundsuffix.frag.hlsl
vendored
Normal file
27
3rdparty/glslang/Test/baseResults/compoundsuffix.frag.hlsl
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
compoundsuffix.frag.hlsl
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80006
|
||||
// Id's are bound by 21
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 20
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source HLSL 500
|
||||
Name 4 "main"
|
||||
Name 20 "fragColor"
|
||||
Decorate 20(fragColor) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 4
|
||||
13: 6(float) Constant 1065353216
|
||||
14: 7(fvec4) ConstantComposite 13 13 13 13
|
||||
19: TypePointer Output 7(fvec4)
|
||||
20(fragColor): 19(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
Store 20(fragColor) 14
|
||||
Return
|
||||
FunctionEnd
|
||||
15
3rdparty/glslang/Test/baseResults/compoundsuffix.vert.glsl
vendored
Normal file
15
3rdparty/glslang/Test/baseResults/compoundsuffix.vert.glsl
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
compoundsuffix.vert.glsl
|
||||
Shader version: 100
|
||||
0:? Sequence
|
||||
0:1 Function Definition: main( ( global void)
|
||||
0:1 Function Parameters:
|
||||
0:3 Sequence
|
||||
0:3 move second child to first child ( temp highp 4-component vector of float)
|
||||
0:3 'gl_Position' ( gl_Position highp 4-component vector of float Position)
|
||||
0:3 Constant:
|
||||
0:3 1.000000
|
||||
0:3 1.000000
|
||||
0:3 1.000000
|
||||
0:3 1.000000
|
||||
0:? Linker Objects
|
||||
|
||||
6
3rdparty/glslang/Test/compoundsuffix.frag.hlsl
vendored
Normal file
6
3rdparty/glslang/Test/compoundsuffix.frag.hlsl
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
void main(out float4 fragColor : SV_TARGET0)
|
||||
{
|
||||
fragColor = 1;
|
||||
}
|
||||
|
||||
|
||||
4
3rdparty/glslang/Test/compoundsuffix.vert.glsl
vendored
Executable file
4
3rdparty/glslang/Test/compoundsuffix.vert.glsl
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(1.0);
|
||||
}
|
||||
8
3rdparty/glslang/Test/runtests
vendored
8
3rdparty/glslang/Test/runtests
vendored
@@ -74,11 +74,15 @@ else
|
||||
fi
|
||||
|
||||
#
|
||||
# Testing -S
|
||||
# Testing -S and compound suffixes
|
||||
#
|
||||
echo Running explicit stage test
|
||||
echo Running explicit stage test and compound suffix tests
|
||||
$EXE -i -S vert nosuffix > $TARGETDIR/nosuffix.out
|
||||
diff -b $BASEDIR/nosuffix.out $TARGETDIR/nosuffix.out || HASERROR=1
|
||||
$EXE -i compoundsuffix.vert.glsl > $TARGETDIR/compoundsuffix.vert.glsl
|
||||
diff -b $BASEDIR/compoundsuffix.vert.glsl $TARGETDIR/compoundsuffix.vert.glsl || HASERROR=1
|
||||
$EXE -e main -H compoundsuffix.frag.hlsl > $TARGETDIR/compoundsuffix.frag.hlsl
|
||||
diff -b $BASEDIR/compoundsuffix.frag.hlsl $TARGETDIR/compoundsuffix.frag.hlsl || HASERROR=1
|
||||
|
||||
#
|
||||
# Testing --hlsl-offsets
|
||||
|
||||
2
3rdparty/glslang/glslang/Include/revision.h
vendored
2
3rdparty/glslang/glslang/Include/revision.h
vendored
@@ -1,3 +1,3 @@
|
||||
// This header is generated by the make-revision script.
|
||||
|
||||
#define GLSLANG_PATCH_LEVEL 2691
|
||||
#define GLSLANG_PATCH_LEVEL 2712
|
||||
|
||||
@@ -3508,7 +3508,8 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS
|
||||
// Either redeclare the requested block, or give an error message why it can't be done.
|
||||
//
|
||||
// TODO: functionality: explicitly sizing members of redeclared blocks is not giving them an explicit size
|
||||
void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes)
|
||||
void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName,
|
||||
const TString* instanceName, TArraySizes* arraySizes)
|
||||
{
|
||||
const char* feature = "built-in block redeclaration";
|
||||
profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature);
|
||||
@@ -3662,15 +3663,24 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
|
||||
|
||||
if (numOriginalMembersFound < newTypeList.size())
|
||||
error(loc, "block redeclaration has extra members", blockName.c_str(), "");
|
||||
if (type.isArray() != (arraySizes != nullptr))
|
||||
if (type.isArray() != (arraySizes != nullptr) ||
|
||||
(type.isArray() && arraySizes != nullptr && type.getArraySizes()->getNumDims() != arraySizes->getNumDims()))
|
||||
error(loc, "cannot change arrayness of redeclared block", blockName.c_str(), "");
|
||||
else if (type.isArray()) {
|
||||
if (type.isSizedArray() && !arraySizes->isSized())
|
||||
error(loc, "block already declared with size, can't redeclare as unsized", blockName.c_str(), "");
|
||||
else if (type.isSizedArray() && *type.getArraySizes() != *arraySizes)
|
||||
error(loc, "cannot change array size of redeclared block", blockName.c_str(), "");
|
||||
else if (!type.isSizedArray() && arraySizes->isSized())
|
||||
// At this point, we know both are arrays and both have the same number of dimensions.
|
||||
|
||||
// It is okay for a built-in block redeclaration to be unsized, and keep the size of the
|
||||
// original block declaration.
|
||||
if (!arraySizes->isSized() && type.isSizedArray())
|
||||
arraySizes->changeOuterSize(type.getOuterArraySize());
|
||||
|
||||
// And, okay to be giving a size to the array, by the redeclaration
|
||||
if (!type.isSizedArray() && arraySizes->isSized())
|
||||
type.changeOuterArraySize(arraySizes->getOuterSize());
|
||||
|
||||
// Now, they must match in all dimensions.
|
||||
if (type.isSizedArray() && *type.getArraySizes() != *arraySizes)
|
||||
error(loc, "cannot change array size of redeclared block", blockName.c_str(), "");
|
||||
}
|
||||
|
||||
symbolTable.insert(*block);
|
||||
|
||||
55
3rdparty/ocornut-imgui/imgui.cpp
vendored
55
3rdparty/ocornut-imgui/imgui.cpp
vendored
@@ -5225,9 +5225,10 @@ static void CheckStacksSize(ImGuiWindow* window, bool write)
|
||||
{ int current = window->IDStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "PushID/PopID or TreeNode/TreePop Mismatch!"); p_backup++; } // Too few or too many PopID()/TreePop()
|
||||
{ int current = window->DC.GroupStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "BeginGroup/EndGroup Mismatch!"); p_backup++; } // Too few or too many EndGroup()
|
||||
{ int current = g.CurrentPopupStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "BeginMenu/EndMenu or BeginPopup/EndPopup Mismatch"); p_backup++;}// Too few or too many EndMenu()/EndPopup()
|
||||
{ int current = g.ColorModifiers.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "PushStyleColor/PopStyleColor Mismatch!"); p_backup++; } // Too few or too many PopStyleColor()
|
||||
{ int current = g.StyleModifiers.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "PushStyleVar/PopStyleVar Mismatch!"); p_backup++; } // Too few or too many PopStyleVar()
|
||||
{ int current = g.FontStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "PushFont/PopFont Mismatch!"); p_backup++; } // Too few or too many PopFont()
|
||||
// For color, style and font stacks there is an incentive to use Push/Begin/Pop/.../End patterns, so we relax our checks a little to allow them.
|
||||
{ int current = g.ColorModifiers.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup >= current && "PushStyleColor/PopStyleColor Mismatch!"); p_backup++; } // Too few or too many PopStyleColor()
|
||||
{ int current = g.StyleModifiers.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup >= current && "PushStyleVar/PopStyleVar Mismatch!"); p_backup++; } // Too few or too many PopStyleVar()
|
||||
{ int current = g.FontStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup >= current && "PushFont/PopFont Mismatch!"); p_backup++; } // Too few or too many PopFont()
|
||||
IM_ASSERT(p_backup == window->DC.StackSizesBackup + IM_ARRAYSIZE(window->DC.StackSizesBackup));
|
||||
}
|
||||
|
||||
@@ -10064,15 +10065,15 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + edit_state.ScrollX;
|
||||
const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y - style.FramePadding.y) : (g.FontSize*0.5f));
|
||||
|
||||
const bool osx_double_click_selects_words = io.OptMacOSXBehaviors; // OS X style: Double click selects by word instead of selecting whole text
|
||||
if (select_all || (hovered && !osx_double_click_selects_words && io.MouseDoubleClicked[0]))
|
||||
const bool is_osx = io.OptMacOSXBehaviors;
|
||||
if (select_all || (hovered && !is_osx && io.MouseDoubleClicked[0]))
|
||||
{
|
||||
edit_state.SelectAll();
|
||||
edit_state.SelectedAllMouseLock = true;
|
||||
}
|
||||
else if (hovered && osx_double_click_selects_words && io.MouseDoubleClicked[0])
|
||||
else if (hovered && is_osx && io.MouseDoubleClicked[0])
|
||||
{
|
||||
// Select a word only, OS X style (by simulating keystrokes)
|
||||
// Double-click select a word only, OS X style (by simulating keystrokes)
|
||||
edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT);
|
||||
edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT);
|
||||
}
|
||||
@@ -10097,7 +10098,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
{
|
||||
// Process text input (before we check for Return because using some IME will effectively send a Return?)
|
||||
// We ignore CTRL inputs, but need to allow ALT+CTRL as some keyboards (e.g. German) use AltGR (which _is_ Alt+Ctrl) to input certain characters.
|
||||
bool ignore_inputs = (io.KeyCtrl && !io.KeyAlt) || (io.OptMacOSXBehaviors && io.KeySuper);
|
||||
bool ignore_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper);
|
||||
if (!ignore_inputs && is_editable && !user_nav_input_start)
|
||||
for (int n = 0; n < IM_ARRAYSIZE(io.InputCharacters) && io.InputCharacters[n]; n++)
|
||||
{
|
||||
@@ -10117,15 +10118,19 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
{
|
||||
// Handle key-presses
|
||||
const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0);
|
||||
const bool is_shortcut_key_only = (io.OptMacOSXBehaviors ? (io.KeySuper && !io.KeyCtrl) : (io.KeyCtrl && !io.KeySuper)) && !io.KeyAlt && !io.KeyShift; // OS X style: Shortcuts using Cmd/Super instead of Ctrl
|
||||
const bool is_wordmove_key_down = io.OptMacOSXBehaviors ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl
|
||||
const bool is_startend_key_down = io.OptMacOSXBehaviors && io.KeySuper && !io.KeyCtrl && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End
|
||||
const bool is_osx = io.OptMacOSXBehaviors;
|
||||
const bool is_shortcut_key = (is_osx ? (io.KeySuper && !io.KeyCtrl) : (io.KeyCtrl && !io.KeySuper)) && !io.KeyAlt && !io.KeyShift; // OS X style: Shortcuts using Cmd/Super instead of Ctrl
|
||||
const bool is_osx_shift_shortcut = is_osx && io.KeySuper && io.KeyShift && !io.KeyCtrl && !io.KeyAlt;
|
||||
const bool is_wordmove_key_down = is_osx ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl
|
||||
const bool is_startend_key_down = is_osx && io.KeySuper && !io.KeyCtrl && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End
|
||||
const bool is_ctrl_key_only = io.KeyCtrl && !io.KeyShift && !io.KeyAlt && !io.KeySuper;
|
||||
const bool is_shift_key_only = io.KeyShift && !io.KeyCtrl && !io.KeyAlt && !io.KeySuper;
|
||||
|
||||
const bool is_cut = ((is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_X)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Delete))) && is_editable && !is_password && (!is_multiline || edit_state.HasSelection());
|
||||
const bool is_copy = ((is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_C)) || (is_ctrl_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && !is_password && (!is_multiline || edit_state.HasSelection());
|
||||
const bool is_paste = ((is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && is_editable;
|
||||
const bool is_cut = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_X)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Delete))) && is_editable && !is_password && (!is_multiline || edit_state.HasSelection());
|
||||
const bool is_copy = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_C)) || (is_ctrl_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && !is_password && (!is_multiline || edit_state.HasSelection());
|
||||
const bool is_paste = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && is_editable;
|
||||
const bool is_undo = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_Z)) && is_editable && is_undoable);
|
||||
const bool is_redo = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressedMap(ImGuiKey_Z))) && is_editable && is_undoable;
|
||||
|
||||
if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }
|
||||
else if (IsKeyPressedMap(ImGuiKey_RightArrow)) { edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); }
|
||||
@@ -10139,7 +10144,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
if (!edit_state.HasSelection())
|
||||
{
|
||||
if (is_wordmove_key_down) edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT|STB_TEXTEDIT_K_SHIFT);
|
||||
else if (io.OptMacOSXBehaviors && io.KeySuper && !io.KeyAlt && !io.KeyCtrl) edit_state.OnKeyPressed(STB_TEXTEDIT_K_LINESTART|STB_TEXTEDIT_K_SHIFT);
|
||||
else if (is_osx && io.KeySuper && !io.KeyAlt && !io.KeyCtrl) edit_state.OnKeyPressed(STB_TEXTEDIT_K_LINESTART|STB_TEXTEDIT_K_SHIFT);
|
||||
}
|
||||
edit_state.OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);
|
||||
}
|
||||
@@ -10163,10 +10168,20 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
if (InputTextFilterCharacter(&c, flags, callback, user_data))
|
||||
edit_state.OnKeyPressed((int)c);
|
||||
}
|
||||
else if (IsKeyPressedMap(ImGuiKey_Escape)) { clear_active_id = cancel_edit = true; }
|
||||
else if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_Z) && is_editable && is_undoable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_UNDO); edit_state.ClearSelection(); }
|
||||
else if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_Y) && is_editable && is_undoable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_REDO); edit_state.ClearSelection(); }
|
||||
else if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_A)) { edit_state.SelectAll(); edit_state.CursorFollow = true; }
|
||||
else if (IsKeyPressedMap(ImGuiKey_Escape))
|
||||
{
|
||||
clear_active_id = cancel_edit = true;
|
||||
}
|
||||
else if (is_undo || is_redo)
|
||||
{
|
||||
edit_state.OnKeyPressed(is_undo ? STB_TEXTEDIT_K_UNDO : STB_TEXTEDIT_K_REDO);
|
||||
edit_state.ClearSelection();
|
||||
}
|
||||
else if (is_shortcut_key && IsKeyPressedMap(ImGuiKey_A))
|
||||
{
|
||||
edit_state.SelectAll();
|
||||
edit_state.CursorFollow = true;
|
||||
}
|
||||
else if (is_cut || is_copy)
|
||||
{
|
||||
// Cut, Copy
|
||||
@@ -10178,7 +10193,6 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
ImTextStrToUtf8(edit_state.TempTextBuffer.Data, edit_state.TempTextBuffer.Size, edit_state.Text.Data+ib, edit_state.Text.Data+ie);
|
||||
SetClipboardText(edit_state.TempTextBuffer.Data);
|
||||
}
|
||||
|
||||
if (is_cut)
|
||||
{
|
||||
if (!edit_state.HasSelection())
|
||||
@@ -10189,7 +10203,6 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
}
|
||||
else if (is_paste)
|
||||
{
|
||||
// Paste
|
||||
if (const char* clipboard = GetClipboardText())
|
||||
{
|
||||
// Filter pasted buffer
|
||||
|
||||
@@ -596,7 +596,7 @@ typedef struct bgfx_resolution_s
|
||||
{
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t flags;
|
||||
uint32_t reset;
|
||||
|
||||
} bgfx_resolution_t;
|
||||
|
||||
|
||||
@@ -3454,6 +3454,8 @@ namespace bgfx
|
||||
|
||||
BGFX_API_FUNC(void allocInstanceDataBuffer(InstanceDataBuffer* _idb, uint32_t _num, uint16_t _stride) )
|
||||
{
|
||||
BGFX_MUTEX_SCOPE(m_resourceApiLock);
|
||||
|
||||
uint16_t stride = BX_ALIGN_16(_stride);
|
||||
uint32_t offset = m_submit->allocTransientVertexBuffer(_num, stride);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user