mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-15 22:09:41 +01:00
Compare commits
15 Commits
ngubarkov/
...
jb21-b237
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a24ed041aa | ||
|
|
d0bf4506c0 | ||
|
|
836f44fded | ||
|
|
f0bbcfc492 | ||
|
|
e829d44cb9 | ||
|
|
df095ab6db | ||
|
|
c301e17244 | ||
|
|
f66a111d13 | ||
|
|
6db1b3ec3c | ||
|
|
a19d03327a | ||
|
|
6d63ee0477 | ||
|
|
60928807c8 | ||
|
|
da11c5e526 | ||
|
|
c56af99364 | ||
|
|
492fddd948 |
@@ -99,6 +99,9 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
AC_ARG_WITH(vulkan-include, [AS_HELP_STRING([--with-vulkan-include],
|
||||
[specify directory for the vulkan include files])])
|
||||
|
||||
AC_ARG_WITH(vulkan-shader-compiler, [AS_HELP_STRING([--with-vulkan-shader-compiler],
|
||||
[specify which shader compiler to use: glslc/glslangValidator])])
|
||||
|
||||
if test "x$SUPPORTS_LIB_VULKAN" = xfalse; then
|
||||
|
||||
if (test "x${with_vulkan}" != x && test "x${with_vulkan}" != xno) || \
|
||||
@@ -120,7 +123,6 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
AC_CHECK_HEADERS([${with_vulkan_include}/include/vulkan/vulkan.h],
|
||||
[ VULKAN_FOUND=yes
|
||||
VULKAN_FLAGS="-DVK_USE_PLATFORM_WAYLAND_KHR -I${with_vulkan_include}/include -DVULKAN_ENABLED"
|
||||
VULKAN_ENABLED=true
|
||||
],
|
||||
[ AC_MSG_ERROR([Can't find 'vulkan/vulkan.h' under '${with_vulkan_include}']) ]
|
||||
)
|
||||
@@ -131,7 +133,6 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
AC_CHECK_HEADERS([$VULKAN_SDK/include/vulkan/vulkan.h],
|
||||
[ VULKAN_FOUND=yes
|
||||
VULKAN_FLAGS="-DVK_USE_PLATFORM_WAYLAND_KHR -I${VULKAN_SDK}/include -DVULKAN_ENABLED"
|
||||
VULKAN_ENABLED=true
|
||||
],
|
||||
[ VULKAN_FOUND=no; break ]
|
||||
)
|
||||
@@ -142,7 +143,6 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
AC_CHECK_HEADERS([vulkan/vulkan.h],
|
||||
[ VULKAN_FOUND=yes
|
||||
VULKAN_FLAGS="-DVK_USE_PLATFORM_WAYLAND_KHR -DVULKAN_ENABLED"
|
||||
VULKAN_ENABLED=true
|
||||
],
|
||||
[ VULKAN_FOUND=no; break ]
|
||||
)
|
||||
@@ -151,11 +151,32 @@ AC_DEFUN_ONCE([LIB_SETUP_WAYLAND],
|
||||
if test "x$VULKAN_FOUND" = xno; then
|
||||
HELP_MSG_MISSING_DEPENDENCY([vulkan])
|
||||
AC_MSG_ERROR([Could not find vulkan! $HELP_MSG ])
|
||||
else
|
||||
# Find shader compiler - glslc or glslangValidator
|
||||
if (test "x${with_vulkan_shader_compiler}" = x || test "x${with_vulkan_shader_compiler}" = xglslc); then
|
||||
UTIL_LOOKUP_PROGS(GLSLC, glslc)
|
||||
SHADER_COMPILER="$GLSLC"
|
||||
VULKAN_SHADER_COMPILER="glslc --target-env=vulkan1.2 -mfmt=num -o"
|
||||
fi
|
||||
|
||||
if (test "x${with_vulkan_shader_compiler}" = x || test "x${with_vulkan_shader_compiler}" = xglslangValidator) && \
|
||||
test "x$SHADER_COMPILER" = x; then
|
||||
UTIL_LOOKUP_PROGS(GLSLANG, glslangValidator)
|
||||
SHADER_COMPILER="$GLSLANG"
|
||||
VULKAN_SHADER_COMPILER="glslangValidator --target-env vulkan1.2 -x -o"
|
||||
fi
|
||||
|
||||
if test "x$SHADER_COMPILER" != x; then
|
||||
VULKAN_ENABLED=true
|
||||
else
|
||||
AC_MSG_ERROR([Can't find shader compiler])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(VULKAN_FLAGS)
|
||||
AC_SUBST(VULKAN_SHADER_COMPILER)
|
||||
AC_SUBST(VULKAN_ENABLED)
|
||||
AC_SUBST(WAYLAND_CFLAGS)
|
||||
AC_SUBST(WAYLAND_LIBS)
|
||||
|
||||
@@ -482,6 +482,7 @@ A11Y_JAWS_ANNOUNCING_ENABLED:=@A11Y_JAWS_ANNOUNCING_ENABLED@
|
||||
WAYLAND_CFLAGS:=@WAYLAND_CFLAGS@
|
||||
WAYLAND_LIBS:=@WAYLAND_LIBS@
|
||||
VULKAN_FLAGS:=@VULKAN_FLAGS@
|
||||
VULKAN_SHADER_COMPILER:=@VULKAN_SHADER_COMPILER@
|
||||
VULKAN_ENABLED:=@VULKAN_ENABLED@
|
||||
|
||||
# The lowest required version of macosx
|
||||
|
||||
@@ -219,6 +219,34 @@ ifeq ($(call isTargetOs, windows)+$(ENABLE_HEADLESS_ONLY)+$(A11Y_NVDA_ANNOUNCING
|
||||
TARGETS += $(COPY_NVDA_DEPENDENCIES)
|
||||
endif
|
||||
|
||||
# Compile Vulkan shaders
|
||||
define compile-spirv
|
||||
$(call MakeTargetDir)
|
||||
$(VULKAN_SHADER_COMPILER) '$(call DecodeSpace, $@)' '$(call DecodeSpace, $<)'
|
||||
endef
|
||||
spirv-name = $(strip $1).h
|
||||
|
||||
ifeq ($(VULKAN_ENABLED), true)
|
||||
$(eval $(call SetupCopyFiles, COMPILE_VULKAN_SHADERS, \
|
||||
SRC := $(TOPDIR)/src/$(MODULE)/share/glsl/vulkan, \
|
||||
FILES := $(call FindFiles, $(TOPDIR)/src/$(MODULE)/share/glsl/vulkan), \
|
||||
DEST := $(SUPPORT_OUTPUTDIR)/headers/java.desktop/vulkan/spirv, \
|
||||
MACRO := compile-spirv, \
|
||||
NAME_MACRO := spirv-name, \
|
||||
))
|
||||
VULKAN_SHADER_LIST = $(SUPPORT_OUTPUTDIR)/headers/java.desktop/vulkan/shader_list.h
|
||||
$(VULKAN_SHADER_LIST): $(COMPILE_VULKAN_SHADERS)
|
||||
> $(VULKAN_SHADER_LIST) $(NEWLINE) \
|
||||
$(foreach f, $(patsubst $(TOPDIR)/src/$(MODULE)/share/glsl/vulkan/%,%,$(call FindFiles, $(TOPDIR)/src/$(MODULE)/share/glsl/vulkan)), \
|
||||
$(ECHO) SHADER_ENTRY\($(subst .,$(COMMA),$(subst /,_,$f))\) >> $(VULKAN_SHADER_LIST) $(NEWLINE) \
|
||||
$(ECHO) '#ifdef INCLUDE_BYTECODE' >> $(VULKAN_SHADER_LIST) $(NEWLINE) \
|
||||
$(ECHO) '#include "spirv/$f.h"' >> $(VULKAN_SHADER_LIST) $(NEWLINE) \
|
||||
$(ECHO) BYTECODE_END >> $(VULKAN_SHADER_LIST) $(NEWLINE) \
|
||||
$(ECHO) '#endif' >> $(VULKAN_SHADER_LIST) $(NEWLINE) \
|
||||
)
|
||||
$(BUILD_LIBAWT): $(VULKAN_SHADER_LIST)
|
||||
endif
|
||||
|
||||
TARGETS += $(BUILD_LIBAWT)
|
||||
|
||||
################################################################################
|
||||
@@ -354,6 +382,7 @@ ifeq ($(call isTargetOs, windows macosx), false)
|
||||
common/font \
|
||||
common/java2d/wl \
|
||||
common/java2d/vulkan \
|
||||
libvmahpp \
|
||||
#
|
||||
|
||||
# Enable 'wakefield' extension for java.awt.Robot support
|
||||
@@ -401,6 +430,8 @@ ifeq ($(call isTargetOs, windows macosx), false)
|
||||
DISABLED_WARNINGS_CXX_gcc := undef, \
|
||||
DISABLED_WARNINGS_clang := parentheses format undef \
|
||||
logical-op-parentheses format-nonliteral int-conversion, \
|
||||
DISABLED_WARNINGS_gcc_VKMemory.cpp := missing-field-initializers implicit-fallthrough parentheses, \
|
||||
DISABLED_WARNINGS_clang_VKMemory.cpp := missing-field-initializers implicit-fallthrough parentheses, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN) \
|
||||
-L$(INSTALL_LIBRARIES_HERE), \
|
||||
|
||||
@@ -25,9 +25,13 @@
|
||||
|
||||
package com.jetbrains.internal;
|
||||
|
||||
import sun.security.action.GetBooleanAction;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
@@ -97,7 +101,8 @@ import static java.lang.invoke.MethodHandles.Lookup;
|
||||
* user to directly create proxy object.
|
||||
*/
|
||||
public class JBRApi {
|
||||
static final boolean VERBOSE = Boolean.getBoolean("jetbrains.api.verbose");
|
||||
@SuppressWarnings("removal")
|
||||
static final boolean VERBOSE = AccessController.doPrivileged(new GetBooleanAction("jetbrains.api.verbose"));
|
||||
|
||||
private static final Map<String, RegisteredProxyInfo> registeredProxyInfoByInterfaceName = new HashMap<>();
|
||||
private static final Map<String, RegisteredProxyInfo> registeredProxyInfoByTargetName = new HashMap<>();
|
||||
@@ -205,19 +210,22 @@ public class JBRApi {
|
||||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public Object build() {
|
||||
ProxyInfo info = ProxyInfo.resolve(this.info);
|
||||
if (info == null) return null;
|
||||
ProxyGenerator generator = new ProxyGenerator(info);
|
||||
if (!generator.areAllMethodsImplemented()) return null;
|
||||
generator.defineClasses();
|
||||
MethodHandle constructor = generator.findConstructor();
|
||||
generator.init();
|
||||
try {
|
||||
return constructor.invoke();
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
|
||||
ProxyInfo info = ProxyInfo.resolve(this.info);
|
||||
if (info == null) return null;
|
||||
ProxyGenerator generator = new ProxyGenerator(info);
|
||||
if (!generator.areAllMethodsImplemented()) return null;
|
||||
generator.defineClasses();
|
||||
MethodHandle constructor = generator.findConstructor();
|
||||
generator.init();
|
||||
try {
|
||||
return constructor.invoke();
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,6 +190,10 @@ public final class LWCToolkit extends LWToolkit {
|
||||
return getKeyboardLayoutList(false).contains(layoutName);
|
||||
}
|
||||
|
||||
public static boolean isKeyboardLayoutInstalled(String layoutName) {
|
||||
return getKeyboardLayoutList(true).contains(layoutName);
|
||||
}
|
||||
|
||||
// Listens to EDT state in invokeAndWait() and disposes the invocation event
|
||||
// when EDT becomes free but the invocation event is not yet dispatched (considered lost).
|
||||
// This prevents a deadlock and makes the invocation return some default result.
|
||||
|
||||
@@ -36,9 +36,14 @@ import java.util.stream.Collectors;
|
||||
public class FontExtensions {
|
||||
private interface FontExtension {
|
||||
FontExtension INSTANCE = (FontExtension) JBRApi.internalServiceBuilder(MethodHandles.lookup())
|
||||
.withStatic("getFeatures", "getFeatures", "java.awt.Font").build();
|
||||
.withStatic("getFeatures", "getFeatures", "java.awt.Font")
|
||||
.withStatic("isComplexRendering", "isComplexRendering", "java.awt.Font")
|
||||
.withStatic("isKerning", "isKerning", "java.awt.Font")
|
||||
.build();
|
||||
|
||||
TreeMap<String, Integer> getFeatures(Font font);
|
||||
boolean isComplexRendering(Font font);
|
||||
boolean isKerning(Font font);
|
||||
}
|
||||
|
||||
public static String[] featuresToStringArray(Map<String, Integer> features) {
|
||||
@@ -49,4 +54,12 @@ public class FontExtensions {
|
||||
public static TreeMap<String, Integer> getFeatures(Font font) {
|
||||
return FontExtension.INSTANCE.getFeatures(font);
|
||||
}
|
||||
|
||||
public static boolean isComplexRendering(Font font) {
|
||||
return FontExtension.INSTANCE.isComplexRendering(font);
|
||||
}
|
||||
|
||||
public static boolean isKerning(Font font) {
|
||||
return FontExtension.INSTANCE.isKerning(font);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2719,29 +2719,17 @@ public class Font implements java.io.Serializable
|
||||
(limit - beginIndex));
|
||||
}
|
||||
|
||||
// this code should be in textlayout
|
||||
// quick check for simple text, assume GV ok to use if simple
|
||||
FontDesignMetrics metrics = FontDesignMetrics.getMetrics(this, frc);
|
||||
return metrics.charsBounds(chars, beginIndex, limit - beginIndex);
|
||||
}
|
||||
|
||||
boolean simple = (values == null ||
|
||||
(values.getKerning() == 0
|
||||
&& values.getLigatures() == 0
|
||||
&& values.getTracking() == 0
|
||||
&& values.getBaselineTransform() == null)) && !anyEnabledFeatures();
|
||||
if (simple) {
|
||||
simple = ! FontUtilities.isComplexText(chars, beginIndex, limit);
|
||||
}
|
||||
private static boolean isComplexRendering(Font font) {
|
||||
return (font.values != null && (font.values.getLigatures() != 0 || font.values.getTracking() != 0 ||
|
||||
font.values.getBaselineTransform() != null)) || font.anyEnabledFeatures();
|
||||
}
|
||||
|
||||
if (simple || ((limit - beginIndex) == 0)) {
|
||||
FontDesignMetrics metrics = FontDesignMetrics.getMetrics(this, frc);
|
||||
return metrics.getSimpleBounds(chars, beginIndex, limit-beginIndex);
|
||||
} else {
|
||||
// need char array constructor on textlayout
|
||||
String str = new String(chars, beginIndex, limit - beginIndex);
|
||||
TextLayout tl = new TextLayout(str, this, frc);
|
||||
return new Rectangle2D.Float(0, -tl.getAscent(), tl.getAdvance(),
|
||||
tl.getAscent() + tl.getDescent() +
|
||||
tl.getLeading());
|
||||
}
|
||||
private static boolean isKerning(Font font) {
|
||||
return font.values != null && (font.values.getKerning() != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,8 +38,11 @@ import java.io.ObjectOutputStream;
|
||||
import java.io.Serial;
|
||||
import java.lang.ref.ReferenceQueue;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.jetbrains.desktop.FontExtensions;
|
||||
import sun.java2d.Disposer;
|
||||
import sun.java2d.DisposerRecord;
|
||||
|
||||
@@ -432,16 +435,13 @@ public final class FontDesignMetrics extends FontMetrics {
|
||||
return frc;
|
||||
}
|
||||
|
||||
public int charWidth(char ch) {
|
||||
private float preciseCharWidth(char ch) {
|
||||
// default metrics for compatibility with legacy code
|
||||
float w;
|
||||
if (ch < 0x100) {
|
||||
w = getLatinCharWidth(ch);
|
||||
}
|
||||
else {
|
||||
w = handleCharWidth(ch);
|
||||
}
|
||||
return (int)(0.5 + w);
|
||||
return (ch < 0x100) ? getLatinCharWidth(ch) : handleCharWidth(ch);
|
||||
}
|
||||
|
||||
public int charWidth(char ch) {
|
||||
return Math.round(preciseCharWidth(ch));
|
||||
}
|
||||
|
||||
public int charWidth(int ch) {
|
||||
@@ -451,93 +451,111 @@ public final class FontDesignMetrics extends FontMetrics {
|
||||
|
||||
float w = handleCharWidth(ch);
|
||||
|
||||
return (int)(0.5 + w);
|
||||
return Math.round(w);
|
||||
}
|
||||
|
||||
private Rectangle2D.Float textLayoutBounds(Object data, int off, int len) {
|
||||
String str = data instanceof String ? ((String) data).substring(off, off + len) :
|
||||
new String((char[]) data, off, len);
|
||||
TextLayout tl = new TextLayout(str, font, frc);
|
||||
return new Rectangle2D.Float(0, -tl.getAscent(),
|
||||
tl.getAdvance(), tl.getAscent() + tl.getDescent() + tl.getLeading());
|
||||
}
|
||||
|
||||
private char getChar(Object data, int i) {
|
||||
return data instanceof String ? ((String) data).charAt(i) : ((char[]) data)[i];
|
||||
}
|
||||
|
||||
final int ADVANCES_FAST_KEY_LIMIT = 0x100;
|
||||
private HashMap<Integer, Float> advances = new HashMap<>();
|
||||
private float[] advancesFast = new float[ADVANCES_FAST_KEY_LIMIT * ADVANCES_FAST_KEY_LIMIT];
|
||||
|
||||
private Rectangle2D.Float dataBounds(Object data, int off, int len) {
|
||||
|
||||
assert (data instanceof String || data instanceof char[]);
|
||||
float width = 0;
|
||||
|
||||
if (FontExtensions.isComplexRendering(font) && len > 0) {
|
||||
return textLayoutBounds(data, off, len);
|
||||
}
|
||||
|
||||
float height = ascent + descent + leading;
|
||||
|
||||
if (len == 0 || len == 1 && !FontUtilities.isNonSimpleChar(getChar(data, off))) {
|
||||
width = len > 0 ? preciseCharWidth(getChar(data, off)) : 0f;
|
||||
return new Rectangle2D.Float(0f, -ascent, width, height);
|
||||
}
|
||||
|
||||
boolean isKerning = FontExtensions.isKerning(font);
|
||||
float consecutiveDoubleCharacterWidth = 0f;
|
||||
char prev = 0;
|
||||
for (int i = off; i < off + len; i++) {
|
||||
char cur = getChar(data, i);
|
||||
if (FontUtilities.isNonSimpleChar(cur)) {
|
||||
return textLayoutBounds(data, off, len);
|
||||
} else {
|
||||
// Correct width of string with kerning calculates by text LayoutBounds but it could be slow.
|
||||
// Below is description of optimized algorithm for correct calculating width of text with kerning:
|
||||
// proof:
|
||||
// base: kerningWidth('c1') = plainWidth('c1')
|
||||
// induction: kerningWidth('c1..cN-1cN') =
|
||||
// kerningWidth('c1..cN-1') + kerningWidth('cN-1cN') - plainWidth('cN-1')
|
||||
// final: kerningWidth('c1..cN') = kerningWidth('c1c2') + ... + kerningWidth('cN-1cN')
|
||||
// - (plainWidth('c2') + ... + plainWidth('cN-1'))
|
||||
// remark: for reducing calculation of kerningWidth('c1c2') using caching
|
||||
if (isKerning && i > off) {
|
||||
// fast path
|
||||
if (prev < ADVANCES_FAST_KEY_LIMIT && cur < ADVANCES_FAST_KEY_LIMIT) {
|
||||
int key = (prev << 8) | cur;
|
||||
if (advancesFast[key] == 0.0f) {
|
||||
advancesFast[key] = textLayoutBounds(data, i - 1, 2).width;
|
||||
}
|
||||
consecutiveDoubleCharacterWidth += advancesFast[key];
|
||||
// common solution
|
||||
} else {
|
||||
int key = (prev << 16) | (0xffff & cur);
|
||||
advances.putIfAbsent(key, textLayoutBounds(data, i - 1, 2).width);
|
||||
consecutiveDoubleCharacterWidth += advances.get(key);
|
||||
}
|
||||
}
|
||||
width += preciseCharWidth(cur);
|
||||
}
|
||||
prev = cur;
|
||||
}
|
||||
|
||||
if (isKerning) {
|
||||
width = consecutiveDoubleCharacterWidth -
|
||||
(width - preciseCharWidth(getChar(data, off)) - preciseCharWidth(getChar(data, off + len - 1)));
|
||||
}
|
||||
|
||||
return new Rectangle2D.Float(0f, -ascent, width, height);
|
||||
}
|
||||
|
||||
public Rectangle2D.Float charsBounds(char[] data, int off, int len) {
|
||||
return dataBounds(data, off, len);
|
||||
}
|
||||
|
||||
private int dataWidth(Object data, int off, int len) {
|
||||
return Math.round((float) dataBounds(data, off, len).getWidth());
|
||||
}
|
||||
|
||||
public int stringWidth(String str) {
|
||||
|
||||
float width = 0;
|
||||
if (font.hasLayoutAttributes()) {
|
||||
/* TextLayout throws IAE for null, so throw NPE explicitly */
|
||||
if (str == null) {
|
||||
throw new NullPointerException("str is null");
|
||||
}
|
||||
if (str.length() == 0) {
|
||||
return 0;
|
||||
}
|
||||
width = new TextLayout(str, font, frc).getAdvance();
|
||||
} else {
|
||||
int length = str.length();
|
||||
for (int i=0; i < length; i++) {
|
||||
char ch = str.charAt(i);
|
||||
if (ch < 0x100) {
|
||||
width += getLatinCharWidth(ch);
|
||||
} else if (FontUtilities.isNonSimpleChar(ch)) {
|
||||
width = new TextLayout(str, font, frc).getAdvance();
|
||||
break;
|
||||
} else {
|
||||
width += handleCharWidth(ch);
|
||||
}
|
||||
}
|
||||
if (str == null) {
|
||||
throw new NullPointerException("str is null");
|
||||
}
|
||||
|
||||
return (int) (0.5 + width);
|
||||
return dataWidth(str, 0, str.length());
|
||||
}
|
||||
|
||||
public int charsWidth(char[] data, int off, int len) {
|
||||
|
||||
float width = 0;
|
||||
if (font.hasLayoutAttributes()) {
|
||||
if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
String str = new String(data, off, len);
|
||||
width = new TextLayout(str, font, frc).getAdvance();
|
||||
} else {
|
||||
/* Explicit test needed to satisfy superclass spec */
|
||||
if (len < 0) {
|
||||
throw new IndexOutOfBoundsException("len="+len);
|
||||
}
|
||||
int limit = off + len;
|
||||
for (int i=off; i < limit; i++) {
|
||||
char ch = data[i];
|
||||
if (ch < 0x100) {
|
||||
width += getLatinCharWidth(ch);
|
||||
} else if (FontUtilities.isNonSimpleChar(ch)) {
|
||||
String str = new String(data, off, len);
|
||||
width = new TextLayout(str, font, frc).getAdvance();
|
||||
break;
|
||||
} else {
|
||||
width += handleCharWidth(ch);
|
||||
}
|
||||
}
|
||||
/* Explicit test needed to satisfy superclass spec */
|
||||
if (len < 0) {
|
||||
throw new IndexOutOfBoundsException("len="+len);
|
||||
}
|
||||
|
||||
return (int) (0.5 + width);
|
||||
return dataWidth(data, off, len);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from java.awt.Font only after verifying
|
||||
* the arguments and that the text is simple and there are no
|
||||
* layout attributes, font transform etc.
|
||||
*/
|
||||
public Rectangle2D getSimpleBounds(char[] data, int off, int len) {
|
||||
|
||||
float width = 0;
|
||||
int limit = off + len;
|
||||
for (int i=off; i < limit; i++) {
|
||||
char ch = data[i];
|
||||
if (ch < 0x100) {
|
||||
width += getLatinCharWidth(ch);
|
||||
} else {
|
||||
width += handleCharWidth(ch);
|
||||
}
|
||||
}
|
||||
|
||||
float height = ascent + descent + leading;
|
||||
return new Rectangle2D.Float(0f, -ascent, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the advance widths of the first 256 characters in the
|
||||
* {@code Font}. The advance is the
|
||||
@@ -557,7 +575,7 @@ public final class FontDesignMetrics extends FontMetrics {
|
||||
if (w == UNKNOWN_WIDTH) {
|
||||
w = advCache[ch] = handleCharWidth(ch);
|
||||
}
|
||||
widths[ch] = (int) (0.5 + w);
|
||||
widths[ch] = Math.round(w);
|
||||
}
|
||||
return widths;
|
||||
}
|
||||
|
||||
8
src/java.desktop/share/glsl/vulkan/test.frag
Normal file
8
src/java.desktop/share/glsl/vulkan/test.frag
Normal file
@@ -0,0 +1,8 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec4 inColor;
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
void main() {
|
||||
outColor = inColor;
|
||||
}
|
||||
21
src/java.desktop/share/glsl/vulkan/test.vert
Normal file
21
src/java.desktop/share/glsl/vulkan/test.vert
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 450
|
||||
|
||||
layout(push_constant) uniform Push {
|
||||
vec2 invViewport2; // 2.0/viewport
|
||||
} push;
|
||||
|
||||
vec4 colors[3] = vec4[](
|
||||
vec4(1,0,0,1),
|
||||
vec4(0,1,0,1),
|
||||
vec4(0,0,1,1)
|
||||
);
|
||||
|
||||
layout(location = 0) in vec2 inPosition;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
void main() {
|
||||
outColor = colors[gl_VertexIndex % 3];
|
||||
gl_Position = vec4(inPosition * push.invViewport2 - 1.0, 0.0, 1.0);
|
||||
gl_PointSize = 1.0f;
|
||||
}
|
||||
@@ -27,16 +27,20 @@
|
||||
#include "VKBase.h"
|
||||
#include <Trace.h>
|
||||
#include <set>
|
||||
#if defined(DEBUG)
|
||||
#include <csignal>
|
||||
#endif
|
||||
|
||||
#define VALIDATION_LAYER_NAME "VK_LAYER_KHRONOS_validation"
|
||||
static const uint32_t REQUIRED_VULKAN_VERSION = VK_MAKE_API_VERSION(0, 1, 0, 0);
|
||||
static const uint32_t REQUIRED_VULKAN_VERSION = VK_MAKE_API_VERSION(0, 1, 2, 0);
|
||||
|
||||
bool VKGraphicsEnvironment::_verbose = false;
|
||||
int VKGraphicsEnvironment::_requested_device_number = -1;
|
||||
std::unique_ptr<VKGraphicsEnvironment> VKGraphicsEnvironment::_ge_instance = nullptr;
|
||||
|
||||
// ========== Vulkan instance ==========
|
||||
// ========== Graphics environment ==========
|
||||
|
||||
#if defined(DEBUG)
|
||||
static vk::raii::DebugUtilsMessengerEXT debugMessenger = nullptr;
|
||||
|
||||
static VkBool32 debugCallback(
|
||||
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
@@ -57,127 +61,13 @@ static VkBool32 debugCallback(
|
||||
|
||||
J2dRlsTraceLn(level, data->pMessage);
|
||||
|
||||
// TODO if (messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) ABORT?
|
||||
if (messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) {
|
||||
raise(SIGABRT);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// ========== Vulkan device ==========
|
||||
|
||||
#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
|
||||
extern struct wl_display *wl_display;
|
||||
#endif
|
||||
|
||||
class PhysicalDevice : vk::raii::PhysicalDevice {
|
||||
friend class VKDevice;
|
||||
|
||||
bool _supported = false;
|
||||
std::vector<const char*> _enabled_layers, _enabled_extensions;
|
||||
int _queue_family = -1;
|
||||
public:
|
||||
|
||||
int queue_family() const {
|
||||
return _queue_family;
|
||||
}
|
||||
|
||||
std::vector<const char *> & enabled_layers() {
|
||||
return _enabled_layers;
|
||||
}
|
||||
|
||||
std::vector<const char *> & enabled_extensions() {
|
||||
return _enabled_extensions;
|
||||
}
|
||||
|
||||
explicit PhysicalDevice(vk::raii::PhysicalDevice&& handle) : vk::raii::PhysicalDevice(std::move(handle)) {
|
||||
const auto& properties = getProperties();
|
||||
const auto& queueFamilies = getQueueFamilyProperties();
|
||||
|
||||
J2dRlsTrace5(J2D_TRACE_INFO, "Vulkan: Found device %s (%d.%d.%d, %s)\n",
|
||||
(const char*) properties.deviceName,
|
||||
VK_API_VERSION_MAJOR(properties.apiVersion),
|
||||
VK_API_VERSION_MINOR(properties.apiVersion),
|
||||
VK_API_VERSION_PATCH(properties.apiVersion),
|
||||
vk::to_string(properties.deviceType).c_str());
|
||||
if (properties.apiVersion < REQUIRED_VULKAN_VERSION) {
|
||||
J2dRlsTrace(J2D_TRACE_INFO, " Unsupported Vulkan version\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check supported queue families.
|
||||
for (unsigned int i = 0; i < queueFamilies.size(); i++) {
|
||||
const auto& family = queueFamilies[i];
|
||||
#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
|
||||
bool presentationSupported = getWaylandPresentationSupportKHR(i, *wl_display);
|
||||
#endif
|
||||
char logFlags[5] {
|
||||
family.queueFlags & vk::QueueFlagBits::eGraphics ? 'G' : '-',
|
||||
family.queueFlags & vk::QueueFlagBits::eCompute ? 'C' : '-',
|
||||
family.queueFlags & vk::QueueFlagBits::eTransfer ? 'T' : '-',
|
||||
family.queueFlags & vk::QueueFlagBits::eSparseBinding ? 'S' : '-',
|
||||
presentationSupported ? 'P' : '-'
|
||||
};
|
||||
J2dRlsTrace3(J2D_TRACE_INFO, " %d queues in family (%.*s)\n", family.queueCount, 5, logFlags);
|
||||
|
||||
// TODO use compute workloads? Separate transfer-only DMA queue?
|
||||
if (_queue_family == -1 && (family.queueFlags & vk::QueueFlagBits::eGraphics) && presentationSupported) {
|
||||
_queue_family = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (_queue_family == -1) {
|
||||
J2dRlsTrace(J2D_TRACE_INFO, " No suitable queue\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Populate maps and log supported layers & extensions.
|
||||
std::set<std::string> layers, extensions;
|
||||
J2dRlsTrace(J2D_TRACE_VERBOSE, " Supported device layers:\n");
|
||||
for (auto& l : enumerateDeviceLayerProperties()) {
|
||||
J2dRlsTrace1(J2D_TRACE_VERBOSE, " %s\n", (char*) l.layerName);
|
||||
layers.emplace((char*) l.layerName);
|
||||
}
|
||||
J2dRlsTrace(J2D_TRACE_VERBOSE, " Supported device extensions:\n");
|
||||
for (auto& e : enumerateDeviceExtensionProperties(nullptr)) {
|
||||
J2dRlsTrace1(J2D_TRACE_VERBOSE, " %s\n", (char*) e.extensionName);
|
||||
extensions.emplace((char*) e.extensionName);
|
||||
}
|
||||
|
||||
// Check required layers & extensions.
|
||||
_enabled_extensions.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||
bool requiredNotFound = false;
|
||||
for (auto e : _enabled_extensions) {
|
||||
if (extensions.find(e) == extensions.end()) {
|
||||
J2dRlsTrace1(J2D_TRACE_INFO, " Required device extension not supported: %s\n", (char*) e);
|
||||
requiredNotFound = true;
|
||||
}
|
||||
}
|
||||
if (requiredNotFound) return;
|
||||
|
||||
// Validation layer
|
||||
#ifdef DEBUG
|
||||
if (layers.find(VALIDATION_LAYER_NAME) != layers.end()) {
|
||||
_enabled_layers.push_back(VALIDATION_LAYER_NAME);
|
||||
} else {
|
||||
J2dRlsTrace1(J2D_TRACE_INFO, " %s device layer is not supported\n", VALIDATION_LAYER_NAME);
|
||||
}
|
||||
#endif
|
||||
|
||||
// This device is supported
|
||||
_supported = true;
|
||||
}
|
||||
|
||||
operator bool() const {
|
||||
vk::PhysicalDevice handle = **this;
|
||||
return handle && _supported;
|
||||
}
|
||||
|
||||
uint32_t getMaxImageDimension2D() {
|
||||
const auto& properties = getProperties();
|
||||
return properties.limits.maxImageDimension2D;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
VKGraphicsEnvironment *VKGraphicsEnvironment::graphics_environment() {
|
||||
if (!_ge_instance) {
|
||||
try {
|
||||
@@ -192,7 +82,7 @@ VKGraphicsEnvironment *VKGraphicsEnvironment::graphics_environment() {
|
||||
}
|
||||
|
||||
VKGraphicsEnvironment::VKGraphicsEnvironment() :
|
||||
_vk_context(), _vk_instance(nullptr), _default_device(-1) {
|
||||
_vk_context(), _vk_instance(nullptr), _default_device(nullptr) {
|
||||
// Load library.
|
||||
uint32_t version = _vk_context.enumerateInstanceVersion();
|
||||
J2dRlsTrace3(J2D_TRACE_INFO, "Vulkan: Available (%d.%d.%d)\n",
|
||||
@@ -231,9 +121,9 @@ VKGraphicsEnvironment::VKGraphicsEnvironment() :
|
||||
}
|
||||
// Configure validation
|
||||
#ifdef DEBUG
|
||||
std::array<vk::ValidationFeatureEnableEXT, 4> enabledValidationFeatures = {
|
||||
vk::ValidationFeatureEnableEXT::eGpuAssisted,
|
||||
vk::ValidationFeatureEnableEXT::eGpuAssistedReserveBindingSlot,
|
||||
std::array<vk::ValidationFeatureEnableEXT, 2> enabledValidationFeatures = {
|
||||
// vk::ValidationFeatureEnableEXT::eGpuAssisted, // TODO GPU assisted validation is available only from Vulkan 1.1
|
||||
// vk::ValidationFeatureEnableEXT::eGpuAssistedReserveBindingSlot,
|
||||
vk::ValidationFeatureEnableEXT::eBestPractices,
|
||||
vk::ValidationFeatureEnableEXT::eSynchronizationValidation
|
||||
};
|
||||
@@ -272,7 +162,7 @@ VKGraphicsEnvironment::VKGraphicsEnvironment() :
|
||||
// Create debug messenger
|
||||
#if defined(DEBUG)
|
||||
if (pNext) {
|
||||
debugMessenger = vk::raii::DebugUtilsMessengerEXT(_vk_instance, vk::DebugUtilsMessengerCreateInfoEXT {
|
||||
_debugMessenger = vk::raii::DebugUtilsMessengerEXT(_vk_instance, vk::DebugUtilsMessengerCreateInfoEXT {
|
||||
/*flags*/ {},
|
||||
/*messageSeverity*/ vk::DebugUtilsMessageSeverityFlagBitsEXT::eError |
|
||||
vk::DebugUtilsMessageSeverityFlagBitsEXT::eWarning |
|
||||
@@ -289,26 +179,43 @@ VKGraphicsEnvironment::VKGraphicsEnvironment() :
|
||||
|
||||
// Find suitable devices.
|
||||
for (auto &handle: _vk_instance.enumeratePhysicalDevices()) {
|
||||
PhysicalDevice physicalDevice{std::move(handle)};
|
||||
if (physicalDevice) { // Supported.
|
||||
_physical_devices.push_back(std::move(physicalDevice));
|
||||
VKDevice device {*_vk_instance, std::move(handle)};
|
||||
if (device.supported()) {
|
||||
_devices.push_back(std::make_unique<VKDevice>(std::move(device)));
|
||||
}
|
||||
}
|
||||
|
||||
if (_physical_devices.empty()) {
|
||||
if (_devices.empty()) {
|
||||
throw std::runtime_error("Vulkan: No suitable device found");
|
||||
}
|
||||
// Create virtual device for a physical device.
|
||||
// TODO system property for manual choice of GPU
|
||||
// TODO integrated/discrete presets
|
||||
// TODO performance/power saving mode switch on the fly?
|
||||
_default_physical_device = 0; // TODO pick first just to check hat virtual device creation works
|
||||
_devices.push_back(std::move(VKDevice{_physical_devices[_default_physical_device]}));
|
||||
_default_device = 0;
|
||||
}
|
||||
int _default_device_number = 0; // TODO pick first just to check that virtual device creation works
|
||||
|
||||
if (_verbose) {
|
||||
fprintf(stderr, "Vulkan graphics devices:\n");
|
||||
}
|
||||
|
||||
_requested_device_number = (_requested_device_number == -1) ? 0 : _requested_device_number;
|
||||
if (_requested_device_number < 0 || _requested_device_number >= static_cast<int>(_devices.size())) {
|
||||
if (_verbose) {
|
||||
fprintf(stderr, " Requested device number (%d) not found, fallback to 0\n", _requested_device_number);
|
||||
}
|
||||
_requested_device_number = 0;
|
||||
}
|
||||
_default_device_number = _requested_device_number;
|
||||
if (_verbose) {
|
||||
for (auto devIter = _devices.begin(); devIter != _devices.end(); devIter++) {
|
||||
auto devNum = std::distance(begin(_devices), devIter);
|
||||
fprintf(stderr, " %c%ld: %s\n", devNum == _default_device_number ? '*' : ' ',
|
||||
devNum, (*devIter)->name().c_str());
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
_default_device = &*_devices[_default_device_number]; // TODO pick first just to check hat virtual device creation works
|
||||
_default_device->init();
|
||||
|
||||
uint32_t VKGraphicsEnvironment::max_texture_size() {
|
||||
return _physical_devices[_default_physical_device].getMaxImageDimension2D();
|
||||
}
|
||||
|
||||
vk::raii::Instance& VKGraphicsEnvironment::vk_instance() {
|
||||
@@ -320,41 +227,227 @@ void VKGraphicsEnvironment::dispose() {
|
||||
}
|
||||
|
||||
VKDevice& VKGraphicsEnvironment::default_device() {
|
||||
return _devices[_default_device];
|
||||
return *_default_device;
|
||||
}
|
||||
|
||||
// ========== Vulkan device ==========
|
||||
|
||||
VKDevice::VKDevice(PhysicalDevice& physicalDevice) : vk::raii::Device(nullptr), _command_pool(nullptr) {
|
||||
#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
|
||||
extern struct wl_display *wl_display;
|
||||
#endif
|
||||
|
||||
VKDevice::VKDevice(vk::Instance instance, vk::raii::PhysicalDevice&& handle) :
|
||||
vk::raii::Device(nullptr), vk::raii::PhysicalDevice(nullptr), _instance(instance) {
|
||||
auto featuresChain = handle.getFeatures2<vk::PhysicalDeviceFeatures2,
|
||||
vk::PhysicalDeviceVulkan11Features,
|
||||
vk::PhysicalDeviceVulkan12Features>();
|
||||
const auto& features10 = featuresChain.get<vk::PhysicalDeviceFeatures2>().features;
|
||||
const auto& features11 = featuresChain.get<vk::PhysicalDeviceVulkan11Features>();
|
||||
const auto& features12 = featuresChain.get<vk::PhysicalDeviceVulkan12Features>();
|
||||
|
||||
auto propertiesChain = handle.getProperties2<vk::PhysicalDeviceProperties2,
|
||||
vk::PhysicalDeviceVulkan11Properties,
|
||||
vk::PhysicalDeviceVulkan12Properties>();
|
||||
const auto& properties10 = propertiesChain.get<vk::PhysicalDeviceProperties2>().properties;
|
||||
const auto& properties11 = propertiesChain.get<vk::PhysicalDeviceVulkan11Properties>();
|
||||
const auto& properties12 = propertiesChain.get<vk::PhysicalDeviceVulkan12Properties>();
|
||||
|
||||
const auto& queueFamilies = handle.getQueueFamilyProperties();
|
||||
|
||||
_name = (const char*) properties10.deviceName;
|
||||
J2dRlsTrace5(J2D_TRACE_INFO, "Vulkan: Found device %s (%d.%d.%d, %s)\n",
|
||||
(const char*) properties10.deviceName,
|
||||
VK_API_VERSION_MAJOR(properties10.apiVersion),
|
||||
VK_API_VERSION_MINOR(properties10.apiVersion),
|
||||
VK_API_VERSION_PATCH(properties10.apiVersion),
|
||||
vk::to_string(properties10.deviceType).c_str());
|
||||
|
||||
// Check API version.
|
||||
if (properties10.apiVersion < REQUIRED_VULKAN_VERSION) {
|
||||
J2dRlsTrace(J2D_TRACE_INFO, " Unsupported Vulkan version\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check supported features.
|
||||
if (!features10.logicOp) {
|
||||
J2dRlsTrace(J2D_TRACE_INFO, " Logic op not supported\n");
|
||||
return;
|
||||
}
|
||||
if (!features12.timelineSemaphore) {
|
||||
J2dRlsTrace(J2D_TRACE_INFO, " Timeline semaphore not supported\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check supported queue families.
|
||||
for (unsigned int i = 0; i < queueFamilies.size(); i++) {
|
||||
const auto& family = queueFamilies[i];
|
||||
#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
|
||||
bool presentationSupported = handle.getWaylandPresentationSupportKHR(i, *wl_display);
|
||||
#endif
|
||||
char logFlags[5] {
|
||||
family.queueFlags & vk::QueueFlagBits::eGraphics ? 'G' : '-',
|
||||
family.queueFlags & vk::QueueFlagBits::eCompute ? 'C' : '-',
|
||||
family.queueFlags & vk::QueueFlagBits::eTransfer ? 'T' : '-',
|
||||
family.queueFlags & vk::QueueFlagBits::eSparseBinding ? 'S' : '-',
|
||||
presentationSupported ? 'P' : '-'
|
||||
};
|
||||
J2dRlsTrace3(J2D_TRACE_INFO, " %d queues in family (%.*s)\n", family.queueCount, 5, logFlags);
|
||||
|
||||
// TODO use compute workloads? Separate transfer-only DMA queue?
|
||||
if (_queue_family == -1 && (family.queueFlags & vk::QueueFlagBits::eGraphics) && presentationSupported) {
|
||||
_queue_family = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (_queue_family == -1) {
|
||||
J2dRlsTrace(J2D_TRACE_INFO, " No suitable queue\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Populate maps and log supported layers & extensions.
|
||||
std::set<std::string> layers, extensions;
|
||||
J2dRlsTrace(J2D_TRACE_VERBOSE, " Supported device layers:\n");
|
||||
for (auto& l : handle.enumerateDeviceLayerProperties()) {
|
||||
J2dRlsTrace1(J2D_TRACE_VERBOSE, " %s\n", (char*) l.layerName);
|
||||
layers.emplace((char*) l.layerName);
|
||||
}
|
||||
J2dRlsTrace(J2D_TRACE_VERBOSE, " Supported device extensions:\n");
|
||||
for (auto& e : handle.enumerateDeviceExtensionProperties(nullptr)) {
|
||||
J2dRlsTrace1(J2D_TRACE_VERBOSE, " %s\n", (char*) e.extensionName);
|
||||
extensions.emplace((char*) e.extensionName);
|
||||
}
|
||||
|
||||
// Check required layers & extensions.
|
||||
_enabled_extensions.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||
bool requiredNotFound = false;
|
||||
for (auto e : _enabled_extensions) {
|
||||
if (extensions.find(e) == extensions.end()) {
|
||||
J2dRlsTrace1(J2D_TRACE_INFO, " Required device extension not supported: %s\n", (char*) e);
|
||||
requiredNotFound = true;
|
||||
}
|
||||
}
|
||||
if (requiredNotFound) return;
|
||||
_ext_memory_budget = extensions.find(VK_EXT_MEMORY_BUDGET_EXTENSION_NAME) != extensions.end();
|
||||
if (_ext_memory_budget) _enabled_extensions.push_back(VK_EXT_MEMORY_BUDGET_EXTENSION_NAME);
|
||||
_khr_synchronization2 = extensions.find(VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME) != extensions.end();
|
||||
if (_khr_synchronization2) _enabled_extensions.push_back(VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME);
|
||||
_khr_dynamic_rendering = extensions.find(VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME) != extensions.end();
|
||||
if (_khr_dynamic_rendering) _enabled_extensions.push_back(VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME);
|
||||
|
||||
// Validation layer
|
||||
#ifdef DEBUG
|
||||
if (layers.find(VALIDATION_LAYER_NAME) != layers.end()) {
|
||||
_enabled_layers.push_back(VALIDATION_LAYER_NAME);
|
||||
} else {
|
||||
J2dRlsTrace1(J2D_TRACE_INFO, " %s device layer is not supported\n", VALIDATION_LAYER_NAME);
|
||||
}
|
||||
#endif
|
||||
|
||||
// This device is supported
|
||||
((vk::raii::PhysicalDevice&) *this) = std::move(handle);
|
||||
}
|
||||
|
||||
void VKDevice::init() {
|
||||
float queuePriorities[1] {1.0f}; // We only use one queue for now
|
||||
std::vector<vk::DeviceQueueCreateInfo> queueCreateInfos;
|
||||
queueCreateInfos.push_back(vk::DeviceQueueCreateInfo {
|
||||
{}, (uint32_t) physicalDevice.queue_family(), 1, &queuePriorities[0]
|
||||
{}, queue_family(), 1, &queuePriorities[0]
|
||||
});
|
||||
|
||||
vk::PhysicalDeviceFeatures features10;
|
||||
features10.logicOp = true;
|
||||
vk::PhysicalDeviceVulkan12Features features12;
|
||||
features12.timelineSemaphore = true;
|
||||
|
||||
void *pNext = &features12;
|
||||
vk::PhysicalDeviceSynchronization2FeaturesKHR synchronization2Features;
|
||||
if (_khr_synchronization2) {
|
||||
synchronization2Features.synchronization2 = true;
|
||||
synchronization2Features.pNext = pNext;
|
||||
pNext = &synchronization2Features;
|
||||
}
|
||||
vk::PhysicalDeviceDynamicRenderingFeaturesKHR dynamicRenderingFeatures;
|
||||
if (_khr_dynamic_rendering) {
|
||||
dynamicRenderingFeatures.dynamicRendering = true;
|
||||
dynamicRenderingFeatures.pNext = pNext;
|
||||
pNext = &dynamicRenderingFeatures;
|
||||
}
|
||||
|
||||
vk::DeviceCreateInfo deviceCreateInfo {
|
||||
/*flags*/ {},
|
||||
/*pQueueCreateInfos*/ queueCreateInfos,
|
||||
/*ppEnabledLayerNames*/ physicalDevice.enabled_layers(),
|
||||
/*ppEnabledExtensionNames*/ physicalDevice.enabled_extensions(),
|
||||
/*pEnabledFeatures*/ nullptr
|
||||
/*ppEnabledLayerNames*/ _enabled_layers,
|
||||
/*ppEnabledExtensionNames*/ _enabled_extensions,
|
||||
/*pEnabledFeatures*/ &features10,
|
||||
/*pNext*/ pNext
|
||||
};
|
||||
*((vk::raii::Device*) this) = {physicalDevice, deviceCreateInfo};
|
||||
this->_queue_family = physicalDevice.queue_family();
|
||||
J2dRlsTrace(J2D_TRACE_INFO, "Vulkan: Device created\n"); // TODO which one?
|
||||
((vk::raii::Device&) *this) = {*this, deviceCreateInfo};
|
||||
_memory.init(_instance, *this, *this, REQUIRED_VULKAN_VERSION, _ext_memory_budget);
|
||||
_pipelines.init((vk::raii::Device&) *this, _khr_dynamic_rendering);
|
||||
_queue = getQueue(queue_family(), 0);
|
||||
_commandPool = createCommandPool(vk::CommandPoolCreateInfo {
|
||||
vk::CommandPoolCreateFlagBits::eTransient | vk::CommandPoolCreateFlagBits::eResetCommandBuffer,
|
||||
queue_family()
|
||||
});
|
||||
vk::SemaphoreTypeCreateInfo semaphoreTypeCreateInfo { vk::SemaphoreType::eTimeline, 0 };
|
||||
_timelineSemaphore = createSemaphore(vk::SemaphoreCreateInfo {{}, &semaphoreTypeCreateInfo});
|
||||
_timelineCounter = 0;
|
||||
J2dRlsTrace1(J2D_TRACE_INFO, "Vulkan: Device created %s\n", _name.c_str());
|
||||
}
|
||||
|
||||
extern "C" jint VK_MaxTextureSize() {
|
||||
return (jint)VKGraphicsEnvironment::graphics_environment()->max_texture_size();
|
||||
VKBuffer VKDevice::getVertexBuffer() {
|
||||
auto b = popPending<VKBuffer>(_pendingVertexBuffers);
|
||||
if (*b) {
|
||||
b.position() = 0;
|
||||
return b;
|
||||
} else {
|
||||
return _memory.allocateBuffer(64 * 1024, vk::BufferUsageFlagBits::eVertexBuffer,
|
||||
vma::AllocationCreateFlagBits::eMapped | vma::AllocationCreateFlagBits::eHostAccessSequentialWrite,
|
||||
vma::MemoryUsage::eAutoPreferHost);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" jboolean VK_Init() {
|
||||
vk::raii::CommandBuffer VKDevice::getCommandBuffer(vk::CommandBufferLevel level) {
|
||||
auto b = popPending<vk::raii::CommandBuffer>(level == vk::CommandBufferLevel::ePrimary ?
|
||||
_pendingPrimaryBuffers : _pendingSecondaryBuffers);
|
||||
if (*b) {
|
||||
b.reset({});
|
||||
return b;
|
||||
} else {
|
||||
return std::move(allocateCommandBuffers({*_commandPool, level, 1})[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void VKDevice::submitCommandBuffer(vk::raii::CommandBuffer&& primary,
|
||||
std::vector<vk::raii::CommandBuffer>& secondary,
|
||||
std::vector<VKBuffer>& vertexBuffers,
|
||||
std::vector<vk::Semaphore>& waitSemaphores,
|
||||
std::vector<vk::PipelineStageFlags>& waitStages,
|
||||
std::vector<vk::Semaphore>& signalSemaphores) {
|
||||
_timelineCounter++;
|
||||
signalSemaphores.insert(signalSemaphores.begin(), *_timelineSemaphore);
|
||||
vk::TimelineSemaphoreSubmitInfo timelineInfo { 0, nullptr, (uint32_t) signalSemaphores.size(), &_timelineCounter };
|
||||
queue().submit(vk::SubmitInfo {
|
||||
waitSemaphores, waitStages, *primary, signalSemaphores, &timelineInfo
|
||||
}, nullptr);
|
||||
pushPending(_pendingPrimaryBuffers, std::move(primary));
|
||||
pushPending(_pendingSecondaryBuffers, secondary);
|
||||
pushPending(_pendingVertexBuffers, vertexBuffers);
|
||||
signalSemaphores.clear();
|
||||
waitSemaphores.clear();
|
||||
waitStages.clear();
|
||||
}
|
||||
|
||||
extern "C" jboolean VK_Init(jboolean verbose, jint requestedDevice) {
|
||||
VKGraphicsEnvironment::set_verbose(verbose);
|
||||
VKGraphicsEnvironment::set_requested_device(requestedDevice);
|
||||
if (VKGraphicsEnvironment::graphics_environment() != nullptr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
debugMessenger = nullptr;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) {
|
||||
VKGraphicsEnvironment::dispose();
|
||||
}
|
||||
|
||||
@@ -31,86 +31,132 @@
|
||||
|
||||
#define VK_NO_PROTOTYPES
|
||||
#define VULKAN_HPP_NO_DEFAULT_DISPATCHER
|
||||
#include <queue>
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
#include "jni.h"
|
||||
#include "VKMemory.h"
|
||||
#include "VKPipeline.h"
|
||||
|
||||
class PhysicalDevice;
|
||||
class VKGraphicsEnvironment;
|
||||
|
||||
class VKDevice : public vk::raii::Device {
|
||||
class VKDevice : public vk::raii::Device, public vk::raii::PhysicalDevice {
|
||||
friend class VKGraphicsEnvironment;
|
||||
vk::raii::CommandPool _command_pool;
|
||||
int _queue_family = -1;
|
||||
VKDevice(PhysicalDevice& physicalDevice);
|
||||
|
||||
vk::Instance _instance;
|
||||
std::string _name;
|
||||
std::vector<const char*> _enabled_layers, _enabled_extensions;
|
||||
bool _ext_memory_budget, _khr_synchronization2, _khr_dynamic_rendering;
|
||||
int _queue_family = -1;
|
||||
|
||||
// Logical device state
|
||||
VKMemory _memory;
|
||||
VKPipelines _pipelines;
|
||||
vk::raii::Queue _queue = nullptr;
|
||||
vk::raii::CommandPool _commandPool = nullptr;
|
||||
vk::raii::Semaphore _timelineSemaphore = nullptr;
|
||||
uint64_t _timelineCounter = 0;
|
||||
uint64_t _lastReadTimelineCounter = 0;
|
||||
|
||||
template <typename T> struct Pending {
|
||||
T resource;
|
||||
uint64_t counter;
|
||||
using Queue = std::queue<Pending<T>>;
|
||||
};
|
||||
Pending<vk::raii::CommandBuffer>::Queue _pendingPrimaryBuffers, _pendingSecondaryBuffers;
|
||||
Pending<VKBuffer>::Queue _pendingVertexBuffers;
|
||||
|
||||
template <typename T> T popPending(typename Pending<T>::Queue& queue) {
|
||||
if (!queue.empty()) {
|
||||
auto& f = queue.front();
|
||||
if (_lastReadTimelineCounter >= f.counter ||
|
||||
(_lastReadTimelineCounter = _timelineSemaphore.getCounterValue()) >= f.counter) {
|
||||
T resource = std::move(f.resource);
|
||||
queue.pop();
|
||||
return resource;
|
||||
}
|
||||
}
|
||||
return T(nullptr);
|
||||
}
|
||||
template <typename T> void pushPending(typename Pending<T>::Queue& queue, T&& resource) {
|
||||
queue.push({std::move(resource), _timelineCounter});
|
||||
}
|
||||
template <typename T> void pushPending(typename Pending<T>::Queue& queue, std::vector<T>& resources) {
|
||||
for (T& r : resources) {
|
||||
pushPending(queue, std::move(r));
|
||||
}
|
||||
resources.clear();
|
||||
}
|
||||
|
||||
explicit VKDevice(vk::Instance instance, vk::raii::PhysicalDevice&& handle);
|
||||
public:
|
||||
int queue_family() const {
|
||||
return _queue_family;
|
||||
|
||||
bool synchronization2() {
|
||||
return _khr_synchronization2;
|
||||
}
|
||||
|
||||
bool dynamicRendering() {
|
||||
return _khr_dynamic_rendering;
|
||||
}
|
||||
|
||||
VKPipelines& pipelines() {
|
||||
return _pipelines;
|
||||
}
|
||||
|
||||
uint32_t queue_family() const {
|
||||
return (uint32_t) _queue_family;
|
||||
}
|
||||
|
||||
const vk::raii::Queue& queue() const {
|
||||
return _queue;
|
||||
}
|
||||
|
||||
void init(); // Creates actual logical device
|
||||
|
||||
VKBuffer getVertexBuffer();
|
||||
vk::raii::CommandBuffer getCommandBuffer(vk::CommandBufferLevel level);
|
||||
void submitCommandBuffer(vk::raii::CommandBuffer&& primary,
|
||||
std::vector<vk::raii::CommandBuffer>& secondary,
|
||||
std::vector<VKBuffer>& vertexBuffers,
|
||||
std::vector<vk::Semaphore>& waitSemaphores,
|
||||
std::vector<vk::PipelineStageFlags>& waitStages,
|
||||
std::vector<vk::Semaphore>& signalSemaphores);
|
||||
|
||||
bool supported() const { // Supported or not
|
||||
return *((const vk::raii::PhysicalDevice&) *this);
|
||||
}
|
||||
|
||||
explicit operator bool() const { // Initialized or not
|
||||
return *((const vk::raii::Device&) *this);
|
||||
}
|
||||
|
||||
const std::string& name() {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
class VKSurfaceData {
|
||||
uint32_t _width;
|
||||
uint32_t _height;
|
||||
uint32_t _scale;
|
||||
uint32_t _bg_color;
|
||||
public:
|
||||
VKSurfaceData(uint32_t w, uint32_t h, uint32_t s, uint32_t bgc)
|
||||
: _width(w), _height(h), _scale(s), _bg_color(bgc) {};
|
||||
|
||||
uint32_t width() const {
|
||||
return _width;
|
||||
}
|
||||
|
||||
uint32_t height() const {
|
||||
return _height;
|
||||
}
|
||||
|
||||
uint32_t scale() const {
|
||||
return _scale;
|
||||
}
|
||||
|
||||
uint32_t bg_color() const {
|
||||
return _bg_color;
|
||||
}
|
||||
|
||||
virtual void set_bg_color(uint32_t bg_color) {
|
||||
_bg_color = bg_color;
|
||||
}
|
||||
|
||||
virtual ~VKSurfaceData() = default;
|
||||
|
||||
virtual void revalidate(uint32_t w, uint32_t h, uint32_t s)
|
||||
{
|
||||
_width = w;
|
||||
_height = h;
|
||||
_scale = s;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class VKGraphicsEnvironment {
|
||||
vk::raii::Context _vk_context;
|
||||
vk::raii::Instance _vk_instance;
|
||||
std::vector<PhysicalDevice> _physical_devices;
|
||||
std::vector<VKDevice> _devices;
|
||||
int _default_physical_device;
|
||||
int _default_device;
|
||||
vk::raii::Context _vk_context;
|
||||
vk::raii::Instance _vk_instance;
|
||||
#if defined(DEBUG)
|
||||
vk::raii::DebugUtilsMessengerEXT _debugMessenger = nullptr;
|
||||
#endif
|
||||
std::vector<std::unique_ptr<VKDevice>> _devices;
|
||||
VKDevice* _default_device;
|
||||
static bool _verbose;
|
||||
static int _requested_device_number;
|
||||
static std::unique_ptr<VKGraphicsEnvironment> _ge_instance;
|
||||
VKGraphicsEnvironment();
|
||||
public:
|
||||
static void set_verbose(bool verbose) { _verbose = verbose; }
|
||||
static void set_requested_device(int requested_device) { _requested_device_number = requested_device; }
|
||||
static VKGraphicsEnvironment* graphics_environment();
|
||||
static void dispose();
|
||||
VKDevice& default_device();
|
||||
vk::raii::Instance& vk_instance();
|
||||
uint32_t max_texture_size();
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
jboolean VK_Init();
|
||||
|
||||
jint VK_MaxTextureSize();
|
||||
jboolean VK_Init(jboolean verbose, jint requestedDevice);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, JetBrains s.r.o.. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#define VMA_IMPLEMENTATION
|
||||
#include "VKMemory.h"
|
||||
|
||||
void VKMemory::init(vk::Instance instance, const vk::raii::PhysicalDevice& physicalDevice,
|
||||
const vk::raii::Device& device, uint32_t apiVersion, bool extMemoryBudget) {
|
||||
vma::VulkanFunctions functions = vma::functionsFromDispatcher(physicalDevice.getDispatcher(), device.getDispatcher());
|
||||
vma::AllocatorCreateInfo createInfo {};
|
||||
createInfo.instance = instance;
|
||||
createInfo.physicalDevice = *physicalDevice;
|
||||
createInfo.device = *device;
|
||||
createInfo.pVulkanFunctions = &functions;
|
||||
createInfo.vulkanApiVersion = apiVersion;
|
||||
if (extMemoryBudget) {
|
||||
createInfo.flags |= vma::AllocatorCreateFlagBits::eExtMemoryBudget;
|
||||
}
|
||||
_allocator = vma::createAllocatorUnique(createInfo);
|
||||
*((vma::Allocator*) this) = *_allocator;
|
||||
}
|
||||
|
||||
VKBuffer VKMemory::allocateBuffer(uint32_t size, vk::BufferUsageFlags usage,
|
||||
vma::AllocationCreateFlags flags, vma::MemoryUsage memoryUsage) {
|
||||
VKBuffer b = nullptr;
|
||||
auto pair = createBufferUnique(vk::BufferCreateInfo {
|
||||
{}, size, usage, vk::SharingMode::eExclusive, {}
|
||||
}, vma::AllocationCreateInfo {
|
||||
flags,
|
||||
memoryUsage, {}, {}, (uint32_t) -1
|
||||
}, b._allocationInfo);
|
||||
b._buffer = std::move(pair.first);
|
||||
b._allocation = std::move(pair.second);
|
||||
b._size = size;
|
||||
return b;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, JetBrains s.r.o.. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#ifndef VKMemory_h_Included
|
||||
#define VKMemory_h_Included
|
||||
|
||||
#define VK_NO_PROTOTYPES
|
||||
#define VULKAN_HPP_NO_DEFAULT_DISPATCHER
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
#include <vk_mem_alloc.hpp>
|
||||
|
||||
class VKBuffer {
|
||||
friend class VKMemory;
|
||||
vma::UniqueBuffer _buffer;
|
||||
vma::UniqueAllocation _allocation;
|
||||
vma::AllocationInfo _allocationInfo;
|
||||
uint32_t _size = 0;
|
||||
uint32_t _position = 0;
|
||||
public:
|
||||
VKBuffer(nullptr_t) {}
|
||||
vk::Buffer operator*() const {
|
||||
return *_buffer;
|
||||
}
|
||||
uint32_t size() const {
|
||||
return _size;
|
||||
}
|
||||
uint32_t& position() {
|
||||
return _position;
|
||||
}
|
||||
void* data() {
|
||||
return _allocationInfo.pMappedData;
|
||||
}
|
||||
};
|
||||
|
||||
class VKMemory : vma::Allocator {
|
||||
vma::UniqueAllocator _allocator;
|
||||
|
||||
public:
|
||||
void init(vk::Instance instance, const vk::raii::PhysicalDevice& physicalDevice,
|
||||
const vk::raii::Device& device, uint32_t apiVersion, bool extMemoryBudget);
|
||||
|
||||
VKBuffer allocateBuffer(uint32_t size, vk::BufferUsageFlags usage,
|
||||
vma::AllocationCreateFlags flags, vma::MemoryUsage memoryUsage);
|
||||
};
|
||||
|
||||
#endif //VKMemory_h_Included
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, JetBrains s.r.o.. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "VKPipeline.h"
|
||||
|
||||
void VKPipelines::init(const vk::raii::Device& device, bool dynamicRendering) {
|
||||
shaders.init(device);
|
||||
|
||||
vk::Format format = vk::Format::eB8G8R8A8Unorm; // TODO
|
||||
|
||||
if (!dynamicRendering) {
|
||||
vk::AttachmentDescription attachmentDescription {
|
||||
/*flags*/ {},
|
||||
/*format*/ format,
|
||||
/*samples*/ vk::SampleCountFlagBits::e1,
|
||||
/*loadOp*/ vk::AttachmentLoadOp::eLoad,
|
||||
/*storeOp*/ vk::AttachmentStoreOp::eStore,
|
||||
/*stencilLoadOp*/ vk::AttachmentLoadOp::eDontCare,
|
||||
/*stencilStoreOp*/ vk::AttachmentStoreOp::eDontCare,
|
||||
/*initialLayout*/ vk::ImageLayout::eColorAttachmentOptimal,
|
||||
/*finalLayout*/ vk::ImageLayout::eColorAttachmentOptimal
|
||||
};
|
||||
vk::AttachmentReference attachmentReference { 0, vk::ImageLayout::eColorAttachmentOptimal };
|
||||
vk::SubpassDescription subpassDescription {
|
||||
/*flags*/ {},
|
||||
/*pipelineBindPoint*/ vk::PipelineBindPoint::eGraphics,
|
||||
/*inputAttachmentCount*/ 0,
|
||||
/*pInputAttachments*/ nullptr,
|
||||
/*colorAttachmentCount*/ 1,
|
||||
/*pColorAttachments*/ &attachmentReference,
|
||||
/*pResolveAttachments*/ nullptr,
|
||||
/*pDepthStencilAttachment*/ nullptr,
|
||||
/*preserveAttachmentCount*/ 0,
|
||||
/*pPreserveAttachments*/ nullptr,
|
||||
};
|
||||
// We don't know in advance, which operations to synchronize
|
||||
// with before and after the render pass, so do a full sync.
|
||||
std::array<vk::SubpassDependency, 2> subpassDependencies {vk::SubpassDependency{
|
||||
/*srcSubpass*/ VK_SUBPASS_EXTERNAL,
|
||||
/*dstSubpass*/ 0,
|
||||
/*srcStageMask*/ vk::PipelineStageFlagBits::eBottomOfPipe,
|
||||
/*dstStageMask*/ vk::PipelineStageFlagBits::eColorAttachmentOutput,
|
||||
/*srcAccessMask*/ {},
|
||||
/*dstAccessMask*/ vk::AccessFlagBits::eColorAttachmentRead | vk::AccessFlagBits::eColorAttachmentWrite,
|
||||
/*dependencyFlags*/ {},
|
||||
}, vk::SubpassDependency{
|
||||
/*srcSubpass*/ 0,
|
||||
/*dstSubpass*/ VK_SUBPASS_EXTERNAL,
|
||||
/*srcStageMask*/ vk::PipelineStageFlagBits::eColorAttachmentOutput,
|
||||
/*dstStageMask*/ vk::PipelineStageFlagBits::eTopOfPipe,
|
||||
/*srcAccessMask*/ vk::AccessFlagBits::eColorAttachmentRead | vk::AccessFlagBits::eColorAttachmentWrite,
|
||||
/*dstAccessMask*/ {},
|
||||
/*dependencyFlags*/ {},
|
||||
}};
|
||||
renderPass = device.createRenderPass(vk::RenderPassCreateInfo{
|
||||
/*flags*/ {},
|
||||
/*pAttachments*/ attachmentDescription,
|
||||
/*pSubpasses*/ subpassDescription,
|
||||
/*pDependencies*/ subpassDependencies
|
||||
});
|
||||
}
|
||||
|
||||
vk::PushConstantRange pushConstantRange {vk::ShaderStageFlagBits::eVertex, 0, sizeof(float) * 2};
|
||||
testLayout = device.createPipelineLayout(vk::PipelineLayoutCreateInfo {{}, {}, pushConstantRange});
|
||||
|
||||
std::array<vk::PipelineShaderStageCreateInfo, 2> testStages {shaders.test_vert.stage(), shaders.test_frag.stage()};
|
||||
vk::VertexInputBindingDescription vertexInputBindingDescription {0, 8, vk::VertexInputRate::eVertex};
|
||||
vk::VertexInputAttributeDescription vertexInputAttributeDescription {0, 0, vk::Format::eR32G32Sfloat, 0};
|
||||
vk::PipelineVertexInputStateCreateInfo vertexInputStateCreateInfo {{}, vertexInputBindingDescription, vertexInputAttributeDescription};
|
||||
vk::PipelineInputAssemblyStateCreateInfo inputAssemblyStateCreateInfo {{}, vk::PrimitiveTopology::eTriangleFan, false};
|
||||
vk::Viewport viewport;
|
||||
vk::Rect2D scissor;
|
||||
vk::PipelineViewportStateCreateInfo viewportStateCreateInfo {{}, viewport, scissor};
|
||||
vk::PipelineRasterizationStateCreateInfo rasterizationStateCreateInfo {
|
||||
{}, false, false, vk::PolygonMode::eFill, vk::CullModeFlagBits::eNone,
|
||||
vk::FrontFace::eClockwise, false, 0, 0, 0, 1
|
||||
};
|
||||
vk::PipelineMultisampleStateCreateInfo multisampleStateCreateInfo {};
|
||||
vk::PipelineColorBlendAttachmentState colorBlendAttachmentState {false}; // TODO No blending yet
|
||||
colorBlendAttachmentState.colorWriteMask = vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eB | vk::ColorComponentFlagBits::eA;
|
||||
vk::PipelineColorBlendStateCreateInfo colorBlendStateCreateInfo {{}, false, vk::LogicOp::eXor, colorBlendAttachmentState};
|
||||
std::array<vk::DynamicState, 2> dynamicStates {vk::DynamicState::eViewport, vk::DynamicState::eScissor};
|
||||
vk::PipelineDynamicStateCreateInfo dynamicStateCreateInfo {{}, dynamicStates};
|
||||
vk::PipelineRenderingCreateInfoKHR renderingCreateInfo {0, format};
|
||||
auto pipelines = device.createGraphicsPipelines(nullptr, {
|
||||
vk::GraphicsPipelineCreateInfo {
|
||||
{}, testStages,
|
||||
&vertexInputStateCreateInfo,
|
||||
&inputAssemblyStateCreateInfo,
|
||||
nullptr,
|
||||
&viewportStateCreateInfo,
|
||||
&rasterizationStateCreateInfo,
|
||||
&multisampleStateCreateInfo,
|
||||
nullptr,
|
||||
&colorBlendStateCreateInfo,
|
||||
&dynamicStateCreateInfo,
|
||||
*testLayout,
|
||||
*renderPass, 0, nullptr, 0,
|
||||
dynamicRendering ? &renderingCreateInfo : nullptr
|
||||
}
|
||||
});
|
||||
// TODO pipeline cache
|
||||
test = std::move(pipelines[0]);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, JetBrains s.r.o.. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#ifndef VKPipeline_h_Included
|
||||
#define VKPipeline_h_Included
|
||||
|
||||
#include "VKShader.h"
|
||||
|
||||
struct VKPipelines {
|
||||
VKShaders shaders;
|
||||
// TODO we need a pool of pipelines and (optionally) render passes for different formats.
|
||||
vk::raii::RenderPass renderPass = nullptr; // Render pass is only needed if dynamic rendering is off.
|
||||
vk::raii::PipelineLayout testLayout = nullptr;
|
||||
vk::raii::Pipeline test = nullptr;
|
||||
|
||||
void init(const vk::raii::Device& device, bool dynamicRendering);
|
||||
};
|
||||
|
||||
#endif //VKPipeline_h_Included
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
#ifndef HEADLESS
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sun_java2d_pipe_BufferedOpCodes.h"
|
||||
#include "sun_java2d_pipe_BufferedRenderPipe.h"
|
||||
#include "sun_java2d_pipe_BufferedTextPipe.h"
|
||||
@@ -35,6 +33,7 @@
|
||||
#include "Trace.h"
|
||||
#include "jlong.h"
|
||||
#include "VKRenderQueue.h"
|
||||
#include "VKRenderer.h"
|
||||
|
||||
#define BYTES_PER_POLY_POINT \
|
||||
sun_java2d_pipe_BufferedRenderPipe_BYTES_PER_POLY_POINT
|
||||
@@ -62,12 +61,13 @@
|
||||
#define OFFSET_XFORM sun_java2d_vulkan_VKBlitLoops_OFFSET_XFORM
|
||||
#define OFFSET_ISOBLIT sun_java2d_vulkan_VKBlitLoops_OFFSET_ISOBLIT
|
||||
|
||||
static VKRenderer renderer;
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
(JNIEnv *env, jobject oglrq,
|
||||
jlong buf, jint limit)
|
||||
{
|
||||
jboolean sync = JNI_FALSE;
|
||||
unsigned char *b, *end;
|
||||
|
||||
J2dTraceLn1(J2D_TRACE_INFO,
|
||||
@@ -87,7 +87,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
while (b < end) {
|
||||
jint opcode = NEXT_INT(b);
|
||||
|
||||
J2dRlsTraceLn2(J2D_TRACE_VERBOSE,
|
||||
J2dRlsTraceLn2(J2D_TRACE_VERBOSE2,
|
||||
"VKRenderQueue_flushBuffer: opcode=%d, rem=%d",
|
||||
opcode, (end-b));
|
||||
|
||||
@@ -103,6 +103,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
J2dRlsTraceLn4(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: DRAW_LINE(%d, %d, %d, %d)",
|
||||
x1, y1, x2, y2);
|
||||
renderer.drawLine(x1, y1, x2, y2);
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_DRAW_RECT:
|
||||
@@ -114,6 +115,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
J2dRlsTraceLn4(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: DRAW_RECT(%d, %d, %d, %d)",
|
||||
x, y, w, h);
|
||||
renderer.drawRect(x, y, w, h);
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_DRAW_POLY:
|
||||
@@ -125,8 +127,8 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jint *xPoints = (jint *)b;
|
||||
jint *yPoints = ((jint *)b) + nPoints;
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: DRAW_POLY");
|
||||
|
||||
SKIP_BYTES(b, nPoints * BYTES_PER_POLY_POINT);
|
||||
renderer.drawPoly();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_DRAW_PIXEL:
|
||||
@@ -134,6 +136,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jint x = NEXT_INT(b);
|
||||
jint y = NEXT_INT(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: DRAW_PIXEL");
|
||||
renderer.drawPixel(x, y);
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_DRAW_SCANLINES:
|
||||
@@ -141,6 +144,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jint count = NEXT_INT(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: DRAW_SCANLINES");
|
||||
SKIP_BYTES(b, count * BYTES_PER_SCANLINE);
|
||||
renderer.drawScanlines();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_DRAW_PARALLELOGRAM:
|
||||
@@ -156,6 +160,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
J2dRlsTraceLn8(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: DRAW_PARALLELOGRAM(%f, %f, %f, %f, %f, %f, %f, %f)",
|
||||
x11, y11, dx21, dy21, dx12, dy12, lwr21, lwr12);
|
||||
renderer.drawParallelogram(x11, y11, dx21, dy21, dx12, dy12, lwr21, lwr12);
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_DRAW_AAPARALLELOGRAM:
|
||||
@@ -183,6 +188,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jint h = NEXT_INT(b);
|
||||
J2dRlsTraceLn4(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: FILL_RECT(%d, %d, %d, %d)", x, y, w, h);
|
||||
renderer.fillRect(x, y, w, h);
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_FILL_SPANS:
|
||||
@@ -191,6 +197,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: FILL_SPANS");
|
||||
SKIP_BYTES(b, count * BYTES_PER_SPAN);
|
||||
renderer.fillSpans();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_FILL_PARALLELOGRAM:
|
||||
@@ -204,6 +211,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
J2dRlsTraceLn6(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: FILL_PARALLELOGRAM(%f, %f, %f, %f, %f, %f)",
|
||||
x11, y11, dx21, dy21, dx12, dy12);
|
||||
renderer.fillParallelogram(x11, y11, dx21, dy21, dx12, dy12);
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_FILL_AAPARALLELOGRAM:
|
||||
@@ -217,6 +225,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
J2dRlsTraceLn6(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: FILL_AAPARALLELOGRAM(%f, %f, %f, %f, %f, %f)",
|
||||
x11, y11, dx21, dy21, dx12, dy12);
|
||||
renderer.fillAAParallelogram(x11, y11, dx21, dy21, dx12, dy12);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -247,6 +256,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
}
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: DRAW_GLYPH_LIST");
|
||||
SKIP_BYTES(b, numGlyphs * bytesPerGlyph);
|
||||
renderer.drawGlyphList();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -262,6 +272,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
J2dRlsTraceLn6(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: COPY_AREA(%d, %d, %d, %d, %d, %d)",
|
||||
x, y, w, h, dx, dy);
|
||||
renderer.copyArea(x, y, w, h, dx, dy);
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_BLIT:
|
||||
@@ -287,6 +298,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jboolean isoblit = EXTRACT_BOOLEAN(packedParams,
|
||||
OFFSET_ISOBLIT);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: BLIT");
|
||||
renderer.blit();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_SURFACE_TO_SW_BLIT:
|
||||
@@ -301,6 +313,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jlong pSrc = NEXT_LONG(b);
|
||||
jlong pDst = NEXT_LONG(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: SURFACE_TO_SW_BLIT");
|
||||
renderer.surfaceToSwBlit();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_MASK_FILL:
|
||||
@@ -315,6 +328,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
unsigned char *pMask = (masklen > 0) ? b : NULL;
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: MASK_FILL");
|
||||
SKIP_BYTES(b, masklen);
|
||||
renderer.maskFill();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_MASK_BLIT:
|
||||
@@ -326,6 +340,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jint masklen = width * height * sizeof(jint);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE, "VKRenderQueue_flushBuffer: MASK_BLIT");
|
||||
SKIP_BYTES(b, masklen);
|
||||
renderer.maskBlit();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -339,12 +354,14 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
J2dRlsTraceLn4(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SET_RECT_CLIP(%d, %d, %d, %d)",
|
||||
x1, y1, x2, y2);
|
||||
renderer.setRectClip(x1, y1, x2, y2);
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_BEGIN_SHAPE_CLIP:
|
||||
{
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: BEGIN_SHAPE_CLIP");
|
||||
renderer.beginShapeClip();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_SET_SHAPE_CLIP_SPANS:
|
||||
@@ -353,18 +370,21 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SET_SHAPE_CLIP_SPANS");
|
||||
SKIP_BYTES(b, count * BYTES_PER_SPAN);
|
||||
renderer.setShapeClipSpans();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_END_SHAPE_CLIP:
|
||||
{
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: END_SHAPE_CLIP");
|
||||
renderer.endShapeClip();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_RESET_CLIP:
|
||||
{
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: RESET_CLIP");
|
||||
renderer.resetClip();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_SET_ALPHA_COMPOSITE:
|
||||
@@ -374,6 +394,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jint flags = NEXT_INT(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SET_ALPHA_COMPOSITE");
|
||||
renderer.setAlphaComposite();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_SET_XOR_COMPOSITE:
|
||||
@@ -381,12 +402,14 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jint xorPixel = NEXT_INT(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SET_XOR_COMPOSITE");
|
||||
renderer.setXorComposite();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_RESET_COMPOSITE:
|
||||
{
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: RESET_COMPOSITE");
|
||||
renderer.resetComposite();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_SET_TRANSFORM:
|
||||
@@ -399,22 +422,25 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jdouble m12 = NEXT_DOUBLE(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SET_TRANSFORM");
|
||||
renderer.setTransform(m00, m10, m01, m11, m02, m12);
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_RESET_TRANSFORM:
|
||||
{
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: RESET_TRANSFORM");
|
||||
renderer.resetTransform();
|
||||
}
|
||||
break;
|
||||
|
||||
// context-related ops
|
||||
case sun_java2d_pipe_BufferedOpCodes_SET_SURFACES:
|
||||
{
|
||||
jlong pSrc = NEXT_LONG(b);
|
||||
jlong pDst = NEXT_LONG(b);
|
||||
VKSurfaceData* src = NEXT_SURFACE(b);
|
||||
VKSurfaceData* dst = NEXT_SURFACE(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SET_SURFACES");
|
||||
renderer.setSurfaces(*src, *dst);
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_SET_SCRATCH_SURFACE:
|
||||
@@ -422,20 +448,23 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jlong pConfigInfo = NEXT_LONG(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SET_SCRATCH_SURFACE");
|
||||
renderer.setScratchSurface();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_FLUSH_SURFACE:
|
||||
{
|
||||
jlong pData = NEXT_LONG(b);
|
||||
VKSurfaceData* surface = NEXT_SURFACE(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: FLUSH_SURFACE");
|
||||
renderer.flushSurface(*surface);
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_DISPOSE_SURFACE:
|
||||
{
|
||||
jlong pData = NEXT_LONG(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: FLUSH_SURFACE");
|
||||
"VKRenderQueue_flushBuffer: DISPOSE_SURFACE");
|
||||
renderer.disposeSurface();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_DISPOSE_CONFIG:
|
||||
@@ -443,18 +472,21 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jlong pConfigInfo = NEXT_LONG(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: DISPOSE_CONFIG");
|
||||
|
||||
renderer.disposeConfig();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_INVALIDATE_CONTEXT:
|
||||
{
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: INVALIDATE_CONTEXT");
|
||||
renderer.invalidateContext();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_SYNC:
|
||||
{
|
||||
sync = JNI_TRUE;
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SYNC");
|
||||
renderer.sync();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -464,11 +496,16 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jlong window = NEXT_LONG(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SWAP_BUFFERS");
|
||||
renderer.swapBuffers();
|
||||
}
|
||||
break;
|
||||
|
||||
// special no-op (mainly used for achieving 8-byte alignment)
|
||||
case sun_java2d_pipe_BufferedOpCodes_NOOP:
|
||||
{
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: NOOP");
|
||||
}
|
||||
break;
|
||||
|
||||
// paint-related ops
|
||||
@@ -476,6 +513,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
{
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: RESET_PAINT");
|
||||
renderer.resetPaint();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_SET_COLOR:
|
||||
@@ -483,6 +521,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jint pixel = NEXT_INT(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SET_COLOR");
|
||||
renderer.setColor((uint32_t) pixel);
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_SET_GRADIENT_PAINT:
|
||||
@@ -496,6 +535,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jint pixel2 = NEXT_INT(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SET_GRADIENT_PAINT");
|
||||
renderer.setGradientPaint();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_SET_LINEAR_GRADIENT_PAINT:
|
||||
@@ -512,6 +552,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
pixels = b; SKIP_BYTES(b, numStops * sizeof(jint));
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SET_LINEAR_GRADIENT_PAINT");
|
||||
renderer.setLinearGradientPaint();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_SET_RADIAL_GRADIENT_PAINT:
|
||||
@@ -532,6 +573,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
pixels = b; SKIP_BYTES(b, numStops * sizeof(jint));
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SET_RADIAL_GRADIENT_PAINT");
|
||||
renderer.setRadialGradientPaint();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_SET_TEXTURE_PAINT:
|
||||
@@ -547,6 +589,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
jdouble yp3 = NEXT_DOUBLE(b);
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: SET_TEXTURE_PAINT");
|
||||
renderer.setTexturePaint();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -560,12 +603,14 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: ENABLE_CONVOLVE_OP");
|
||||
SKIP_BYTES(b, kernelWidth * kernelHeight * sizeof(jfloat));
|
||||
renderer.enableConvolveOp();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_DISABLE_CONVOLVE_OP:
|
||||
{
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: DISABLE_CONVOLVE_OP");
|
||||
renderer.disableConvolveOp();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_ENABLE_RESCALE_OP:
|
||||
@@ -578,12 +623,14 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: ENABLE_RESCALE_OP");
|
||||
SKIP_BYTES(b, numFactors * sizeof(jfloat) * 2);
|
||||
renderer.enableRescaleOp();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_DISABLE_RESCALE_OP:
|
||||
{
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: DISABLE_RESCALE_OP");
|
||||
renderer.disableRescaleOp();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_ENABLE_LOOKUP_OP:
|
||||
@@ -599,12 +646,14 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: ENABLE_LOOKUP_OP");
|
||||
SKIP_BYTES(b, numBands * bandLength * bytesPerElem);
|
||||
renderer.enableLookupOp();
|
||||
}
|
||||
break;
|
||||
case sun_java2d_pipe_BufferedOpCodes_DISABLE_LOOKUP_OP:
|
||||
{
|
||||
J2dRlsTraceLn(J2D_TRACE_VERBOSE,
|
||||
"VKRenderQueue_flushBuffer: DISABLE_LOOKUP_OP");
|
||||
renderer.disableLookupOp();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -614,6 +663,7 @@ Java_sun_java2d_vulkan_VKRenderQueue_flushBuffer
|
||||
return;
|
||||
}
|
||||
}
|
||||
renderer.flush();
|
||||
}
|
||||
|
||||
#endif /* !HEADLESS */
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#define NEXT_BOOLEAN(buf) (jboolean)NEXT_INT(buf)
|
||||
#define NEXT_LONG(buf) NEXT_VAL(buf, jlong)
|
||||
#define NEXT_DOUBLE(buf) NEXT_VAL(buf, jdouble)
|
||||
#define NEXT_SURFACE(buf) ((VKSurfaceData*) (SurfaceDataOps*) jlong_to_ptr(NEXT_LONG(buf)))
|
||||
|
||||
/*
|
||||
* Increments a pointer (buf) by the given number of bytes.
|
||||
|
||||
@@ -0,0 +1,282 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, JetBrains s.r.o.. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "VKRenderer.h"
|
||||
|
||||
VKRecorder::Vertex* VKRecorder::draw(uint32_t numVertices) {
|
||||
uint32_t bytes = numVertices * sizeof(VKRecorder::Vertex);
|
||||
if (_renderPass.vertexBuffer == nullptr && !_vertexBuffers.empty()) {
|
||||
_renderPass.vertexBuffer = &_vertexBuffers.back();
|
||||
_renderPass.commandBuffer->bindVertexBuffers(0, **_renderPass.vertexBuffer, vk::DeviceSize(0));
|
||||
}
|
||||
if (_renderPass.vertexBuffer == nullptr ||
|
||||
_renderPass.vertexBuffer->position() + bytes > _renderPass.vertexBuffer->size()) {
|
||||
_vertexBuffers.push_back(device().getVertexBuffer());
|
||||
_renderPass.vertexBuffer = &_vertexBuffers.back(); // TODO check that our number of vertices fit into single buffer at all
|
||||
_renderPass.commandBuffer->bindVertexBuffers(0, **_renderPass.vertexBuffer, vk::DeviceSize(0));
|
||||
}
|
||||
auto data = (uintptr_t) _renderPass.vertexBuffer->data() + _renderPass.vertexBuffer->position();
|
||||
uint32_t firstVertex = _renderPass.vertexBuffer->position() / sizeof(VKRecorder::Vertex);
|
||||
_renderPass.vertexBuffer->position() += bytes;
|
||||
_renderPass.commandBuffer->draw(numVertices, 1, firstVertex, 0);
|
||||
return (VKRecorder::Vertex*) data;
|
||||
}
|
||||
|
||||
VKDevice* VKRecorder::setDevice(VKDevice *device) {
|
||||
if (device != _device) {
|
||||
if (_device != nullptr) {
|
||||
flush();
|
||||
}
|
||||
std::swap(_device, device);
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
||||
void VKRecorder::waitSemaphore(vk::Semaphore semaphore, vk::PipelineStageFlags stage) {
|
||||
_waitSemaphores.push_back(semaphore);
|
||||
_waitSemaphoreStages.push_back(stage);
|
||||
}
|
||||
|
||||
void VKRecorder::signalSemaphore(vk::Semaphore semaphore) {
|
||||
_signalSemaphores.push_back(semaphore);
|
||||
}
|
||||
|
||||
const vk::raii::CommandBuffer& VKRecorder::record(bool flushRenderPass) {
|
||||
if (!*_commandBuffer) {
|
||||
_commandBuffer = device().getCommandBuffer(vk::CommandBufferLevel::ePrimary);
|
||||
_commandBuffer.begin({vk::CommandBufferUsageFlagBits::eOneTimeSubmit });
|
||||
}
|
||||
if (flushRenderPass && _renderPass.commandBuffer != nullptr) {
|
||||
_renderPass.commandBuffer->end();
|
||||
vk::Rect2D renderArea {{0, 0}, {_renderPass.surface->width(), _renderPass.surface->height()}};
|
||||
if (device().dynamicRendering()) {
|
||||
vk::RenderingAttachmentInfoKHR colorAttachmentInfo {
|
||||
_renderPass.surfaceView, vk::ImageLayout::eColorAttachmentOptimal,
|
||||
vk::ResolveModeFlagBits::eNone, {}, {},
|
||||
_renderPass.attachmentLoadOp, vk::AttachmentStoreOp::eStore,
|
||||
_renderPass.clearValue
|
||||
};
|
||||
_commandBuffer.beginRenderingKHR(vk::RenderingInfoKHR{
|
||||
vk::RenderingFlagBitsKHR::eContentsSecondaryCommandBuffers,
|
||||
renderArea, 1, 0, colorAttachmentInfo, {}, {}
|
||||
});
|
||||
} else {
|
||||
_commandBuffer.beginRenderPass(vk::RenderPassBeginInfo{
|
||||
/*renderPass*/ *device().pipelines().renderPass,
|
||||
/*framebuffer*/ _renderPass.surfaceFramebuffer,
|
||||
/*renderArea*/ renderArea,
|
||||
/*clearValueCount*/ 0,
|
||||
/*pClearValues*/ nullptr
|
||||
}, vk::SubpassContents::eSecondaryCommandBuffers);
|
||||
}
|
||||
_commandBuffer.executeCommands(**_renderPass.commandBuffer);
|
||||
if (device().dynamicRendering()) {
|
||||
_commandBuffer.endRenderingKHR();
|
||||
} else {
|
||||
_commandBuffer.endRenderPass();
|
||||
}
|
||||
_renderPass = {};
|
||||
}
|
||||
return _commandBuffer;
|
||||
}
|
||||
|
||||
const vk::raii::CommandBuffer& VKRecorder::render(VKSurfaceData& surface, vk::ClearColorValue* clear) {
|
||||
if (_renderPass.surface != &surface) {
|
||||
if (_renderPass.commandBuffer != nullptr) {
|
||||
record(true); // Flush current render pass
|
||||
}
|
||||
VKSurfaceImage i = surface.access(*this,
|
||||
vk::PipelineStageFlagBits::eColorAttachmentOutput,
|
||||
vk::AccessFlagBits::eColorAttachmentWrite,
|
||||
vk::ImageLayout::eColorAttachmentOptimal);
|
||||
_renderPass.surface = &surface;
|
||||
_renderPass.surfaceView = i.view;
|
||||
_renderPass.surfaceFramebuffer = i.framebuffer;
|
||||
_renderPass.attachmentLoadOp = vk::AttachmentLoadOp::eLoad;
|
||||
}
|
||||
if (clear != nullptr) {
|
||||
_renderPass.clearValue = *clear;
|
||||
_renderPass.attachmentLoadOp = vk::AttachmentLoadOp::eClear;
|
||||
}
|
||||
if (_renderPass.commandBuffer == nullptr || clear != nullptr) {
|
||||
if (_renderPass.commandBuffer == nullptr) {
|
||||
_secondaryBuffers.push_back(device().getCommandBuffer(vk::CommandBufferLevel::eSecondary));
|
||||
_renderPass.commandBuffer = &_secondaryBuffers.back();
|
||||
} else {
|
||||
// We already recorded some rendering commands, but it doesn't matter, as we'll clear the surface anyway.
|
||||
_renderPass.commandBuffer->reset({});
|
||||
}
|
||||
vk::Format format = surface.format();
|
||||
vk::CommandBufferInheritanceRenderingInfoKHR inheritanceRenderingInfo {
|
||||
vk::RenderingFlagBitsKHR::eContentsSecondaryCommandBuffers,
|
||||
0, format
|
||||
};
|
||||
vk::CommandBufferInheritanceInfo inheritanceInfo;
|
||||
if (device().dynamicRendering()) {
|
||||
inheritanceInfo.pNext = &inheritanceRenderingInfo;
|
||||
} else {
|
||||
inheritanceInfo.renderPass = *device().pipelines().renderPass;
|
||||
inheritanceInfo.subpass = 0;
|
||||
inheritanceInfo.framebuffer = _renderPass.surfaceFramebuffer;
|
||||
}
|
||||
_renderPass.commandBuffer->begin({ vk::CommandBufferUsageFlagBits::eOneTimeSubmit |
|
||||
vk::CommandBufferUsageFlagBits::eRenderPassContinue, &inheritanceInfo });
|
||||
if (clear != nullptr && !device().dynamicRendering()) {
|
||||
// Our static render pass uses loadOp=LOAD, so clear attachment manually.
|
||||
_renderPass.commandBuffer->clearAttachments(vk::ClearAttachment {
|
||||
vk::ImageAspectFlagBits::eColor, 0, _renderPass.clearValue
|
||||
}, vk::ClearRect {vk::Rect2D{{0, 0}, {_renderPass.surface->width(), _renderPass.surface->height()}}, 0, 1});
|
||||
}
|
||||
}
|
||||
return *_renderPass.commandBuffer;
|
||||
}
|
||||
|
||||
void VKRecorder::flush() {
|
||||
if (!*_commandBuffer && _renderPass.commandBuffer == nullptr) {
|
||||
return;
|
||||
}
|
||||
record(true).end();
|
||||
device().submitCommandBuffer(std::move(_commandBuffer), _secondaryBuffers, _vertexBuffers,
|
||||
_waitSemaphores, _waitSemaphoreStages, _signalSemaphores);
|
||||
}
|
||||
|
||||
// draw ops
|
||||
|
||||
void VKRenderer::drawLine(jint x1, jint y1, jint x2, jint y2) {/*TODO*/}
|
||||
void VKRenderer::drawRect(jint x, jint y, jint w, jint h) {/*TODO*/}
|
||||
void VKRenderer::drawPoly(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::drawPixel(jint x, jint y) {/*TODO*/}
|
||||
void VKRenderer::drawScanlines(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::drawParallelogram(jfloat x11, jfloat y11,
|
||||
jfloat dx21, jfloat dy21,
|
||||
jfloat dx12, jfloat dy12,
|
||||
jfloat lwr21, jfloat lwr12) {/*TODO*/}
|
||||
void VKRenderer::drawAAParallelogram(jfloat x11, jfloat y11,
|
||||
jfloat dx21, jfloat dy21,
|
||||
jfloat dx12, jfloat dy12,
|
||||
jfloat lwr21, jfloat lwr12) {/*TODO*/}
|
||||
|
||||
// fill ops
|
||||
|
||||
void VKRenderer::fillRect(jint xi, jint yi, jint wi, jint hi) {
|
||||
// TODO
|
||||
auto& cb = render(*_dstSurface);
|
||||
// cb.clearAttachments(vk::ClearAttachment {vk::ImageAspectFlagBits::eColor, 0, _color},
|
||||
// vk::ClearRect {vk::Rect2D {{x, y}, {(uint32_t) w, (uint32_t) h}}, 0, 1});
|
||||
cb.bindPipeline(vk::PipelineBindPoint::eGraphics, *device().pipelines().test);
|
||||
cb.pushConstants<float>(*device().pipelines().testLayout, vk::ShaderStageFlagBits::eVertex, 0, {
|
||||
2.0f/(float)_dstSurface->width(), 2.0f/(float)_dstSurface->height()
|
||||
});
|
||||
vk::Viewport viewport {0, 0, (float) _dstSurface->width(), (float) _dstSurface->height(), 0, 1};
|
||||
cb.setViewport(0, viewport);
|
||||
vk::Rect2D scissor {{0, 0}, {_dstSurface->width(), _dstSurface->height()}};
|
||||
cb.setScissor(0, scissor);
|
||||
auto x = (float) xi, y = (float) yi, w = (float) wi, h = (float) hi;
|
||||
auto v = draw(4);
|
||||
v[0] = {x, y};
|
||||
v[1] = {x+w, y};
|
||||
v[2] = {x+w, y+h};
|
||||
v[3] = {x, y+h};
|
||||
}
|
||||
void VKRenderer::fillSpans(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::fillParallelogram(jfloat x11, jfloat y11,
|
||||
jfloat dx21, jfloat dy21,
|
||||
jfloat dx12, jfloat dy12) {/*TODO*/}
|
||||
void VKRenderer::fillAAParallelogram(jfloat x11, jfloat y11,
|
||||
jfloat dx21, jfloat dy21,
|
||||
jfloat dx12, jfloat dy12) {/*TODO*/}
|
||||
|
||||
// text-related ops
|
||||
|
||||
void VKRenderer::drawGlyphList(/*TODO*/) {/*TODO*/}
|
||||
|
||||
// copy-related ops
|
||||
|
||||
void VKRenderer::copyArea(jint x, jint y, jint w, jint h, jint dx, jint dy) {/*TODO*/}
|
||||
void VKRenderer::blit(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::surfaceToSwBlit(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::maskFill(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::maskBlit(/*TODO*/) {/*TODO*/}
|
||||
|
||||
// state-related ops
|
||||
|
||||
void VKRenderer::setRectClip(jint x1, jint y1, jint x2, jint y2) {/*TODO*/}
|
||||
void VKRenderer::beginShapeClip() {/*TODO*/}
|
||||
void VKRenderer::setShapeClipSpans(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::endShapeClip() {/*TODO*/}
|
||||
void VKRenderer::resetClip() {/*TODO*/}
|
||||
void VKRenderer::setAlphaComposite(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::setXorComposite(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::resetComposite() {/*TODO*/}
|
||||
void VKRenderer::setTransform(jdouble m00, jdouble m10,
|
||||
jdouble m01, jdouble m11,
|
||||
jdouble m02, jdouble m12) {/*TODO*/}
|
||||
void VKRenderer::resetTransform() {/*TODO*/}
|
||||
|
||||
// context-related ops
|
||||
|
||||
void VKRenderer::setSurfaces(VKSurfaceData& src, VKSurfaceData& dst) {
|
||||
if (&src.device() != &dst.device()) {
|
||||
throw std::runtime_error("src and dst surfaces use different devices!");
|
||||
}
|
||||
setDevice(&dst.device());
|
||||
_dstSurface = &dst;
|
||||
_srcSurface = &src;
|
||||
}
|
||||
void VKRenderer::setScratchSurface(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::flushSurface(VKSurfaceData& surface) {
|
||||
VKDevice* old = setDevice(&surface.device());
|
||||
surface.flush(*this);
|
||||
setDevice(old);
|
||||
}
|
||||
void VKRenderer::disposeSurface(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::disposeConfig(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::invalidateContext() {/*TODO*/}
|
||||
void VKRenderer::sync() {/*TODO*/}
|
||||
|
||||
// multibuffering ops
|
||||
|
||||
void VKRenderer::swapBuffers(/*TODO*/) {/*TODO*/}
|
||||
|
||||
// paint-related ops
|
||||
|
||||
void VKRenderer::resetPaint() {/*TODO*/}
|
||||
void VKRenderer::setColor(uint32_t pixel) {
|
||||
_color = pixel;
|
||||
}
|
||||
void VKRenderer::setGradientPaint(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::setLinearGradientPaint(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::setRadialGradientPaint(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::setTexturePaint(/*TODO*/) {/*TODO*/}
|
||||
|
||||
// BufferedImageOp-related ops
|
||||
|
||||
void VKRenderer::enableConvolveOp(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::disableConvolveOp() {/*TODO*/}
|
||||
void VKRenderer::enableRescaleOp(/*TODO*/) {/*TODO*/}
|
||||
void VKRenderer::disableRescaleOp() {/*TODO*/}
|
||||
void VKRenderer::enableLookupOp() {/*TODO*/}
|
||||
void VKRenderer::disableLookupOp() {/*TODO*/}
|
||||
174
src/java.desktop/share/native/common/java2d/vulkan/VKRenderer.h
Normal file
174
src/java.desktop/share/native/common/java2d/vulkan/VKRenderer.h
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, JetBrains s.r.o.. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#ifndef VKRenderer_h_Included
|
||||
#define VKRenderer_h_Included
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "VKBase.h"
|
||||
#include "VKSurfaceData.h"
|
||||
|
||||
class VKRecorder{
|
||||
VKDevice *_device;
|
||||
vk::raii::CommandBuffer _commandBuffer = nullptr;
|
||||
std::vector<vk::raii::CommandBuffer> _secondaryBuffers;
|
||||
std::vector<vk::Semaphore> _waitSemaphores, _signalSemaphores;
|
||||
std::vector<vk::PipelineStageFlags> _waitSemaphoreStages;
|
||||
std::vector<VKBuffer> _vertexBuffers;
|
||||
struct RenderPass {
|
||||
vk::raii::CommandBuffer *commandBuffer = nullptr;
|
||||
VKSurfaceData *surface = nullptr;
|
||||
VKBuffer *vertexBuffer = nullptr;
|
||||
vk::ImageView surfaceView;
|
||||
vk::Framebuffer surfaceFramebuffer; // Only if dynamic rendering is off.
|
||||
vk::AttachmentLoadOp attachmentLoadOp;
|
||||
vk::ClearValue clearValue;
|
||||
} _renderPass {};
|
||||
|
||||
protected:
|
||||
struct Vertex {
|
||||
float x, y;
|
||||
};
|
||||
|
||||
Vertex* draw(uint32_t numVertices);
|
||||
|
||||
VKDevice& device() {
|
||||
return *_device;
|
||||
}
|
||||
VKDevice* setDevice(VKDevice *device);
|
||||
|
||||
public:
|
||||
void waitSemaphore(vk::Semaphore semaphore, vk::PipelineStageFlags stage);
|
||||
|
||||
void signalSemaphore(vk::Semaphore semaphore);
|
||||
|
||||
const vk::raii::CommandBuffer& record(bool flushRenderPass = true); // Prepare for ordinary commands
|
||||
|
||||
const vk::raii::CommandBuffer& render(VKSurfaceData& surface,
|
||||
vk::ClearColorValue* clear = nullptr); // Prepare for render pass commands
|
||||
|
||||
void flush();
|
||||
};
|
||||
|
||||
class VKRenderer : private VKRecorder{
|
||||
VKSurfaceData *_srcSurface, *_dstSurface;
|
||||
struct alignas(16) Color {
|
||||
float r, g, b, a;
|
||||
Color& operator=(uint32_t c) {
|
||||
r = (float) ((c >> 16) & 0xff) / 255.0f;
|
||||
g = (float) ((c >> 8) & 0xff) / 255.0f;
|
||||
b = (float) (c & 0xff) / 255.0f;
|
||||
a = (float) ((c >> 24) & 0xff) / 255.0f;
|
||||
return *this;
|
||||
}
|
||||
operator vk::ClearValue() const {
|
||||
return vk::ClearColorValue {r, g, b, a};
|
||||
}
|
||||
} _color;
|
||||
|
||||
public:
|
||||
using VKRecorder::flush;
|
||||
|
||||
// draw ops
|
||||
void drawLine(jint x1, jint y1, jint x2, jint y2);
|
||||
void drawRect(jint x, jint y, jint w, jint h);
|
||||
void drawPoly(/*TODO*/);
|
||||
void drawPixel(jint x, jint y);
|
||||
void drawScanlines(/*TODO*/);
|
||||
void drawParallelogram(jfloat x11, jfloat y11,
|
||||
jfloat dx21, jfloat dy21,
|
||||
jfloat dx12, jfloat dy12,
|
||||
jfloat lwr21, jfloat lwr12);
|
||||
void drawAAParallelogram(jfloat x11, jfloat y11,
|
||||
jfloat dx21, jfloat dy21,
|
||||
jfloat dx12, jfloat dy12,
|
||||
jfloat lwr21, jfloat lwr12);
|
||||
|
||||
// fill ops
|
||||
void fillRect(jint x, jint y, jint w, jint h);
|
||||
void fillSpans(/*TODO*/);
|
||||
void fillParallelogram(jfloat x11, jfloat y11,
|
||||
jfloat dx21, jfloat dy21,
|
||||
jfloat dx12, jfloat dy12);
|
||||
void fillAAParallelogram(jfloat x11, jfloat y11,
|
||||
jfloat dx21, jfloat dy21,
|
||||
jfloat dx12, jfloat dy12);
|
||||
|
||||
// text-related ops
|
||||
void drawGlyphList(/*TODO*/);
|
||||
|
||||
// copy-related ops
|
||||
void copyArea(jint x, jint y, jint w, jint h, jint dx, jint dy);
|
||||
void blit(/*TODO*/);
|
||||
void surfaceToSwBlit(/*TODO*/);
|
||||
void maskFill(/*TODO*/);
|
||||
void maskBlit(/*TODO*/);
|
||||
|
||||
// state-related ops
|
||||
void setRectClip(jint x1, jint y1, jint x2, jint y2);
|
||||
void beginShapeClip();
|
||||
void setShapeClipSpans(/*TODO*/);
|
||||
void endShapeClip();
|
||||
void resetClip();
|
||||
void setAlphaComposite(/*TODO*/);
|
||||
void setXorComposite(/*TODO*/);
|
||||
void resetComposite();
|
||||
void setTransform(jdouble m00, jdouble m10,
|
||||
jdouble m01, jdouble m11,
|
||||
jdouble m02, jdouble m12);
|
||||
void resetTransform();
|
||||
|
||||
// context-related ops
|
||||
void setSurfaces(VKSurfaceData& src, VKSurfaceData& dst);
|
||||
void setScratchSurface(/*TODO*/);
|
||||
void flushSurface(VKSurfaceData& surface);
|
||||
void disposeSurface(/*TODO*/);
|
||||
void disposeConfig(/*TODO*/);
|
||||
void invalidateContext();
|
||||
void sync();
|
||||
|
||||
// multibuffering ops
|
||||
void swapBuffers(/*TODO*/);
|
||||
|
||||
// paint-related ops
|
||||
void resetPaint();
|
||||
void setColor(uint32_t pixel);
|
||||
void setGradientPaint(/*TODO*/);
|
||||
void setLinearGradientPaint(/*TODO*/);
|
||||
void setRadialGradientPaint(/*TODO*/);
|
||||
void setTexturePaint(/*TODO*/);
|
||||
|
||||
// BufferedImageOp-related ops
|
||||
void enableConvolveOp(/*TODO*/);
|
||||
void disableConvolveOp();
|
||||
void enableRescaleOp(/*TODO*/);
|
||||
void disableRescaleOp();
|
||||
void enableLookupOp();
|
||||
void disableLookupOp();
|
||||
};
|
||||
|
||||
#endif //__cplusplus
|
||||
#endif //VKRenderer_h_Included
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, JetBrains s.r.o.. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "VKShader.h"
|
||||
|
||||
// Inline bytecode of all shaders
|
||||
#define INCLUDE_BYTECODE
|
||||
#define SHADER_ENTRY(NAME, TYPE) static uint32_t NAME ## _ ## TYPE ## _data[] = {
|
||||
#define BYTECODE_END };
|
||||
#include "vulkan/shader_list.h"
|
||||
#undef INCLUDE_BYTECODE
|
||||
#undef SHADER_ENTRY
|
||||
#undef BYTECODE_END
|
||||
|
||||
void VKShaders::init(const vk::raii::Device& device) {
|
||||
// Declare file extensions as stage flags
|
||||
auto vert = vk::ShaderStageFlagBits::eVertex;
|
||||
auto frag = vk::ShaderStageFlagBits::eFragment;
|
||||
// Init all shader modules
|
||||
# define SHADER_ENTRY(NAME, TYPE) \
|
||||
NAME ## _ ## TYPE.init(device, sizeof NAME ## _ ## TYPE ## _data, NAME ## _ ## TYPE ## _data, TYPE);
|
||||
# include "vulkan/shader_list.h"
|
||||
# undef SHADER_ENTRY
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, JetBrains s.r.o.. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#ifndef VKShader_h_Included
|
||||
#define VKShader_h_Included
|
||||
|
||||
#define VK_NO_PROTOTYPES
|
||||
#define VULKAN_HPP_NO_DEFAULT_DISPATCHER
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
class VKShader : public vk::raii::ShaderModule {
|
||||
friend struct VKShaders;
|
||||
vk::ShaderStageFlagBits _stage;
|
||||
void init(const vk::raii::Device& device, size_t size, const uint32_t* data, vk::ShaderStageFlagBits stage) {
|
||||
*((vk::raii::ShaderModule*) this) = device.createShaderModule({{}, size, data});
|
||||
_stage = stage;
|
||||
}
|
||||
public:
|
||||
VKShader() : vk::raii::ShaderModule(nullptr), _stage() {}
|
||||
vk::PipelineShaderStageCreateInfo stage(const vk::SpecializationInfo *specializationInfo = nullptr) {
|
||||
return vk::PipelineShaderStageCreateInfo {{}, _stage, **this, "main", specializationInfo};
|
||||
}
|
||||
};
|
||||
|
||||
struct VKShaders {
|
||||
// Actual list of shaders is autogenerated from source file names
|
||||
# define SHADER_ENTRY(NAME, TYPE) VKShader NAME ## _ ## TYPE;
|
||||
# include "vulkan/shader_list.h"
|
||||
# undef SHADER_ENTRY
|
||||
|
||||
void init(const vk::raii::Device& device);
|
||||
};
|
||||
|
||||
#endif //VKShader_h_Included
|
||||
@@ -28,11 +28,7 @@
|
||||
#ifndef VULKAN_ENABLED
|
||||
#include "jni.h"
|
||||
|
||||
jboolean VK_Init() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
jint VK_MaxTextureSize() {
|
||||
jboolean VK_Init(jboolean verbose, jint requestedDevice) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, JetBrains s.r.o.. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "jni_util.h"
|
||||
#include "Disposer.h"
|
||||
#include "Trace.h"
|
||||
#include "VKSurfaceData.h"
|
||||
#include "VKRenderer.h"
|
||||
|
||||
void VKSurfaceData::attachToJavaSurface(JNIEnv *env, jobject javaSurfaceData) {
|
||||
// SurfaceData utility functions operate on C structures and malloc/free,
|
||||
// But we are using C++ classes, so set up the disposer manually.
|
||||
// This is a C++ analogue of SurfaceData_InitOps / SurfaceData_SetOps.
|
||||
jboolean exception = false;
|
||||
if (JNU_GetFieldByName(env, &exception, javaSurfaceData, "pData", "J").j == 0 && !exception) {
|
||||
jlong ptr = ptr_to_jlong((SurfaceDataOps*) this);
|
||||
JNU_SetFieldByName(env, &exception, javaSurfaceData, "pData", "J", ptr);
|
||||
/* Register the data for disposal */
|
||||
Disposer_AddRecord(env, javaSurfaceData, [](JNIEnv *env, jlong ops) {
|
||||
if (ops != 0) {
|
||||
auto sd = (SurfaceDataOps*)jlong_to_ptr(ops);
|
||||
jobject sdObject = sd->sdObject;
|
||||
sd->Dispose(env, sd);
|
||||
if (sdObject != nullptr) {
|
||||
env->DeleteWeakGlobalRef(sdObject);
|
||||
}
|
||||
}
|
||||
}, ptr);
|
||||
} else if (!exception) {
|
||||
throw std::runtime_error("Attempting to set SurfaceData ops twice");
|
||||
}
|
||||
if (exception) {
|
||||
throw std::runtime_error("VKSurfaceData::attachToJavaSurface error");
|
||||
}
|
||||
sdObject = env->NewWeakGlobalRef(javaSurfaceData);
|
||||
}
|
||||
|
||||
VKSurfaceData::VKSurfaceData(uint32_t w, uint32_t h, uint32_t s, uint32_t bgc)
|
||||
: SurfaceDataOps(), _width(w), _height(h), _scale(s), _bg_color(bgc), _device(nullptr) {
|
||||
Lock = [](JNIEnv *env, SurfaceDataOps *ops, SurfaceDataRasInfo *rasInfo, jint lockFlags) {
|
||||
((VKSurfaceData*) ops)->_mutex.lock();
|
||||
return SD_SUCCESS;
|
||||
};
|
||||
Unlock = [](JNIEnv *env, SurfaceDataOps *ops, SurfaceDataRasInfo *rasInfo) {
|
||||
((VKSurfaceData*) ops)->_mutex.unlock();
|
||||
};
|
||||
Dispose = [](JNIEnv *env, SurfaceDataOps *ops) {
|
||||
delete (VKSurfaceData*) ops;
|
||||
};
|
||||
}
|
||||
|
||||
bool VKSurfaceData::barrier(VKRecorder& recorder, vk::Image image,
|
||||
vk::PipelineStageFlags stage, vk::AccessFlags access, vk::ImageLayout layout) {
|
||||
// TODO consider write/read access
|
||||
if (_lastStage != stage || _lastAccess != access || _layout != layout) {
|
||||
if (_device->synchronization2()) {
|
||||
vk::ImageMemoryBarrier2KHR barrier {
|
||||
(vk::PipelineStageFlags2KHR) (VkFlags) _lastStage,
|
||||
(vk::AccessFlags2KHR) (VkFlags) _lastAccess,
|
||||
(vk::PipelineStageFlags2KHR) (VkFlags) stage,
|
||||
(vk::AccessFlags2KHR) (VkFlags) access,
|
||||
_layout, layout,
|
||||
VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED,
|
||||
image, vk::ImageSubresourceRange {vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1}
|
||||
};
|
||||
recorder.record(false).pipelineBarrier2KHR(vk::DependencyInfoKHR {{}, {}, {}, barrier});
|
||||
} else {
|
||||
vk::ImageMemoryBarrier barrier {
|
||||
_lastAccess, access,
|
||||
_layout, layout,
|
||||
VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED,
|
||||
image, vk::ImageSubresourceRange {vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1}
|
||||
};
|
||||
recorder.record(false).pipelineBarrier(_lastStage, stage, {}, {}, {}, barrier);
|
||||
}
|
||||
_lastStage = stage;
|
||||
_lastAccess = access;
|
||||
_layout = layout;
|
||||
// TODO check write access
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
void VKSwapchainSurfaceData::revalidate(uint32_t w, uint32_t h, uint32_t s) {
|
||||
if (*_swapchain && s == scale() && w == width() && h == height() ) {
|
||||
J2dTraceLn1(J2D_TRACE_INFO,
|
||||
"VKSwapchainSurfaceData_revalidate is skipped: swapchain(%p)",
|
||||
*_swapchain);
|
||||
return;
|
||||
}
|
||||
VKSurfaceData::revalidate(w, h, s);
|
||||
if (!_device || !*_surface) {
|
||||
J2dTraceLn2(J2D_TRACE_ERROR,
|
||||
"VKSwapchainSurfaceData_revalidate is skipped: device(%p) surface(%p)",
|
||||
_device, *_surface);
|
||||
return;
|
||||
}
|
||||
|
||||
vk::SurfaceCapabilitiesKHR surfaceCapabilities = device().getSurfaceCapabilitiesKHR(*_surface);
|
||||
_format = vk::Format::eB8G8R8A8Unorm; // TODO?
|
||||
|
||||
// TODO all these parameters must be checked against device & surface capabilities
|
||||
vk::SwapchainCreateInfoKHR swapchainCreateInfo{
|
||||
{},
|
||||
*_surface,
|
||||
surfaceCapabilities.minImageCount,
|
||||
format(),
|
||||
vk::ColorSpaceKHR::eVkColorspaceSrgbNonlinear,
|
||||
{width(), height()}, // TODO According to spec we need to use surfaceCapabilities.currentExtent, which is not available at this point (it gives -1)... We'll figure this out later
|
||||
1,
|
||||
vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eTransferDst,
|
||||
vk::SharingMode::eExclusive,
|
||||
0,
|
||||
nullptr,
|
||||
vk::SurfaceTransformFlagBitsKHR::eIdentity,
|
||||
vk::CompositeAlphaFlagBitsKHR::eOpaque,
|
||||
vk::PresentModeKHR::eImmediate,
|
||||
true, *_swapchain
|
||||
};
|
||||
|
||||
device().waitIdle(); // TODO proper synchronization in case there are rendering operations for old swapchain in flight
|
||||
_images.clear();
|
||||
_swapchain = device().createSwapchainKHR(swapchainCreateInfo);
|
||||
for (vk::Image image : _swapchain.getImages()) {
|
||||
_images.push_back({image, device().createImageView(vk::ImageViewCreateInfo {
|
||||
{}, image, vk::ImageViewType::e2D, format(), {},
|
||||
vk::ImageSubresourceRange {vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1}
|
||||
})});
|
||||
if (!device().dynamicRendering()) {
|
||||
_images.back().framebuffer = device().createFramebuffer(vk::FramebufferCreateInfo{
|
||||
/*flags*/ {},
|
||||
/*renderPass*/ *device().pipelines().renderPass,
|
||||
/*attachmentCount*/ 1,
|
||||
/*pAttachments*/ &*_images.back().view,
|
||||
/*width*/ width(),
|
||||
/*height*/ height(),
|
||||
/*layers*/ 1
|
||||
});
|
||||
}
|
||||
}
|
||||
_currentImage = (uint32_t) -1;
|
||||
_freeSemaphore = nullptr;
|
||||
// TODO Now we need to repaint our surface... How is it done? No idea
|
||||
}
|
||||
|
||||
VKSurfaceImage VKSwapchainSurfaceData::access(VKRecorder& recorder,
|
||||
vk::PipelineStageFlags stage,
|
||||
vk::AccessFlags access,
|
||||
vk::ImageLayout layout) {
|
||||
// Acquire image
|
||||
bool semaphorePending = false;
|
||||
if (_currentImage == (uint32_t) -1) {
|
||||
if (!*_freeSemaphore) {
|
||||
_freeSemaphore = device().createSemaphore({});
|
||||
}
|
||||
auto img = _swapchain.acquireNextImage(-1, *_freeSemaphore, nullptr);
|
||||
vk::resultCheck(img.first, "vk::SwapchainKHR::acquireNextImage");
|
||||
_layout = vk::ImageLayout::eUndefined;
|
||||
_lastStage = _lastWriteStage = vk::PipelineStageFlagBits::eTopOfPipe;
|
||||
_lastAccess = _lastWriteAccess = {};
|
||||
_currentImage = (int) img.second;
|
||||
std::swap(_images[_currentImage].semaphore, _freeSemaphore);
|
||||
semaphorePending = true;
|
||||
}
|
||||
// Insert barrier & semaphore
|
||||
auto& current = _images[_currentImage];
|
||||
barrier(recorder, current.image, stage, access, layout);
|
||||
if (semaphorePending) {
|
||||
recorder.waitSemaphore(*current.semaphore,
|
||||
vk::PipelineStageFlagBits::eColorAttachmentOutput | vk::PipelineStageFlagBits::eTransfer);
|
||||
}
|
||||
return {current.image, *current.view, *current.framebuffer};
|
||||
}
|
||||
|
||||
void VKSwapchainSurfaceData::flush(VKRecorder& recorder) {
|
||||
if (_currentImage == (uint32_t) -1) {
|
||||
return; // Nothing to flush
|
||||
}
|
||||
recorder.record(true); // Force flush current render pass before accessing image with present layout.
|
||||
access(recorder, vk::PipelineStageFlagBits::eTopOfPipe, {}, vk::ImageLayout::ePresentSrcKHR);
|
||||
auto& current = _images[_currentImage];
|
||||
recorder.signalSemaphore(*current.semaphore);
|
||||
recorder.flush();
|
||||
device().queue().presentKHR(vk::PresentInfoKHR {
|
||||
*current.semaphore, *_swapchain, _currentImage
|
||||
});
|
||||
_currentImage = (uint32_t) -1;
|
||||
}
|
||||
@@ -27,62 +27,10 @@
|
||||
#ifndef VKSurfaceData_h_Included
|
||||
#define VKSurfaceData_h_Included
|
||||
|
||||
#include "java_awt_image_AffineTransformOp.h"
|
||||
#include "sun_java2d_pipe_hw_AccelSurface.h"
|
||||
|
||||
#include <mutex>
|
||||
#include "jni.h"
|
||||
#include "SurfaceData.h"
|
||||
#include "Trace.h"
|
||||
|
||||
/**
|
||||
* The VKSDOps structure describes a native Vulkan surface and contains all
|
||||
* information pertaining to the native surface. Some information about
|
||||
* the more important/different fields:
|
||||
*
|
||||
* void *privOps;
|
||||
* Pointer to native-specific SurfaceData info, such as the
|
||||
* native Drawable handle and GraphicsConfig data.
|
||||
*
|
||||
* jobject graphicsConfig;
|
||||
* Strong reference to the VKGraphicsConfig used by this VKSurfaceData.
|
||||
*
|
||||
* jint drawableType;
|
||||
* The surface type; can be any one of the surface type constants defined
|
||||
* below (VK_WINDOW, VK_TEXTURE, etc).
|
||||
*
|
||||
* jboolean isOpaque;
|
||||
* If true, the surface should be treated as being fully opaque.
|
||||
*
|
||||
* jboolean needsInit;
|
||||
* If true, the surface requires some one-time initialization, which should
|
||||
* be performed after a context has been made current to the surface for
|
||||
* the first time.
|
||||
*
|
||||
* jint x/yOffset
|
||||
* The offset in pixels of the Vulkan viewport origin from the lower-left
|
||||
* corner of the heavyweight drawable.
|
||||
*
|
||||
* jint width/height;
|
||||
* The cached surface bounds. For offscreen surface types (VK_RT_TEXTURE,
|
||||
* VK_TEXTURE, etc.) these values must remain constant. Onscreen window
|
||||
* surfaces (VK_WINDOW, etc.) may have their
|
||||
* bounds changed in response to a programmatic or user-initiated event, so
|
||||
* these values represent the last known dimensions. To determine the true
|
||||
* current bounds of this surface, query the native Drawable through the
|
||||
* privOps field.
|
||||
*
|
||||
*/
|
||||
typedef struct _VKSDOps {
|
||||
SurfaceDataOps sdOps;
|
||||
void *privOps;
|
||||
jobject graphicsConfig;
|
||||
jint drawableType;
|
||||
jboolean isOpaque;
|
||||
jboolean needsInit;
|
||||
jint xOffset;
|
||||
jint yOffset;
|
||||
jint width;
|
||||
jint height;
|
||||
} VKSDOps;
|
||||
#include "VKBase.h"
|
||||
|
||||
/**
|
||||
* These are shorthand names for the surface type constants defined in
|
||||
@@ -92,4 +40,123 @@ typedef struct _VKSDOps {
|
||||
#define VKSD_WINDOW sun_java2d_pipe_hw_AccelSurface_WINDOW
|
||||
#define VKSD_TEXTURE sun_java2d_pipe_hw_AccelSurface_TEXTURE
|
||||
#define VKSD_RT_TEXTURE sun_java2d_pipe_hw_AccelSurface_RT_TEXTURE
|
||||
|
||||
class VKRecorder;
|
||||
|
||||
struct VKSurfaceImage {
|
||||
vk::Image image;
|
||||
vk::ImageView view;
|
||||
vk::Framebuffer framebuffer; // Only if dynamic rendering is off.
|
||||
};
|
||||
|
||||
class VKSurfaceData : private SurfaceDataOps {
|
||||
std::recursive_mutex _mutex;
|
||||
uint32_t _width;
|
||||
uint32_t _height;
|
||||
uint32_t _scale; // TODO Is it needed there at all?
|
||||
uint32_t _bg_color;
|
||||
protected:
|
||||
VKDevice* _device;
|
||||
vk::Format _format;
|
||||
|
||||
vk::ImageLayout _layout = vk::ImageLayout::eUndefined;
|
||||
// We track any access and write access separately, as read-read access does not need synchronization.
|
||||
vk::PipelineStageFlags _lastStage = vk::PipelineStageFlagBits::eTopOfPipe;
|
||||
vk::PipelineStageFlags _lastWriteStage = vk::PipelineStageFlagBits::eTopOfPipe;
|
||||
vk::AccessFlags _lastAccess = {};
|
||||
vk::AccessFlags _lastWriteAccess = {};
|
||||
|
||||
/// Insert barrier if needed for given access and layout.
|
||||
bool barrier(VKRecorder& recorder, vk::Image image,
|
||||
vk::PipelineStageFlags stage, vk::AccessFlags access, vk::ImageLayout layout);
|
||||
public:
|
||||
VKSurfaceData(uint32_t w, uint32_t h, uint32_t s, uint32_t bgc);
|
||||
// No need to move, as object must only be created with "new".
|
||||
VKSurfaceData(VKSurfaceData&&) = delete;
|
||||
VKSurfaceData& operator=(VKSurfaceData&&) = delete;
|
||||
|
||||
void attachToJavaSurface(JNIEnv *env, jobject javaSurfaceData);
|
||||
|
||||
VKDevice& device() const {
|
||||
return *_device;
|
||||
}
|
||||
|
||||
vk::Format format() const {
|
||||
return _format;
|
||||
}
|
||||
|
||||
uint32_t width() const {
|
||||
return _width;
|
||||
}
|
||||
|
||||
uint32_t height() const {
|
||||
return _height;
|
||||
}
|
||||
|
||||
uint32_t scale() const {
|
||||
return _scale;
|
||||
}
|
||||
|
||||
uint32_t bg_color() const {
|
||||
return _bg_color;
|
||||
}
|
||||
|
||||
void set_bg_color(uint32_t bg_color) {
|
||||
if (_bg_color != bg_color) {
|
||||
_bg_color = bg_color;
|
||||
// TODO now we need to repaint the surface???
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~VKSurfaceData() = default;
|
||||
|
||||
virtual void revalidate(uint32_t w, uint32_t h, uint32_t s) {
|
||||
_width = w;
|
||||
_height = h;
|
||||
_scale = s;
|
||||
}
|
||||
|
||||
/// Prepare image for access (necessary barriers & layout transitions).
|
||||
virtual VKSurfaceImage access(VKRecorder& recorder,
|
||||
vk::PipelineStageFlags stage,
|
||||
vk::AccessFlags access,
|
||||
vk::ImageLayout layout) = 0;
|
||||
/// Flush all pending changes to the surface, including screen presentation for on-screen surfaces.
|
||||
virtual void flush(VKRecorder& recorder) = 0;
|
||||
};
|
||||
|
||||
class VKSwapchainSurfaceData : public VKSurfaceData {
|
||||
struct Image {
|
||||
vk::Image image;
|
||||
vk::raii::ImageView view;
|
||||
vk::raii::Framebuffer framebuffer = nullptr; // Only if dynamic rendering is off.
|
||||
vk::raii::Semaphore semaphore = nullptr;
|
||||
};
|
||||
|
||||
vk::raii::SurfaceKHR _surface = nullptr;
|
||||
vk::raii::SwapchainKHR _swapchain = nullptr;
|
||||
std::vector<Image> _images;
|
||||
uint32_t _currentImage = (uint32_t) -1;
|
||||
vk::raii::Semaphore _freeSemaphore = nullptr;
|
||||
|
||||
protected:
|
||||
void reset(VKDevice& device, vk::raii::SurfaceKHR surface) {
|
||||
_images.clear();
|
||||
_swapchain = nullptr;
|
||||
_surface = std::move(surface);
|
||||
_device = &device;
|
||||
}
|
||||
public:
|
||||
VKSwapchainSurfaceData(uint32_t w, uint32_t h, uint32_t s, uint32_t bgc)
|
||||
: VKSurfaceData(w, h, s, bgc) {};
|
||||
|
||||
virtual void revalidate(uint32_t w, uint32_t h, uint32_t s);
|
||||
|
||||
virtual VKSurfaceImage access(VKRecorder& recorder,
|
||||
vk::PipelineStageFlags stage,
|
||||
vk::AccessFlags access,
|
||||
vk::ImageLayout layout);
|
||||
virtual void flush(VKRecorder& recorder);
|
||||
};
|
||||
|
||||
#endif /* VKSurfaceData_h_Included */
|
||||
|
||||
19558
src/java.desktop/share/native/libvmahpp/vk_mem_alloc.h
Normal file
19558
src/java.desktop/share/native/libvmahpp/vk_mem_alloc.h
Normal file
File diff suppressed because it is too large
Load Diff
135
src/java.desktop/share/native/libvmahpp/vk_mem_alloc.hpp
Normal file
135
src/java.desktop/share/native/libvmahpp/vk_mem_alloc.hpp
Normal file
@@ -0,0 +1,135 @@
|
||||
#ifndef VULKAN_MEMORY_ALLOCATOR_HPP
|
||||
#define VULKAN_MEMORY_ALLOCATOR_HPP
|
||||
|
||||
#if !defined(AMD_VULKAN_MEMORY_ALLOCATOR_H)
|
||||
#include <vk_mem_alloc.h>
|
||||
#endif
|
||||
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
#if !defined(VMA_HPP_NAMESPACE)
|
||||
#define VMA_HPP_NAMESPACE vma
|
||||
#endif
|
||||
|
||||
#define VMA_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY(VMA_HPP_NAMESPACE)
|
||||
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
struct Dispatcher {}; // VMA uses function pointers from VmaAllocator instead
|
||||
class Allocator;
|
||||
|
||||
template<class T>
|
||||
VULKAN_HPP_NAMESPACE::UniqueHandle<T, Dispatcher> createUniqueHandle(const T& t) VULKAN_HPP_NOEXCEPT {
|
||||
return VULKAN_HPP_NAMESPACE::UniqueHandle<T, Dispatcher>(t);
|
||||
}
|
||||
template<class T, class O>
|
||||
VULKAN_HPP_NAMESPACE::UniqueHandle<T, Dispatcher> createUniqueHandle(const T& t, const O* o) VULKAN_HPP_NOEXCEPT {
|
||||
return VULKAN_HPP_NAMESPACE::UniqueHandle<T, Dispatcher>(t, o);
|
||||
}
|
||||
template<class F, class S, class O>
|
||||
std::pair<VULKAN_HPP_NAMESPACE::UniqueHandle<F, Dispatcher>, VULKAN_HPP_NAMESPACE::UniqueHandle<S, Dispatcher>>
|
||||
createUniqueHandle(const std::pair<F, S>& t, const O* o) VULKAN_HPP_NOEXCEPT {
|
||||
return {
|
||||
VULKAN_HPP_NAMESPACE::UniqueHandle<F, Dispatcher>(t.first, o),
|
||||
VULKAN_HPP_NAMESPACE::UniqueHandle<S, Dispatcher>(t.second, o)
|
||||
};
|
||||
}
|
||||
|
||||
template<class T, class UniqueVectorAllocator, class VectorAllocator, class O>
|
||||
std::vector<VULKAN_HPP_NAMESPACE::UniqueHandle<T, Dispatcher>, UniqueVectorAllocator>
|
||||
createUniqueHandleVector(const std::vector<T, VectorAllocator>& vector, const O* o,
|
||||
const UniqueVectorAllocator& vectorAllocator) VULKAN_HPP_NOEXCEPT {
|
||||
std::vector<VULKAN_HPP_NAMESPACE::UniqueHandle<T, Dispatcher>, UniqueVectorAllocator> result(vectorAllocator);
|
||||
result.reserve(vector.size());
|
||||
for (const T& t : vector) result.emplace_back(t, o);
|
||||
return result;
|
||||
}
|
||||
|
||||
template<class T, class Owner> class Deleter {
|
||||
const Owner* owner;
|
||||
public:
|
||||
Deleter() = default;
|
||||
Deleter(const Owner* owner) VULKAN_HPP_NOEXCEPT : owner(owner) {}
|
||||
protected:
|
||||
void destroy(const T& t) VULKAN_HPP_NOEXCEPT; // Implemented manually for each handle type
|
||||
};
|
||||
template<class T> class Deleter<T, void> {
|
||||
protected:
|
||||
void destroy(const T& t) VULKAN_HPP_NOEXCEPT { t.destroy(); }
|
||||
};
|
||||
}
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> struct UniqueHandleTraits<Buffer, VMA_HPP_NAMESPACE::Dispatcher> {
|
||||
using deleter = VMA_HPP_NAMESPACE::Deleter<Buffer, VMA_HPP_NAMESPACE::Allocator>;
|
||||
};
|
||||
template<> struct UniqueHandleTraits<Image, VMA_HPP_NAMESPACE::Dispatcher> {
|
||||
using deleter = VMA_HPP_NAMESPACE::Deleter<Image, VMA_HPP_NAMESPACE::Allocator>;
|
||||
};
|
||||
}
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
using UniqueBuffer = VULKAN_HPP_NAMESPACE::UniqueHandle<VULKAN_HPP_NAMESPACE::Buffer, Dispatcher>;
|
||||
using UniqueImage = VULKAN_HPP_NAMESPACE::UniqueHandle<VULKAN_HPP_NAMESPACE::Image, Dispatcher>;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "vk_mem_alloc_enums.hpp"
|
||||
#include "vk_mem_alloc_handles.hpp"
|
||||
#include "vk_mem_alloc_structs.hpp"
|
||||
#include "vk_mem_alloc_funcs.hpp"
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
# define VMA_HPP_DESTROY_IMPL(NAME) \
|
||||
template<> VULKAN_HPP_INLINE void VULKAN_HPP_NAMESPACE::UniqueHandleTraits<NAME, Dispatcher>::deleter::destroy(const NAME& t) VULKAN_HPP_NOEXCEPT
|
||||
|
||||
VMA_HPP_DESTROY_IMPL(VULKAN_HPP_NAMESPACE::Buffer) { owner->destroyBuffer(t, nullptr); }
|
||||
VMA_HPP_DESTROY_IMPL(VULKAN_HPP_NAMESPACE::Image) { owner->destroyImage(t, nullptr); }
|
||||
VMA_HPP_DESTROY_IMPL(Pool) { owner->destroyPool(t); }
|
||||
VMA_HPP_DESTROY_IMPL(Allocation) { owner->freeMemory(t); }
|
||||
VMA_HPP_DESTROY_IMPL(VirtualAllocation) { owner->virtualFree(t); }
|
||||
|
||||
# undef VMA_HPP_DESTROY_IMPL
|
||||
#endif
|
||||
|
||||
template<class InstanceDispatcher, class DeviceDispatcher>
|
||||
VULKAN_HPP_CONSTEXPR VulkanFunctions functionsFromDispatcher(InstanceDispatcher const * instance,
|
||||
DeviceDispatcher const * device) VULKAN_HPP_NOEXCEPT {
|
||||
return VulkanFunctions {
|
||||
instance->vkGetInstanceProcAddr,
|
||||
instance->vkGetDeviceProcAddr,
|
||||
instance->vkGetPhysicalDeviceProperties,
|
||||
instance->vkGetPhysicalDeviceMemoryProperties,
|
||||
device->vkAllocateMemory,
|
||||
device->vkFreeMemory,
|
||||
device->vkMapMemory,
|
||||
device->vkUnmapMemory,
|
||||
device->vkFlushMappedMemoryRanges,
|
||||
device->vkInvalidateMappedMemoryRanges,
|
||||
device->vkBindBufferMemory,
|
||||
device->vkBindImageMemory,
|
||||
device->vkGetBufferMemoryRequirements,
|
||||
device->vkGetImageMemoryRequirements,
|
||||
device->vkCreateBuffer,
|
||||
device->vkDestroyBuffer,
|
||||
device->vkCreateImage,
|
||||
device->vkDestroyImage,
|
||||
device->vkCmdCopyBuffer,
|
||||
device->vkGetBufferMemoryRequirements2KHR ? device->vkGetBufferMemoryRequirements2KHR : device->vkGetBufferMemoryRequirements2,
|
||||
device->vkGetImageMemoryRequirements2KHR ? device->vkGetImageMemoryRequirements2KHR : device->vkGetImageMemoryRequirements2,
|
||||
device->vkBindBufferMemory2KHR ? device->vkBindBufferMemory2KHR : device->vkBindBufferMemory2,
|
||||
device->vkBindImageMemory2KHR ? device->vkBindImageMemory2KHR : device->vkBindImageMemory2,
|
||||
instance->vkGetPhysicalDeviceMemoryProperties2KHR ? instance->vkGetPhysicalDeviceMemoryProperties2KHR : instance->vkGetPhysicalDeviceMemoryProperties2,
|
||||
device->vkGetDeviceBufferMemoryRequirements,
|
||||
device->vkGetDeviceImageMemoryRequirements
|
||||
};
|
||||
}
|
||||
|
||||
template<class Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
||||
VULKAN_HPP_CONSTEXPR VulkanFunctions functionsFromDispatcher(Dispatch const & dispatch
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT) VULKAN_HPP_NOEXCEPT {
|
||||
return functionsFromDispatcher(&dispatch, &dispatch);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
478
src/java.desktop/share/native/libvmahpp/vk_mem_alloc_enums.hpp
Normal file
478
src/java.desktop/share/native/libvmahpp/vk_mem_alloc_enums.hpp
Normal file
@@ -0,0 +1,478 @@
|
||||
#ifndef VULKAN_MEMORY_ALLOCATOR_ENUMS_HPP
|
||||
#define VULKAN_MEMORY_ALLOCATOR_ENUMS_HPP
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
enum class AllocatorCreateFlagBits : VmaAllocatorCreateFlags {
|
||||
eExternallySynchronized = VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT,
|
||||
eKhrDedicatedAllocation = VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT,
|
||||
eKhrBindMemory2 = VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT,
|
||||
eExtMemoryBudget = VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT,
|
||||
eAmdDeviceCoherentMemory = VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT,
|
||||
eBufferDeviceAddress = VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT,
|
||||
eExtMemoryPriority = VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT
|
||||
};
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(AllocatorCreateFlagBits value) {
|
||||
if (value == AllocatorCreateFlagBits::eExternallySynchronized) return "ExternallySynchronized";
|
||||
if (value == AllocatorCreateFlagBits::eKhrDedicatedAllocation) return "KhrDedicatedAllocation";
|
||||
if (value == AllocatorCreateFlagBits::eKhrBindMemory2) return "KhrBindMemory2";
|
||||
if (value == AllocatorCreateFlagBits::eExtMemoryBudget) return "ExtMemoryBudget";
|
||||
if (value == AllocatorCreateFlagBits::eAmdDeviceCoherentMemory) return "AmdDeviceCoherentMemory";
|
||||
if (value == AllocatorCreateFlagBits::eBufferDeviceAddress) return "BufferDeviceAddress";
|
||||
if (value == AllocatorCreateFlagBits::eExtMemoryPriority) return "ExtMemoryPriority";
|
||||
return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString(static_cast<uint32_t>(value)) + " )";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> struct FlagTraits<VMA_HPP_NAMESPACE::AllocatorCreateFlagBits> {
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR bool isBitmask = true;
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR Flags<VMA_HPP_NAMESPACE::AllocatorCreateFlagBits> allFlags =
|
||||
VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eExternallySynchronized
|
||||
| VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eKhrDedicatedAllocation
|
||||
| VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eKhrBindMemory2
|
||||
| VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eExtMemoryBudget
|
||||
| VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eAmdDeviceCoherentMemory
|
||||
| VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eBufferDeviceAddress
|
||||
| VMA_HPP_NAMESPACE::AllocatorCreateFlagBits::eExtMemoryPriority;
|
||||
};
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
using AllocatorCreateFlags = VULKAN_HPP_NAMESPACE::Flags<AllocatorCreateFlagBits>;
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR AllocatorCreateFlags operator|(AllocatorCreateFlagBits bit0, AllocatorCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return AllocatorCreateFlags(bit0) | bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR AllocatorCreateFlags operator&(AllocatorCreateFlagBits bit0, AllocatorCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return AllocatorCreateFlags(bit0) & bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR AllocatorCreateFlags operator^(AllocatorCreateFlagBits bit0, AllocatorCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return AllocatorCreateFlags(bit0) ^ bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR AllocatorCreateFlags operator~(AllocatorCreateFlagBits bits) VULKAN_HPP_NOEXCEPT {
|
||||
return ~(AllocatorCreateFlags(bits));
|
||||
}
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(AllocatorCreateFlags value) {
|
||||
if (!value) return "{}";
|
||||
std::string result;
|
||||
if (value & AllocatorCreateFlagBits::eExternallySynchronized) result += "ExternallySynchronized | ";
|
||||
if (value & AllocatorCreateFlagBits::eKhrDedicatedAllocation) result += "KhrDedicatedAllocation | ";
|
||||
if (value & AllocatorCreateFlagBits::eKhrBindMemory2) result += "KhrBindMemory2 | ";
|
||||
if (value & AllocatorCreateFlagBits::eExtMemoryBudget) result += "ExtMemoryBudget | ";
|
||||
if (value & AllocatorCreateFlagBits::eAmdDeviceCoherentMemory) result += "AmdDeviceCoherentMemory | ";
|
||||
if (value & AllocatorCreateFlagBits::eBufferDeviceAddress) result += "BufferDeviceAddress | ";
|
||||
if (value & AllocatorCreateFlagBits::eExtMemoryPriority) result += "ExtMemoryPriority | ";
|
||||
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
enum class MemoryUsage {
|
||||
eUnknown = VMA_MEMORY_USAGE_UNKNOWN,
|
||||
eGpuOnly = VMA_MEMORY_USAGE_GPU_ONLY,
|
||||
eCpuOnly = VMA_MEMORY_USAGE_CPU_ONLY,
|
||||
eCpuToGpu = VMA_MEMORY_USAGE_CPU_TO_GPU,
|
||||
eGpuToCpu = VMA_MEMORY_USAGE_GPU_TO_CPU,
|
||||
eCpuCopy = VMA_MEMORY_USAGE_CPU_COPY,
|
||||
eGpuLazilyAllocated = VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED,
|
||||
eAuto = VMA_MEMORY_USAGE_AUTO,
|
||||
eAutoPreferDevice = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE,
|
||||
eAutoPreferHost = VMA_MEMORY_USAGE_AUTO_PREFER_HOST
|
||||
};
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(MemoryUsage value) {
|
||||
if (value == MemoryUsage::eUnknown) return "Unknown";
|
||||
if (value == MemoryUsage::eGpuOnly) return "GpuOnly";
|
||||
if (value == MemoryUsage::eCpuOnly) return "CpuOnly";
|
||||
if (value == MemoryUsage::eCpuToGpu) return "CpuToGpu";
|
||||
if (value == MemoryUsage::eGpuToCpu) return "GpuToCpu";
|
||||
if (value == MemoryUsage::eCpuCopy) return "CpuCopy";
|
||||
if (value == MemoryUsage::eGpuLazilyAllocated) return "GpuLazilyAllocated";
|
||||
if (value == MemoryUsage::eAuto) return "Auto";
|
||||
if (value == MemoryUsage::eAutoPreferDevice) return "AutoPreferDevice";
|
||||
if (value == MemoryUsage::eAutoPreferHost) return "AutoPreferHost";
|
||||
return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString(static_cast<uint32_t>(value)) + " )";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
enum class AllocationCreateFlagBits : VmaAllocationCreateFlags {
|
||||
eDedicatedMemory = VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT,
|
||||
eNeverAllocate = VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT,
|
||||
eMapped = VMA_ALLOCATION_CREATE_MAPPED_BIT,
|
||||
eUserDataCopyString = VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT,
|
||||
eUpperAddress = VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT,
|
||||
eDontBind = VMA_ALLOCATION_CREATE_DONT_BIND_BIT,
|
||||
eWithinBudget = VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT,
|
||||
eCanAlias = VMA_ALLOCATION_CREATE_CAN_ALIAS_BIT,
|
||||
eHostAccessSequentialWrite = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT,
|
||||
eHostAccessRandom = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
|
||||
eHostAccessAllowTransferInstead = VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT,
|
||||
eStrategyMinMemory = VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT,
|
||||
eStrategyMinTime = VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT,
|
||||
eStrategyMinOffset = VMA_ALLOCATION_CREATE_STRATEGY_MIN_OFFSET_BIT,
|
||||
eStrategyBestFit = VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT,
|
||||
eStrategyFirstFit = VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT
|
||||
};
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(AllocationCreateFlagBits value) {
|
||||
if (value == AllocationCreateFlagBits::eDedicatedMemory) return "DedicatedMemory";
|
||||
if (value == AllocationCreateFlagBits::eNeverAllocate) return "NeverAllocate";
|
||||
if (value == AllocationCreateFlagBits::eMapped) return "Mapped";
|
||||
if (value == AllocationCreateFlagBits::eUserDataCopyString) return "UserDataCopyString";
|
||||
if (value == AllocationCreateFlagBits::eUpperAddress) return "UpperAddress";
|
||||
if (value == AllocationCreateFlagBits::eDontBind) return "DontBind";
|
||||
if (value == AllocationCreateFlagBits::eWithinBudget) return "WithinBudget";
|
||||
if (value == AllocationCreateFlagBits::eCanAlias) return "CanAlias";
|
||||
if (value == AllocationCreateFlagBits::eHostAccessSequentialWrite) return "HostAccessSequentialWrite";
|
||||
if (value == AllocationCreateFlagBits::eHostAccessRandom) return "HostAccessRandom";
|
||||
if (value == AllocationCreateFlagBits::eHostAccessAllowTransferInstead) return "HostAccessAllowTransferInstead";
|
||||
if (value == AllocationCreateFlagBits::eStrategyMinMemory) return "StrategyMinMemory";
|
||||
if (value == AllocationCreateFlagBits::eStrategyMinTime) return "StrategyMinTime";
|
||||
if (value == AllocationCreateFlagBits::eStrategyMinOffset) return "StrategyMinOffset";
|
||||
if (value == AllocationCreateFlagBits::eStrategyBestFit) return "StrategyBestFit";
|
||||
if (value == AllocationCreateFlagBits::eStrategyFirstFit) return "StrategyFirstFit";
|
||||
return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString(static_cast<uint32_t>(value)) + " )";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> struct FlagTraits<VMA_HPP_NAMESPACE::AllocationCreateFlagBits> {
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR bool isBitmask = true;
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR Flags<VMA_HPP_NAMESPACE::AllocationCreateFlagBits> allFlags =
|
||||
VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eDedicatedMemory
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eNeverAllocate
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eMapped
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eUserDataCopyString
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eUpperAddress
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eDontBind
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eWithinBudget
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eCanAlias
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eHostAccessSequentialWrite
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eHostAccessRandom
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eHostAccessAllowTransferInstead
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eStrategyMinMemory
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eStrategyMinTime
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eStrategyMinOffset
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eStrategyBestFit
|
||||
| VMA_HPP_NAMESPACE::AllocationCreateFlagBits::eStrategyFirstFit;
|
||||
};
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
using AllocationCreateFlags = VULKAN_HPP_NAMESPACE::Flags<AllocationCreateFlagBits>;
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR AllocationCreateFlags operator|(AllocationCreateFlagBits bit0, AllocationCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return AllocationCreateFlags(bit0) | bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR AllocationCreateFlags operator&(AllocationCreateFlagBits bit0, AllocationCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return AllocationCreateFlags(bit0) & bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR AllocationCreateFlags operator^(AllocationCreateFlagBits bit0, AllocationCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return AllocationCreateFlags(bit0) ^ bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR AllocationCreateFlags operator~(AllocationCreateFlagBits bits) VULKAN_HPP_NOEXCEPT {
|
||||
return ~(AllocationCreateFlags(bits));
|
||||
}
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(AllocationCreateFlags value) {
|
||||
if (!value) return "{}";
|
||||
std::string result;
|
||||
if (value & AllocationCreateFlagBits::eDedicatedMemory) result += "DedicatedMemory | ";
|
||||
if (value & AllocationCreateFlagBits::eNeverAllocate) result += "NeverAllocate | ";
|
||||
if (value & AllocationCreateFlagBits::eMapped) result += "Mapped | ";
|
||||
if (value & AllocationCreateFlagBits::eUserDataCopyString) result += "UserDataCopyString | ";
|
||||
if (value & AllocationCreateFlagBits::eUpperAddress) result += "UpperAddress | ";
|
||||
if (value & AllocationCreateFlagBits::eDontBind) result += "DontBind | ";
|
||||
if (value & AllocationCreateFlagBits::eWithinBudget) result += "WithinBudget | ";
|
||||
if (value & AllocationCreateFlagBits::eCanAlias) result += "CanAlias | ";
|
||||
if (value & AllocationCreateFlagBits::eHostAccessSequentialWrite) result += "HostAccessSequentialWrite | ";
|
||||
if (value & AllocationCreateFlagBits::eHostAccessRandom) result += "HostAccessRandom | ";
|
||||
if (value & AllocationCreateFlagBits::eHostAccessAllowTransferInstead) result += "HostAccessAllowTransferInstead | ";
|
||||
if (value & AllocationCreateFlagBits::eStrategyMinMemory) result += "StrategyMinMemory | ";
|
||||
if (value & AllocationCreateFlagBits::eStrategyMinTime) result += "StrategyMinTime | ";
|
||||
if (value & AllocationCreateFlagBits::eStrategyMinOffset) result += "StrategyMinOffset | ";
|
||||
if (value & AllocationCreateFlagBits::eStrategyBestFit) result += "StrategyBestFit | ";
|
||||
if (value & AllocationCreateFlagBits::eStrategyFirstFit) result += "StrategyFirstFit | ";
|
||||
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
enum class PoolCreateFlagBits : VmaPoolCreateFlags {
|
||||
eIgnoreBufferImageGranularity = VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT,
|
||||
eLinearAlgorithm = VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT
|
||||
};
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(PoolCreateFlagBits value) {
|
||||
if (value == PoolCreateFlagBits::eIgnoreBufferImageGranularity) return "IgnoreBufferImageGranularity";
|
||||
if (value == PoolCreateFlagBits::eLinearAlgorithm) return "LinearAlgorithm";
|
||||
return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString(static_cast<uint32_t>(value)) + " )";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> struct FlagTraits<VMA_HPP_NAMESPACE::PoolCreateFlagBits> {
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR bool isBitmask = true;
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR Flags<VMA_HPP_NAMESPACE::PoolCreateFlagBits> allFlags =
|
||||
VMA_HPP_NAMESPACE::PoolCreateFlagBits::eIgnoreBufferImageGranularity
|
||||
| VMA_HPP_NAMESPACE::PoolCreateFlagBits::eLinearAlgorithm;
|
||||
};
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
using PoolCreateFlags = VULKAN_HPP_NAMESPACE::Flags<PoolCreateFlagBits>;
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR PoolCreateFlags operator|(PoolCreateFlagBits bit0, PoolCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return PoolCreateFlags(bit0) | bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR PoolCreateFlags operator&(PoolCreateFlagBits bit0, PoolCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return PoolCreateFlags(bit0) & bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR PoolCreateFlags operator^(PoolCreateFlagBits bit0, PoolCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return PoolCreateFlags(bit0) ^ bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR PoolCreateFlags operator~(PoolCreateFlagBits bits) VULKAN_HPP_NOEXCEPT {
|
||||
return ~(PoolCreateFlags(bits));
|
||||
}
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(PoolCreateFlags value) {
|
||||
if (!value) return "{}";
|
||||
std::string result;
|
||||
if (value & PoolCreateFlagBits::eIgnoreBufferImageGranularity) result += "IgnoreBufferImageGranularity | ";
|
||||
if (value & PoolCreateFlagBits::eLinearAlgorithm) result += "LinearAlgorithm | ";
|
||||
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
enum class DefragmentationFlagBits : VmaDefragmentationFlags {
|
||||
eFlagAlgorithmFast = VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FAST_BIT,
|
||||
eFlagAlgorithmBalanced = VMA_DEFRAGMENTATION_FLAG_ALGORITHM_BALANCED_BIT,
|
||||
eFlagAlgorithmFull = VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FULL_BIT,
|
||||
eFlagAlgorithmExtensive = VMA_DEFRAGMENTATION_FLAG_ALGORITHM_EXTENSIVE_BIT
|
||||
};
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(DefragmentationFlagBits value) {
|
||||
if (value == DefragmentationFlagBits::eFlagAlgorithmFast) return "FlagAlgorithmFast";
|
||||
if (value == DefragmentationFlagBits::eFlagAlgorithmBalanced) return "FlagAlgorithmBalanced";
|
||||
if (value == DefragmentationFlagBits::eFlagAlgorithmFull) return "FlagAlgorithmFull";
|
||||
if (value == DefragmentationFlagBits::eFlagAlgorithmExtensive) return "FlagAlgorithmExtensive";
|
||||
return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString(static_cast<uint32_t>(value)) + " )";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> struct FlagTraits<VMA_HPP_NAMESPACE::DefragmentationFlagBits> {
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR bool isBitmask = true;
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR Flags<VMA_HPP_NAMESPACE::DefragmentationFlagBits> allFlags =
|
||||
VMA_HPP_NAMESPACE::DefragmentationFlagBits::eFlagAlgorithmFast
|
||||
| VMA_HPP_NAMESPACE::DefragmentationFlagBits::eFlagAlgorithmBalanced
|
||||
| VMA_HPP_NAMESPACE::DefragmentationFlagBits::eFlagAlgorithmFull
|
||||
| VMA_HPP_NAMESPACE::DefragmentationFlagBits::eFlagAlgorithmExtensive;
|
||||
};
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
using DefragmentationFlags = VULKAN_HPP_NAMESPACE::Flags<DefragmentationFlagBits>;
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR DefragmentationFlags operator|(DefragmentationFlagBits bit0, DefragmentationFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return DefragmentationFlags(bit0) | bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR DefragmentationFlags operator&(DefragmentationFlagBits bit0, DefragmentationFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return DefragmentationFlags(bit0) & bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR DefragmentationFlags operator^(DefragmentationFlagBits bit0, DefragmentationFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return DefragmentationFlags(bit0) ^ bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR DefragmentationFlags operator~(DefragmentationFlagBits bits) VULKAN_HPP_NOEXCEPT {
|
||||
return ~(DefragmentationFlags(bits));
|
||||
}
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(DefragmentationFlags value) {
|
||||
if (!value) return "{}";
|
||||
std::string result;
|
||||
if (value & DefragmentationFlagBits::eFlagAlgorithmFast) result += "FlagAlgorithmFast | ";
|
||||
if (value & DefragmentationFlagBits::eFlagAlgorithmBalanced) result += "FlagAlgorithmBalanced | ";
|
||||
if (value & DefragmentationFlagBits::eFlagAlgorithmFull) result += "FlagAlgorithmFull | ";
|
||||
if (value & DefragmentationFlagBits::eFlagAlgorithmExtensive) result += "FlagAlgorithmExtensive | ";
|
||||
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
enum class DefragmentationMoveOperation {
|
||||
eCopy = VMA_DEFRAGMENTATION_MOVE_OPERATION_COPY,
|
||||
eIgnore = VMA_DEFRAGMENTATION_MOVE_OPERATION_IGNORE,
|
||||
eDestroy = VMA_DEFRAGMENTATION_MOVE_OPERATION_DESTROY
|
||||
};
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(DefragmentationMoveOperation value) {
|
||||
if (value == DefragmentationMoveOperation::eCopy) return "Copy";
|
||||
if (value == DefragmentationMoveOperation::eIgnore) return "Ignore";
|
||||
if (value == DefragmentationMoveOperation::eDestroy) return "Destroy";
|
||||
return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString(static_cast<uint32_t>(value)) + " )";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
enum class VirtualBlockCreateFlagBits : VmaVirtualBlockCreateFlags {
|
||||
eLinearAlgorithm = VMA_VIRTUAL_BLOCK_CREATE_LINEAR_ALGORITHM_BIT
|
||||
};
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(VirtualBlockCreateFlagBits value) {
|
||||
if (value == VirtualBlockCreateFlagBits::eLinearAlgorithm) return "LinearAlgorithm";
|
||||
return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString(static_cast<uint32_t>(value)) + " )";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> struct FlagTraits<VMA_HPP_NAMESPACE::VirtualBlockCreateFlagBits> {
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR bool isBitmask = true;
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR Flags<VMA_HPP_NAMESPACE::VirtualBlockCreateFlagBits> allFlags =
|
||||
VMA_HPP_NAMESPACE::VirtualBlockCreateFlagBits::eLinearAlgorithm;
|
||||
};
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
using VirtualBlockCreateFlags = VULKAN_HPP_NAMESPACE::Flags<VirtualBlockCreateFlagBits>;
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR VirtualBlockCreateFlags operator|(VirtualBlockCreateFlagBits bit0, VirtualBlockCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return VirtualBlockCreateFlags(bit0) | bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR VirtualBlockCreateFlags operator&(VirtualBlockCreateFlagBits bit0, VirtualBlockCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return VirtualBlockCreateFlags(bit0) & bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR VirtualBlockCreateFlags operator^(VirtualBlockCreateFlagBits bit0, VirtualBlockCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return VirtualBlockCreateFlags(bit0) ^ bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR VirtualBlockCreateFlags operator~(VirtualBlockCreateFlagBits bits) VULKAN_HPP_NOEXCEPT {
|
||||
return ~(VirtualBlockCreateFlags(bits));
|
||||
}
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(VirtualBlockCreateFlags value) {
|
||||
if (!value) return "{}";
|
||||
std::string result;
|
||||
if (value & VirtualBlockCreateFlagBits::eLinearAlgorithm) result += "LinearAlgorithm | ";
|
||||
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
enum class VirtualAllocationCreateFlagBits : VmaVirtualAllocationCreateFlags {
|
||||
eUpperAddress = VMA_VIRTUAL_ALLOCATION_CREATE_UPPER_ADDRESS_BIT,
|
||||
eStrategyMinMemory = VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT,
|
||||
eStrategyMinTime = VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT,
|
||||
eStrategyMinOffset = VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_OFFSET_BIT
|
||||
};
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(VirtualAllocationCreateFlagBits value) {
|
||||
if (value == VirtualAllocationCreateFlagBits::eUpperAddress) return "UpperAddress";
|
||||
if (value == VirtualAllocationCreateFlagBits::eStrategyMinMemory) return "StrategyMinMemory";
|
||||
if (value == VirtualAllocationCreateFlagBits::eStrategyMinTime) return "StrategyMinTime";
|
||||
if (value == VirtualAllocationCreateFlagBits::eStrategyMinOffset) return "StrategyMinOffset";
|
||||
return "invalid ( " + VULKAN_HPP_NAMESPACE::toHexString(static_cast<uint32_t>(value)) + " )";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> struct FlagTraits<VMA_HPP_NAMESPACE::VirtualAllocationCreateFlagBits> {
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR bool isBitmask = true;
|
||||
static VULKAN_HPP_CONST_OR_CONSTEXPR Flags<VMA_HPP_NAMESPACE::VirtualAllocationCreateFlagBits> allFlags =
|
||||
VMA_HPP_NAMESPACE::VirtualAllocationCreateFlagBits::eUpperAddress
|
||||
| VMA_HPP_NAMESPACE::VirtualAllocationCreateFlagBits::eStrategyMinMemory
|
||||
| VMA_HPP_NAMESPACE::VirtualAllocationCreateFlagBits::eStrategyMinTime
|
||||
| VMA_HPP_NAMESPACE::VirtualAllocationCreateFlagBits::eStrategyMinOffset;
|
||||
};
|
||||
}
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
using VirtualAllocationCreateFlags = VULKAN_HPP_NAMESPACE::Flags<VirtualAllocationCreateFlagBits>;
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR VirtualAllocationCreateFlags operator|(VirtualAllocationCreateFlagBits bit0, VirtualAllocationCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return VirtualAllocationCreateFlags(bit0) | bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR VirtualAllocationCreateFlags operator&(VirtualAllocationCreateFlagBits bit0, VirtualAllocationCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return VirtualAllocationCreateFlags(bit0) & bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR VirtualAllocationCreateFlags operator^(VirtualAllocationCreateFlagBits bit0, VirtualAllocationCreateFlagBits bit1) VULKAN_HPP_NOEXCEPT {
|
||||
return VirtualAllocationCreateFlags(bit0) ^ bit1;
|
||||
}
|
||||
|
||||
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR VirtualAllocationCreateFlags operator~(VirtualAllocationCreateFlagBits bits) VULKAN_HPP_NOEXCEPT {
|
||||
return ~(VirtualAllocationCreateFlags(bits));
|
||||
}
|
||||
|
||||
# if !defined( VULKAN_HPP_NO_TO_STRING )
|
||||
VULKAN_HPP_INLINE std::string to_string(VirtualAllocationCreateFlags value) {
|
||||
if (!value) return "{}";
|
||||
std::string result;
|
||||
if (value & VirtualAllocationCreateFlagBits::eUpperAddress) result += "UpperAddress | ";
|
||||
if (value & VirtualAllocationCreateFlagBits::eStrategyMinMemory) result += "StrategyMinMemory | ";
|
||||
if (value & VirtualAllocationCreateFlagBits::eStrategyMinTime) result += "StrategyMinTime | ";
|
||||
if (value & VirtualAllocationCreateFlagBits::eStrategyMinOffset) result += "StrategyMinOffset | ";
|
||||
return "{ " + result.substr( 0, result.size() - 3 ) + " }";
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif
|
||||
1049
src/java.desktop/share/native/libvmahpp/vk_mem_alloc_funcs.hpp
Normal file
1049
src/java.desktop/share/native/libvmahpp/vk_mem_alloc_funcs.hpp
Normal file
File diff suppressed because it is too large
Load Diff
935
src/java.desktop/share/native/libvmahpp/vk_mem_alloc_handles.hpp
Normal file
935
src/java.desktop/share/native/libvmahpp/vk_mem_alloc_handles.hpp
Normal file
@@ -0,0 +1,935 @@
|
||||
#ifndef VULKAN_MEMORY_ALLOCATOR_HANDLES_HPP
|
||||
#define VULKAN_MEMORY_ALLOCATOR_HANDLES_HPP
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
struct DeviceMemoryCallbacks;
|
||||
struct VulkanFunctions;
|
||||
struct AllocatorCreateInfo;
|
||||
struct AllocatorInfo;
|
||||
struct Statistics;
|
||||
struct DetailedStatistics;
|
||||
struct TotalStatistics;
|
||||
struct Budget;
|
||||
struct AllocationCreateInfo;
|
||||
struct PoolCreateInfo;
|
||||
struct AllocationInfo;
|
||||
struct DefragmentationInfo;
|
||||
struct DefragmentationMove;
|
||||
struct DefragmentationPassMoveInfo;
|
||||
struct DefragmentationStats;
|
||||
struct VirtualBlockCreateInfo;
|
||||
struct VirtualAllocationCreateInfo;
|
||||
struct VirtualAllocationInfo;
|
||||
|
||||
class Allocator;
|
||||
class Pool;
|
||||
class Allocation;
|
||||
class DefragmentationContext;
|
||||
class VirtualAllocation;
|
||||
class VirtualBlock;
|
||||
}
|
||||
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
class Pool {
|
||||
public:
|
||||
using CType = VmaPool;
|
||||
using NativeType = VmaPool;
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR Pool() = default;
|
||||
VULKAN_HPP_CONSTEXPR Pool(std::nullptr_t) VULKAN_HPP_NOEXCEPT {}
|
||||
VULKAN_HPP_TYPESAFE_EXPLICIT Pool(VmaPool pool) VULKAN_HPP_NOEXCEPT : m_pool(pool) {}
|
||||
|
||||
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
|
||||
Pool& operator=(VmaPool pool) VULKAN_HPP_NOEXCEPT {
|
||||
m_pool = pool;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
Pool& operator=(std::nullptr_t) VULKAN_HPP_NOEXCEPT {
|
||||
m_pool = {};
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
auto operator<=>(Pool const &) const = default;
|
||||
#else
|
||||
bool operator==(Pool const & rhs) const VULKAN_HPP_NOEXCEPT {
|
||||
return m_pool == rhs.m_pool;
|
||||
}
|
||||
#endif
|
||||
|
||||
VULKAN_HPP_TYPESAFE_EXPLICIT operator VmaPool() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_pool;
|
||||
}
|
||||
|
||||
explicit operator bool() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_pool != VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
bool operator!() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_pool == VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
private:
|
||||
VmaPool m_pool = {};
|
||||
};
|
||||
VULKAN_HPP_STATIC_ASSERT(sizeof(Pool) == sizeof(VmaPool),
|
||||
"handle and wrapper have different size!");
|
||||
}
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> class UniqueHandleTraits<VMA_HPP_NAMESPACE::Pool, VMA_HPP_NAMESPACE::Dispatcher> {
|
||||
public:
|
||||
using deleter = VMA_HPP_NAMESPACE::Deleter<VMA_HPP_NAMESPACE::Pool, VMA_HPP_NAMESPACE::Allocator>;
|
||||
};
|
||||
}
|
||||
namespace VMA_HPP_NAMESPACE { using UniquePool = VULKAN_HPP_NAMESPACE::UniqueHandle<Pool, Dispatcher>; }
|
||||
#endif
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
class Allocation {
|
||||
public:
|
||||
using CType = VmaAllocation;
|
||||
using NativeType = VmaAllocation;
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR Allocation() = default;
|
||||
VULKAN_HPP_CONSTEXPR Allocation(std::nullptr_t) VULKAN_HPP_NOEXCEPT {}
|
||||
VULKAN_HPP_TYPESAFE_EXPLICIT Allocation(VmaAllocation allocation) VULKAN_HPP_NOEXCEPT : m_allocation(allocation) {}
|
||||
|
||||
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
|
||||
Allocation& operator=(VmaAllocation allocation) VULKAN_HPP_NOEXCEPT {
|
||||
m_allocation = allocation;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
Allocation& operator=(std::nullptr_t) VULKAN_HPP_NOEXCEPT {
|
||||
m_allocation = {};
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
auto operator<=>(Allocation const &) const = default;
|
||||
#else
|
||||
bool operator==(Allocation const & rhs) const VULKAN_HPP_NOEXCEPT {
|
||||
return m_allocation == rhs.m_allocation;
|
||||
}
|
||||
#endif
|
||||
|
||||
VULKAN_HPP_TYPESAFE_EXPLICIT operator VmaAllocation() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_allocation;
|
||||
}
|
||||
|
||||
explicit operator bool() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_allocation != VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
bool operator!() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_allocation == VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
private:
|
||||
VmaAllocation m_allocation = {};
|
||||
};
|
||||
VULKAN_HPP_STATIC_ASSERT(sizeof(Allocation) == sizeof(VmaAllocation),
|
||||
"handle and wrapper have different size!");
|
||||
}
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> class UniqueHandleTraits<VMA_HPP_NAMESPACE::Allocation, VMA_HPP_NAMESPACE::Dispatcher> {
|
||||
public:
|
||||
using deleter = VMA_HPP_NAMESPACE::Deleter<VMA_HPP_NAMESPACE::Allocation, VMA_HPP_NAMESPACE::Allocator>;
|
||||
};
|
||||
}
|
||||
namespace VMA_HPP_NAMESPACE { using UniqueAllocation = VULKAN_HPP_NAMESPACE::UniqueHandle<Allocation, Dispatcher>; }
|
||||
#endif
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
class DefragmentationContext {
|
||||
public:
|
||||
using CType = VmaDefragmentationContext;
|
||||
using NativeType = VmaDefragmentationContext;
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR DefragmentationContext() = default;
|
||||
VULKAN_HPP_CONSTEXPR DefragmentationContext(std::nullptr_t) VULKAN_HPP_NOEXCEPT {}
|
||||
VULKAN_HPP_TYPESAFE_EXPLICIT DefragmentationContext(VmaDefragmentationContext defragmentationContext) VULKAN_HPP_NOEXCEPT : m_defragmentationContext(defragmentationContext) {}
|
||||
|
||||
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
|
||||
DefragmentationContext& operator=(VmaDefragmentationContext defragmentationContext) VULKAN_HPP_NOEXCEPT {
|
||||
m_defragmentationContext = defragmentationContext;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
DefragmentationContext& operator=(std::nullptr_t) VULKAN_HPP_NOEXCEPT {
|
||||
m_defragmentationContext = {};
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
auto operator<=>(DefragmentationContext const &) const = default;
|
||||
#else
|
||||
bool operator==(DefragmentationContext const & rhs) const VULKAN_HPP_NOEXCEPT {
|
||||
return m_defragmentationContext == rhs.m_defragmentationContext;
|
||||
}
|
||||
#endif
|
||||
|
||||
VULKAN_HPP_TYPESAFE_EXPLICIT operator VmaDefragmentationContext() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_defragmentationContext;
|
||||
}
|
||||
|
||||
explicit operator bool() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_defragmentationContext != VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
bool operator!() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_defragmentationContext == VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
private:
|
||||
VmaDefragmentationContext m_defragmentationContext = {};
|
||||
};
|
||||
VULKAN_HPP_STATIC_ASSERT(sizeof(DefragmentationContext) == sizeof(VmaDefragmentationContext),
|
||||
"handle and wrapper have different size!");
|
||||
}
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> class UniqueHandleTraits<VMA_HPP_NAMESPACE::DefragmentationContext, VMA_HPP_NAMESPACE::Dispatcher> {
|
||||
public:
|
||||
using deleter = VMA_HPP_NAMESPACE::Deleter<VMA_HPP_NAMESPACE::DefragmentationContext, void>;
|
||||
};
|
||||
}
|
||||
namespace VMA_HPP_NAMESPACE { using UniqueDefragmentationContext = VULKAN_HPP_NAMESPACE::UniqueHandle<DefragmentationContext, Dispatcher>; }
|
||||
#endif
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
class Allocator {
|
||||
public:
|
||||
using CType = VmaAllocator;
|
||||
using NativeType = VmaAllocator;
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR Allocator() = default;
|
||||
VULKAN_HPP_CONSTEXPR Allocator(std::nullptr_t) VULKAN_HPP_NOEXCEPT {}
|
||||
VULKAN_HPP_TYPESAFE_EXPLICIT Allocator(VmaAllocator allocator) VULKAN_HPP_NOEXCEPT : m_allocator(allocator) {}
|
||||
|
||||
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
|
||||
Allocator& operator=(VmaAllocator allocator) VULKAN_HPP_NOEXCEPT {
|
||||
m_allocator = allocator;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
Allocator& operator=(std::nullptr_t) VULKAN_HPP_NOEXCEPT {
|
||||
m_allocator = {};
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
auto operator<=>(Allocator const &) const = default;
|
||||
#else
|
||||
bool operator==(Allocator const & rhs) const VULKAN_HPP_NOEXCEPT {
|
||||
return m_allocator == rhs.m_allocator;
|
||||
}
|
||||
#endif
|
||||
|
||||
VULKAN_HPP_TYPESAFE_EXPLICIT operator VmaAllocator() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_allocator;
|
||||
}
|
||||
|
||||
explicit operator bool() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_allocator != VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
bool operator!() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_allocator == VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void destroy() const;
|
||||
#else
|
||||
void destroy() const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS AllocatorInfo getAllocatorInfo() const;
|
||||
#endif
|
||||
void getAllocatorInfo(AllocatorInfo* allocatorInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS const VULKAN_HPP_NAMESPACE::PhysicalDeviceProperties* getPhysicalDeviceProperties() const;
|
||||
#endif
|
||||
void getPhysicalDeviceProperties(const VULKAN_HPP_NAMESPACE::PhysicalDeviceProperties** physicalDeviceProperties) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS const VULKAN_HPP_NAMESPACE::PhysicalDeviceMemoryProperties* getMemoryProperties() const;
|
||||
#endif
|
||||
void getMemoryProperties(const VULKAN_HPP_NAMESPACE::PhysicalDeviceMemoryProperties** physicalDeviceMemoryProperties) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_NAMESPACE::MemoryPropertyFlags getMemoryTypeProperties(uint32_t memoryTypeIndex) const;
|
||||
#endif
|
||||
void getMemoryTypeProperties(uint32_t memoryTypeIndex,
|
||||
VULKAN_HPP_NAMESPACE::MemoryPropertyFlags* flags) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void setCurrentFrameIndex(uint32_t frameIndex) const;
|
||||
#else
|
||||
void setCurrentFrameIndex(uint32_t frameIndex) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS TotalStatistics calculateStatistics() const;
|
||||
#endif
|
||||
void calculateStatistics(TotalStatistics* stats) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
template<typename VectorAllocator = std::allocator<Budget>,
|
||||
typename B = VectorAllocator,
|
||||
typename std::enable_if<std::is_same<typename B::value_type, Budget>::value, int>::type = 0>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS std::vector<Budget, VectorAllocator> getHeapBudgets(VectorAllocator& vectorAllocator) const;
|
||||
|
||||
template<typename VectorAllocator = std::allocator<Budget>>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS std::vector<Budget, VectorAllocator> getHeapBudgets() const;
|
||||
#endif
|
||||
void getHeapBudgets(Budget* budgets) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<uint32_t>::type findMemoryTypeIndex(uint32_t memoryTypeBits,
|
||||
const AllocationCreateInfo& allocationCreateInfo) const;
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result findMemoryTypeIndex(uint32_t memoryTypeBits,
|
||||
const AllocationCreateInfo* allocationCreateInfo,
|
||||
uint32_t* memoryTypeIndex) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<uint32_t>::type findMemoryTypeIndexForBufferInfo(const VULKAN_HPP_NAMESPACE::BufferCreateInfo& bufferCreateInfo,
|
||||
const AllocationCreateInfo& allocationCreateInfo) const;
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result findMemoryTypeIndexForBufferInfo(const VULKAN_HPP_NAMESPACE::BufferCreateInfo* bufferCreateInfo,
|
||||
const AllocationCreateInfo* allocationCreateInfo,
|
||||
uint32_t* memoryTypeIndex) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<uint32_t>::type findMemoryTypeIndexForImageInfo(const VULKAN_HPP_NAMESPACE::ImageCreateInfo& imageCreateInfo,
|
||||
const AllocationCreateInfo& allocationCreateInfo) const;
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result findMemoryTypeIndexForImageInfo(const VULKAN_HPP_NAMESPACE::ImageCreateInfo* imageCreateInfo,
|
||||
const AllocationCreateInfo* allocationCreateInfo,
|
||||
uint32_t* memoryTypeIndex) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<Pool>::type createPool(const PoolCreateInfo& createInfo) const;
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<UniquePool>::type createPoolUnique(const PoolCreateInfo& createInfo) const;
|
||||
#endif
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result createPool(const PoolCreateInfo* createInfo,
|
||||
Pool* pool) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void destroyPool(Pool pool) const;
|
||||
#else
|
||||
void destroyPool(Pool pool) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS Statistics getPoolStatistics(Pool pool) const;
|
||||
#endif
|
||||
void getPoolStatistics(Pool pool,
|
||||
Statistics* poolStats) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS DetailedStatistics calculatePoolStatistics(Pool pool) const;
|
||||
#endif
|
||||
void calculatePoolStatistics(Pool pool,
|
||||
DetailedStatistics* poolStats) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type checkPoolCorruption(Pool pool) const;
|
||||
#else
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result checkPoolCorruption(Pool pool) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS const char* getPoolName(Pool pool) const;
|
||||
#endif
|
||||
void getPoolName(Pool pool,
|
||||
const char** name) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void setPoolName(Pool pool,
|
||||
const char* name) const;
|
||||
#else
|
||||
void setPoolName(Pool pool,
|
||||
const char* name) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<Allocation>::type allocateMemory(const VULKAN_HPP_NAMESPACE::MemoryRequirements& vkMemoryRequirements,
|
||||
const AllocationCreateInfo& createInfo,
|
||||
VULKAN_HPP_NAMESPACE::Optional<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<UniqueAllocation>::type allocateMemoryUnique(const VULKAN_HPP_NAMESPACE::MemoryRequirements& vkMemoryRequirements,
|
||||
const AllocationCreateInfo& createInfo,
|
||||
VULKAN_HPP_NAMESPACE::Optional<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#endif
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result allocateMemory(const VULKAN_HPP_NAMESPACE::MemoryRequirements* vkMemoryRequirements,
|
||||
const AllocationCreateInfo* createInfo,
|
||||
Allocation* allocation,
|
||||
AllocationInfo* allocationInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
template<typename VectorAllocator = std::allocator<Allocation>,
|
||||
typename B = VectorAllocator,
|
||||
typename std::enable_if<std::is_same<typename B::value_type, Allocation>::value, int>::type = 0>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<std::vector<Allocation, VectorAllocator>>::type allocateMemoryPages(VULKAN_HPP_NAMESPACE::ArrayProxy<const VULKAN_HPP_NAMESPACE::MemoryRequirements> vkMemoryRequirements,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxy<const AllocationCreateInfo> createInfo,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxyNoTemporaries<AllocationInfo> allocationInfo,
|
||||
VectorAllocator& vectorAllocator) const;
|
||||
|
||||
template<typename VectorAllocator = std::allocator<Allocation>>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<std::vector<Allocation, VectorAllocator>>::type allocateMemoryPages(VULKAN_HPP_NAMESPACE::ArrayProxy<const VULKAN_HPP_NAMESPACE::MemoryRequirements> vkMemoryRequirements,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxy<const AllocationCreateInfo> createInfo,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxyNoTemporaries<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
template<typename VectorAllocator = std::allocator<UniqueAllocation>,
|
||||
typename B = VectorAllocator,
|
||||
typename std::enable_if<std::is_same<typename B::value_type, UniqueAllocation>::value, int>::type = 0>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<std::vector<UniqueAllocation, VectorAllocator>>::type allocateMemoryPagesUnique(VULKAN_HPP_NAMESPACE::ArrayProxy<const VULKAN_HPP_NAMESPACE::MemoryRequirements> vkMemoryRequirements,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxy<const AllocationCreateInfo> createInfo,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxyNoTemporaries<AllocationInfo> allocationInfo,
|
||||
VectorAllocator& vectorAllocator) const;
|
||||
|
||||
template<typename VectorAllocator = std::allocator<UniqueAllocation>>
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<std::vector<UniqueAllocation, VectorAllocator>>::type allocateMemoryPagesUnique(VULKAN_HPP_NAMESPACE::ArrayProxy<const VULKAN_HPP_NAMESPACE::MemoryRequirements> vkMemoryRequirements,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxy<const AllocationCreateInfo> createInfo,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxyNoTemporaries<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#endif
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result allocateMemoryPages(const VULKAN_HPP_NAMESPACE::MemoryRequirements* vkMemoryRequirements,
|
||||
const AllocationCreateInfo* createInfo,
|
||||
size_t allocationCount,
|
||||
Allocation* allocations,
|
||||
AllocationInfo* allocationInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<Allocation>::type allocateMemoryForBuffer(VULKAN_HPP_NAMESPACE::Buffer buffer,
|
||||
const AllocationCreateInfo& createInfo,
|
||||
VULKAN_HPP_NAMESPACE::Optional<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<UniqueAllocation>::type allocateMemoryForBufferUnique(VULKAN_HPP_NAMESPACE::Buffer buffer,
|
||||
const AllocationCreateInfo& createInfo,
|
||||
VULKAN_HPP_NAMESPACE::Optional<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#endif
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result allocateMemoryForBuffer(VULKAN_HPP_NAMESPACE::Buffer buffer,
|
||||
const AllocationCreateInfo* createInfo,
|
||||
Allocation* allocation,
|
||||
AllocationInfo* allocationInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<Allocation>::type allocateMemoryForImage(VULKAN_HPP_NAMESPACE::Image image,
|
||||
const AllocationCreateInfo& createInfo,
|
||||
VULKAN_HPP_NAMESPACE::Optional<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<UniqueAllocation>::type allocateMemoryForImageUnique(VULKAN_HPP_NAMESPACE::Image image,
|
||||
const AllocationCreateInfo& createInfo,
|
||||
VULKAN_HPP_NAMESPACE::Optional<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#endif
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result allocateMemoryForImage(VULKAN_HPP_NAMESPACE::Image image,
|
||||
const AllocationCreateInfo* createInfo,
|
||||
Allocation* allocation,
|
||||
AllocationInfo* allocationInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void freeMemory(Allocation allocation) const;
|
||||
#else
|
||||
void freeMemory(Allocation allocation) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void freeMemoryPages(VULKAN_HPP_NAMESPACE::ArrayProxy<const Allocation> allocations) const;
|
||||
#endif
|
||||
void freeMemoryPages(size_t allocationCount,
|
||||
const Allocation* allocations) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS AllocationInfo getAllocationInfo(Allocation allocation) const;
|
||||
#endif
|
||||
void getAllocationInfo(Allocation allocation,
|
||||
AllocationInfo* allocationInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void setAllocationUserData(Allocation allocation,
|
||||
void* userData) const;
|
||||
#else
|
||||
void setAllocationUserData(Allocation allocation,
|
||||
void* userData) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void setAllocationName(Allocation allocation,
|
||||
const char* name) const;
|
||||
#else
|
||||
void setAllocationName(Allocation allocation,
|
||||
const char* name) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_NAMESPACE::MemoryPropertyFlags getAllocationMemoryProperties(Allocation allocation) const;
|
||||
#endif
|
||||
void getAllocationMemoryProperties(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::MemoryPropertyFlags* flags) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<void*>::type mapMemory(Allocation allocation) const;
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result mapMemory(Allocation allocation,
|
||||
void** data) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void unmapMemory(Allocation allocation) const;
|
||||
#else
|
||||
void unmapMemory(Allocation allocation) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type flushAllocation(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize offset,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size) const;
|
||||
#else
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result flushAllocation(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize offset,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type invalidateAllocation(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize offset,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size) const;
|
||||
#else
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result invalidateAllocation(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize offset,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize size) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type flushAllocations(VULKAN_HPP_NAMESPACE::ArrayProxy<const Allocation> allocations,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxy<const VULKAN_HPP_NAMESPACE::DeviceSize> offsets,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxy<const VULKAN_HPP_NAMESPACE::DeviceSize> sizes) const;
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result flushAllocations(uint32_t allocationCount,
|
||||
const Allocation* allocations,
|
||||
const VULKAN_HPP_NAMESPACE::DeviceSize* offsets,
|
||||
const VULKAN_HPP_NAMESPACE::DeviceSize* sizes) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type invalidateAllocations(VULKAN_HPP_NAMESPACE::ArrayProxy<const Allocation> allocations,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxy<const VULKAN_HPP_NAMESPACE::DeviceSize> offsets,
|
||||
VULKAN_HPP_NAMESPACE::ArrayProxy<const VULKAN_HPP_NAMESPACE::DeviceSize> sizes) const;
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result invalidateAllocations(uint32_t allocationCount,
|
||||
const Allocation* allocations,
|
||||
const VULKAN_HPP_NAMESPACE::DeviceSize* offsets,
|
||||
const VULKAN_HPP_NAMESPACE::DeviceSize* sizes) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type checkCorruption(uint32_t memoryTypeBits) const;
|
||||
#else
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result checkCorruption(uint32_t memoryTypeBits) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<DefragmentationContext>::type beginDefragmentation(const DefragmentationInfo& info) const;
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result beginDefragmentation(const DefragmentationInfo* info,
|
||||
DefragmentationContext* context) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void endDefragmentation(DefragmentationContext context,
|
||||
VULKAN_HPP_NAMESPACE::Optional<DefragmentationStats> stats = nullptr) const;
|
||||
#endif
|
||||
void endDefragmentation(DefragmentationContext context,
|
||||
DefragmentationStats* stats) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<DefragmentationPassMoveInfo>::type beginDefragmentationPass(DefragmentationContext context) const;
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result beginDefragmentationPass(DefragmentationContext context,
|
||||
DefragmentationPassMoveInfo* passInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<DefragmentationPassMoveInfo>::type endDefragmentationPass(DefragmentationContext context) const;
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result endDefragmentationPass(DefragmentationContext context,
|
||||
DefragmentationPassMoveInfo* passInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type bindBufferMemory(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::Buffer buffer) const;
|
||||
#else
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result bindBufferMemory(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::Buffer buffer) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type bindBufferMemory2(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize allocationLocalOffset,
|
||||
VULKAN_HPP_NAMESPACE::Buffer buffer,
|
||||
const void* next) const;
|
||||
#else
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result bindBufferMemory2(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize allocationLocalOffset,
|
||||
VULKAN_HPP_NAMESPACE::Buffer buffer,
|
||||
const void* next) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type bindImageMemory(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::Image image) const;
|
||||
#else
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result bindImageMemory(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::Image image) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type bindImageMemory2(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize allocationLocalOffset,
|
||||
VULKAN_HPP_NAMESPACE::Image image,
|
||||
const void* next) const;
|
||||
#else
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result bindImageMemory2(Allocation allocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize allocationLocalOffset,
|
||||
VULKAN_HPP_NAMESPACE::Image image,
|
||||
const void* next) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<std::pair<VULKAN_HPP_NAMESPACE::Buffer, Allocation>>::type createBuffer(const VULKAN_HPP_NAMESPACE::BufferCreateInfo& bufferCreateInfo,
|
||||
const AllocationCreateInfo& allocationCreateInfo,
|
||||
VULKAN_HPP_NAMESPACE::Optional<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<std::pair<UniqueBuffer, UniqueAllocation>>::type createBufferUnique(const VULKAN_HPP_NAMESPACE::BufferCreateInfo& bufferCreateInfo,
|
||||
const AllocationCreateInfo& allocationCreateInfo,
|
||||
VULKAN_HPP_NAMESPACE::Optional<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#endif
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result createBuffer(const VULKAN_HPP_NAMESPACE::BufferCreateInfo* bufferCreateInfo,
|
||||
const AllocationCreateInfo* allocationCreateInfo,
|
||||
VULKAN_HPP_NAMESPACE::Buffer* buffer,
|
||||
Allocation* allocation,
|
||||
AllocationInfo* allocationInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<std::pair<VULKAN_HPP_NAMESPACE::Buffer, Allocation>>::type createBufferWithAlignment(const VULKAN_HPP_NAMESPACE::BufferCreateInfo& bufferCreateInfo,
|
||||
const AllocationCreateInfo& allocationCreateInfo,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize minAlignment,
|
||||
VULKAN_HPP_NAMESPACE::Optional<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<std::pair<UniqueBuffer, UniqueAllocation>>::type createBufferWithAlignmentUnique(const VULKAN_HPP_NAMESPACE::BufferCreateInfo& bufferCreateInfo,
|
||||
const AllocationCreateInfo& allocationCreateInfo,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize minAlignment,
|
||||
VULKAN_HPP_NAMESPACE::Optional<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#endif
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result createBufferWithAlignment(const VULKAN_HPP_NAMESPACE::BufferCreateInfo* bufferCreateInfo,
|
||||
const AllocationCreateInfo* allocationCreateInfo,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize minAlignment,
|
||||
VULKAN_HPP_NAMESPACE::Buffer* buffer,
|
||||
Allocation* allocation,
|
||||
AllocationInfo* allocationInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<VULKAN_HPP_NAMESPACE::Buffer>::type createAliasingBuffer(Allocation allocation,
|
||||
const VULKAN_HPP_NAMESPACE::BufferCreateInfo& bufferCreateInfo) const;
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result createAliasingBuffer(Allocation allocation,
|
||||
const VULKAN_HPP_NAMESPACE::BufferCreateInfo* bufferCreateInfo,
|
||||
VULKAN_HPP_NAMESPACE::Buffer* buffer) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void destroyBuffer(VULKAN_HPP_NAMESPACE::Buffer buffer,
|
||||
Allocation allocation) const;
|
||||
#else
|
||||
void destroyBuffer(VULKAN_HPP_NAMESPACE::Buffer buffer,
|
||||
Allocation allocation) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<std::pair<VULKAN_HPP_NAMESPACE::Image, Allocation>>::type createImage(const VULKAN_HPP_NAMESPACE::ImageCreateInfo& imageCreateInfo,
|
||||
const AllocationCreateInfo& allocationCreateInfo,
|
||||
VULKAN_HPP_NAMESPACE::Optional<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<std::pair<UniqueImage, UniqueAllocation>>::type createImageUnique(const VULKAN_HPP_NAMESPACE::ImageCreateInfo& imageCreateInfo,
|
||||
const AllocationCreateInfo& allocationCreateInfo,
|
||||
VULKAN_HPP_NAMESPACE::Optional<AllocationInfo> allocationInfo = nullptr) const;
|
||||
#endif
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result createImage(const VULKAN_HPP_NAMESPACE::ImageCreateInfo* imageCreateInfo,
|
||||
const AllocationCreateInfo* allocationCreateInfo,
|
||||
VULKAN_HPP_NAMESPACE::Image* image,
|
||||
Allocation* allocation,
|
||||
AllocationInfo* allocationInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<VULKAN_HPP_NAMESPACE::Image>::type createAliasingImage(Allocation allocation,
|
||||
const VULKAN_HPP_NAMESPACE::ImageCreateInfo& imageCreateInfo) const;
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result createAliasingImage(Allocation allocation,
|
||||
const VULKAN_HPP_NAMESPACE::ImageCreateInfo* imageCreateInfo,
|
||||
VULKAN_HPP_NAMESPACE::Image* image) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void destroyImage(VULKAN_HPP_NAMESPACE::Image image,
|
||||
Allocation allocation) const;
|
||||
#else
|
||||
void destroyImage(VULKAN_HPP_NAMESPACE::Image image,
|
||||
Allocation allocation) const;
|
||||
#endif
|
||||
|
||||
#if VMA_STATS_STRING_ENABLED
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS char* buildStatsString(VULKAN_HPP_NAMESPACE::Bool32 detailedMap) const;
|
||||
#endif
|
||||
void buildStatsString(char** statsString,
|
||||
VULKAN_HPP_NAMESPACE::Bool32 detailedMap) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void freeStatsString(char* statsString) const;
|
||||
#else
|
||||
void freeStatsString(char* statsString) const;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
private:
|
||||
VmaAllocator m_allocator = {};
|
||||
};
|
||||
VULKAN_HPP_STATIC_ASSERT(sizeof(Allocator) == sizeof(VmaAllocator),
|
||||
"handle and wrapper have different size!");
|
||||
}
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> class UniqueHandleTraits<VMA_HPP_NAMESPACE::Allocator, VMA_HPP_NAMESPACE::Dispatcher> {
|
||||
public:
|
||||
using deleter = VMA_HPP_NAMESPACE::Deleter<VMA_HPP_NAMESPACE::Allocator, void>;
|
||||
};
|
||||
}
|
||||
namespace VMA_HPP_NAMESPACE { using UniqueAllocator = VULKAN_HPP_NAMESPACE::UniqueHandle<Allocator, Dispatcher>; }
|
||||
#endif
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
class VirtualAllocation {
|
||||
public:
|
||||
using CType = VmaVirtualAllocation;
|
||||
using NativeType = VmaVirtualAllocation;
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR VirtualAllocation() = default;
|
||||
VULKAN_HPP_CONSTEXPR VirtualAllocation(std::nullptr_t) VULKAN_HPP_NOEXCEPT {}
|
||||
VULKAN_HPP_TYPESAFE_EXPLICIT VirtualAllocation(VmaVirtualAllocation virtualAllocation) VULKAN_HPP_NOEXCEPT : m_virtualAllocation(virtualAllocation) {}
|
||||
|
||||
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
|
||||
VirtualAllocation& operator=(VmaVirtualAllocation virtualAllocation) VULKAN_HPP_NOEXCEPT {
|
||||
m_virtualAllocation = virtualAllocation;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
VirtualAllocation& operator=(std::nullptr_t) VULKAN_HPP_NOEXCEPT {
|
||||
m_virtualAllocation = {};
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
auto operator<=>(VirtualAllocation const &) const = default;
|
||||
#else
|
||||
bool operator==(VirtualAllocation const & rhs) const VULKAN_HPP_NOEXCEPT {
|
||||
return m_virtualAllocation == rhs.m_virtualAllocation;
|
||||
}
|
||||
#endif
|
||||
|
||||
VULKAN_HPP_TYPESAFE_EXPLICIT operator VmaVirtualAllocation() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_virtualAllocation;
|
||||
}
|
||||
|
||||
explicit operator bool() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_virtualAllocation != VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
bool operator!() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_virtualAllocation == VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
private:
|
||||
VmaVirtualAllocation m_virtualAllocation = {};
|
||||
};
|
||||
VULKAN_HPP_STATIC_ASSERT(sizeof(VirtualAllocation) == sizeof(VmaVirtualAllocation),
|
||||
"handle and wrapper have different size!");
|
||||
}
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> class UniqueHandleTraits<VMA_HPP_NAMESPACE::VirtualAllocation, VMA_HPP_NAMESPACE::Dispatcher> {
|
||||
public:
|
||||
using deleter = VMA_HPP_NAMESPACE::Deleter<VMA_HPP_NAMESPACE::VirtualAllocation, VMA_HPP_NAMESPACE::VirtualBlock>;
|
||||
};
|
||||
}
|
||||
namespace VMA_HPP_NAMESPACE { using UniqueVirtualAllocation = VULKAN_HPP_NAMESPACE::UniqueHandle<VirtualAllocation, Dispatcher>; }
|
||||
#endif
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
class VirtualBlock {
|
||||
public:
|
||||
using CType = VmaVirtualBlock;
|
||||
using NativeType = VmaVirtualBlock;
|
||||
public:
|
||||
VULKAN_HPP_CONSTEXPR VirtualBlock() = default;
|
||||
VULKAN_HPP_CONSTEXPR VirtualBlock(std::nullptr_t) VULKAN_HPP_NOEXCEPT {}
|
||||
VULKAN_HPP_TYPESAFE_EXPLICIT VirtualBlock(VmaVirtualBlock virtualBlock) VULKAN_HPP_NOEXCEPT : m_virtualBlock(virtualBlock) {}
|
||||
|
||||
#if defined(VULKAN_HPP_TYPESAFE_CONVERSION)
|
||||
VirtualBlock& operator=(VmaVirtualBlock virtualBlock) VULKAN_HPP_NOEXCEPT {
|
||||
m_virtualBlock = virtualBlock;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
VirtualBlock& operator=(std::nullptr_t) VULKAN_HPP_NOEXCEPT {
|
||||
m_virtualBlock = {};
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR )
|
||||
auto operator<=>(VirtualBlock const &) const = default;
|
||||
#else
|
||||
bool operator==(VirtualBlock const & rhs) const VULKAN_HPP_NOEXCEPT {
|
||||
return m_virtualBlock == rhs.m_virtualBlock;
|
||||
}
|
||||
#endif
|
||||
|
||||
VULKAN_HPP_TYPESAFE_EXPLICIT operator VmaVirtualBlock() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_virtualBlock;
|
||||
}
|
||||
|
||||
explicit operator bool() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_virtualBlock != VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
bool operator!() const VULKAN_HPP_NOEXCEPT {
|
||||
return m_virtualBlock == VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void destroy() const;
|
||||
#else
|
||||
void destroy() const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_NAMESPACE::Bool32 isVirtualBlockEmpty() const;
|
||||
#else
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Bool32 isVirtualBlockEmpty() const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VirtualAllocationInfo getVirtualAllocationInfo(VirtualAllocation allocation) const;
|
||||
#endif
|
||||
void getVirtualAllocationInfo(VirtualAllocation allocation,
|
||||
VirtualAllocationInfo* virtualAllocInfo) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<VirtualAllocation>::type virtualAllocate(const VirtualAllocationCreateInfo& createInfo,
|
||||
VULKAN_HPP_NAMESPACE::Optional<VULKAN_HPP_NAMESPACE::DeviceSize> offset = nullptr) const;
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<UniqueVirtualAllocation>::type virtualAllocateUnique(const VirtualAllocationCreateInfo& createInfo,
|
||||
VULKAN_HPP_NAMESPACE::Optional<VULKAN_HPP_NAMESPACE::DeviceSize> offset = nullptr) const;
|
||||
#endif
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result virtualAllocate(const VirtualAllocationCreateInfo* createInfo,
|
||||
VirtualAllocation* allocation,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize* offset) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void virtualFree(VirtualAllocation allocation) const;
|
||||
#else
|
||||
void virtualFree(VirtualAllocation allocation) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void clearVirtualBlock() const;
|
||||
#else
|
||||
void clearVirtualBlock() const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void setVirtualAllocationUserData(VirtualAllocation allocation,
|
||||
void* userData) const;
|
||||
#else
|
||||
void setVirtualAllocationUserData(VirtualAllocation allocation,
|
||||
void* userData) const;
|
||||
#endif
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS Statistics getVirtualBlockStatistics() const;
|
||||
#endif
|
||||
void getVirtualBlockStatistics(Statistics* stats) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS DetailedStatistics calculateVirtualBlockStatistics() const;
|
||||
#endif
|
||||
void calculateVirtualBlockStatistics(DetailedStatistics* stats) const;
|
||||
|
||||
#if VMA_STATS_STRING_ENABLED
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS char* buildVirtualBlockStatsString(VULKAN_HPP_NAMESPACE::Bool32 detailedMap) const;
|
||||
#endif
|
||||
void buildVirtualBlockStatsString(char** statsString,
|
||||
VULKAN_HPP_NAMESPACE::Bool32 detailedMap) const;
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
void freeVirtualBlockStatsString(char* statsString) const;
|
||||
#else
|
||||
void freeVirtualBlockStatsString(char* statsString) const;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
private:
|
||||
VmaVirtualBlock m_virtualBlock = {};
|
||||
};
|
||||
VULKAN_HPP_STATIC_ASSERT(sizeof(VirtualBlock) == sizeof(VmaVirtualBlock),
|
||||
"handle and wrapper have different size!");
|
||||
}
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
namespace VULKAN_HPP_NAMESPACE {
|
||||
template<> class UniqueHandleTraits<VMA_HPP_NAMESPACE::VirtualBlock, VMA_HPP_NAMESPACE::Dispatcher> {
|
||||
public:
|
||||
using deleter = VMA_HPP_NAMESPACE::Deleter<VMA_HPP_NAMESPACE::VirtualBlock, void>;
|
||||
};
|
||||
}
|
||||
namespace VMA_HPP_NAMESPACE { using UniqueVirtualBlock = VULKAN_HPP_NAMESPACE::UniqueHandle<VirtualBlock, Dispatcher>; }
|
||||
#endif
|
||||
|
||||
namespace VMA_HPP_NAMESPACE {
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<Allocator>::type createAllocator(const AllocatorCreateInfo& createInfo);
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<UniqueAllocator>::type createAllocatorUnique(const AllocatorCreateInfo& createInfo);
|
||||
#endif
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result createAllocator(const AllocatorCreateInfo* createInfo,
|
||||
Allocator* allocator);
|
||||
|
||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<VirtualBlock>::type createVirtualBlock(const VirtualBlockCreateInfo& createInfo);
|
||||
#ifndef VULKAN_HPP_NO_SMART_HANDLE
|
||||
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename VULKAN_HPP_NAMESPACE::ResultValueType<UniqueVirtualBlock>::type createVirtualBlockUnique(const VirtualBlockCreateInfo& createInfo);
|
||||
#endif
|
||||
#endif
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::Result createVirtualBlock(const VirtualBlockCreateInfo* createInfo,
|
||||
VirtualBlock* virtualBlock);
|
||||
}
|
||||
#endif
|
||||
1829
src/java.desktop/share/native/libvmahpp/vk_mem_alloc_structs.hpp
Normal file
1829
src/java.desktop/share/native/libvmahpp/vk_mem_alloc_structs.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -234,11 +234,11 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
this.visible = v;
|
||||
if (this.visible) {
|
||||
final String title = getTitle();
|
||||
final boolean isPopup = target instanceof Window window && window.getType() == Window.Type.POPUP;
|
||||
final boolean isWlPopup = targetIsWlPopup();
|
||||
final int thisWidth = getWidth();
|
||||
final int thisHeight = getHeight();
|
||||
performLocked(() -> {
|
||||
if (isPopup) {
|
||||
if (isWlPopup) {
|
||||
Window popup = (Window) target;
|
||||
final Component popupParent = AWTAccessor.getWindowAccessor().getPopupParent(popup);
|
||||
final int parentWidth = popupParent.getWidth();
|
||||
@@ -281,6 +281,16 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if our target should be treated as a popup in Wayland's sense,
|
||||
* i.e. it has to have a parent to position relative to.
|
||||
*/
|
||||
private boolean targetIsWlPopup() {
|
||||
return target instanceof Window window
|
||||
&& window.getType() == Window.Type.POPUP
|
||||
&& AWTAccessor.getWindowAccessor().getPopupParent(window) != null;
|
||||
}
|
||||
|
||||
void configureWLSurface() {
|
||||
synchronized (sizeLock) {
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
@@ -373,23 +383,24 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
WLToolkit.postEvent(new ComponentEvent(getTarget(), ComponentEvent.COMPONENT_MOVED));
|
||||
}
|
||||
|
||||
synchronized(sizeLock) {
|
||||
final boolean sizeChanged = this.width != width || this.height != height;
|
||||
if (sizeChanged) {
|
||||
Rectangle oldBounds = getVisibleBounds();
|
||||
final boolean sizeChanged = oldBounds.width != width || oldBounds.height != height;
|
||||
if (sizeChanged) {
|
||||
synchronized (sizeLock) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine(String.format("%s is resizing its buffer to %dx%d with %dx scale", this, getBufferWidth(), getBufferHeight(), getBufferScale()));
|
||||
}
|
||||
SurfaceData.convertTo(WLSurfaceDataExt.class, surfaceData).revalidate(
|
||||
getBufferWidth(), getBufferHeight(), getBufferScale());
|
||||
updateWindowGeometry();
|
||||
layout();
|
||||
|
||||
WLToolkit.postEvent(new ComponentEvent(getTarget(), ComponentEvent.COMPONENT_RESIZED));
|
||||
}
|
||||
postPaintEvent();
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
log.fine(String.format("%s is resizing its buffer to %dx%d with %dx scale", this, getBufferWidth(), getBufferHeight(), getBufferScale()));
|
||||
}
|
||||
SurfaceData.convertTo(WLSurfaceDataExt.class, surfaceData).revalidate(
|
||||
getBufferWidth(), getBufferHeight(), getBufferScale());
|
||||
updateWindowGeometry();
|
||||
layout();
|
||||
|
||||
WLToolkit.postEvent(new ComponentEvent(getTarget(), ComponentEvent.COMPONENT_RESIZED));
|
||||
}
|
||||
postPaintEvent();
|
||||
}
|
||||
|
||||
public Rectangle getVisibleBounds() {
|
||||
@@ -819,6 +830,10 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
performLocked(() -> nativeRequestUnsetFullScreen(nativePtr));
|
||||
}
|
||||
|
||||
final void activate() {
|
||||
performLocked(() -> nativeActivate(nativePtr));
|
||||
}
|
||||
|
||||
private static native void initIDs();
|
||||
|
||||
protected native long nativeCreateFrame();
|
||||
@@ -853,6 +868,7 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
private static native void nativeSetCursor(long pData);
|
||||
private static native long nativeGetPredefinedCursor(String name);
|
||||
private native void nativeShowWindowMenu(long ptr, int x, int y);
|
||||
private native void nativeActivate(long ptr);
|
||||
|
||||
static long getParentNativePtr(Component target) {
|
||||
Component parent = target.getParent();
|
||||
@@ -1002,11 +1018,11 @@ public class WLComponentPeer implements ComponentPeer {
|
||||
log.fine(String.format("%s configured to %dx%d", this, newWidth, newHeight));
|
||||
}
|
||||
|
||||
final boolean isPopup = target instanceof Window window && window.getType() == Window.Type.POPUP;
|
||||
boolean isWlPopup = targetIsWlPopup();
|
||||
|
||||
if (newWidth != 0 && newHeight != 0) performUnlocked(() ->target.setSize(newWidth, newHeight));
|
||||
|
||||
if (newWidth == 0 || newHeight == 0 || isPopup) {
|
||||
if (newWidth == 0 || newHeight == 0 || isWlPopup) {
|
||||
// From xdg-shell.xml: "If the width or height arguments are zero,
|
||||
// it means the client should decide its own window dimension".
|
||||
|
||||
|
||||
@@ -127,11 +127,6 @@ public class WLFramePeer extends WLDecoratedPeer implements FramePeer {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toFront() {
|
||||
//throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBack() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -73,10 +73,9 @@ public abstract class WLGraphicsConfig extends GraphicsConfiguration {
|
||||
|
||||
@Override
|
||||
public AffineTransform getNormalizingTransform() {
|
||||
// TODO: may not be able to implement this fully, but we can try
|
||||
// obtaining physical width/height from wl_output.geometry event.
|
||||
// Those may be 0, of course.
|
||||
return getDefaultTransform();
|
||||
double xScale = device.getResolutionX(this) / 72.0;
|
||||
double yScale = device.getResolutionY(this) / 72.0;
|
||||
return new AffineTransform(xScale, 0.0, 0.0, yScale, 0.0, 0.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,6 +31,7 @@ import sun.java2d.vulkan.WLVKGraphicsConfig;
|
||||
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Window;
|
||||
|
||||
@@ -39,6 +40,7 @@ import java.awt.Window;
|
||||
* in the multi-monitor setup. Whenever those change, this device is re-created.
|
||||
*/
|
||||
public class WLGraphicsDevice extends GraphicsDevice {
|
||||
private static final double MM_IN_INCH = 25.4;
|
||||
/**
|
||||
* ID of the corresponding wl_output object received from Wayland.
|
||||
*/
|
||||
@@ -60,16 +62,21 @@ public class WLGraphicsDevice extends GraphicsDevice {
|
||||
*/
|
||||
private volatile int y; // only changes when the device gets invalidated
|
||||
|
||||
private final int widthMm;
|
||||
private final int heightMm;
|
||||
|
||||
// Configs are always the same in size and scale
|
||||
private volatile WLGraphicsConfig[] configs = null;
|
||||
private volatile GraphicsConfiguration[] configs = null;
|
||||
|
||||
// The default config is an object from the configs array
|
||||
private volatile WLGraphicsConfig defaultConfig = null;
|
||||
|
||||
private WLGraphicsDevice(int id, int x, int y) {
|
||||
private WLGraphicsDevice(int id, int x, int y, int widthMm, int heightMm) {
|
||||
this.wlID = id;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.widthMm = widthMm;
|
||||
this.heightMm = heightMm;
|
||||
}
|
||||
|
||||
int getID() {
|
||||
@@ -77,23 +84,30 @@ public class WLGraphicsDevice extends GraphicsDevice {
|
||||
}
|
||||
|
||||
void updateConfiguration(String name, int width, int height, int scale) {
|
||||
this.name = name == null ? "wl_output." + wlID : name;
|
||||
this.name = name;
|
||||
|
||||
if (configs == null || configs[0].differsFrom(width, height, scale)) {
|
||||
WLGraphicsConfig config = defaultConfig;
|
||||
// Note that all configs are of equal size and scale
|
||||
if (config == null || config.differsFrom(width, height, scale)) {
|
||||
GraphicsConfiguration[] newConfigs;
|
||||
WLGraphicsConfig newDefaultConfig;
|
||||
// It is necessary to create a new object whenever config changes as its
|
||||
// identity is used to detect changes in scale, among other things.
|
||||
if (WLGraphicsEnvironment.isVulkanEnabled()) {
|
||||
defaultConfig = WLVKGraphicsConfig.getConfig(this, width, height, scale);
|
||||
configs = new WLGraphicsConfig[1];
|
||||
configs[0] = defaultConfig;
|
||||
newDefaultConfig = WLVKGraphicsConfig.getConfig(this, width, height, scale);
|
||||
newConfigs = new GraphicsConfiguration[1];
|
||||
newConfigs[0] = newDefaultConfig;
|
||||
} else {
|
||||
// TODO: Actually, Wayland may support a lot more shared memory buffer configurations, need to
|
||||
// subscribe to the wl_shm:format event and get the list from there.
|
||||
defaultConfig = WLSMGraphicsConfig.getConfig(this, width, height, scale, false);
|
||||
configs = new WLGraphicsConfig[2];
|
||||
configs[0] = defaultConfig;
|
||||
configs[1] = WLSMGraphicsConfig.getConfig(this, width, height, scale, true);
|
||||
newDefaultConfig = WLSMGraphicsConfig.getConfig(this, width, height, scale, false);
|
||||
newConfigs = new GraphicsConfiguration[2];
|
||||
newConfigs[0] = newDefaultConfig;
|
||||
newConfigs[1] = WLSMGraphicsConfig.getConfig(this, width, height, scale, true);
|
||||
}
|
||||
|
||||
configs = newConfigs;
|
||||
defaultConfig = newDefaultConfig;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,13 +121,17 @@ public class WLGraphicsDevice extends GraphicsDevice {
|
||||
this.x = similarDevice.x;
|
||||
this.y = similarDevice.y;
|
||||
|
||||
final int newScale = similarDevice.getScale();
|
||||
final Rectangle newBounds = similarDevice.defaultConfig.getBounds();
|
||||
int newScale = similarDevice.getScale();
|
||||
Rectangle newBounds = similarDevice.defaultConfig.getBounds();
|
||||
updateConfiguration(similarDevice.name, newBounds.width, newBounds.height, newScale);
|
||||
}
|
||||
|
||||
public static WLGraphicsDevice createWithConfiguration(int id, String name, int x, int y, int width, int height, int scale) {
|
||||
final WLGraphicsDevice device = new WLGraphicsDevice(id, x, y);
|
||||
public static WLGraphicsDevice createWithConfiguration(int id, String name,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
int widthMm, int heightMm,
|
||||
int scale) {
|
||||
WLGraphicsDevice device = new WLGraphicsDevice(id, x, y, widthMm, heightMm);
|
||||
device.updateConfiguration(name, width, height, scale);
|
||||
return device;
|
||||
}
|
||||
@@ -127,11 +145,17 @@ public class WLGraphicsDevice extends GraphicsDevice {
|
||||
}
|
||||
|
||||
boolean hasSameNameAs(WLGraphicsDevice otherDevice) {
|
||||
return name != null && otherDevice.name != null && name.equals(otherDevice.name);
|
||||
var localName = name;
|
||||
var otherName = otherDevice.name;
|
||||
return localName != null && localName.equals(otherName);
|
||||
}
|
||||
|
||||
boolean hasSameSizeAs(WLGraphicsDevice modelDevice) {
|
||||
return defaultConfig != null && modelDevice.defaultConfig != null && defaultConfig.getBounds().equals(modelDevice.defaultConfig.getBounds());
|
||||
var config = defaultConfig;
|
||||
var modelConfig = modelDevice.defaultConfig;
|
||||
return config != null
|
||||
&& modelConfig != null
|
||||
&& config.getBounds().equals(modelConfig.getBounds());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,6 +187,27 @@ public class WLGraphicsDevice extends GraphicsDevice {
|
||||
return defaultConfig.getScale();
|
||||
}
|
||||
|
||||
int getResolution() {
|
||||
Rectangle bounds = defaultConfig.getBounds();
|
||||
if (bounds.width == 0 || bounds.height == 0) return 0;
|
||||
|
||||
double diagonalPixel = Math.sqrt(bounds.width * bounds.width + bounds.height * bounds.height);
|
||||
double diagonalMm = Math.sqrt(widthMm * widthMm + heightMm * heightMm);
|
||||
return (int) (diagonalPixel / diagonalMm * MM_IN_INCH);
|
||||
}
|
||||
|
||||
int getResolutionX(WLGraphicsConfig config) {
|
||||
Rectangle bounds = config.getBounds();
|
||||
if (bounds.width == 0) return 0;
|
||||
return (int)((double)bounds.width / widthMm * MM_IN_INCH);
|
||||
}
|
||||
|
||||
int getResolutionY(WLGraphicsConfig config) {
|
||||
Rectangle bounds = config.getBounds();
|
||||
if (bounds.height == 0) return 0;
|
||||
return (int)((double)bounds.height / heightMm * MM_IN_INCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullScreenSupported() {
|
||||
return true;
|
||||
@@ -211,8 +256,13 @@ public class WLGraphicsDevice extends GraphicsDevice {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("WLGraphicsDevice: id=%d at (%d, %d) with %s",
|
||||
wlID, x, y,
|
||||
defaultConfig != null ? defaultConfig : "<no configs>");
|
||||
var config = defaultConfig;
|
||||
return String.format("WLGraphicsDevice: '%s' id=%d at (%d, %d) with %s",
|
||||
name, wlID, x, y,
|
||||
config != null ? config : "<no configs>");
|
||||
}
|
||||
|
||||
public Insets getInsets() {
|
||||
return new Insets(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,23 +45,43 @@ public class WLGraphicsEnvironment extends SunGraphicsEnvironment {
|
||||
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.wl.WLGraphicsEnvironment");
|
||||
|
||||
private static boolean vulkanEnabled = false;
|
||||
private static boolean verboseVulkanStatus = false;
|
||||
private static boolean vulkanRequested = false;
|
||||
private static int vulkanRequestedDeviceNumber = -1;
|
||||
@SuppressWarnings("removal")
|
||||
private static boolean vulkanRequested =
|
||||
private static String vulkanOption =
|
||||
AccessController.doPrivileged(
|
||||
(PrivilegedAction<Boolean>) () ->
|
||||
"true".equals(System.getProperty("sun.java2d.vulkan")));
|
||||
(PrivilegedAction<String>) () -> System.getProperty("sun.java2d.vulkan", ""));
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static String vulkanOptionDeviceNumber =
|
||||
AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) () -> System.getProperty("sun.java2d.vulkan.deviceNumber", "0"));
|
||||
|
||||
static {
|
||||
vulkanRequested = "true".equalsIgnoreCase(vulkanOption);
|
||||
try {
|
||||
vulkanRequestedDeviceNumber = Integer.parseInt(vulkanOptionDeviceNumber);
|
||||
} catch (NumberFormatException e) {
|
||||
log.warning("Invalid Vulkan device number:" + vulkanOptionDeviceNumber);
|
||||
}
|
||||
verboseVulkanStatus = "True".equals(vulkanOption);
|
||||
|
||||
|
||||
System.loadLibrary("awt");
|
||||
SurfaceManagerFactory.setInstance(new UnixSurfaceManagerFactory());
|
||||
if (vulkanRequested) {
|
||||
vulkanEnabled = initVKWL();
|
||||
vulkanEnabled = initVKWL(verboseVulkanStatus, vulkanRequestedDeviceNumber);
|
||||
}
|
||||
if (log.isLoggable(Level.FINE)) {
|
||||
log.fine("Vulkan rendering enabled: " + (vulkanEnabled?"YES":"NO"));
|
||||
}
|
||||
|
||||
// Make sure the toolkit is loaded because otherwise this GE is going to be empty
|
||||
WLToolkit.isInitialized();
|
||||
}
|
||||
|
||||
private static native boolean initVKWL();
|
||||
private static native boolean initVKWL(boolean verbose, int deviceNumber);
|
||||
|
||||
private WLGraphicsEnvironment() {
|
||||
}
|
||||
@@ -100,7 +120,8 @@ public class WLGraphicsEnvironment extends SunGraphicsEnvironment {
|
||||
|
||||
private final List<WLGraphicsDevice> devices = new ArrayList<>(5);
|
||||
|
||||
private void notifyOutputConfigured(String name, int wlID, int x, int y, int width, int height,
|
||||
private void notifyOutputConfigured(String name, String make, String model, int wlID,
|
||||
int x, int y, int width, int height, int widthMm, int heightMm,
|
||||
int subpixel, int transform, int scale) {
|
||||
// Called from native code whenever a new output appears or an existing one changes its properties
|
||||
// NB: initially called during WLToolkit.initIDs() on the main thread; later on EDT.
|
||||
@@ -108,6 +129,10 @@ public class WLGraphicsEnvironment extends SunGraphicsEnvironment {
|
||||
log.fine(String.format("Output configured id=%d at (%d, %d) %dx%d %dx scale", wlID, x, y, width, height, scale));
|
||||
}
|
||||
|
||||
String humanID =
|
||||
(name != null ? name + " " : "")
|
||||
+ (make != null ? make + " " : "")
|
||||
+ (model != null ? model : "");
|
||||
synchronized (devices) {
|
||||
boolean newOutput = true;
|
||||
for (int i = 0; i < devices.size(); i++) {
|
||||
@@ -115,9 +140,10 @@ public class WLGraphicsEnvironment extends SunGraphicsEnvironment {
|
||||
if (gd.getID() == wlID) {
|
||||
newOutput = false;
|
||||
if (gd.isSameDeviceAs(wlID, x, y)) {
|
||||
gd.updateConfiguration(name, width, height, scale);
|
||||
gd.updateConfiguration(humanID, width, height, scale);
|
||||
} else {
|
||||
final WLGraphicsDevice updatedDevice = WLGraphicsDevice.createWithConfiguration(wlID, name, x, y, width, height, scale);
|
||||
final WLGraphicsDevice updatedDevice = WLGraphicsDevice.createWithConfiguration(wlID, humanID,
|
||||
x, y, width, height, widthMm, heightMm, scale);
|
||||
devices.set(i, updatedDevice);
|
||||
gd.invalidate(updatedDevice);
|
||||
}
|
||||
@@ -125,7 +151,8 @@ public class WLGraphicsEnvironment extends SunGraphicsEnvironment {
|
||||
}
|
||||
}
|
||||
if (newOutput) {
|
||||
final WLGraphicsDevice gd = WLGraphicsDevice.createWithConfiguration(wlID, name, x, y, width, height, scale);
|
||||
final WLGraphicsDevice gd = WLGraphicsDevice.createWithConfiguration(wlID, humanID, x, y,
|
||||
width, height, widthMm, heightMm, scale);
|
||||
devices.add(gd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class WLKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
|
||||
|
||||
@Override
|
||||
public void setCurrentFocusOwner(Component comp) {
|
||||
if (comp != currentFocusedWindow) {
|
||||
if (comp != null && comp != currentFocusedWindow) {
|
||||
// In Wayland, only Window can be focused, not any widget in it.
|
||||
focusLog.severe("Unexpected focus owner set in a Window: " + comp);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ public class WLToolkit extends UNIXToolkit implements Runnable {
|
||||
* the next click is considered separate and not part of multi-click event.
|
||||
* @return maximum milliseconds between same mouse button clicks for them to be a multiclick
|
||||
*/
|
||||
static long getMulticlickTime() {
|
||||
static int getMulticlickTime() {
|
||||
/* TODO: get from the system somehow */
|
||||
return AWT_MULTICLICK_DEFAULT_TIME_MS;
|
||||
}
|
||||
@@ -814,8 +814,8 @@ public class WLToolkit extends UNIXToolkit implements Runnable {
|
||||
|
||||
@Override
|
||||
public int getScreenResolution() {
|
||||
// TODO
|
||||
return 150;
|
||||
var defaultScreen = (WLGraphicsDevice)WLGraphicsEnvironment.getSingleInstance().getDefaultScreenDevice();
|
||||
return defaultScreen.getResolution();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -855,8 +855,14 @@ public class WLToolkit extends UNIXToolkit implements Runnable {
|
||||
protected void initializeDesktopProperties() {
|
||||
super.initializeDesktopProperties();
|
||||
|
||||
desktopProperties.put("DnD.Autoscroll.initialDelay", 50);
|
||||
desktopProperties.put("DnD.Autoscroll.interval", 50);
|
||||
desktopProperties.put("DnD.Autoscroll.cursorHysteresis", 5);
|
||||
desktopProperties.put("Shell.shellFolderManager", "sun.awt.shell.ShellFolderManager");
|
||||
|
||||
if (!GraphicsEnvironment.isHeadless()) {
|
||||
desktopProperties.put("awt.mouse.numButtons", MOUSE_BUTTONS_COUNT);
|
||||
desktopProperties.put("awt.multiClickInterval", getMulticlickTime());
|
||||
desktopProperties.put("awt.mouse.numButtons", getNumberOfButtons());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -996,6 +1002,17 @@ public class WLToolkit extends UNIXToolkit implements Runnable {
|
||||
flushImpl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getScreenInsets(final GraphicsConfiguration gc) {
|
||||
final GraphicsDevice gd = gc.getDevice();
|
||||
if (gd instanceof WLGraphicsDevice device) {
|
||||
Insets insets = device.getInsets();
|
||||
return (Insets) insets.clone();
|
||||
} else {
|
||||
return super.getScreenInsets(gc);
|
||||
}
|
||||
}
|
||||
|
||||
private native int readEvents();
|
||||
private native void dispatchEventsOnEDT();
|
||||
private native void flushImpl();
|
||||
|
||||
@@ -89,7 +89,7 @@ public class WLWindowPeer extends WLComponentPeer implements WindowPeer {
|
||||
|
||||
@Override
|
||||
public void toFront() {
|
||||
// TODO
|
||||
activate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -67,7 +67,6 @@ public final class WLVKGraphicsConfig extends WLGraphicsConfig
|
||||
PlatformLogger.getLogger("sun.java2d.vulkan.WLVKGraphicsConfig");
|
||||
|
||||
private static ImageCapabilities imageCaps = new VKImageCaps();
|
||||
private final int maxTextureSize;
|
||||
|
||||
private BufferCapabilities bufferCaps;
|
||||
private ContextCapabilities vkCaps;
|
||||
@@ -75,17 +74,9 @@ public final class WLVKGraphicsConfig extends WLGraphicsConfig
|
||||
|
||||
private static native long getVKConfigInfo();
|
||||
|
||||
/**
|
||||
* Returns maximum texture size supported by Vulkan. Must be
|
||||
* called under VKRQ lock.
|
||||
*/
|
||||
private static native int nativeGetMaxTextureSize();
|
||||
|
||||
public WLVKGraphicsConfig(WLGraphicsDevice device, int width, int height, int scale, int maxTextureSize,
|
||||
ContextCapabilities vkCaps) {
|
||||
public WLVKGraphicsConfig(WLGraphicsDevice device, int width, int height, int scale, ContextCapabilities vkCaps) {
|
||||
super(device, width, height, scale);
|
||||
this.vkCaps = vkCaps;
|
||||
this.maxTextureSize = maxTextureSize;
|
||||
context = new VKContext(VKRenderQueue.getInstance());
|
||||
}
|
||||
|
||||
@@ -100,7 +91,7 @@ public final class WLVKGraphicsConfig extends WLGraphicsConfig
|
||||
CAPS_PS30 | CAPS_PS20 | CAPS_RT_TEXTURE_ALPHA |
|
||||
CAPS_RT_TEXTURE_OPAQUE | CAPS_MULTITEXTURE | CAPS_TEXNONPOW2 |
|
||||
CAPS_TEXNONSQUARE, null);
|
||||
return new WLVKGraphicsConfig(device, width, height, scale, nativeGetMaxTextureSize(), caps);
|
||||
return new WLVKGraphicsConfig(device, width, height, scale, caps);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,6 @@ public abstract class WLVKSurfaceData extends VKSurfaceData implements WLSurface
|
||||
|
||||
protected WLComponentPeer peer;
|
||||
protected WLVKGraphicsConfig graphicsConfig;
|
||||
private native void initOps(WLVKGraphicsConfig gc, WLComponentPeer peer);
|
||||
|
||||
@Override
|
||||
public native void assignSurface(long surfacePtr);
|
||||
|
||||
@@ -27,12 +27,4 @@
|
||||
#include "jni.h"
|
||||
#include "VKBase.h"
|
||||
|
||||
/*
|
||||
* Class: sun_java2d_vulkan_WLVKGraphicsConfig
|
||||
* Method: nativeGetMaxTextureSize
|
||||
* Signature: ()I
|
||||
*/
|
||||
extern "C" JNIEXPORT jint JNICALL Java_sun_java2d_vulkan_WLVKGraphicsConfig_nativeGetMaxTextureSize
|
||||
(JNIEnv *env, jclass vkgc) {
|
||||
return VK_MaxTextureSize();
|
||||
}
|
||||
// TODO ?
|
||||
|
||||
@@ -36,121 +36,32 @@
|
||||
|
||||
extern struct wl_display *wl_display;
|
||||
|
||||
/**
|
||||
* This is the implementation of the general surface LockFunc defined in
|
||||
* SurfaceData.h.
|
||||
*/
|
||||
jint
|
||||
WLVKSD_Lock(JNIEnv *env,
|
||||
SurfaceDataOps *ops,
|
||||
SurfaceDataRasInfo *pRasInfo,
|
||||
jint lockflags)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
VKSDOps *vsdo = (VKSDOps*)ops;
|
||||
J2dTrace1(J2D_TRACE_INFO, "WLVKSD_Unlock: %p\n", ops);
|
||||
pthread_mutex_lock(&((WLVKSDOps*)vsdo->privOps)->lock);
|
||||
#endif
|
||||
return SD_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
WLVKSD_GetRasInfo(JNIEnv *env,
|
||||
SurfaceDataOps *ops,
|
||||
SurfaceDataRasInfo *pRasInfo)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
VKSDOps *vsdo = (VKSDOps*)ops;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
WLVKSD_Unlock(JNIEnv *env,
|
||||
SurfaceDataOps *ops,
|
||||
SurfaceDataRasInfo *pRasInfo)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
VKSDOps *vsdo = (VKSDOps*)ops;
|
||||
J2dTrace1(J2D_TRACE_INFO, "WLVKSD_Unlock: %p\n", ops);
|
||||
pthread_mutex_unlock(&((WLVKSDOps*)vsdo->privOps)->lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
WLVKSD_Dispose(JNIEnv *env, SurfaceDataOps *ops)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
/* ops is assumed non-null as it is checked in SurfaceData_DisposeOps */
|
||||
VKSDOps *vsdo = (VKSDOps*)ops;
|
||||
J2dTrace1(J2D_TRACE_INFO, "WLSD_Dispose %p\n", ops);
|
||||
WLVKSDOps *wlvksdOps = (WLVKSDOps*)vsdo->privOps;
|
||||
pthread_mutex_destroy(&wlvksdOps->lock);
|
||||
if (wlvksdOps->wlvkSD !=nullptr) {
|
||||
delete wlvksdOps->wlvkSD;
|
||||
wlvksdOps->wlvkSD = nullptr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
extern "C" JNIEXPORT void JNICALL Java_sun_java2d_vulkan_WLVKSurfaceData_initOps
|
||||
(JNIEnv *env, jclass vksd, jint width, jint height, jint scale, jint backgroundRGB) {
|
||||
(JNIEnv *env, jobject vksd, jint width, jint height, jint scale, jint backgroundRGB) {
|
||||
#ifndef HEADLESS
|
||||
VKSDOps *vsdo = (VKSDOps*)SurfaceData_InitOps(env, vksd, sizeof(VKSDOps));
|
||||
J2dRlsTraceLn1(J2D_TRACE_INFO, "WLVKSurfaceData_initOps: %p", vsdo);
|
||||
jboolean hasException;
|
||||
if (vsdo == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (width <= 0) {
|
||||
width = 1;
|
||||
}
|
||||
if (height <= 0) {
|
||||
height = 1;
|
||||
}
|
||||
|
||||
WLVKSDOps *wlvksdOps = (WLVKSDOps *)malloc(sizeof(WLVKSDOps));
|
||||
|
||||
if (wlvksdOps == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "creating native WLVK ops");
|
||||
return;
|
||||
}
|
||||
|
||||
vsdo->privOps = wlvksdOps;
|
||||
vsdo->sdOps.Lock = WLVKSD_Lock;
|
||||
vsdo->sdOps.Unlock = WLVKSD_Unlock;
|
||||
vsdo->sdOps.GetRasInfo = WLVKSD_GetRasInfo;
|
||||
vsdo->sdOps.Dispose = WLVKSD_Dispose;
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
// Recursive mutex is required because blit can be done with both source
|
||||
// and destination being the same surface (during scrolling, for example).
|
||||
// So WLSD_Lock() should be able to lock the same surface twice in a row.
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
|
||||
pthread_mutex_init(&wlvksdOps->lock, &attr);
|
||||
wlvksdOps->wlvkSD = new WLVKSurfaceData(width, height, scale, backgroundRGB);
|
||||
J2dTrace3(J2D_TRACE_INFO, "Create WLVKSurfaceData with size %d x %d and scale %d\n", width, height, scale);
|
||||
width /= scale; // TODO This is incorrect, but we'll deal with this later, we probably need to do something on Wayland side for app-controlled scaling
|
||||
height /= scale; // TODO This is incorrect, but we'll deal with this later, we probably need to do something on Wayland side for app-controlled scaling
|
||||
auto *sd = new WLVKSurfaceData(width, height, scale, backgroundRGB);
|
||||
sd->attachToJavaSurface(env, vksd);
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_sun_java2d_vulkan_WLVKSurfaceData_assignSurface(JNIEnv *env, jobject wsd,
|
||||
jlong wlSurfacePtr)
|
||||
Java_sun_java2d_vulkan_WLVKSurfaceData_assignSurface(JNIEnv *env, jobject wsd, jlong wlSurfacePtr)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
VKSDOps *vsdo = (VKSDOps*)SurfaceData_GetOps(env, wsd);
|
||||
if (vsdo == NULL) {
|
||||
auto sd = (WLVKSurfaceData*)SurfaceData_GetOps(env, wsd);
|
||||
if (sd == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
WLVKSDOps *wlvksdOps = (WLVKSDOps*)vsdo->privOps;
|
||||
|
||||
wl_surface* wlSurface = (struct wl_surface*)jlong_to_ptr(wlSurfacePtr);
|
||||
auto wlSurface = (struct wl_surface*)jlong_to_ptr(wlSurfacePtr);
|
||||
J2dTraceLn2(J2D_TRACE_INFO, "WLVKSurfaceData_assignSurface wl_surface(%p) wl_display(%p)",
|
||||
wlSurface, wl_display);
|
||||
|
||||
try {
|
||||
wlvksdOps->wlvkSD->validate(wlSurface);
|
||||
sd->validate(wlSurface);
|
||||
} catch (std::exception& e) {
|
||||
J2dRlsTrace1(J2D_TRACE_ERROR, "WLVKSurfaceData_assignSurface: %s\n", e.what());
|
||||
}
|
||||
@@ -162,6 +73,7 @@ Java_sun_java2d_vulkan_WLVKSurfaceData_flush(JNIEnv *env, jobject wsd)
|
||||
{
|
||||
#ifndef HEADLESS
|
||||
J2dTrace(J2D_TRACE_INFO, "WLVKSurfaceData_flush\n");
|
||||
// TODO?
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
@@ -169,17 +81,17 @@ extern "C" JNIEXPORT void JNICALL
|
||||
Java_sun_java2d_vulkan_WLVKSurfaceData_revalidate(JNIEnv *env, jobject wsd,
|
||||
jint width, jint height, jint scale)
|
||||
{
|
||||
width /= scale; // TODO This is incorrect, but we'll deal with this later, we probably need to do something on Wayland side for app-controlled scaling
|
||||
height /= scale; // TODO This is incorrect, but we'll deal with this later, we probably need to do something on Wayland side for app-controlled scaling
|
||||
#ifndef HEADLESS
|
||||
VKSDOps *vsdo = (VKSDOps*)SurfaceData_GetOps(env, wsd);
|
||||
if (vsdo == NULL) {
|
||||
auto sd = (WLVKSurfaceData*)SurfaceData_GetOps(env, wsd);
|
||||
if (sd == nullptr) {
|
||||
return;
|
||||
}
|
||||
J2dTrace3(J2D_TRACE_INFO, "WLVKSurfaceData_revalidate to size %d x %d and scale %d\n", width, height, scale);
|
||||
|
||||
WLVKSDOps *wlvksdOps = (WLVKSDOps*)vsdo->privOps;
|
||||
try {
|
||||
wlvksdOps->wlvkSD->revalidate(width, height, scale);
|
||||
wlvksdOps->wlvkSD->update();
|
||||
sd->revalidate(width, height, scale);
|
||||
} catch (std::exception& e) {
|
||||
J2dRlsTrace1(J2D_TRACE_ERROR, "WLVKSurfaceData_revalidate: %s\n", e.what());
|
||||
}
|
||||
@@ -187,153 +99,18 @@ Java_sun_java2d_vulkan_WLVKSurfaceData_revalidate(JNIEnv *env, jobject wsd,
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
JNI_OnUnload(JavaVM *vm, void *reserved) {
|
||||
#ifndef HEADLESS
|
||||
VKGraphicsEnvironment::dispose();
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
|
||||
WLVKSurfaceData::WLVKSurfaceData(uint32_t w, uint32_t h, uint32_t s, uint32_t bgc)
|
||||
:VKSurfaceData(w, h, s, bgc), _wl_surface(nullptr), _surface_khr(nullptr), _swapchain_khr(nullptr)
|
||||
{
|
||||
J2dTrace3(J2D_TRACE_INFO, "Create WLVKSurfaceData with size %d x %d and scale %d\n", w, h, s);
|
||||
}
|
||||
|
||||
void WLVKSurfaceData::validate(wl_surface* wls)
|
||||
{
|
||||
if (wls ==_wl_surface) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto& device = VKGraphicsEnvironment::graphics_environment()->default_device();
|
||||
device.waitIdle(); // TODO wait until device is done with old swapchain
|
||||
auto surface = VKGraphicsEnvironment::graphics_environment()->vk_instance()
|
||||
.createWaylandSurfaceKHR({{}, wl_display, wls});
|
||||
|
||||
_wl_surface = wls;
|
||||
|
||||
vk::WaylandSurfaceCreateInfoKHR createInfoKhr = {
|
||||
{}, wl_display, _wl_surface
|
||||
};
|
||||
|
||||
_surface_khr =
|
||||
VKGraphicsEnvironment::graphics_environment()->vk_instance().createWaylandSurfaceKHR(
|
||||
createInfoKhr);
|
||||
reset(device, std::move(surface));
|
||||
revalidate(width(), height(), scale());
|
||||
update();
|
||||
}
|
||||
|
||||
void WLVKSurfaceData::revalidate(uint32_t w, uint32_t h, uint32_t s)
|
||||
{
|
||||
if (s == scale() && w == width() && h == height() ) {
|
||||
if (!*_surface_khr || *_swapchain_khr) {
|
||||
J2dTraceLn2(J2D_TRACE_INFO,
|
||||
"WLVKSurfaceData_revalidate is skipped: surface_khr(%p) swapchain_khr(%p)",
|
||||
*_surface_khr, *_swapchain_khr);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
VKSurfaceData::revalidate(w, h, s);
|
||||
if (!*_surface_khr) {
|
||||
J2dTraceLn1(J2D_TRACE_INFO,"WLVKSurfaceData_revalidate is skipped: surface_khr(%p)",
|
||||
*_surface_khr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
vk::SwapchainCreateInfoKHR swapchainCreateInfoKhr{
|
||||
{},
|
||||
*_surface_khr,
|
||||
1, vk::Format::eB8G8R8A8Unorm,
|
||||
vk::ColorSpaceKHR::eVkColorspaceSrgbNonlinear,
|
||||
{width()/scale(), height()/scale()},
|
||||
1,
|
||||
vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eTransferDst,
|
||||
vk::SharingMode::eExclusive,
|
||||
0,
|
||||
nullptr,
|
||||
vk::SurfaceTransformFlagBitsKHR::eIdentity,
|
||||
vk::CompositeAlphaFlagBitsKHR::eOpaque,
|
||||
vk::PresentModeKHR::eImmediate,
|
||||
false, *_swapchain_khr
|
||||
};
|
||||
|
||||
auto& device = VKGraphicsEnvironment::graphics_environment()->default_device();
|
||||
_swapchain_khr = device.createSwapchainKHR(swapchainCreateInfoKhr);
|
||||
}
|
||||
|
||||
void WLVKSurfaceData::set_bg_color(uint32_t bgc)
|
||||
{
|
||||
if (bg_color() == bgc) {
|
||||
return;
|
||||
}
|
||||
VKSurfaceData::set_bg_color(bgc);
|
||||
update();
|
||||
}
|
||||
|
||||
void WLVKSurfaceData::update()
|
||||
{
|
||||
if (!*_swapchain_khr) {
|
||||
return;
|
||||
}
|
||||
auto& device = VKGraphicsEnvironment::graphics_environment()->default_device();
|
||||
vk::SemaphoreCreateInfo semInfo = {};
|
||||
vk::raii::Semaphore presentCompleteSem = device.createSemaphore(semInfo);
|
||||
|
||||
std::pair<vk::Result, uint32_t> img = _swapchain_khr.acquireNextImage(0, *presentCompleteSem, nullptr);
|
||||
if (img.first!=vk::Result::eSuccess) {
|
||||
J2dRlsTraceLn(J2D_TRACE_INFO, "failed to get image");
|
||||
}
|
||||
else {
|
||||
J2dRlsTraceLn(J2D_TRACE_INFO, "obtained image");
|
||||
}
|
||||
auto images = _swapchain_khr.getImages();
|
||||
|
||||
vk::CommandPoolCreateInfo poolInfo{
|
||||
{vk::CommandPoolCreateFlagBits::eResetCommandBuffer},
|
||||
static_cast<uint32_t>(device.queue_family())
|
||||
};
|
||||
|
||||
auto pool = device.createCommandPool(poolInfo);
|
||||
|
||||
vk::CommandBufferAllocateInfo buffInfo{
|
||||
*pool, vk::CommandBufferLevel::ePrimary, (uint32_t) 1, nullptr
|
||||
};
|
||||
|
||||
auto buffers = device.allocateCommandBuffers(buffInfo);
|
||||
|
||||
vk::CommandBufferBeginInfo begInfo{
|
||||
};
|
||||
|
||||
uint32_t alpha = (bg_color() >> 24) & 0xFF;
|
||||
uint32_t red = (bg_color() >> 16) & 0xFF;
|
||||
uint32_t green = (bg_color() >> 8) & 0xFF;
|
||||
uint32_t blue = bg_color() & 0xFF;
|
||||
vk::ClearColorValue color = {
|
||||
static_cast<float>(red)/255.0f,
|
||||
static_cast<float>(green)/255.0f,
|
||||
static_cast<float>(blue)/255.0f,
|
||||
static_cast<float>(alpha)/255.0f
|
||||
};
|
||||
|
||||
std::vector<vk::ImageSubresourceRange> range = {{
|
||||
vk::ImageAspectFlagBits::eColor,
|
||||
0, 1, 0, 1}};
|
||||
buffers[0].begin(begInfo);
|
||||
buffers[0].clearColorImage(images[img.second], vk::ImageLayout::eSharedPresentKHR, color, range);
|
||||
buffers[0].end();
|
||||
|
||||
vk::SubmitInfo submitInfo{
|
||||
nullptr, nullptr, *buffers[0], nullptr
|
||||
};
|
||||
|
||||
auto queue = device.getQueue(device.queue_family(), 0);
|
||||
|
||||
queue.submit(submitInfo, nullptr);
|
||||
queue.waitIdle();
|
||||
vk::PresentInfoKHR presentInfo;
|
||||
presentInfo.swapchainCount = 1;
|
||||
presentInfo.pSwapchains = &*_swapchain_khr;
|
||||
presentInfo.pImageIndices = &(img.second);
|
||||
|
||||
queue.presentKHR(presentInfo);
|
||||
queue.waitIdle();
|
||||
device.waitIdle();
|
||||
}
|
||||
@@ -27,45 +27,18 @@
|
||||
#ifndef WLVKSurfaceData_h_Included
|
||||
#define WLVKSurfaceData_h_Included
|
||||
|
||||
#include <cstdlib>
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <SurfaceData.h>
|
||||
#include <VKBase.h>
|
||||
#include "VKSurfaceData.h"
|
||||
|
||||
#ifdef HEADLESS
|
||||
#define WLVKSDOps void
|
||||
#else /* HEADLESS */
|
||||
#ifndef HEADLESS
|
||||
|
||||
class WLVKSurfaceData : public VKSurfaceData {
|
||||
wl_surface* _wl_surface;
|
||||
vk::raii::SurfaceKHR _surface_khr;
|
||||
vk::raii::SwapchainKHR _swapchain_khr;
|
||||
class WLVKSurfaceData : public VKSwapchainSurfaceData {
|
||||
wl_surface* _wl_surface;
|
||||
public:
|
||||
WLVKSurfaceData(uint32_t w, uint32_t h, uint32_t s, uint32_t bgc);
|
||||
WLVKSurfaceData(uint32_t w, uint32_t h, uint32_t s, uint32_t bgc)
|
||||
: VKSwapchainSurfaceData(w, h, s, bgc), _wl_surface(nullptr) {}
|
||||
void validate(wl_surface* wls);
|
||||
void revalidate(uint32_t w, uint32_t h, uint32_t s);
|
||||
void set_bg_color(uint32_t bgc);
|
||||
void update();
|
||||
};
|
||||
|
||||
/**
|
||||
* The WLVKSDOps structure contains the WLVK-specific information for a given
|
||||
* WLVKSurfaceData. It is referenced by the native OGLSDOps structure.
|
||||
*
|
||||
* wl_surface* wlSurface;
|
||||
* For onscreen windows, we maintain a reference to that window's associated
|
||||
* wl_surface handle here. Offscreen surfaces have no associated Window, so for
|
||||
* those surfaces, this value will simply be zero.
|
||||
*
|
||||
* VkSurfaceKHR* surface;
|
||||
* Vulkan surface associated with this surface.
|
||||
*/
|
||||
typedef struct _WLVKSDOps {
|
||||
SurfaceDataOps sdOps;
|
||||
WLVKSurfaceData* wlvkSD;
|
||||
pthread_mutex_t lock;
|
||||
} WLVKSDOps;
|
||||
|
||||
#endif /* HEADLESS */
|
||||
|
||||
#endif /* WLVKSurfaceData_h_Included */
|
||||
|
||||
@@ -82,22 +82,9 @@ ReportFatalError(const char* file, int line, const char *msg)
|
||||
assert(0);
|
||||
}
|
||||
|
||||
static inline void
|
||||
AssertCalledOnEDT(const char* file, int line)
|
||||
{
|
||||
char threadName[16];
|
||||
pthread_getname_np(pthread_self(), threadName, sizeof(threadName));
|
||||
if (strncmp(threadName, "AWT-EventQueue", 14) != 0) {
|
||||
fprintf(stderr, "Assert failed (called on %s instead of EDT) at %s:%d\n", threadName, file, line);
|
||||
fflush(stderr);
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
AssertDrawLockIsHeld(WLSurfaceBufferManager* manager, const char * file, int line);
|
||||
|
||||
#define ASSERT_ON_EDT() AssertCalledOnEDT(__FILE__, __LINE__)
|
||||
#define WL_FATAL_ERROR(msg) ReportFatalError(__FILE__, __LINE__, msg)
|
||||
#define ASSERT_DRAW_LOCK_IS_HELD(manager) AssertDrawLockIsHeld(manager, __FILE__, __LINE__)
|
||||
#define ASSERT_SHOW_LOCK_IS_HELD(manager) AssertShowLockIsHeld(manager, __FILE__, __LINE__)
|
||||
@@ -770,7 +757,7 @@ WLSBM_Create(jint width, jint height, jint scale, jint bgPixel, jint wlShmFormat
|
||||
// both read from and written to (when scrolling, for instance).
|
||||
// So it needs to be able to be "locked" twice: once for writing and
|
||||
// once for reading.
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&manager->drawLock, &attr);
|
||||
DrawBufferCreate(manager);
|
||||
ShowBufferCreate(manager);
|
||||
|
||||
@@ -261,7 +261,7 @@ Java_sun_java2d_wl_WLSMSurfaceData_initOps(JNIEnv *env, jobject wsd,
|
||||
// Recursive mutex is required because blit can be done with both source
|
||||
// and destination being the same surface (during scrolling, for example).
|
||||
// So WLSD_Lock() should be able to lock the same surface twice in a row.
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&wsdo->lock, &attr);
|
||||
#endif /* !HEADLESS */
|
||||
}
|
||||
|
||||
@@ -44,12 +44,53 @@ static jmethodID notifyConfiguredMID;
|
||||
static jmethodID notifyEnteredOutputMID;
|
||||
static jmethodID notifyLeftOutputMID;
|
||||
|
||||
struct activation_token_list_item {
|
||||
struct xdg_activation_token_v1 *token;
|
||||
struct activation_token_list_item *next_item;
|
||||
};
|
||||
|
||||
static struct activation_token_list_item *add_token(struct activation_token_list_item *list,
|
||||
struct xdg_activation_token_v1 *token_to_add) {
|
||||
struct activation_token_list_item *new_item =
|
||||
(struct activation_token_list_item *) calloc(1, sizeof(struct activation_token_list_item));
|
||||
new_item->token = token_to_add;
|
||||
new_item->next_item = list;
|
||||
return new_item;
|
||||
}
|
||||
|
||||
static struct activation_token_list_item *delete_last_token(struct activation_token_list_item *list) {
|
||||
assert(list);
|
||||
xdg_activation_token_v1_destroy(list->token);
|
||||
struct activation_token_list_item *next_item = list->next_item;
|
||||
free(list);
|
||||
return next_item;
|
||||
}
|
||||
|
||||
static struct activation_token_list_item *delete_token(struct activation_token_list_item *list,
|
||||
struct xdg_activation_token_v1 *token_to_delete) {
|
||||
if (list == NULL) {
|
||||
return NULL;
|
||||
} else if (list->token == token_to_delete) {
|
||||
return delete_last_token(list);
|
||||
} else {
|
||||
list->next_item = delete_token(list->next_item, token_to_delete);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
static void delete_all_tokens(struct activation_token_list_item *list) {
|
||||
while (list) {
|
||||
list = delete_last_token(list);
|
||||
}
|
||||
}
|
||||
|
||||
struct WLFrame {
|
||||
jobject nativeFramePeer; // weak reference
|
||||
struct wl_surface *wl_surface;
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct WLFrame *parent;
|
||||
struct xdg_positioner *xdg_positioner;
|
||||
struct activation_token_list_item *activation_token_list;
|
||||
jboolean toplevel;
|
||||
union {
|
||||
struct xdg_toplevel *xdg_toplevel;
|
||||
@@ -224,6 +265,22 @@ static const struct xdg_popup_listener xdg_popup_listener = {
|
||||
.popup_done = xdg_popup_done,
|
||||
};
|
||||
|
||||
static void
|
||||
xdg_activation_token_v1_done(void *data,
|
||||
struct xdg_activation_token_v1 *xdg_activation_token_v1,
|
||||
const char *token) {
|
||||
struct WLFrame *frame = (struct WLFrame *) data;
|
||||
assert(frame);
|
||||
struct wl_surface *surface = frame->wl_surface;
|
||||
assert(surface);
|
||||
xdg_activation_v1_activate(xdg_activation_v1, token, surface);
|
||||
frame->activation_token_list = delete_token(frame->activation_token_list, xdg_activation_token_v1);
|
||||
}
|
||||
|
||||
static const struct xdg_activation_token_v1_listener xdg_activation_token_v1_listener = {
|
||||
.done = xdg_activation_token_v1_done,
|
||||
};
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_wl_WLComponentPeer_initIDs
|
||||
(JNIEnv *env, jclass clazz)
|
||||
@@ -440,6 +497,8 @@ DoHide(struct WLFrame *frame)
|
||||
}
|
||||
xdg_surface_destroy(frame->xdg_surface);
|
||||
wl_surface_destroy(frame->wl_surface);
|
||||
delete_all_tokens(frame->activation_token_list);
|
||||
frame->activation_token_list = NULL;
|
||||
frame->wl_surface = NULL;
|
||||
frame->xdg_surface = NULL;
|
||||
frame->xdg_toplevel = NULL;
|
||||
@@ -525,3 +584,20 @@ JNIEXPORT void JNICALL Java_sun_awt_wl_WLComponentPeer_nativeShowWindowMenu
|
||||
xdg_toplevel_show_window_menu(frame->xdg_toplevel, wl_seat, last_mouse_pressed_serial, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_awt_wl_WLComponentPeer_nativeActivate
|
||||
(JNIEnv *env, jobject obj, jlong ptr)
|
||||
{
|
||||
struct WLFrame *frame = jlong_to_ptr(ptr);
|
||||
if (frame->wl_surface && xdg_activation_v1 && wl_seat) {
|
||||
struct xdg_activation_token_v1 *token = xdg_activation_v1_get_activation_token(xdg_activation_v1);
|
||||
xdg_activation_token_v1_add_listener(token, &xdg_activation_token_v1_listener, frame);
|
||||
xdg_activation_token_v1_set_serial(token, last_input_or_focus_serial, wl_seat);
|
||||
if (wl_surface_in_focus) {
|
||||
xdg_activation_token_v1_set_surface(token, wl_surface_in_focus);
|
||||
}
|
||||
xdg_activation_token_v1_commit(token);
|
||||
frame->activation_token_list = add_token(frame->activation_token_list, token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,11 +43,15 @@ typedef struct WLOutput {
|
||||
int32_t y;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
int32_t width_mm;
|
||||
int32_t height_mm;
|
||||
|
||||
uint32_t subpixel;
|
||||
uint32_t transform;
|
||||
uint32_t scale;
|
||||
|
||||
char * make;
|
||||
char * model;
|
||||
char * name;
|
||||
} WLOutput;
|
||||
|
||||
@@ -79,6 +83,10 @@ wl_output_geometry(
|
||||
output->y = y;
|
||||
output->subpixel = subpixel;
|
||||
output->transform = transform;
|
||||
output->width_mm = physical_width;
|
||||
output->height_mm = physical_height;
|
||||
output->make = make != NULL ? strdup(make) : NULL;
|
||||
output->model = model != NULL ? strdup(model) : NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -138,16 +146,23 @@ wl_output_done(
|
||||
|
||||
JNIEnv *env = getEnv();
|
||||
jobject obj = (*env)->CallStaticObjectMethod(env, geClass, getSingleInstanceMID);
|
||||
JNU_CHECK_EXCEPTION(env);
|
||||
CHECK_NULL_THROW_IE(env, obj, "WLGraphicsEnvironment.getSingleInstance() returned null");
|
||||
jstring outputName = output->name ? JNU_NewStringPlatform(env, output->name) : NULL;
|
||||
jstring name = output->name ? JNU_NewStringPlatform(env, output->name) : NULL;
|
||||
jstring make = output->make ? JNU_NewStringPlatform(env, output->make) : NULL;
|
||||
jstring model = output->model ? JNU_NewStringPlatform(env, output->model) : NULL;
|
||||
JNU_CHECK_EXCEPTION(env);
|
||||
(*env)->CallVoidMethod(env, obj, notifyOutputConfiguredMID,
|
||||
outputName,
|
||||
name,
|
||||
make,
|
||||
model,
|
||||
output->id,
|
||||
output->x,
|
||||
output->y,
|
||||
output->width,
|
||||
output->height,
|
||||
output->width_mm,
|
||||
output->height_mm,
|
||||
(jint)output->subpixel,
|
||||
(jint)output->transform,
|
||||
(jint)output->scale);
|
||||
@@ -182,7 +197,7 @@ WLGraphicsEnvironment_initIDs
|
||||
CHECK_NULL_RETURN(
|
||||
notifyOutputConfiguredMID = (*env)->GetMethodID(env, clazz,
|
||||
"notifyOutputConfigured",
|
||||
"(Ljava/lang/String;IIIIIIII)V"),
|
||||
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIIIIIIIII)V"),
|
||||
JNI_FALSE);
|
||||
CHECK_NULL_RETURN(
|
||||
notifyOutputDestroyedMID = (*env)->GetMethodID(env, clazz,
|
||||
@@ -221,6 +236,8 @@ WLOutputDeregister(struct wl_registry *wl_registry, uint32_t id)
|
||||
wl_output_destroy(cur->wl_output);
|
||||
WLOutput * next = cur->next;
|
||||
free(cur->name);
|
||||
free(cur->make);
|
||||
free(cur->model);
|
||||
free(cur);
|
||||
cur = next;
|
||||
} else {
|
||||
@@ -266,7 +283,7 @@ WLOutputByID(uint32_t id)
|
||||
* Signature: ()Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_sun_awt_wl_WLGraphicsEnvironment_initVKWL(JNIEnv *env, jclass wlge)
|
||||
Java_sun_awt_wl_WLGraphicsEnvironment_initVKWL(JNIEnv *env, jclass wlge, jboolean verbose, jint requestedDevice)
|
||||
{
|
||||
jboolean vkwlAvailable = JNI_FALSE;
|
||||
/* TODO: The following sequence lead to uninitialized awt lock
|
||||
@@ -278,7 +295,7 @@ Java_sun_awt_wl_WLGraphicsEnvironment_initVKWL(JNIEnv *env, jclass wlge)
|
||||
WLGraphicsEnvironment.initVKWL()
|
||||
*/
|
||||
//AWT_LOCK();
|
||||
vkwlAvailable = VK_Init();
|
||||
vkwlAvailable = VK_Init(verbose, requestedDevice);
|
||||
//AWT_UNLOCK();
|
||||
return vkwlAvailable;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ struct wl_display *wl_display = NULL;
|
||||
struct wl_shm *wl_shm = NULL;
|
||||
struct wl_compositor *wl_compositor = NULL;
|
||||
struct xdg_wm_base *xdg_wm_base = NULL;
|
||||
struct xdg_activation_v1 *xdg_activation_v1 = NULL;
|
||||
struct wl_seat *wl_seat = NULL;
|
||||
|
||||
struct wl_keyboard *wl_keyboard;
|
||||
@@ -65,8 +66,11 @@ struct wl_pointer *wl_pointer;
|
||||
|
||||
struct wl_cursor_theme *wl_cursor_theme = NULL;
|
||||
|
||||
struct wl_surface *wl_surface_in_focus = NULL;
|
||||
|
||||
uint32_t last_mouse_pressed_serial = 0;
|
||||
uint32_t last_pointer_enter_serial = 0;
|
||||
uint32_t last_input_or_focus_serial = 0;
|
||||
|
||||
static uint32_t num_of_outstanding_sync = 0;
|
||||
|
||||
@@ -311,6 +315,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
|
||||
pointer_event.button = button,
|
||||
pointer_event.state = state;
|
||||
if (state) {
|
||||
last_input_or_focus_serial = serial;
|
||||
last_mouse_pressed_serial = serial;
|
||||
}
|
||||
}
|
||||
@@ -452,6 +457,9 @@ static void
|
||||
wl_keyboard_enter(void *data, struct wl_keyboard *wl_keyboard,
|
||||
uint32_t serial, struct wl_surface *surface, struct wl_array *keys)
|
||||
{
|
||||
wl_surface_in_focus = surface;
|
||||
last_input_or_focus_serial = serial;
|
||||
|
||||
JNIEnv* env = getEnv();
|
||||
(*env)->CallStaticVoidMethod(env,
|
||||
tkClass,
|
||||
@@ -481,6 +489,8 @@ static void
|
||||
wl_keyboard_key(void *data, struct wl_keyboard *wl_keyboard,
|
||||
uint32_t serial, uint32_t time, uint32_t evdev_key, uint32_t state)
|
||||
{
|
||||
last_input_or_focus_serial = serial;
|
||||
|
||||
const uint32_t scancode = evdev_key + 8;
|
||||
const uint32_t keychar32 = xkb_ifs.xkb_state_key_get_utf32(xkb_state, scancode);
|
||||
const xkb_keysym_t keysym = xkb_ifs.xkb_state_key_get_one_sym(xkb_state, scancode);
|
||||
@@ -503,6 +513,8 @@ static void
|
||||
wl_keyboard_leave(void *data, struct wl_keyboard *wl_keyboard,
|
||||
uint32_t serial, struct wl_surface *surface)
|
||||
{
|
||||
wl_surface_in_focus = NULL;
|
||||
|
||||
JNIEnv* env = getEnv();
|
||||
(*env)->CallStaticVoidMethod(env,
|
||||
tkClass,
|
||||
@@ -518,6 +530,8 @@ wl_keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard,
|
||||
uint32_t mods_latched, uint32_t mods_locked,
|
||||
uint32_t group)
|
||||
{
|
||||
last_input_or_focus_serial = serial;
|
||||
|
||||
xkb_ifs.xkb_state_update_mask(xkb_state,
|
||||
mods_depressed,
|
||||
mods_latched,
|
||||
@@ -668,6 +682,8 @@ registry_global(void *data, struct wl_registry *wl_registry,
|
||||
} else if (strcmp(interface, wl_output_interface.name) == 0) {
|
||||
WLOutputRegister(wl_registry, name);
|
||||
process_new_listener_before_end_of_init();
|
||||
} else if (strcmp(interface, xdg_activation_v1_interface.name) == 0) {
|
||||
xdg_activation_v1 = wl_registry_bind(wl_registry, name, &xdg_activation_v1_interface, 1);
|
||||
}
|
||||
#ifdef WAKEFIELD_ROBOT
|
||||
else if (strcmp(interface, wakefield_interface.name) == 0) {
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <wayland-client.h>
|
||||
#include <wayland-cursor.h>
|
||||
#include "xdg-shell-client-protocol.h"
|
||||
#include "xdg-activation-v1-client-protocol.h"
|
||||
|
||||
#define CHECK_NULL_THROW_OOME_RETURN(env, x, msg, z)\
|
||||
do { \
|
||||
@@ -48,10 +49,14 @@ extern struct wl_display *wl_display;
|
||||
extern struct wl_pointer *wl_pointer;
|
||||
extern struct wl_compositor *wl_compositor;
|
||||
extern struct xdg_wm_base *xdg_wm_base;
|
||||
extern struct xdg_activation_v1 *xdg_activation_v1;
|
||||
extern struct wl_cursor_theme *wl_cursor_theme;
|
||||
|
||||
extern struct wl_surface *wl_surface_in_focus;
|
||||
|
||||
extern uint32_t last_mouse_pressed_serial;
|
||||
extern uint32_t last_pointer_enter_serial;
|
||||
extern uint32_t last_input_or_focus_serial;
|
||||
|
||||
JNIEnv *getEnv();
|
||||
|
||||
|
||||
413
src/java.desktop/unix/native/libawt_wlawt/xdg-activation-v1-client-protocol.h
Executable file
413
src/java.desktop/unix/native/libawt_wlawt/xdg-activation-v1-client-protocol.h
Executable file
@@ -0,0 +1,413 @@
|
||||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
#ifndef XDG_ACTIVATION_V1_CLIENT_PROTOCOL_H
|
||||
#define XDG_ACTIVATION_V1_CLIENT_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "wayland-client.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @page page_xdg_activation_v1 The xdg_activation_v1 protocol
|
||||
* Protocol for requesting activation of surfaces
|
||||
*
|
||||
* @section page_desc_xdg_activation_v1 Description
|
||||
*
|
||||
* The way for a client to pass focus to another toplevel is as follows.
|
||||
*
|
||||
* The client that intends to activate another toplevel uses the
|
||||
* xdg_activation_v1.get_activation_token request to get an activation token.
|
||||
* This token is then forwarded to the client, which is supposed to activate
|
||||
* one of its surfaces, through a separate band of communication.
|
||||
*
|
||||
* One established way of doing this is through the XDG_ACTIVATION_TOKEN
|
||||
* environment variable of a newly launched child process. The child process
|
||||
* should unset the environment variable again right after reading it out in
|
||||
* order to avoid propagating it to other child processes.
|
||||
*
|
||||
* Another established way exists for Applications implementing the D-Bus
|
||||
* interface org.freedesktop.Application, which should get their token under
|
||||
* XDG_ACTIVATION_TOKEN on their platform_data.
|
||||
*
|
||||
* In general activation tokens may be transferred across clients through
|
||||
* means not described in this protocol.
|
||||
*
|
||||
* The client to be activated will then pass the token
|
||||
* it received to the xdg_activation_v1.activate request. The compositor can
|
||||
* then use this token to decide how to react to the activation request.
|
||||
*
|
||||
* The token the activating client gets may be ineffective either already at
|
||||
* the time it receives it, for example if it was not focused, for focus
|
||||
* stealing prevention. The activating client will have no way to discover
|
||||
* the validity of the token, and may still forward it to the to be activated
|
||||
* client.
|
||||
*
|
||||
* The created activation token may optionally get information attached to it
|
||||
* that can be used by the compositor to identify the application that we
|
||||
* intend to activate. This can for example be used to display a visual hint
|
||||
* about what application is being started.
|
||||
*
|
||||
* Warning! The protocol described in this file is currently in the testing
|
||||
* phase. Backward compatible changes may be added together with the
|
||||
* corresponding interface version bump. Backward incompatible changes can
|
||||
* only be done by creating a new major version of the extension.
|
||||
*
|
||||
* @section page_ifaces_xdg_activation_v1 Interfaces
|
||||
* - @subpage page_iface_xdg_activation_v1 - interface for activating surfaces
|
||||
* - @subpage page_iface_xdg_activation_token_v1 - an exported activation handle
|
||||
* @section page_copyright_xdg_activation_v1 Copyright
|
||||
* <pre>
|
||||
*
|
||||
* Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||
* Copyright © 2020 Carlos Garnacho <carlosg@gnome.org>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* </pre>
|
||||
*/
|
||||
struct wl_seat;
|
||||
struct wl_surface;
|
||||
struct xdg_activation_token_v1;
|
||||
struct xdg_activation_v1;
|
||||
|
||||
/**
|
||||
* @page page_iface_xdg_activation_v1 xdg_activation_v1
|
||||
* @section page_iface_xdg_activation_v1_desc Description
|
||||
*
|
||||
* A global interface used for informing the compositor about applications
|
||||
* being activated or started, or for applications to request to be
|
||||
* activated.
|
||||
* @section page_iface_xdg_activation_v1_api API
|
||||
* See @ref iface_xdg_activation_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_xdg_activation_v1 The xdg_activation_v1 interface
|
||||
*
|
||||
* A global interface used for informing the compositor about applications
|
||||
* being activated or started, or for applications to request to be
|
||||
* activated.
|
||||
*/
|
||||
extern const struct wl_interface xdg_activation_v1_interface;
|
||||
/**
|
||||
* @page page_iface_xdg_activation_token_v1 xdg_activation_token_v1
|
||||
* @section page_iface_xdg_activation_token_v1_desc Description
|
||||
*
|
||||
* An object for setting up a token and receiving a token handle that can
|
||||
* be passed as an activation token to another client.
|
||||
*
|
||||
* The object is created using the xdg_activation_v1.get_activation_token
|
||||
* request. This object should then be populated with the app_id, surface
|
||||
* and serial information and committed. The compositor shall then issue a
|
||||
* done event with the token. In case the request's parameters are invalid,
|
||||
* the compositor will provide an invalid token.
|
||||
* @section page_iface_xdg_activation_token_v1_api API
|
||||
* See @ref iface_xdg_activation_token_v1.
|
||||
*/
|
||||
/**
|
||||
* @defgroup iface_xdg_activation_token_v1 The xdg_activation_token_v1 interface
|
||||
*
|
||||
* An object for setting up a token and receiving a token handle that can
|
||||
* be passed as an activation token to another client.
|
||||
*
|
||||
* The object is created using the xdg_activation_v1.get_activation_token
|
||||
* request. This object should then be populated with the app_id, surface
|
||||
* and serial information and committed. The compositor shall then issue a
|
||||
* done event with the token. In case the request's parameters are invalid,
|
||||
* the compositor will provide an invalid token.
|
||||
*/
|
||||
extern const struct wl_interface xdg_activation_token_v1_interface;
|
||||
|
||||
#define XDG_ACTIVATION_V1_DESTROY 0
|
||||
#define XDG_ACTIVATION_V1_GET_ACTIVATION_TOKEN 1
|
||||
#define XDG_ACTIVATION_V1_ACTIVATE 2
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_v1
|
||||
*/
|
||||
#define XDG_ACTIVATION_V1_DESTROY_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_v1
|
||||
*/
|
||||
#define XDG_ACTIVATION_V1_GET_ACTIVATION_TOKEN_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_v1
|
||||
*/
|
||||
#define XDG_ACTIVATION_V1_ACTIVATE_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_xdg_activation_v1 */
|
||||
static inline void
|
||||
xdg_activation_v1_set_user_data(struct xdg_activation_v1 *xdg_activation_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) xdg_activation_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_xdg_activation_v1 */
|
||||
static inline void *
|
||||
xdg_activation_v1_get_user_data(struct xdg_activation_v1 *xdg_activation_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) xdg_activation_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
xdg_activation_v1_get_version(struct xdg_activation_v1 *xdg_activation_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) xdg_activation_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_v1
|
||||
*
|
||||
* Notify the compositor that the xdg_activation object will no longer be
|
||||
* used.
|
||||
*
|
||||
* The child objects created via this interface are unaffected and should
|
||||
* be destroyed separately.
|
||||
*/
|
||||
static inline void
|
||||
xdg_activation_v1_destroy(struct xdg_activation_v1 *xdg_activation_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_activation_v1,
|
||||
XDG_ACTIVATION_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) xdg_activation_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_v1
|
||||
*
|
||||
* Creates an xdg_activation_token_v1 object that will provide
|
||||
* the initiating client with a unique token for this activation. This
|
||||
* token should be offered to the clients to be activated.
|
||||
*/
|
||||
static inline struct xdg_activation_token_v1 *
|
||||
xdg_activation_v1_get_activation_token(struct xdg_activation_v1 *xdg_activation_v1)
|
||||
{
|
||||
struct wl_proxy *id;
|
||||
|
||||
id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_activation_v1,
|
||||
XDG_ACTIVATION_V1_GET_ACTIVATION_TOKEN, &xdg_activation_token_v1_interface, NULL);
|
||||
|
||||
return (struct xdg_activation_token_v1 *) id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_v1
|
||||
*
|
||||
* Requests surface activation. It's up to the compositor to display
|
||||
* this information as desired, for example by placing the surface above
|
||||
* the rest.
|
||||
*
|
||||
* The compositor may know who requested this by checking the activation
|
||||
* token and might decide not to follow through with the activation if it's
|
||||
* considered unwanted.
|
||||
*
|
||||
* Compositors can ignore unknown activation tokens when an invalid
|
||||
* token is passed.
|
||||
*/
|
||||
static inline void
|
||||
xdg_activation_v1_activate(struct xdg_activation_v1 *xdg_activation_v1, const char *token, struct wl_surface *surface)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_activation_v1,
|
||||
XDG_ACTIVATION_V1_ACTIVATE, token, surface);
|
||||
}
|
||||
|
||||
#ifndef XDG_ACTIVATION_TOKEN_V1_ERROR_ENUM
|
||||
#define XDG_ACTIVATION_TOKEN_V1_ERROR_ENUM
|
||||
enum xdg_activation_token_v1_error {
|
||||
/**
|
||||
* The token has already been used previously
|
||||
*/
|
||||
XDG_ACTIVATION_TOKEN_V1_ERROR_ALREADY_USED = 0,
|
||||
};
|
||||
#endif /* XDG_ACTIVATION_TOKEN_V1_ERROR_ENUM */
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
* @struct xdg_activation_token_v1_listener
|
||||
*/
|
||||
struct xdg_activation_token_v1_listener {
|
||||
/**
|
||||
* the exported activation token
|
||||
*
|
||||
* The 'done' event contains the unique token of this activation
|
||||
* request and notifies that the provider is done.
|
||||
* @param token the exported activation token
|
||||
*/
|
||||
void (*done)(void *data,
|
||||
struct xdg_activation_token_v1 *xdg_activation_token_v1,
|
||||
const char *token);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
*/
|
||||
static inline int
|
||||
xdg_activation_token_v1_add_listener(struct xdg_activation_token_v1 *xdg_activation_token_v1,
|
||||
const struct xdg_activation_token_v1_listener *listener, void *data)
|
||||
{
|
||||
return wl_proxy_add_listener((struct wl_proxy *) xdg_activation_token_v1,
|
||||
(void (**)(void)) listener, data);
|
||||
}
|
||||
|
||||
#define XDG_ACTIVATION_TOKEN_V1_SET_SERIAL 0
|
||||
#define XDG_ACTIVATION_TOKEN_V1_SET_APP_ID 1
|
||||
#define XDG_ACTIVATION_TOKEN_V1_SET_SURFACE 2
|
||||
#define XDG_ACTIVATION_TOKEN_V1_COMMIT 3
|
||||
#define XDG_ACTIVATION_TOKEN_V1_DESTROY 4
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
*/
|
||||
#define XDG_ACTIVATION_TOKEN_V1_DONE_SINCE_VERSION 1
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
*/
|
||||
#define XDG_ACTIVATION_TOKEN_V1_SET_SERIAL_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
*/
|
||||
#define XDG_ACTIVATION_TOKEN_V1_SET_APP_ID_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
*/
|
||||
#define XDG_ACTIVATION_TOKEN_V1_SET_SURFACE_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
*/
|
||||
#define XDG_ACTIVATION_TOKEN_V1_COMMIT_SINCE_VERSION 1
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
*/
|
||||
#define XDG_ACTIVATION_TOKEN_V1_DESTROY_SINCE_VERSION 1
|
||||
|
||||
/** @ingroup iface_xdg_activation_token_v1 */
|
||||
static inline void
|
||||
xdg_activation_token_v1_set_user_data(struct xdg_activation_token_v1 *xdg_activation_token_v1, void *user_data)
|
||||
{
|
||||
wl_proxy_set_user_data((struct wl_proxy *) xdg_activation_token_v1, user_data);
|
||||
}
|
||||
|
||||
/** @ingroup iface_xdg_activation_token_v1 */
|
||||
static inline void *
|
||||
xdg_activation_token_v1_get_user_data(struct xdg_activation_token_v1 *xdg_activation_token_v1)
|
||||
{
|
||||
return wl_proxy_get_user_data((struct wl_proxy *) xdg_activation_token_v1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
xdg_activation_token_v1_get_version(struct xdg_activation_token_v1 *xdg_activation_token_v1)
|
||||
{
|
||||
return wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
*
|
||||
* Provides information about the seat and serial event that requested the
|
||||
* token.
|
||||
*
|
||||
* The serial can come from an input or focus event. For instance, if a
|
||||
* click triggers the launch of a third-party client, the launcher client
|
||||
* should send a set_serial request with the serial and seat from the
|
||||
* wl_pointer.button event.
|
||||
*
|
||||
* Some compositors might refuse to activate toplevels when the token
|
||||
* doesn't have a valid and recent enough event serial.
|
||||
*
|
||||
* Must be sent before commit. This information is optional.
|
||||
*/
|
||||
static inline void
|
||||
xdg_activation_token_v1_set_serial(struct xdg_activation_token_v1 *xdg_activation_token_v1, uint32_t serial, struct wl_seat *seat)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_activation_token_v1,
|
||||
XDG_ACTIVATION_TOKEN_V1_SET_SERIAL, serial, seat);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
*
|
||||
* The requesting client can specify an app_id to associate the token
|
||||
* being created with it.
|
||||
*
|
||||
* Must be sent before commit. This information is optional.
|
||||
*/
|
||||
static inline void
|
||||
xdg_activation_token_v1_set_app_id(struct xdg_activation_token_v1 *xdg_activation_token_v1, const char *app_id)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_activation_token_v1,
|
||||
XDG_ACTIVATION_TOKEN_V1_SET_APP_ID, app_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
*
|
||||
* This request sets the surface requesting the activation. Note, this is
|
||||
* different from the surface that will be activated.
|
||||
*
|
||||
* Some compositors might refuse to activate toplevels when the token
|
||||
* doesn't have a requesting surface.
|
||||
*
|
||||
* Must be sent before commit. This information is optional.
|
||||
*/
|
||||
static inline void
|
||||
xdg_activation_token_v1_set_surface(struct xdg_activation_token_v1 *xdg_activation_token_v1, struct wl_surface *surface)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_activation_token_v1,
|
||||
XDG_ACTIVATION_TOKEN_V1_SET_SURFACE, surface);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
*
|
||||
* Requests an activation token based on the different parameters that
|
||||
* have been offered through set_serial, set_surface and set_app_id.
|
||||
*/
|
||||
static inline void
|
||||
xdg_activation_token_v1_commit(struct xdg_activation_token_v1 *xdg_activation_token_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_activation_token_v1,
|
||||
XDG_ACTIVATION_TOKEN_V1_COMMIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup iface_xdg_activation_token_v1
|
||||
*
|
||||
* Notify the compositor that the xdg_activation_token_v1 object will no
|
||||
* longer be used.
|
||||
*/
|
||||
static inline void
|
||||
xdg_activation_token_v1_destroy(struct xdg_activation_token_v1 *xdg_activation_token_v1)
|
||||
{
|
||||
wl_proxy_marshal((struct wl_proxy *) xdg_activation_token_v1,
|
||||
XDG_ACTIVATION_TOKEN_V1_DESTROY);
|
||||
|
||||
wl_proxy_destroy((struct wl_proxy *) xdg_activation_token_v1);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
84
src/java.desktop/unix/native/libawt_wlawt/xdg-activation-v1-protocol.c
Executable file
84
src/java.desktop/unix/native/libawt_wlawt/xdg-activation-v1-protocol.c
Executable file
@@ -0,0 +1,84 @@
|
||||
/* Generated by wayland-scanner 1.18.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||
* Copyright © 2020 Carlos Garnacho <carlosg@gnome.org>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "wayland-util.h"
|
||||
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
|
||||
#endif
|
||||
|
||||
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
|
||||
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
|
||||
#else
|
||||
#define WL_PRIVATE
|
||||
#endif
|
||||
|
||||
extern const struct wl_interface wl_seat_interface;
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
extern const struct wl_interface xdg_activation_token_v1_interface;
|
||||
|
||||
static const struct wl_interface *xdg_activation_v1_types[] = {
|
||||
NULL,
|
||||
&xdg_activation_token_v1_interface,
|
||||
NULL,
|
||||
&wl_surface_interface,
|
||||
NULL,
|
||||
&wl_seat_interface,
|
||||
&wl_surface_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_activation_v1_requests[] = {
|
||||
{ "destroy", "", xdg_activation_v1_types + 0 },
|
||||
{ "get_activation_token", "n", xdg_activation_v1_types + 1 },
|
||||
{ "activate", "so", xdg_activation_v1_types + 2 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface xdg_activation_v1_interface = {
|
||||
"xdg_activation_v1", 1,
|
||||
3, xdg_activation_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_activation_token_v1_requests[] = {
|
||||
{ "set_serial", "uo", xdg_activation_v1_types + 4 },
|
||||
{ "set_app_id", "s", xdg_activation_v1_types + 0 },
|
||||
{ "set_surface", "o", xdg_activation_v1_types + 6 },
|
||||
{ "commit", "", xdg_activation_v1_types + 0 },
|
||||
{ "destroy", "", xdg_activation_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message xdg_activation_token_v1_events[] = {
|
||||
{ "done", "s", xdg_activation_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface xdg_activation_token_v1_interface = {
|
||||
"xdg_activation_token_v1", 1,
|
||||
5, xdg_activation_token_v1_requests,
|
||||
1, xdg_activation_token_v1_events,
|
||||
};
|
||||
|
||||
@@ -53,7 +53,9 @@ gtest/MetaspaceGtests.java#balanced-no-ccs initial_run generic-all
|
||||
gtest/MetaspaceGtests.java#reclaim-aggressive-ndebug initial_run generic-all
|
||||
gtest/LargePageGtests.java#use-large-pages initial_run linux-all,windows-all
|
||||
|
||||
gtest/NMTGtests.java JBR-5718 generic-all
|
||||
gtest/NMTGtests.java#nmt-detail JBR-5718 generic-all
|
||||
gtest/NMTGtests.java#nmt-off JBR-5718 generic-all
|
||||
gtest/NMTGtests.java#nmt-summary JBR-5718 generic-all
|
||||
|
||||
gc/stress/TestReclaimStringsLeaksMemory.java initial_run windows-all
|
||||
|
||||
@@ -256,13 +258,11 @@ vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi005/TestDescription
|
||||
|
||||
gc/shenandoah/mxbeans/TestChurnNotifications.java#aggressive NO_BUG macosx_all
|
||||
|
||||
runtime/cds/appcds/TestDumpClassListSource.java NO_BUG generic_all
|
||||
runtime/cds/appcds/CommandLineFlagCombo.java NO_BUG generic_all
|
||||
runtime/cds/appcds/TestDumpClassListSource.java NO_BUG generic_all
|
||||
runtime/cds/appcds/dynamicArchive/TestAutoCreateSharedArchiveNoDefaultArchive.java NO_BUG generic_all
|
||||
runtime/cds/appcds/dynamicArchive/TestAutoCreateSharedArchiveUpgrade.java NO_BUG generic_all
|
||||
runtime/cds/CheckDefaultArchiveFile.java NO_BUG generic_all
|
||||
|
||||
serviceability/jvmti/SetBreakpoint/TestManyBreakpoints.java NO_BUG linux_aarch64
|
||||
vmTestbase/nsk/stress/thread/thread008.java initial_run windows-all
|
||||
compiler/vectorapi/VectorRebracket128Test.java NO_BUG linux_aarch64
|
||||
|
||||
|
||||
@@ -785,3 +785,251 @@ jdk_containers_extended = \
|
||||
:jdk_io \
|
||||
:jdk_nio \
|
||||
:jdk_svc
|
||||
|
||||
# Wayland tests to be executed with -Dawt.toolkit.name=WLToolkit
|
||||
jdk_awt_wayland = \
|
||||
:jdk_awt \
|
||||
-com/apple/eawt \
|
||||
-com/apple/laf \
|
||||
-sun/awt \
|
||||
-java/awt/a11y \
|
||||
-java/awt/applet \
|
||||
-java/awt/BasicStroke/DashOffset.java \
|
||||
-java/awt/BasicStroke/DashScaleMinWidth.java \
|
||||
-java/awt/BasicStroke/DashZeroWidth.java \
|
||||
-java/awt/BorderLayout \
|
||||
-java/awt/Button \
|
||||
-java/awt/Checkbox \
|
||||
-java/awt/Choice \
|
||||
-java/awt/Clipboard \
|
||||
-java/awt/ColorClass/AlphaColorTest.java \
|
||||
-java/awt/Component/7097771 \
|
||||
-java/awt/Component/CompEventOnHiddenComponent \
|
||||
-java/awt/Component/ComponentRedrawnTest.java \
|
||||
-java/awt/Component/CreateImage \
|
||||
-java/awt/Component/DimensionEncapsulation \
|
||||
-java/awt/Component/F10TopToplevel \
|
||||
-java/awt/Component/GetListenersTest.java \
|
||||
-java/awt/Component/GetScreenLocTest \
|
||||
-java/awt/Component/InsetsEncapsulation \
|
||||
-java/awt/Component/isLightweightCrash \
|
||||
-java/awt/Component/NativeInLightShow \
|
||||
-java/awt/Component/NoUpdateUponShow \
|
||||
-java/awt/Component/PaintAll \
|
||||
-java/awt/Component/PrintAllXcheckJNI \
|
||||
-java/awt/Component/RepaintTest.java \
|
||||
-java/awt/Component/Revalidate \
|
||||
-java/awt/Component/SetComponentsBounds \
|
||||
-java/awt/Component/SetEnabledPerformance \
|
||||
-java/awt/Component/TreeLockDeadlock \
|
||||
-java/awt/Component/UpdatingBootTime \
|
||||
-java/awt/Component/Validate \
|
||||
-java/awt/ComponentOrientation \
|
||||
-java/awt/Container \
|
||||
-java/awt/Cursor \
|
||||
-java/awt/datatransfer/Clipboard/GetContentsInterruptedTest.java \
|
||||
-java/awt/datatransfer/ClipboardInterVMTest/ClipboardInterVMTest.java \
|
||||
-java/awt/datatransfer/ConstructFlavoredObjectTest/ConstructFlavoredObjectTest.java \
|
||||
-java/awt/datatransfer/CustomClassLoaderTransferTest/CustomClassLoaderTransferTest.java \
|
||||
-java/awt/datatransfer/DataFlavor/DataFlavorRemoteTest.java \
|
||||
-java/awt/datatransfer/DragImage/MultiResolutionDragImageTest.java \
|
||||
-java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.html \
|
||||
-java/awt/datatransfer/ImageTransfer/ImageTransferTest.java \
|
||||
-java/awt/datatransfer/Independence/IndependenceAWTTest.java \
|
||||
-java/awt/datatransfer/Independence/IndependenceSwingTest.java \
|
||||
-java/awt/datatransfer/SystemFlavorMap/AddFlavorTest.java \
|
||||
-java/awt/datatransfer/SystemSelection/SystemSelectionAWTTest.java \
|
||||
-java/awt/datatransfer/SystemSelection/SystemSelectionSwingTest.java \
|
||||
-java/awt/datatransfer/UnicodeTransferTest/UnicodeTransferTest.java \
|
||||
-java/awt/Debug \
|
||||
-java/awt/Desktop \
|
||||
-java/awt/Dialog \
|
||||
-java/awt/dnd \
|
||||
-java/awt/EmbeddedFrame \
|
||||
-java/awt/event \
|
||||
-java/awt/EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java \
|
||||
-java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.java \
|
||||
-java/awt/EventDispatchThread/PropertyPermissionOnEDT/PropertyPermissionOnEDT.java \
|
||||
-java/awt/EventQueue/6980209/bug6980209.java \
|
||||
-java/awt/FileDialog \
|
||||
-java/awt/FlowLayout \
|
||||
-java/awt/Focus/6378278 \
|
||||
-java/awt/Focus/6382144 \
|
||||
-java/awt/Focus/6401036 \
|
||||
-java/awt/Focus/6981400 \
|
||||
-java/awt/Focus/8000326 \
|
||||
-java/awt/Focus/8013611 \
|
||||
-java/awt/Focus/8073453 \
|
||||
-java/awt/Focus/8282640 \
|
||||
-java/awt/Focus/ActualFocusedWindowTest \
|
||||
-java/awt/Focus/AppletInitialFocusTest \
|
||||
-java/awt/Focus/AsyncUpFocusCycleTest.java \
|
||||
-java/awt/Focus/AutoRequestFocusTest \
|
||||
-java/awt/Focus/Cause \
|
||||
-java/awt/Focus/ChildWindowFocusTest \
|
||||
-java/awt/Focus/ChoiceFocus \
|
||||
-java/awt/Focus/ClearGlobalFocusOwnerTest \
|
||||
-java/awt/Focus/ClearLwQueueBreakTest \
|
||||
-java/awt/Focus/ClearMostRecentFocusOwnerTest.java \
|
||||
-java/awt/Focus/CloseDialogActivateOwnerTest \
|
||||
-java/awt/Focus/ConsumedTabKeyTest.java \
|
||||
-java/awt/Focus/ConsumeNextKeyTypedOnModalShowTest \
|
||||
-java/awt/Focus/ContainerFocusAutoTransferTest \
|
||||
-java/awt/Focus/DeiconifiedFrameLoosesFocus \
|
||||
-java/awt/Focus/DisposedWindow \
|
||||
-java/awt/Focus/EventRetargetTest.java \
|
||||
-java/awt/Focus/ExtraPropChangeNotifVetoingTest.java \
|
||||
-java/awt/Focus/FocusEmbeddedFrameTest \
|
||||
-java/awt/Focus/FocusForRemovedComponentTest.java \
|
||||
-java/awt/Focus/FocusOwnerFrameOnClick \
|
||||
-java/awt/Focus/FocusSubRequestTest \
|
||||
-java/awt/Focus/FocusTransitionTest \
|
||||
-java/awt/Focus/FocusTraversalPolicy \
|
||||
-java/awt/Focus/FocusTraversalPolicyIAE.java \
|
||||
-java/awt/Focus/FrameJumpingToMouse \
|
||||
-java/awt/Focus/FrameMinimizeTest \
|
||||
-java/awt/Focus/IconifiedFrameFocusChangeTest \
|
||||
-java/awt/Focus/InitialFocusTest.java \
|
||||
-java/awt/Focus/InputVerifierTest3 \
|
||||
-java/awt/Focus/KeyEventForBadFocusOwnerTest \
|
||||
-java/awt/Focus/LabelScrollBarFocus.java \
|
||||
-java/awt/Focus/ModalBlockedStealsFocusTest \
|
||||
-java/awt/Focus/ModalDialogActivationTest \
|
||||
-java/awt/Focus/ModalDialogInFocusEventTest.java \
|
||||
-java/awt/Focus/ModalDialogInitialFocusTest \
|
||||
-java/awt/Focus/ModalExcludedWindowClickTest \
|
||||
-java/awt/Focus/MouseClickRequestFocusRaceTest \
|
||||
-java/awt/Focus/NoAutotransferToDisabledCompTest \
|
||||
-java/awt/Focus/NoFocusOwnerAWTTest.java \
|
||||
-java/awt/Focus/NoFocusOwnerSwingTest.java \
|
||||
-java/awt/Focus/NonFocusableBlockedOwnerTest \
|
||||
-java/awt/Focus/NonFocusableResizableTooSmall \
|
||||
-java/awt/Focus/NonFocusableWindowTest \
|
||||
-java/awt/Focus/NullActiveWindowOnFocusLost \
|
||||
-java/awt/Focus/OwnedWindowFocusIMECrashTest \
|
||||
-java/awt/Focus/QuickTypeTest.java \
|
||||
-java/awt/Focus/RemoveAfterRequest \
|
||||
-java/awt/Focus/RequestFocusAndHideTest \
|
||||
-java/awt/Focus/RequestFocusByCause \
|
||||
-java/awt/Focus/RequestFocusToDisabledCompTest \
|
||||
-java/awt/Focus/RequestOnCompWithNullParent \
|
||||
-java/awt/Focus/ResetMostRecentFocusOwnerTest \
|
||||
-java/awt/Focus/RestoreFocusInfiniteLoopTest.java \
|
||||
-java/awt/Focus/RestoreFocusOnDisabledComponentTest \
|
||||
-java/awt/Focus/RollbackFocusFromAnotherWindowTest \
|
||||
-java/awt/Focus/RowToleranceTransitivityTest.java \
|
||||
-java/awt/Focus/SequencedLightweightRequestsTest.java \
|
||||
-java/awt/Focus/SetFocusableTest.java \
|
||||
-java/awt/Focus/ShowFrameCheckForegroundTest \
|
||||
-java/awt/Focus/SimpleWindowActivationTest \
|
||||
-java/awt/Focus/SortingFPT \
|
||||
-java/awt/Focus/TemporaryLostComponentDeadlock.java \
|
||||
-java/awt/Focus/ToFrontFocusTest \
|
||||
-java/awt/Focus/TranserFocusToWindow \
|
||||
-java/awt/Focus/TraversalKeysPropertyNamesTest.java \
|
||||
-java/awt/Focus/TypeAhead \
|
||||
-java/awt/Focus/UnaccessibleChoice \
|
||||
-java/awt/Focus/UpFocusCycleTest.java \
|
||||
-java/awt/Focus/VetoableChangeListenerLoopTest.java \
|
||||
-java/awt/Focus/WindowInitialFocusTest \
|
||||
-java/awt/Focus/WindowIsFocusableAccessByThreadsTest \
|
||||
-java/awt/Focus/WindowUpdateFocusabilityTest \
|
||||
-java/awt/Focus/WrongKeyTypedConsumedTest \
|
||||
-java/awt/font/TextLayout/MyanmarTextTest.java \
|
||||
-java/awt/font/TextLayout/TestJustification.html \
|
||||
-java/awt/font/TextLayout/TestOldHangul.java \
|
||||
-java/awt/font/TextLayout/TestTibetan.java \
|
||||
-java/awt/font/TextLayout/TestVS.java \
|
||||
-java/awt/font/TextLayout/VariationSelectorTest.java \
|
||||
-java/awt/FontClass/FontAccess.java \
|
||||
-java/awt/Frame \
|
||||
-java/awt/FullScreen/8013581 \
|
||||
-java/awt/FullScreen/AllFramesMaximize \
|
||||
-java/awt/FullScreen/AltTabCrashTest \
|
||||
-java/awt/FullScreen/BufferStrategyExceptionTest \
|
||||
-java/awt/FullScreen/FullScreenInsets \
|
||||
-java/awt/FullScreen/FullscreenWindowProps \
|
||||
-java/awt/FullScreen/TranslucentWindow \
|
||||
-java/awt/grab \
|
||||
-java/awt/Graphics/DrawOvalTest.java \
|
||||
-java/awt/Graphics/LCDTextAndGraphicsState.java \
|
||||
-java/awt/Graphics/TextAAHintsTest.java \
|
||||
-java/awt/Graphics/XORPaint.java \
|
||||
-java/awt/Graphics2D/CopyAreaOOB.java \
|
||||
-java/awt/GraphicsDevice/DisplayModes/CompareToXrandrTest.java \
|
||||
-java/awt/GraphicsDevice/DisplayModes/CycleDMImage.java \
|
||||
-java/awt/GridBagLayout \
|
||||
-java/awt/GridLayout \
|
||||
-java/awt/Gtk \
|
||||
-java/awt/hidpi \
|
||||
-java/awt/Icon \
|
||||
-java/awt/im \
|
||||
-java/awt/image/BufferStrategy/ExceptionAfterComponentDispose.java \
|
||||
-java/awt/image/MemoryLeakTest/MemoryLeakTest.java \
|
||||
-java/awt/image/OpaquePNGToGIFTest.java \
|
||||
-java/awt/image/VolatileImage/DrawBufImgOp.java \
|
||||
-java/awt/image/VolatileImage/TransparentVImage.java \
|
||||
-java/awt/image/mlib/MlibOpsTest.java \
|
||||
-java/awt/image/multiresolution/MenuMultiresolutionIconTest.java \
|
||||
-java/awt/image/multiresolution/MultiDisplayTest/MultiDisplayTest.java \
|
||||
-java/awt/image/multiresolution/MultiResolutionJOptionPaneIconTest.java \
|
||||
-java/awt/image/multiresolution/MultiresolutionIconTest.java \
|
||||
-java/awt/Insets/CombinedTestApp1.java \
|
||||
-java/awt/Insets/RemoveMenuBarTest.java \
|
||||
-java/awt/InputMethods \
|
||||
-java/awt/JAWT \
|
||||
-java/awt/keyboard \
|
||||
-java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest \
|
||||
-java/awt/KeyboardFocusmanager/TypeAhead \
|
||||
-java/awt/Label \
|
||||
-java/awt/Layout \
|
||||
-java/awt/LightweightComponent \
|
||||
-java/awt/LightweightDispatcher \
|
||||
-java/awt/List \
|
||||
-java/awt/Menu \
|
||||
-java/awt/MenuBar \
|
||||
-java/awt/MenuItem \
|
||||
-java/awt/Mixing \
|
||||
-java/awt/Modal \
|
||||
-java/awt/Mouse \
|
||||
-java/awt/MouseAdapter \
|
||||
-java/awt/MouseInfo \
|
||||
-java/awt/MultipleGradientPaint \
|
||||
-java/awt/Multiscreen/MouseEventTest/MouseEventTest.java \
|
||||
-java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java \
|
||||
-java/awt/Multiscreen/MultiScreenLocationTest/MultiScreenLocationTest.java \
|
||||
-java/awt/Paint/bug8024864.java \
|
||||
-java/awt/Paint/ButtonRepaint.java \
|
||||
-java/awt/Paint/CheckboxRepaint.java \
|
||||
-java/awt/Paint/ComponentIsNotDrawnAfterRemoveAddTest \
|
||||
-java/awt/Paint/ExposeOnEDT.java \
|
||||
-java/awt/Paint/LabelRepaint.java \
|
||||
-java/awt/Paint/ListRepaint.java \
|
||||
-java/awt/Paint/PaintNativeOnUpdate.java \
|
||||
-java/awt/Panel \
|
||||
-java/awt/PopupMenu \
|
||||
-java/awt/print \
|
||||
-java/awt/PrintJob \
|
||||
-java/awt/Robot \
|
||||
-java/awt/Scrollbar \
|
||||
-java/awt/ScrollPane \
|
||||
-java/awt/security \
|
||||
-java/awt/SplashScreen \
|
||||
-java/awt/TextArea \
|
||||
-java/awt/TextComponent \
|
||||
-java/awt/TextField \
|
||||
-java/awt/Toolkit/BadDisplayTest/BadDisplayTest.java \
|
||||
-java/awt/Toolkit/DesktopProperties/rfe4758438.java \
|
||||
-java/awt/Toolkit/DynamicLayout/bug7172833.java \
|
||||
-java/awt/Toolkit/Headless/GetPrintJob/GetPrintJob.java \
|
||||
-java/awt/Toolkit/Headless/WrappedToolkitTest/WrappedToolkitTest.sh \
|
||||
-java/awt/Toolkit/LockingKeyStateTest/LockingKeyStateTest.java \
|
||||
-java/awt/Toolkit/RealSync/Test.java \
|
||||
-java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java \
|
||||
-java/awt/Toolkit/SecurityTest/SecurityTest2.java \
|
||||
-java/awt/Toolkit/ToolkitPropertyTest/ToolkitPropertyTest_Enable.java \
|
||||
-java/awt/TrayIcon \
|
||||
-java/awt/wakefield \
|
||||
-java/awt/Window \
|
||||
-java/awt/WMSpecificTests \
|
||||
-java/awt/xembed
|
||||
|
||||
@@ -182,13 +182,6 @@ public class FontExtensionsTest {
|
||||
return !textDrawingEquals(BASE_FONT, fontWithFeatures(FontExtensions.FeatureTag.FRAC), FRACTION_STRING);
|
||||
}
|
||||
|
||||
@JBRTest
|
||||
private static Boolean testFeaturesZeroFrac() {
|
||||
Font fontFZ = fontWithFeatures(FontExtensions.FeatureTag.FRAC, FontExtensions.FeatureTag.ZERO);
|
||||
return !textDrawingEquals(fontFZ, fontWithFeatures(FontExtensions.FeatureTag.FRAC), ZERO_STRING + " " + FRACTION_STRING) &&
|
||||
!textDrawingEquals(fontFZ, fontWithFeatures(FontExtensions.FeatureTag.ZERO), ZERO_STRING + " " + FRACTION_STRING);
|
||||
}
|
||||
|
||||
@JBRTest
|
||||
private static Boolean testFeaturesDerive1() {
|
||||
Font fontFZ1 = fontWithFeatures(FontExtensions.FeatureTag.FRAC, FontExtensions.FeatureTag.ZERO).
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
* @requires (jdk.version.major >= 8 & os.family == "mac")
|
||||
*/
|
||||
|
||||
import sun.lwawt.macosx.LWCToolkit;
|
||||
|
||||
import static java.awt.event.KeyEvent.*;
|
||||
|
||||
public class KeyCodesTest implements Runnable {
|
||||
@@ -140,6 +142,10 @@ public class KeyCodesTest implements Runnable {
|
||||
}
|
||||
|
||||
private void verify(String typed, int vk, String layout, int key, int charKeyCode, int location, int modifiers) {
|
||||
if (!LWCToolkit.isKeyboardLayoutInstalled(layout)) {
|
||||
System.out.printf("WARNING: Skipping key code test, vk = %d, layout = %s: this layout is not installed", vk, layout);
|
||||
return;
|
||||
}
|
||||
char ch = (typed.length() == 1) ? typed.charAt(0) : 0;
|
||||
InputMethodTest.section("Key code test: " + vk + ", layout: " + layout + ", char: " + String.format("U+%04X", (int)ch));
|
||||
InputMethodTest.layout(layout);
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java 8202931,JBR-5398 macosx-all,linux-all,windows-all
|
||||
java/awt/FullScreen/CurrentDisplayModeTest/CurrentDisplayModeTest.java JBR-5059 linux-all
|
||||
java/awt/FullScreen/MultimonFullscreenTest/MultimonDeadlockTest.java JBR-4379 windows-all
|
||||
java/awt/GraphicsDevice/DisplayModes/CompareToXrandrTest.java JBR-5062 linux-all
|
||||
java/awt/datatransfer/Clipboard/GetContentsInterruptedTest.java JBR-5086 linux-5.15.0-46-generic Ubuntu 20.04
|
||||
java/awt/Frame/FramesGC/FramesGC.java JBR-6057 windows-all
|
||||
java/awt/Frame/GetGraphicsStressTest/GetGraphicsStressTest.java JBR-5117 linux-all
|
||||
java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java 8311535 windows-all
|
||||
java/awt/Multiscreen/WindowGCChangeTest/WindowGCChangeTest.java JBR-5531 macosx-all
|
||||
java/awt/Robot/MouseLocationOnScreen/MouseLocationOnScreen.java JBR-5390 macosx-all,linux-all
|
||||
java/awt/Toolkit/AWTEventListenerProxyTest/AWTEventListenerProxyTest.java JBR-6065 windows-all
|
||||
java/awt/im/memoryleak/InputContextMemoryLeakTest.java JBR-6065 windows-all
|
||||
|
||||
javax/swing/JInternalFrame/Test6325652.java JBR-6065 windows-all
|
||||
javax/swing/JMenu/4692443/bug4692443.java JBR-6065 windows-all
|
||||
javax/swing/JMenuBar/4750590/bug4750590.java JBR-6065 windows-all
|
||||
javax/swing/JMenuItem/4171437/bug4171437.java JBR-6065 windows-all
|
||||
javax/swing/JTextField/8036819/bug8036819.java JBR-6065 windows-all
|
||||
javax/swing/JTree/4927934/bug4927934.java JBR-6065 windows-all
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.java 8017454 macosx-all
|
||||
java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java JBR-5210 windows-all
|
||||
java/awt/Frame/MiscUndecorated/ActiveSwingWindowTest.java JBR-5210 windows-all
|
||||
java/awt/Frame/MiscUndecorated/FrameCloseTest.java JBR-5210 windows-all
|
||||
java/awt/Frame/MiscUndecorated/RepaintTest.java 8266244,JBR-5786 macosx-aarch64,linux-all
|
||||
java/awt/Frame/MiscUndecorated/RepaintTest.java 8266244,JBR-5786 macosx-aarch64,generic-all
|
||||
java/awt/Robot/HiDPIMouseClick/HiDPIRobotMouseClick.java 8253184 windows-all
|
||||
java/awt/Modal/FileDialog/FileDialogAppModal1Test.java 7186009,8253184,JBR-5827 macosx-all,windows-all,linux-all
|
||||
java/awt/Modal/FileDialog/FileDialogAppModal2Test.java 7186009,8253184 macosx-all,windows-all
|
||||
@@ -633,6 +633,7 @@ java/awt/Mouse/MouseWheelAbsXY/MouseWheelAbsXY.java 8253184 windows-all
|
||||
java/awt/Toolkit/ToolkitPropertyTest/ToolkitPropertyTest_Enable.java 6847163 linux-all
|
||||
java/awt/xembed/server/RunTestXEmbed.java 7034201 linux-all
|
||||
java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java 8164473 linux-all
|
||||
java/awt/Frame/DecoratedFrameInsets/DecoratedFrameInsetsTest.java JBR-5205 linux-5.4.0-1103-aws
|
||||
java/awt/Frame/DisposeParentGC/DisposeParentGC.java 8079786 macosx-all
|
||||
|
||||
java/awt/GraphicsDevice/CheckDisplayModes.java 8266242 macosx-aarch64
|
||||
@@ -662,6 +663,7 @@ java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java 8238720 w
|
||||
java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java 8238720 windows-all
|
||||
java/awt/event/MouseEvent/FrameMouseEventAbsoluteCoordsTest/FrameMouseEventAbsoluteCoordsTest.java 8238720 windows-all
|
||||
|
||||
java/awt/wakefield/RobotKeyboard.java JBR-5653 linux-all
|
||||
java/awt/wakefield/ScreenCapture.java JBR-5653 linux-all
|
||||
|
||||
# Several tests which fail sometimes on macos11
|
||||
@@ -874,6 +876,7 @@ javax/imageio/plugins/external_plugin_tests/TestClassPathPlugin.sh JBR-5363 wind
|
||||
javax/swing/plaf/basic/BasicComboPopup/JComboBoxPopupLocation/JComboBoxPopupLocation.java 8194945 macosx-all
|
||||
javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java 8253184,JBR-5510 windows-all,linux-5.18.2-arch1-1
|
||||
javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java 8253184 windows-all
|
||||
javax/swing/plaf/basic/BasicTableHeaderUI/6394566/bug6394566.java JBR-5846 windows-all
|
||||
javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java 8233177 linux-all,windows-all
|
||||
javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java 8253184 linux-all,windows-all
|
||||
javax/swing/plaf/nimbus/8041642/bug8041642.java 8253184,JBR-5510 windows-all,linux-5.18.2-arch1-1
|
||||
@@ -894,12 +897,14 @@ javax/swing/JColorChooser/Test6524757.java JBR-5210 windows-all
|
||||
javax/swing/JColorChooser/Test6827032.java JBR-5210 windows-all
|
||||
javax/swing/JComboBox/6406264/bug6406264.java JBR-5210 windows-all
|
||||
javax/swing/JComboBox/bug4890345.java JBR-5799 windows-all
|
||||
javax/swing/JComboBox/bug4924758.java JBR-5846 windows-all
|
||||
javax/swing/JComboBox/bug5029504.java JBR-5799 windows-all
|
||||
javax/swing/JComponent/6683775/bug6683775.java 8172337 generic-all
|
||||
javax/swing/JDialog/Transparency/TransparencyTest.java 8253184,JBR-5510 windows-all,linux-5.18.2-arch1-1
|
||||
javax/swing/JLabel/4138746/JLabelMnemonicsTest.java JBR-4949 linux-all,windows-all
|
||||
javax/swing/JLabel/6596966/bug6596966.java 8197552 windows-all
|
||||
javax/swing/JLabel/7004134/bug7004134.java JBR-5437 linux-all
|
||||
javax/swing/JMenu/4515762/bug4515762.java 8197552 windows-all
|
||||
javax/swing/JMenu/6470128/bug6470128.java 8253184 windows-all
|
||||
javax/swing/JMenu/6538132/bug6538132.java JBR-894 windows-all00
|
||||
javax/swing/JMenuItem/4654927/bug4654927.java JBR-164 windows-all
|
||||
@@ -944,6 +949,7 @@ javax/swing/JEditorPane/bug4714674.java JBR-5810 windows-all
|
||||
javax/swing/JComboBox/DisabledComboBoxFontTestAuto.java 8310072 linux-all,windows-all
|
||||
javax/swing/JEditorPane/JEditorPaneGCSwitchTest/JEditorPaneGCSwitchTest_i18n.java JBR-912 windows-all
|
||||
javax/swing/JEditorPane/JEditorPaneGCSwitchTest/JEditorPaneGCSwitchTest.java JBR-912 windows-all
|
||||
javax/swing/JFileChooser/4524490/bug4524490.java JBR-5846 windows-all
|
||||
javax/swing/JFileChooser/8021253/bug8021253.java JBR-107 windows-all
|
||||
javax/swing/JFileChooser/8041694/bug8041694.java JBR-5210 windows-all
|
||||
javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8198003 generic-all
|
||||
@@ -964,9 +970,11 @@ javax/swing/JTabbedPane/4361477/bug4361477.java JBR-5932 linux-all
|
||||
javax/swing/JTabbedPane/8007563/Test8007563.java 8051591 generic-all
|
||||
javax/swing/JTabbedPane/4624207/bug4624207.java 8064922,8197552 macosx-all,windows-all 8064922:macosx-all, 8197552:windows-all
|
||||
javax/swing/JTabbedPane/TestBackgroundScrollPolicy.java 8253184,windows-all
|
||||
javax/swing/JToggleButton/TestSelectedKey.java JBR-5846 windows-all
|
||||
javax/swing/JToolBar/4529206/bug4529206.java JBR-5387 linux-all
|
||||
javax/swing/JToolTip/6219960/bug6219960.java 8253184 windows-all
|
||||
javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java 8160720 generic-all
|
||||
javax/swing/text/AbstractDocument/8190763/TestCCEOnEditEvent.java JBR-5799 windows-all
|
||||
javax/swing/text/DefaultCaret/HidingSelection/HidingSelectionTest.java JBR-5510 linux-5.18.2-arch1-1
|
||||
javax/swing/text/TableView/TableViewLayoutTest.java 8194936,JBR-4316,JBR-5510 linux-5.18.2-arch1-1,linux-all
|
||||
javax/swing/JFileChooser/6798062/bug6798062.java 8146446 windows-all
|
||||
@@ -1010,7 +1018,7 @@ javax/swing/text/StyledEditorKit/4506788/bug4506788.java JBR-180 windows-all
|
||||
javax/swing/text/View/8014863/bug8014863.java JBR-5541 windows-all
|
||||
javax/swing/text/View/8156217/FPMethodCalledTest.java JBR-5541 linux-all
|
||||
javax/swing/UI/UnninstallUIMemoryLeaks/UnninstallUIMemoryLeaks.java JBR-5952 windows-x64
|
||||
javax/swing/UIDefaults/6795356/TableTest.java.TableTest JBR-5767 windows-all
|
||||
javax/swing/UIDefaults/6795356/TableTest.java JBR-5767 windows-all
|
||||
java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java 8253184 windows-all
|
||||
java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java 8253184 windows-all
|
||||
java/awt/Robot/CheckCommonColors/CheckCommonColors.java 8253184,JBR-5510 windows-all,linux-5.18.2-arch1-1
|
||||
@@ -1024,6 +1032,7 @@ sanity/client/SwingSet/src/FrameDemoTest.java 8253184 windows-all
|
||||
sanity/client/SwingSet/src/InternalFrameDemoTest.java 8253184 windows-all
|
||||
sanity/client/SwingSet/src/GridBagLayoutDemoTest.java 8253184 windows-all
|
||||
sanity/client/SwingSet/src/TextFieldDemoTest.java JBR-5061 linux-5.15.0-39-generic Ubuntu-22.04
|
||||
sanity/client/SwingSet/src/ToolTipDemoTest.java 8293001 linux-all
|
||||
sanity/client/SwingSet/src/SliderDemoTest.java 8253184 windows-all
|
||||
sanity/client/SwingSet/src/SpinnerDemoTest.java 8253184 windows-all
|
||||
sanity/client/SwingSet/src/SplitPaneDemoTest.java JBR-5817 linux-5.19.0-1025-aws
|
||||
@@ -1258,6 +1267,7 @@ javax/swing/JSpinner/JSpinnerFocusTest.java JBR-5288 windows-all
|
||||
javax/swing/JSpinner/SpinnerTest.java JBR-4880 windows-all
|
||||
javax/swing/JSpinner/TestJSpinnerFocusLost.java JBR-5210 windows-all
|
||||
javax/swing/JTable/7068740/bug7068740.java 8197552 windows-all
|
||||
javax/swing/JTable/8236907/LastVisibleRow.java JBR-6066 macosx-aarch64
|
||||
javax/swing/text/FlowView/LayoutTest.java JBR-4880 windows-all
|
||||
javax/swing/text/html/7189299/bug7189299.java JBR-4880 windows-all
|
||||
jb/java/jcef/HandleJSQueryTest3314.sh JBR-4866 linux-all
|
||||
@@ -1344,6 +1354,7 @@ java/awt/image/VolatileImage/ReportRenderingError.java#windows JBR-5359 windows-
|
||||
java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java JBR-5359,JBR-5510 windows-aarch64,linux-5.18.2-arch1-1
|
||||
java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java JBR-5359,JBR-5510 windows-aarch64,linux-5.18.2-arch1-1
|
||||
java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java JBR-5359,JBR-5510 windows-aarch64,linux-5.18.2-arch1-1
|
||||
java/awt/Mixing/LWPopupMenu.java JBR-824 generic-all
|
||||
java/awt/Mixing/OpaqueTest.java JBR-5707 linux-all
|
||||
java/awt/Mixing/OverlappingButtons.java JBR-5707 linux-all
|
||||
java/awt/Window/BackgroundIsNotUpdated/BackgroundIsNotUpdated.java JBR-5359,JBR-5510 windows-aarch64,linux-5.18.2-arch1-1
|
||||
@@ -1366,13 +1377,14 @@ jb/java/awt/CustomTitleBar/HitTestNonClientArea.java JBR-5465,JBR-5550 windows-a
|
||||
jb/java/awt/CustomTitleBar/MaximizeWindowTest.java JBR-5465,JBR-5550 windows-all
|
||||
jb/java/awt/CustomTitleBar/MaximizedWindowFocusTest.java JBR-5828 windows-all
|
||||
jb/java/awt/CustomTitleBar/MinimizingWindowTest.java JBR-5359,JBR-5345 windows-aarch64,windows-x64
|
||||
jb/java/awt/CustomTitleBar/MouseEventsOnClientArea.java JBR-5910 windows-x64
|
||||
jb/java/awt/CustomTitleBar/NativeControlsVisibilityTest.java JBR-5359,JBR-5345 windows-aarch64,windows-x64
|
||||
jb/java/awt/CustomTitleBar/WindowsControlWidthTest.java JBR-5359,JBR-5345 windows-aarch64,windows-x64
|
||||
jb/java/awt/CustomTitleBar/WindowResizeTest.java JBR-5592 windows-all
|
||||
sanity/client/SwingSet/src/EditorPaneDemoTest.java JBR-5359,JBR-5510 windows-aarch64,linux-5.18.2-arch1-1
|
||||
sun/java2d/AcceleratedXORModeTest.java JBR-5359 windows-aarch64
|
||||
sun/java2d/GdiRendering/ClipShapeRendering.java JBR-5359,JBR-5510 windows-aarch64,linux-5.18.2-arch1-1
|
||||
sun/java2d/GdiRendering/InsetClipping.java JBR-5359,JBR-5510 windows-aarch64,linux-5.18.2-arch1-1
|
||||
sun/java2d/GdiRendering/InsetClipping.java 7124403,JBR-5359,JBR-5510 windows-x64,macosx-all,windows-aarch64,linux-5.18.2-arch1-1
|
||||
|
||||
java/awt/Choice/PopdownGeneratesMouseEvents/PopdownGeneratesMouseEvents.java JBR-5510 linux-5.18.2-arch1-1
|
||||
java/awt/Insets/DialogInsets.java JBR-5510 linux-5.18.2-arch1-1
|
||||
|
||||
@@ -25,8 +25,6 @@ java/awt/Mouse/ExtraMouseClick/ExtraMouseClick.java JBR-4354 windows-all,linux-a
|
||||
java/awt/Mouse/MouseComboBoxTest/MouseComboBoxTest.java nobug windows-all
|
||||
java/awt/Paint/PaintNativeOnUpdate.java nobug windows-all
|
||||
java/awt/Robot/CheckCommonColors/CheckCommonColors.java nobug windows-all
|
||||
java/awt/Robot/HiDPIScreenCapture/HiDPIRobotScreenCaptureTest.java nobug windows-all
|
||||
java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java nobug windows-all
|
||||
java/awt/TextArea/OverScrollTest/OverScrollTest.java nobug windows-all
|
||||
java/awt/TextField/OverScrollTest/OverScrollTest.java nobug windows-all
|
||||
java/awt/Window/8159168/SetShapeTest.java nobug windows-all
|
||||
|
||||
@@ -30,11 +30,13 @@ import quality.util.RenderUtil;
|
||||
import java.awt.*;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.awt.font.GlyphVector;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.awt.font.TextLayout;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Path2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Map;
|
||||
|
||||
public class TextMetricsTest {
|
||||
|
||||
@@ -42,7 +44,6 @@ public class TextMetricsTest {
|
||||
public void testTextBounds() throws Exception {
|
||||
final Font font = new Font("Menlo", Font.PLAIN, 22);
|
||||
|
||||
|
||||
BufferedImage bi = RenderUtil.capture(120, 120,
|
||||
g2 -> {
|
||||
String s = "A";
|
||||
@@ -92,4 +93,49 @@ public class TextMetricsTest {
|
||||
Assert.assertTrue(bnd.getX() == 0.0 && bnd.getY() == 0.0 &&
|
||||
bnd.getWidth() == 0.0 && bnd.getHeight() == 0.0);
|
||||
}
|
||||
|
||||
private static void checkStringWidth(Font font, FontRenderContext frc, String str) {
|
||||
float width = (float) font.getStringBounds(str.toCharArray(), 0, str.length(), frc).getWidth();
|
||||
float standard = new TextLayout(str, font, frc).getAdvance();
|
||||
Assert.assertTrue(Math.abs(width - standard) < 0.1f);
|
||||
}
|
||||
|
||||
private static void checkCalculationStringWidth(Font font, String text) {
|
||||
AffineTransform affineTransform = new AffineTransform();
|
||||
Map<TextAttribute, Object> attributes = null;
|
||||
FontRenderContext frc = new FontRenderContext(affineTransform, true, true);
|
||||
FontRenderContext baseFrc = new FontRenderContext(new AffineTransform(), true, true);
|
||||
|
||||
checkStringWidth(font, frc, text);
|
||||
checkStringWidth(font.deriveFont(affineTransform), frc, text);
|
||||
|
||||
affineTransform.translate(0.5f, 0.0f);
|
||||
checkStringWidth(font, frc, text);
|
||||
checkStringWidth(font.deriveFont(affineTransform), baseFrc, text);
|
||||
|
||||
attributes = Map.of(TextAttribute.TRACKING, 0.5);
|
||||
checkStringWidth(font.deriveFont(attributes), baseFrc, text);
|
||||
|
||||
attributes = Map.of(TextAttribute.KERNING, TextAttribute.KERNING_ON);
|
||||
checkStringWidth(font.deriveFont(attributes), baseFrc, text);
|
||||
|
||||
attributes = Map.of(TextAttribute.LIGATURES, TextAttribute.LIGATURES_ON);
|
||||
checkStringWidth(font.deriveFont(attributes), baseFrc, text);
|
||||
}
|
||||
|
||||
@Test
|
||||
// checking equals of calculation of string's width with two different approach:
|
||||
// fast implementation inside FontDesignMetrics and guaranteed correct implementation in TextLayout
|
||||
public void checkCalculationStringWidth() {
|
||||
final Font font = new Font("Arial", Font.PLAIN, 15);
|
||||
|
||||
checkCalculationStringWidth(font,
|
||||
"AVAVAVAVAVAVAAAAVVAVVAVVVAVAVAVAVAVA !@#$%^&*12345678zc.vbnm.a..s.dfg,hjqwertgyh}{}{}///");
|
||||
checkCalculationStringWidth(font,
|
||||
"a");
|
||||
checkCalculationStringWidth(font,
|
||||
"世丕且且世两上与丑万丣丕且丗丕");
|
||||
checkCalculationStringWidth(font,
|
||||
"\uD83D\uDE06\uD83D\uDE06\uD83D\uDE06\uD83D\uDE06\uD83D\uDE06\uD83D\uDE06\uD83D\uDE06");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user