Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • master
  • vkd3d-1.7.x
  • vkd3d-0.0.1
  • vkd3d-1.0
  • vkd3d-1.1
  • vkd3d-1.10
  • vkd3d-1.11
  • vkd3d-1.12
  • vkd3d-1.13
  • vkd3d-1.14
  • vkd3d-1.15
  • vkd3d-1.2
  • vkd3d-1.3
  • vkd3d-1.4
  • vkd3d-1.5
  • vkd3d-1.6
  • vkd3d-1.7
  • vkd3d-1.7.1
  • vkd3d-1.8
  • vkd3d-1.9
20 results

Target

Select target project
  • wine/vkd3d
  • stefan/vkd3d
  • cmccarthy/vkd3d
  • giomasce/vkd3d
  • fcasas/vkd3d
  • jactry/vkd3d
  • ReDress/vkd3d
  • mstorsjo/vkd3d
  • huw/vkd3d
  • julliard/vkd3d
  • bshanks/vkd3d
  • zfigura/vkd3d
  • hverbeet/vkd3d
  • DarkShadow44/vkd3d
  • nsivov/vkd3d
  • dhary686/vkd3d
  • Mystral/vkd3d
  • maljaf/vkd3d
  • smcv/vkd3d
  • flibitijibibo/vkd3d
  • q4a/vkd3d
  • jsikorski/vkd3d
  • alesliehughes/vkd3d-alesliehughes
  • vitorhnn/vkd3d
  • agusev/vkd3d
  • etang-cw/vkd3d
  • petrathekat/vkd3d
  • simon.mr995/vkd3d
  • sgwaki/vkd3d
  • jacek/vkd3d
  • fweimer/vkd3d
  • Clara/vkd3d
  • disini/vkd3d
  • antenabr2/vkd3d
  • gilvbp/vkd3d
  • yshui/vkd3d
  • shaunren/vkd3d
  • jennetsaryyewa96/vkd3d
  • Jamesattay/vkd3d
  • zacemmneeto77/vkd3d
  • GermanAizek/vkd3d
  • opespinach/vkd3d
  • ruslanboyka201/vkd3d
  • navi/vkd3d
  • Feifan/vkd3d
  • yashmhmdly172/vkd3d
  • Sec32fun32/vkd3d
  • ritalat/vkd3d
  • ivyl/vkd3d
  • baikaishiuc/vkd3d
  • austin987/vkd3d
  • TornadoCookie/vkd3d
52 results
Select Git revision
  • accel_struct
  • aliasing
  • alternative_dx_io_2
  • amiata
  • android
  • args
  • aso
  • atomics
  • binding_tier
  • cfg2
  • cfg3
  • cfg4
  • cfg_block_count
  • ci-image
  • ci-mvk
  • ci-test
  • clip-cull
  • d3d12
  • descriptors
  • docs
  • ds_footprints_proposal
  • dump-dxil
  • dump_dxil
  • eval_attr
  • eyjafjallajokull
  • falconeer
  • falconeer2
  • falconeer3
  • faster-spirv
  • faster-spirv2
  • feedback
  • fix-d3d12
  • fix_root_descriptors
  • fix_win
  • flegrei
  • hash-table
  • heap
  • initial_state
  • investigate
  • io
  • larderello
  • llvmpipe
  • llvmpipe-crash
  • mac
  • master
  • mongibello-master
  • mongibello-old
  • msl2
  • msl_typing
  • mutable
  • non-uniform2
  • nvidia
  • nvidia_freeze
  • olympus
  • preproc_doc
  • proposal
  • proposal_mesa_lt
  • push_constants
  • qualcomm
  • refactor
  • refactor2
  • select
  • shader_root_sig
  • shadowci
  • spirv_parser
  • stress-tester
  • stromboli
  • sync
  • sync_experiments
  • test
  • test-pipeline
  • test-runner-models
  • test_16_bit_validation
  • texkill_with_ssa
  • validate_descriptors
  • validate_instructions
  • validate_instructions_dubious
  • validate_registers
  • validate_signatures
  • validate_signatures2
  • vesuvio
  • vsir_transform
  • vulcano
  • yellowstone
  • vkd3d-0.0.1
  • vkd3d-1.0
  • vkd3d-1.1
  • vkd3d-1.10
  • vkd3d-1.11
  • vkd3d-1.2
  • vkd3d-1.3
  • vkd3d-1.4
  • vkd3d-1.5
  • vkd3d-1.6
  • vkd3d-1.7
  • vkd3d-1.8
  • vkd3d-1.9
97 results
Show changes
Commits on Source (1703)
# https://editorconfig.org/
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
tab_width = 8
trim_trailing_whitespace = true
max_line_length = 120
insert_final_newline = true
[Makefile*]
indent_style = tab
indent_size = 8
This diff is collapsed.
......@@ -3,6 +3,8 @@ Alexandre Julliard
Alistair Leslie-Hughes
Andrew Eikum
Andrey Gusev
Anna (navi) Figueiredo Gomes
Arkadiusz Hiler
Atharva Nimbalkar
Biswapriyo Nath
Brendan Shanks
......@@ -14,6 +16,7 @@ Elizabeth Figura
Ethan Lee
Evan Tang
Fabian Maurer
Feifan He
Florian Weimer
Francisco Casas
Francois Gouget
......@@ -33,8 +36,10 @@ Petrichor Park
Philip Rebohle
Rémi Bernon
Robin Kertels
Shaun Ren
Stefan Dösinger
Sven Hesse
Victor Chiletto
Vinson Lee
Yuxuan Shui
Zhiyi Zhang
Copyright 2016-2024 the Vkd3d project authors (see the file AUTHORS for a
Copyright 2016-2025 the Vkd3d project authors (see the file AUTHORS for a
complete list)
Vkd3d is free software; you can redistribute it and/or modify it under
......
This diff is collapsed.
......@@ -10,6 +10,7 @@ OPTIMIZE_OUTPUT_FOR_C = YES
EXTRACT_STATIC = YES
QUIET = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_INCOMPLETE_DOC = NO
LATEX_BATCHMODE = YES
INPUT = @srcdir@/include/vkd3d.h \
......
......@@ -2,6 +2,7 @@ ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = @VKD3D_CFLAGS@
AM_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/include/private -I$(builddir)/include/private
AM_LDFLAGS = -no-undefined
VKD3D_PERL = $(PERL) -w
widl_headers = \
include/vkd3d_d3d12.h \
......@@ -48,8 +49,8 @@ vkd3d_cross_tests = \
vkd3d_shader_tests = \
tests/hlsl/abs.shader_test \
tests/hlsl/all.shader_test \
tests/hlsl/alpha-test.shader_test \
tests/hlsl/angle-unit.shader_test \
tests/hlsl/annotations.shader_test \
tests/hlsl/any.shader_test \
tests/hlsl/arithmetic-float-uniform.shader_test \
tests/hlsl/arithmetic-float.shader_test \
......@@ -60,8 +61,10 @@ vkd3d_shader_tests = \
tests/hlsl/array-parameters.shader_test \
tests/hlsl/array-size-expr.shader_test \
tests/hlsl/asfloat.shader_test \
tests/hlsl/asint.shader_test \
tests/hlsl/asuint.shader_test \
tests/hlsl/attributes.shader_test \
tests/hlsl/bitwise-assignment.shader_test \
tests/hlsl/bitwise.shader_test \
tests/hlsl/bool-cast.shader_test \
tests/hlsl/bool-semantics.shader_test \
......@@ -78,32 +81,53 @@ vkd3d_shader_tests = \
tests/hlsl/ceil.shader_test \
tests/hlsl/cf-cond-types.shader_test \
tests/hlsl/clamp.shader_test \
tests/hlsl/clip-cull-distance.shader_test \
tests/hlsl/clip-planes.shader_test \
tests/hlsl/clip.shader_test \
tests/hlsl/combined-samplers.shader_test \
tests/hlsl/comma.shader_test \
tests/hlsl/compute.shader_test \
tests/hlsl/conditional.shader_test \
tests/hlsl/const.shader_test \
tests/hlsl/constructgswithso.shader_test \
tests/hlsl/coverage.shader_test \
tests/hlsl/cross.shader_test \
tests/hlsl/d3dcolor-to-ubyte4.shader_test \
tests/hlsl/ddxddy.shader_test \
tests/hlsl/default-values.shader_test \
tests/hlsl/depth-bounds.shader_test \
tests/hlsl/depth-out.shader_test \
tests/hlsl/determinant.shader_test \
tests/hlsl/discard.shader_test \
tests/hlsl/distance.shader_test \
tests/hlsl/dot.shader_test \
tests/hlsl/duplicate-modifiers.shader_test \
tests/hlsl/early-depth-stencil.shader_test \
tests/hlsl/effect-annotations-fx_2.shader_test \
tests/hlsl/effect-annotations-fx_4.shader_test \
tests/hlsl/effect-assignments-fx_5.shader_test \
tests/hlsl/effect-compile.shader_test \
tests/hlsl/effect-initial-values-fx_2.shader_test \
tests/hlsl/effect-initial-values-fx_4.shader_test \
tests/hlsl/effect-pass-states-fx_4.shader_test \
tests/hlsl/effect-pass-states-fx_5.shader_test \
tests/hlsl/effect-shader-objects-fx_2.shader_test \
tests/hlsl/effect-shader-objects-fx_5.shader_test \
tests/hlsl/effect-technique-fx_2.shader_test \
tests/hlsl/effect-technique-fx_4.shader_test \
tests/hlsl/effect-technique-fx_5.shader_test \
tests/hlsl/effect-variables-fx_2.shader_test \
tests/hlsl/effect-variables-fx_4.shader_test \
tests/hlsl/effect-variables-fx_5.shader_test \
tests/hlsl/entry-point-semantics.shader_test \
tests/hlsl/eval-attrib.shader_test \
tests/hlsl/exp.shader_test \
tests/hlsl/expr-indexing.shader_test \
tests/hlsl/f16tof32.shader_test \
tests/hlsl/f32tof16.shader_test \
tests/hlsl/faceforward.shader_test \
tests/hlsl/fog.shader_test \
tests/hlsl/ffp-point-size.shader_test \
tests/hlsl/float-comparison.shader_test \
tests/hlsl/floor.shader_test \
tests/hlsl/fmod.shader_test \
......@@ -115,13 +139,17 @@ vkd3d_shader_tests = \
tests/hlsl/function.shader_test \
tests/hlsl/fwidth.shader_test \
tests/hlsl/fxgroup-syntax.shader_test \
tests/hlsl/gather-cmp.shader_test \
tests/hlsl/gather-offset.shader_test \
tests/hlsl/gather.shader_test \
tests/hlsl/geometry-shader-syntax.shader_test \
tests/hlsl/geometry.shader_test \
tests/hlsl/get-sample-pos.shader_test \
tests/hlsl/getdimensions.shader_test \
tests/hlsl/half.shader_test \
tests/hlsl/hard-copy-prop.shader_test \
tests/hlsl/hull-shader-attributes.shader_test \
tests/hlsl/hull-shader-syntax.shader_test \
tests/hlsl/initializer-flatten.shader_test \
tests/hlsl/initializer-implicit-array.shader_test \
tests/hlsl/initializer-invalid-arg-count.shader_test \
......@@ -133,14 +161,19 @@ vkd3d_shader_tests = \
tests/hlsl/initializer-objects.shader_test \
tests/hlsl/initializer-static-array.shader_test \
tests/hlsl/initializer-struct.shader_test \
tests/hlsl/intrinsic-override.shader_test \
tests/hlsl/instance-id.shader_test \
tests/hlsl/interface-packing.shader_test \
tests/hlsl/intrinsic-override.shader_test \
tests/hlsl/invalid.shader_test \
tests/hlsl/inverse-trig.shader_test \
tests/hlsl/is-front-face.shader_test \
tests/hlsl/isinf.shader_test \
tests/hlsl/ldexp.shader_test \
tests/hlsl/length-property.shader_test \
tests/hlsl/length.shader_test \
tests/hlsl/lerp.shader_test \
tests/hlsl/lhs-cast.shader_test \
tests/hlsl/lhs-partial-assignment.shader_test \
tests/hlsl/lit.shader_test \
tests/hlsl/load-level.shader_test \
tests/hlsl/log.shader_test \
......@@ -154,22 +187,28 @@ vkd3d_shader_tests = \
tests/hlsl/matrix-semantics.shader_test \
tests/hlsl/max-min.shader_test \
tests/hlsl/minimum-precision.shader_test \
tests/hlsl/modf.shader_test \
tests/hlsl/mul.shader_test \
tests/hlsl/multiple-rt.shader_test \
tests/hlsl/nested-arrays.shader_test \
tests/hlsl/nointerpolation.shader_test \
tests/hlsl/non-const-indexing.shader_test \
tests/hlsl/normalize.shader_test \
tests/hlsl/null.shader_test \
tests/hlsl/numeric-constructor-truncation.shader_test \
tests/hlsl/numeric-types.shader_test \
tests/hlsl/numthreads.shader_test \
tests/hlsl/object-field-offsets.shader_test \
tests/hlsl/object-parameters.shader_test \
tests/hlsl/object-references.shader_test \
tests/hlsl/patch-syntax.shader_test \
tests/hlsl/pixel-position.shader_test \
tests/hlsl/point-sprite.shader_test \
tests/hlsl/pointer-cast.shader_test \
tests/hlsl/pow.shader_test \
tests/hlsl/precise-modifier.shader_test \
tests/hlsl/rasteriser-ordered-views.shader_test \
tests/hlsl/rcp.shader_test \
tests/hlsl/reflect.shader_test \
tests/hlsl/refract.shader_test \
tests/hlsl/register-reservations-numeric.shader_test \
......@@ -179,25 +218,35 @@ vkd3d_shader_tests = \
tests/hlsl/return-implicit-conversion.shader_test \
tests/hlsl/return.shader_test \
tests/hlsl/round.shader_test \
tests/hlsl/rt-array-index.shader_test \
tests/hlsl/rt-format-mismatch.shader_test \
tests/hlsl/rt-get-sample-info.shader_test \
tests/hlsl/sample-bias.shader_test \
tests/hlsl/sample-cmp.shader_test \
tests/hlsl/sample-grad.shader_test \
tests/hlsl/sample-level.shader_test \
tests/hlsl/sampler-offset.shader_test \
tests/hlsl/sampler-state.shader_test \
tests/hlsl/sampler.shader_test \
tests/hlsl/saturate.shader_test \
tests/hlsl/scope.shader_test \
tests/hlsl/shade-mode.shader_test \
tests/hlsl/shader-interstage-interface.shader_test \
tests/hlsl/shader-point-size.shader_test \
tests/hlsl/shape.shader_test \
tests/hlsl/side-effects.shader_test \
tests/hlsl/sign.shader_test \
tests/hlsl/single-numeric-initializer.shader_test \
tests/hlsl/sm1-const-allocation.shader_test \
tests/hlsl/sm1-const-folding.shader_test \
tests/hlsl/sm1-interstage-interface.shader_test \
tests/hlsl/sm6-ternary.shader_test \
tests/hlsl/sm6-uav-rwtexture.shader_test \
tests/hlsl/smoothstep.shader_test \
tests/hlsl/sqrt.shader_test \
tests/hlsl/srv-buffers.shader_test \
tests/hlsl/srv-byteaddressbuffer.shader_test \
tests/hlsl/srv-structuredbuffer.shader_test \
tests/hlsl/state-block-function-syntax.shader_test \
tests/hlsl/state-block-syntax.shader_test \
tests/hlsl/static-initializer.shader_test \
......@@ -206,12 +255,14 @@ vkd3d_shader_tests = \
tests/hlsl/strings.shader_test \
tests/hlsl/struct-array.shader_test \
tests/hlsl/struct-assignment.shader_test \
tests/hlsl/struct-inheritance.shader_test \
tests/hlsl/struct-semantics.shader_test \
tests/hlsl/switch.shader_test \
tests/hlsl/swizzle-constant-prop.shader_test \
tests/hlsl/swizzle-matrix.shader_test \
tests/hlsl/swizzles.shader_test \
tests/hlsl/ternary.shader_test \
tests/hlsl/tessellation-patch-vars.shader_test \
tests/hlsl/tessellation.shader_test \
tests/hlsl/texture-load-offset.shader_test \
tests/hlsl/texture-load-typed.shader_test \
......@@ -233,6 +284,10 @@ vkd3d_shader_tests = \
tests/hlsl/unbounded-array-5.1.shader_test \
tests/hlsl/uniform-parameters.shader_test \
tests/hlsl/uniform-semantics.shader_test \
tests/hlsl/uninitialized-varyings.shader_test \
tests/hlsl/unorm-snorm.shader_test \
tests/hlsl/unroll.shader_test \
tests/hlsl/unsigned.shader_test \
tests/hlsl/vector-indexing-uniform.shader_test \
tests/hlsl/vector-indexing.shader_test \
tests/hlsl/vertex-shader-ops.shader_test \
......@@ -257,7 +312,8 @@ vkd3d_test_headers = \
tests/dxcompiler.h \
tests/shader_runner.h \
tests/utils.h \
tests/vulkan_procs.h
tests/vulkan_procs.h \
tests/vulkan_utils.h
vkd3d_demos = \
demos/vkd3d-gears \
......@@ -265,10 +321,12 @@ vkd3d_demos = \
vkd3d_demos_headers = \
demos/demo.h \
demos/demo_vkd3d.h \
demos/demo_win32.h \
demos/demo_xcb.h
BUILT_SOURCES = $(widl_headers) \
include/private/spirv_grammar.h \
include/private/vkd3d_version.h
noinst_LTLIBRARIES = libvkd3d-common.la
......@@ -327,6 +385,7 @@ nodist_libvkd3d_shader_la_SOURCES = $(vkd3d_shader_yyfiles)
libvkd3d_shader_la_SOURCES = \
include/private/list.h \
include/private/rbtree.h \
include/private/spirv_grammar.h \
include/private/vkd3d_common.h \
include/private/vkd3d_memory.h \
include/vkd3d_shader.h \
......@@ -342,6 +401,7 @@ libvkd3d_shader_la_SOURCES = \
libs/vkd3d-shader/hlsl_codegen.c \
libs/vkd3d-shader/hlsl_constant_ops.c \
libs/vkd3d-shader/ir.c \
libs/vkd3d-shader/msl.c \
libs/vkd3d-shader/preproc.h \
libs/vkd3d-shader/spirv.c \
libs/vkd3d-shader/tpf.c \
......@@ -349,7 +409,7 @@ libvkd3d_shader_la_SOURCES = \
libs/vkd3d-shader/vkd3d_shader_main.c \
libs/vkd3d-shader/vkd3d_shader_private.h
libvkd3d_shader_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_SHADER_SOURCE -I$(srcdir)/libs/vkd3d-shader @SPIRV_TOOLS_CFLAGS@
libvkd3d_shader_la_LDFLAGS = $(AM_LDFLAGS) -version-info 10:0:9
libvkd3d_shader_la_LDFLAGS = $(AM_LDFLAGS) -version-info 14:0:13
libvkd3d_shader_la_LIBADD = libvkd3d-common.la @SPIRV_TOOLS_LIBS@ -lm
if HAVE_LD_VERSION_SCRIPT
libvkd3d_shader_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libs/vkd3d-shader/vkd3d_shader.map
......@@ -384,7 +444,7 @@ libvkd3d_la_SOURCES = \
libs/vkd3d/vkd3d_shaders.h \
libs/vkd3d/vulkan_procs.h
libvkd3d_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_SOURCE
libvkd3d_la_LDFLAGS = $(AM_LDFLAGS) -version-info 12:0:11
libvkd3d_la_LDFLAGS = $(AM_LDFLAGS) -version-info 16:0:15
libvkd3d_la_LIBADD = libvkd3d-common.la libvkd3d-shader.la @DL_LIBS@ @PTHREAD_LIBS@
if HAVE_LD_VERSION_SCRIPT
libvkd3d_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libs/vkd3d/vkd3d.map
......@@ -397,7 +457,7 @@ libvkd3d_utils_la_SOURCES = \
libs/vkd3d-utils/vkd3d_utils_main.c \
libs/vkd3d-utils/vkd3d_utils_private.h
libvkd3d_utils_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_UTILS_SOURCE
libvkd3d_utils_la_LDFLAGS = $(AM_LDFLAGS) -version-info 6:0:5
libvkd3d_utils_la_LDFLAGS = $(AM_LDFLAGS) -version-info 7:1:6
libvkd3d_utils_la_LIBADD = libvkd3d-common.la libvkd3d-shader.la libvkd3d.la @PTHREAD_LIBS@
if HAVE_LD_VERSION_SCRIPT
libvkd3d_utils_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libs/vkd3d-utils/vkd3d_utils.map
......@@ -429,15 +489,20 @@ LDADD = libvkd3d.la libvkd3d-shader.la libvkd3d-utils.la
AM_DEFAULT_SOURCE_EXT = .c
TEST_EXTENSIONS = .shader_test
TEST_CPPFLAGS = -I$(builddir)/tests
if BUILD_TESTS
check_PROGRAMS = $(vkd3d_tests) $(vkd3d_cross_tests) tests/shader_runner
dist_check_SCRIPTS = tests/test-driver.sh
TESTS = $(vkd3d_tests) $(vkd3d_cross_tests) $(vkd3d_shader_tests)
tests_d3d12_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
tests_d3d12_LDADD = $(LDADD) @PTHREAD_LIBS@ @DL_LIBS@
tests_d3d12_invalid_usage_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
tests_d3d12_invalid_usage_LDADD = $(LDADD) @DL_LIBS@
tests_hlsl_d3d12_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
tests_hlsl_d3d12_LDADD = $(LDADD) @DL_LIBS@
tests_shader_runner_CFLAGS = $(AM_CFLAGS) -I$(builddir)/tests @OPENGL_CFLAGS@
tests_shader_runner_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
tests_shader_runner_CFLAGS = $(AM_CFLAGS) @OPENGL_CFLAGS@
tests_shader_runner_LDADD = $(LDADD) @OPENGL_LIBS@ @DL_LIBS@
tests_shader_runner_SOURCES = \
tests/shader_runner.c \
......@@ -446,8 +511,18 @@ tests_shader_runner_SOURCES = \
tests/shader_runner_d3d12.c \
tests/shader_runner_gl.c \
tests/shader_runner_vulkan.c
if HAVE_METAL
tests_shader_runner_OBJCFLAGS = $(AM_CFLAGS)
tests_shader_runner_SOURCES += tests/shader_runner_metal.m
tests_shader_runner_LINK = $(OBJCLINK) -framework Foundation -framework Metal
else
tests_shader_runner_LINK = $(LINK)
endif
tests_vkd3d_api_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
tests_vkd3d_api_LDADD = libvkd3d.la @DL_LIBS@
tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la
tests_vkd3d_shader_api_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
tests_vkd3d_shader_api_CFLAGS = $(AM_CFLAGS) @OPENGL_CFLAGS@
tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la @OPENGL_LIBS@ @DL_LIBS@
SHADER_TEST_LOG_COMPILER = tests/shader_runner
SHADER_TEST_LOG_DRIVER = $(srcdir)/tests/test-driver.sh
endif
......@@ -456,16 +531,18 @@ EXTRA_DIST += $(vkd3d_shader_tests)
if BUILD_DEMOS
DEMOS_LDADD = $(LDADD) libvkd3d-shader.la @DL_LIBS@ @DEMO_LIBS@
DEMOS_CFLAGS = $(AM_CFLAGS) @DEMO_CFLAGS@
DEMOS_CFLAGS = $(AM_CFLAGS) @DEMO_CFLAGS@ -Wa,-I$(srcdir)/demos
bin_PROGRAMS += $(vkd3d_demos)
demos_vkd3d_gears_SOURCES = demos/gears.c demos/gears_hlsl.h
demos_vkd3d_gears_SOURCES = demos/gears.c demos/gears.hlsl
demos_vkd3d_gears_CFLAGS = $(DEMOS_CFLAGS)
demos_vkd3d_gears_LDADD = $(DEMOS_LDADD) -lm
demos/vkd3d_gears-gears.$(OBJEXT): demos/gears.hlsl
demos_vkd3d_triangle_SOURCES = demos/triangle.c demos/triangle_hlsl.h
demos_vkd3d_triangle_SOURCES = demos/triangle.c demos/triangle.hlsl
demos_vkd3d_triangle_CFLAGS = $(DEMOS_CFLAGS)
demos_vkd3d_triangle_LDADD = $(DEMOS_LDADD)
demos/vkd3d_triangle-triangle.$(OBJEXT): demos/triangle.hlsl
endif
noinst_HEADERS = $(vkd3d_test_headers) $(vkd3d_demos_headers)
......@@ -510,6 +587,15 @@ libvkd3d.pc: $(srcdir)/libs/vkd3d/libvkd3d.pc.in Makefile
-e 's![@]PACKAGE_VERSION[@]!$(PACKAGE_VERSION)!g' \
$< > $@
VKD3D_V_PERL = $(vkd3d_v_perl_@AM_V@)
vkd3d_v_perl_ = $(vkd3d_v_perl_@AM_DEFAULT_V@)
vkd3d_v_perl_0 = @echo " PERL " $@;
vkd3d_v_perl_1 =
include/private/spirv_grammar.h: libs/vkd3d-shader/make_spirv include/private/spirv.core.grammar.json
@$(MKDIR_P) $(@D)
$(VKD3D_V_PERL)$(VKD3D_PERL) $^ > $@.tmp && mv $@.tmp $@
include/private/vkd3d_version.h: dummy-vkd3d-version
@$(MKDIR_P) include/private
version=`(GIT_DIR=$(top_srcdir)/.git git rev-parse --short HEAD 2>/dev/null || echo '') \
......@@ -518,7 +604,7 @@ include/private/vkd3d_version.h: dummy-vkd3d-version
&& (echo $$version | cmp -s - $@) \
|| echo $$version >$@ || ($(RM) $@ && exit 1)
.SILENT: include/private/vkd3d_version.h
CLEANFILES += include/private/vkd3d_version.h
CLEANFILES += include/private/spirv_grammar.h include/private/vkd3d_version.h
.PHONY: dummy-vkd3d-version
dummy-vkd3d-version:
......@@ -526,7 +612,7 @@ dummy-vkd3d-version:
## Cross-compile tests
cross_implibs = crosslibs/d3d12
CROSS_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/include/private -I$(builddir)/include -I$(builddir)/tests
CROSS_CFLAGS = -g -O2 -Wall -municode ${CROSS_CPPFLAGS} \
CROSS_CFLAGS = -g -O2 -Wall -municode ${CROSS_CPPFLAGS} -Wa,-I$(srcdir)/demos \
-D_WIN32_WINNT=0x0600 -D__USE_MINGW_ANSI_STDIO=0 -DVKD3D_CROSSTEST=1
EXTRA_DIST += $(cross_implibs:=.cross32.def) $(cross_implibs:=.cross64.def)
EXTRA_DIST += tests/driver.c tests/shader_runner_d3d11.c tests/shader_runner_d3d9.c
......@@ -550,6 +636,8 @@ CROSS32_EXEFILES += $(vkd3d_cross_tests:=.cross32.exe)
endif
if BUILD_DEMOS
CROSS32_EXEFILES += $(vkd3d_demos:demos/vkd3d-%=demos/%.cross32.exe)
demos/gears.cross32.exe: demos/gears.hlsl
demos/triangle.cross32.exe: demos/triangle.hlsl
endif
CROSS32_FILES = $(CROSS32_EXEFILES)
......@@ -597,6 +685,8 @@ CROSS64_EXEFILES += $(vkd3d_cross_tests:=.cross64.exe)
endif
if BUILD_DEMOS
CROSS64_EXEFILES += $(vkd3d_demos:demos/vkd3d-%=demos/%.cross64.exe)
demos/gears.cross64.exe: demos/gears.hlsl
demos/triangle.cross64.exe: demos/triangle.hlsl
endif
CROSS64_FILES = $(CROSS64_EXEFILES)
......
......@@ -9,7 +9,8 @@ similar, but not identical, to Direct3D 12.
Building vkd3d
==============
Vkd3d depends on SPIRV-Headers and Vulkan-Headers (>= 1.3.228).
Vkd3d depends on SPIRV-Headers and Vulkan-Headers (>= 1.3.228), as well as Perl
and libjson-perl.
Vkd3d generates some of its headers from IDL files. If you are using the
release tarballs, then these headers are pre-generated and are included. If
......@@ -19,10 +20,20 @@ available or is not recent (>= 3.21), then you can build Wine with `make
tools/widl/widl' to avoid building all of Wine. You can then point vkd3d's
configure at that widl binary with `WIDL="/path/to/widl"'.
For release builds, you may want to define NDEBUG. If you do not need debug log
messages, you may also consider VKD3D_NO_TRACE_MESSAGES and
VKD3D_NO_DEBUG_MESSAGES. For example, you can pass `CPPFLAGS="-DNDEBUG
-DVKD3D_NO_TRACE_MESSAGES"' to configure.
For release builds, you may want to disable debug log messages defining
preprocessor macros VKD3D_NO_TRACE_MESSAGES and VKD3D_NO_DEBUG_MESSAGES.
See the `Preprocessor definitions' section below for more details.
================
Developing vkd3d
================
Development of vkd3d happens on the Wine GitLab instance
(https://gitlab.winehq.org/wine/vkd3d/). Contributors are encouraged
to submit their patches using the merge request tool.
Each merge request is automatically tested with the GitLab CI
system. See gitlab/README in the Git tree for more details.
===========
Using vkd3d
......@@ -39,8 +50,8 @@ Environment variables
=====================
Most of the environment variables used by vkd3d are for debugging purposes. The
environment variables are not considered a part of API and might be changed or
removed in the future versions of vkd3d.
environment variables are not considered a stable interface and might be changed
or removed in future versions of vkd3d.
Some of debug variables are lists of elements. Elements must be separated by
commas or semicolons.
......@@ -65,6 +76,14 @@ commas or semicolons.
* VKD3D_DISABLE_EXTENSIONS - a list of Vulkan extensions that libvkd3d should
not use even if available.
* VKD3D_CAPS_OVERRIDE - a list of Direct3D 12 capabilities for which the
default value detected by vkd3d should be overridden, in the form
`capability1=value1,capability2=value2'. This doesn't change the vkd3d
behaviour, only the information reported to the application. The following
capabilities can currently be overridden:
* feature_level (allowed values: 11.0, 11.1, 12.0, 12.1, 12.2)
* resource_binding_tier (allowed values: 1, 2, 3)
* VKD3D_SHADER_CONFIG - a list of options that change the behavior of
libvkd3d-shader.
* force_validation - Enable (additional) validation of libvkd3d-shader's
......@@ -78,6 +97,10 @@ commas or semicolons.
* VKD3D_TEST_DEBUG - enables additional debug messages in tests. Set to 0, 1
or 2.
* VKD3D_TEST_DETAILED - enables printing detailed output when running the test
suite, reporting specific shader_test lines that trigger XFAIL and SKIP even
on tests that overall PASS. Set to 0, or 1.
* VKD3D_TEST_FILTER - a filter string. Only the tests whose names matches the
filter string will be run, e.g. VKD3D_TEST_FILTER=clear_render_target.
Useful for debugging or developing new tests.
......@@ -86,6 +109,9 @@ commas or semicolons.
platform controls the behavior of todo(), todo_if(), bug_if() and broken()
conditions in tests.
* VKD3D_TEST_SKIP_DXC - when set, tests requiring the dxcompiler library will
be skipped.
* VKD3D_TEST_BUG - set to 0 to disable bug_if() conditions in tests.
If the configuration defines 'DXCOMPILER_LIBS=-L/path/to/dxcompiler', Shader
......@@ -98,13 +124,90 @@ code for adding DXBC checksums, so the official release should be installed
from:
https://github.com/microsoft/DirectXShaderCompiler/releases
================
Developing vkd3d
================
Development of vkd3d happens on the Wine GitLab instance
(https://gitlab.winehq.org/wine/vkd3d/). Contributors are encouraged
to submit their patches using the merge request tool.
Each merge request is automatically tested with the GitLab CI
system. See gitlab/README in the Git tree for more details.
========================
Preprocessor definitions
========================
A number of preprocessor definitions can be used at compilation time to control
the behaviour of the generated binary. You can pass something like
`CPPFLAGS="-DVKD3D_VAR1 -DVKD3D_VAR2"' to the configure script. The preprocessor
variables are not considered a stable interface and might be changed or removed
in future versions of vkd3d.
* VKD3D_NO_TRACE_MESSAGES - do not emit trace messages in the debug log; this
can be useful in release builds to reduce the size of the binary and make it
slightly faster.
* VKD3D_NO_DEBUG_MESSAGES - do not emit warn and fixme messages in the debug
log; this will further optimise the binary, but may omit messages that could
help debug problems with vkd3d.
* VKD3D_NO_ERROR_MESSAGES - do not emit error messages; this will optimise the
binary even more, but may omit very important messages, so it is not
recommended in most circumstances.
* VKD3D_ABORT_ON_ERR - abort the process as soon as an error message is
emitted; this can be useful for developers to make error conditions as
conspicuous as possible.
* VKD3D_SHADER_UNSUPPORTED_GLSL - enable GLSL (GL Shading Language) support in
vkd3d-shader, which is disabled by default because it is not considered ready
for release yet. Please note that this feature is not currently supported,
and it might change in a non-compatible way before it is released.
* VKD3D_SHADER_UNSUPPORTED_MSL - enable MSL (Metal Shading Language) support in
vkd3d-shader, which is disabled by default because it is not considered ready
for release yet. Please note that this feature is not currently supported,
and it might change in a non-compatible way before it is released.
* VKD3D_SHADER_UNSUPPORTED_SPIRV_PARSER - enable SPIR-V parser support in
vkd3d-shader, which is disabled by default because it is not considered ready
for release yet. Please note that this feature is not currently supported,
and it might change in a non-compatible way before it is released.
============================
Testing with the Agility SDK
============================
Traditionally Microsoft have released the Direct3D 12 development files,
including the debug layer runtime, as part of the larger Windows SDK.
In 2021 the DirectX 12 Agility SDK was introduced, which may be updated
independently of the Windows SDK. If you plan to run the vkd3d
crosstests with Microsoft's debug layer you might want to get it from
the Agility SDK, both because it's probably going to be more up-to-date
and because the Agility SDK is a couple dozens of megabytes versus the
gigabytes of the Windows SDK.
In order to build the vkd3d crosstests with Agility SDK support, follow
these steps:
* The Agility SDK is distributed at [1]: select your preferred
version (likely the most recent one) and note the number in column
D3D12SDKVersion, which you're going to need later.
[1] https://devblogs.microsoft.com/directx/directx12agility/
* You also need to enable the "Graphics Tools" optional feature in Windows.
Open the "Settings" applications, then look for "Apps", "Optional features",
"View features" and install "Graphics Tools".
* Configure vkd3d with something like:
'CROSSCC64="x86_64-w64-mingw32-gcc -DVKD3D_AGILITY_SDK_VERSION=<version>"',
as well as the equivalent CROSSCC32 variable for the 32-bit
crosstests. You'll have to replace '<version>' with the
D3D12SDKVersion number you noted above. Then build the crosstests
with 'make crosstest' as usual.
* Download the Agility SDK NuGet package, which is essentially a ZIP
file with a .nupkg extension. Extract d3d12core.dll and
d3d12sdklayers.dll for your architecture, and put them in the
directory containing the crosstest executables.
* Now you can run the crosstests, possibly with arguments
'--validate' and '--gbv' to enable the debug layers. They will use
the runtime from the Agility SDK.
* It's also possible to use '-DVKD3D_AGILITY_SDK_PATH=/path/to/sdk/' to
specify the directory to load the Agility SDK DLLs from at runtime.
If relative, the path is intended to be relative to the executable
path. If unspecified the path defaults to './'.
AC_PREREQ([2.69])
AC_INIT([vkd3d],[1.11])
AC_INIT([vkd3d],[1.15])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS(include/config.h)
AC_ARG_VAR([PERL], [The Perl 5 language interpreter])
AC_ARG_VAR([WIDL], [widl IDL compiler])
AC_ARG_VAR([CROSSCC32], [32-bit Windows cross compiler])
AC_ARG_VAR([CROSSCC64], [64-bit Windows cross compiler])
AC_ARG_WITH([metal], AS_HELP_STRING([--with-metal], [Build with the Metal library (default: test)]))
AC_ARG_WITH([ncurses], AS_HELP_STRING([--with-ncurses], [Build with the ncurses library (default: test)]))
AC_ARG_WITH([opengl], AS_HELP_STRING([--with-opengl], [Build with the OpenGL library (default: test)]))
AC_ARG_WITH([spirv-tools], AS_HELP_STRING([--with-spirv-tools],
......@@ -31,6 +33,11 @@ AC_PROG_MKDIR_P
VKD3D_PROG_WIDL(3, 21)
AS_IF([test "x$WIDL" = "xno"], [AC_MSG_WARN([widl is required to build header files.])])
AC_CHECK_PROGS([PERL], [perl], [none])
AS_IF([test "$PERL" = "none"], [AC_MSG_ERROR([no suitable perl found. Please install the 'perl-base' package.])])
VKD3D_CHECK_PERL_MODULE([JSON],
[AC_MSG_ERROR([perl module 'JSON' not found. Please install the 'libjson-perl' package.])])
AC_CHECK_PROGS([FLEX], [flex], [none])
AS_IF([test "$FLEX" = "none"], [AC_MSG_ERROR([no suitable flex found. Please install the 'flex' package.])])
AC_ARG_VAR([LFLAGS], [extra flags for flex])
......@@ -134,6 +141,16 @@ AS_IF([test "x$SONAME_LIBDXCOMPILER" = "x"],
[VKD3D_CHECK_SONAME([dxcompiler], [DxcCreateInstance], [HAVE_DXCOMPILER=yes], [HAVE_DXCOMPILER=no], [$DXCOMPILER_LIBS])],
[AC_DEFINE_UNQUOTED([SONAME_LIBDXCOMPILER],["$SONAME_LIBDXCOMPILER"],[Define to the shared object name of the dxcompiler library.])])
AS_IF([test "x$with_metal" != "xno"],
[AC_MSG_CHECKING([for Metal])]
[AC_PREPROC_IFELSE([AC_LANG_PROGRAM([#include <Metal/Metal.h>])],
[AC_MSG_RESULT([yes])
AC_PROG_OBJC
AC_DEFINE([HAVE_METAL], [1], [Define to 1 if you have Metal.])
with_metal=yes],
[AC_MSG_RESULT([no])
AM_CONDITIONAL([am__fastdepOBJC], [false])
with_metal=no])])
AS_IF([test "x$with_ncurses" != "xno"],
[PKG_CHECK_MODULES([NCURSES], [ncurses],
[AC_DEFINE([HAVE_NCURSES], [1], [Define to 1 if you have ncurses.]) with_ncurses=yes],
......@@ -162,6 +179,7 @@ VKD3D_CHECK_FUNC([HAVE_SYNC_ADD_AND_FETCH], [__sync_add_and_fetch], [__sync_add_
VKD3D_CHECK_FUNC([HAVE_SYNC_BOOL_COMPARE_AND_SWAP], [__sync_bool_compare_and_swap], [__sync_bool_compare_and_swap((int *)0, 0, 0)])
VKD3D_CHECK_FUNC([HAVE_ATOMIC_EXCHANGE_N], [__atomic_exchange_n], [__atomic_exchange_n((int *)0, 0, 0)])
AC_CHECK_FUNCS([gettid])
AC_CHECK_FUNCS([pthread_threadid_np])
dnl Makefiles
case $host_os in
......@@ -181,6 +199,7 @@ AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_tests" != "xno"])
AM_CONDITIONAL([HAVE_WIDL], [test "x$WIDL" != "xno"])
AM_CONDITIONAL([HAVE_CROSSTARGET32], [test "x$CROSSTARGET32" != "xno"])
AM_CONDITIONAL([HAVE_CROSSTARGET64], [test "x$CROSSTARGET64" != "xno"])
AM_CONDITIONAL([HAVE_METAL], [test "${host_os#darwin}" != "$host_os"])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
......@@ -197,11 +216,12 @@ AS_ECHO(["
widl: ${WIDL}
Have dxcompiler: ${HAVE_DXCOMPILER}
Have Metal: ${with_metal}
Have ncurses: ${with_ncurses}
Have OpenGL: ${with_opengl}
Have SPIRV-Tools: ${with_spirv_tools}
Have xcb: ${HAVE_XCB}
Have dxcompiler: ${HAVE_DXCOMPILER}
Building demos: ${enable_demos}
Building tests: ${enable_tests}
......
......@@ -39,6 +39,42 @@
#include <vkd3d_d3d12.h>
#include <inttypes.h>
#ifdef __WIN32__
#define DEMO_ASM_PUSHSECTION ".section rdata\n\t"
#define DEMO_ASM_POPSECTION ".text\n\t"
#define DEMO_ASM_OBJECT_TYPE(name)
#else
#define DEMO_ASM_PUSHSECTION ".pushsection .rodata\n\t"
#define DEMO_ASM_POPSECTION ".popsection\n\t"
#define DEMO_ASM_OBJECT_TYPE(name) ".type "name", @object\n\t"
#endif
#if defined(__WIN32__) && defined(__i386__)
#define DEMO_ASM_NAME(name) "_"#name
#else
#define DEMO_ASM_NAME(name) #name
#endif
#define DEMO_EMBED_ASM(name, file) \
DEMO_ASM_PUSHSECTION \
".global "name"\n\t" \
DEMO_ASM_OBJECT_TYPE(name) \
".balign 8\n\t" \
name":\n\t" \
".incbin \""file"\"\n\t" \
name"_end:\n\t" \
".global "name"_size\n\t" \
DEMO_ASM_OBJECT_TYPE(name"_size") \
".balign 8\n\t" \
name"_size:\n\t" \
".int "name"_end - "name"\n\t" \
DEMO_ASM_POPSECTION
#define DEMO_EMBED(name, file) \
extern const unsigned int name##_size; \
extern const uint8_t name[]; \
__asm__(DEMO_EMBED_ASM(DEMO_ASM_NAME(name), file))
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*x))
#define DEMO_KEY_UNKNOWN 0x0000
......@@ -142,5 +178,5 @@ static inline HRESULT demo_create_root_signature(ID3D12Device *device,
#include "demo_win32.h"
#else
#define INFINITE VKD3D_INFINITE
#include "demo_xcb.h"
#include "demo_vkd3d.h"
#endif
/*
* Copyright 2016 Józef Kucia for CodeWeavers
* Copyright 2016 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define VK_NO_PROTOTYPES
#define VK_USE_PLATFORM_XCB_KHR
#define VKD3D_UTILS_API_VERSION VKD3D_API_VERSION_1_15
#include "config.h"
#include <vkd3d.h>
#include <vkd3d_utils.h>
#include <xcb/xcb_event.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xcb_keysyms.h>
#include <dlfcn.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#define DECLARE_VK_PFN(name) PFN_##name name;
DECLARE_VK_PFN(vkAcquireNextImageKHR)
DECLARE_VK_PFN(vkCreateFence)
DECLARE_VK_PFN(vkCreateSwapchainKHR)
DECLARE_VK_PFN(vkCreateXcbSurfaceKHR)
DECLARE_VK_PFN(vkDestroyFence)
DECLARE_VK_PFN(vkDestroySurfaceKHR)
DECLARE_VK_PFN(vkDestroySwapchainKHR)
DECLARE_VK_PFN(vkGetPhysicalDeviceSurfaceCapabilitiesKHR)
DECLARE_VK_PFN(vkGetPhysicalDeviceSurfaceFormatsKHR)
DECLARE_VK_PFN(vkGetPhysicalDeviceSurfaceSupportKHR)
DECLARE_VK_PFN(vkGetSwapchainImagesKHR)
DECLARE_VK_PFN(vkQueuePresentKHR)
DECLARE_VK_PFN(vkResetFences)
DECLARE_VK_PFN(vkWaitForFences)
struct demo_xcb
{
xcb_connection_t *connection;
xcb_atom_t wm_protocols_atom;
xcb_atom_t wm_delete_window_atom;
xcb_key_symbols_t *xcb_keysyms;
int screen;
};
struct demo
{
struct demo_xcb xcb;
struct demo_window **windows;
size_t windows_size;
size_t window_count;
void *user_data;
void (*idle_func)(struct demo *demo, void *user_data);
};
struct demo_window
{
struct demo *demo;
void *user_data;
void (*expose_func)(struct demo_window *window, void *user_data);
void (*key_press_func)(struct demo_window *window, demo_key key, void *user_data);
};
static inline bool demo_add_window(struct demo *demo, struct demo_window *window)
{
if (demo->window_count == demo->windows_size)
{
size_t new_capacity;
void *new_elements;
new_capacity = max(demo->windows_size * 2, 4);
if (!(new_elements = realloc(demo->windows, new_capacity * sizeof(*demo->windows))))
return false;
demo->windows = new_elements;
demo->windows_size = new_capacity;
}
demo->windows[demo->window_count++] = window;
return true;
}
static inline void demo_remove_window(struct demo *demo, const struct demo_window *window)
{
size_t i;
for (i = 0; i < demo->window_count; ++i)
{
if (demo->windows[i] != window)
continue;
--demo->window_count;
memmove(&demo->windows[i], &demo->windows[i + 1], (demo->window_count - i) * sizeof(*demo->windows));
break;
}
}
static inline bool demo_window_init(struct demo_window *window, struct demo *demo, void *user_data)
{
if (!demo_add_window(demo, window))
return false;
window->demo = demo;
window->user_data = user_data;
window->expose_func = NULL;
window->key_press_func = NULL;
return true;
}
static inline void demo_window_cleanup(struct demo_window *window)
{
demo_remove_window(window->demo, window);
}
#include "demo_xcb.h"
static void load_vulkan_procs(void)
{
void *libvulkan;
if (!(libvulkan = dlopen(SONAME_LIBVULKAN, RTLD_NOW)))
{
fprintf(stderr, "Failed to load %s: %s.\n", SONAME_LIBVULKAN, dlerror());
exit(1);
}
#define LOAD_VK_PFN(name) name = (void *)dlsym(libvulkan, #name);
LOAD_VK_PFN(vkAcquireNextImageKHR)
LOAD_VK_PFN(vkCreateFence)
LOAD_VK_PFN(vkCreateSwapchainKHR)
LOAD_VK_PFN(vkCreateXcbSurfaceKHR)
LOAD_VK_PFN(vkDestroyFence)
LOAD_VK_PFN(vkDestroySurfaceKHR)
LOAD_VK_PFN(vkDestroySwapchainKHR)
LOAD_VK_PFN(vkGetPhysicalDeviceSurfaceCapabilitiesKHR)
LOAD_VK_PFN(vkGetPhysicalDeviceSurfaceFormatsKHR)
LOAD_VK_PFN(vkGetPhysicalDeviceSurfaceSupportKHR)
LOAD_VK_PFN(vkGetSwapchainImagesKHR)
LOAD_VK_PFN(vkQueuePresentKHR)
LOAD_VK_PFN(vkResetFences)
LOAD_VK_PFN(vkWaitForFences)
}
struct demo_swapchain
{
VkSurfaceKHR vk_surface;
VkSwapchainKHR vk_swapchain;
VkFence vk_fence;
VkInstance vk_instance;
VkDevice vk_device;
ID3D12CommandQueue *command_queue;
ID3D12Fence *present_fence;
unsigned long long present_count;
uint32_t current_buffer;
unsigned int buffer_count;
ID3D12Resource *buffers[1];
};
static inline void demo_cleanup(struct demo *demo)
{
free(demo->windows);
demo_xcb_cleanup(demo);
}
static inline bool demo_init(struct demo *demo, void *user_data)
{
if (!demo_xcb_init(&demo->xcb))
return false;
demo->windows = NULL;
demo->windows_size = 0;
demo->window_count = 0;
demo->user_data = user_data;
demo->idle_func = NULL;
return true;
}
static inline void demo_get_dpi(struct demo *demo, double *dpi_x, double *dpi_y)
{
demo_xcb_get_dpi(demo, dpi_x, dpi_y);
}
static inline void demo_process_events(struct demo *demo)
{
demo_xcb_process_events(demo);
}
static inline void demo_set_idle_func(struct demo *demo,
void (*idle_func)(struct demo *demo, void *user_data))
{
demo->idle_func = idle_func;
}
static inline void demo_window_destroy(struct demo_window *window)
{
demo_window_xcb_destroy(window);
}
static inline struct demo_window *demo_window_create(struct demo *demo, const char *title,
unsigned int width, unsigned int height, void *user_data)
{
return demo_window_xcb_create(demo, title, width, height, user_data);
}
static inline void demo_window_set_expose_func(struct demo_window *window,
void (*expose_func)(struct demo_window *window, void *user_data))
{
window->expose_func = expose_func;
}
static inline void demo_window_set_key_press_func(struct demo_window *window,
void (*key_press_func)(struct demo_window *window, demo_key key, void *user_data))
{
window->key_press_func = key_press_func;
}
static inline struct demo_swapchain *demo_swapchain_create(ID3D12CommandQueue *command_queue,
struct demo_window *window, const struct demo_swapchain_desc *desc)
{
struct vkd3d_image_resource_create_info resource_create_info;
struct VkSwapchainCreateInfoKHR vk_swapchain_desc;
VkSwapchainKHR vk_swapchain = VK_NULL_HANDLE;
uint32_t format_count, queue_family_index;
VkSurfaceCapabilitiesKHR surface_caps;
VkPhysicalDevice vk_physical_device;
VkFence vk_fence = VK_NULL_HANDLE;
struct demo_swapchain *swapchain;
unsigned int image_count, i, j;
VkFenceCreateInfo fence_desc;
VkSurfaceFormatKHR *formats;
ID3D12Device *d3d12_device;
VkSurfaceKHR vk_surface;
VkInstance vk_instance;
VkBool32 supported;
VkDevice vk_device;
VkImage *vk_images;
VkFormat format;
load_vulkan_procs();
if ((format = vkd3d_get_vk_format(desc->format)) == VK_FORMAT_UNDEFINED)
return NULL;
if (FAILED(ID3D12CommandQueue_GetDevice(command_queue, &IID_ID3D12Device, (void **)&d3d12_device)))
return NULL;
vk_instance = vkd3d_instance_get_vk_instance(vkd3d_instance_from_device(d3d12_device));
vk_physical_device = vkd3d_get_vk_physical_device(d3d12_device);
vk_device = vkd3d_get_vk_device(d3d12_device);
if (!(vk_surface = demo_window_xcb_create_vk_surface(window, vk_instance)))
{
ID3D12Device_Release(d3d12_device);
return NULL;
}
queue_family_index = vkd3d_get_vk_queue_family_index(command_queue);
if (vkGetPhysicalDeviceSurfaceSupportKHR(vk_physical_device,
queue_family_index, vk_surface, &supported) < 0 || !supported)
goto fail;
if (vkGetPhysicalDeviceSurfaceCapabilitiesKHR(vk_physical_device, vk_surface, &surface_caps) < 0)
goto fail;
if ((surface_caps.maxImageCount && desc->buffer_count > surface_caps.maxImageCount)
|| desc->buffer_count < surface_caps.minImageCount
|| desc->width > surface_caps.maxImageExtent.width || desc->width < surface_caps.minImageExtent.width
|| desc->height > surface_caps.maxImageExtent.height || desc->height < surface_caps.minImageExtent.height
|| !(surface_caps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR))
goto fail;
if (vkGetPhysicalDeviceSurfaceFormatsKHR(vk_physical_device, vk_surface, &format_count, NULL) < 0
|| !format_count || !(formats = calloc(format_count, sizeof(*formats))))
goto fail;
if (vkGetPhysicalDeviceSurfaceFormatsKHR(vk_physical_device, vk_surface, &format_count, formats) < 0)
{
free(formats);
goto fail;
}
if (format_count != 1 || formats->format != VK_FORMAT_UNDEFINED
|| formats->colorSpace != VK_COLOR_SPACE_SRGB_NONLINEAR_KHR)
{
for (i = 0; i < format_count; ++i)
{
if (formats[i].format == format && formats[i].colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR)
break;
}
if (i == format_count)
{
free(formats);
goto fail;
}
}
free(formats);
formats = NULL;
vk_swapchain_desc.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
vk_swapchain_desc.pNext = NULL;
vk_swapchain_desc.flags = 0;
vk_swapchain_desc.surface = vk_surface;
vk_swapchain_desc.minImageCount = desc->buffer_count;
vk_swapchain_desc.imageFormat = format;
vk_swapchain_desc.imageColorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
vk_swapchain_desc.imageExtent.width = desc->width;
vk_swapchain_desc.imageExtent.height = desc->height;
vk_swapchain_desc.imageArrayLayers = 1;
vk_swapchain_desc.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
vk_swapchain_desc.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
vk_swapchain_desc.queueFamilyIndexCount = 0;
vk_swapchain_desc.pQueueFamilyIndices = NULL;
vk_swapchain_desc.preTransform = surface_caps.currentTransform;
vk_swapchain_desc.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
vk_swapchain_desc.presentMode = VK_PRESENT_MODE_FIFO_KHR;
vk_swapchain_desc.clipped = VK_TRUE;
vk_swapchain_desc.oldSwapchain = VK_NULL_HANDLE;
if (vkCreateSwapchainKHR(vk_device, &vk_swapchain_desc, NULL, &vk_swapchain) < 0)
goto fail;
fence_desc.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
fence_desc.pNext = NULL;
fence_desc.flags = 0;
if (vkCreateFence(vk_device, &fence_desc, NULL, &vk_fence) < 0)
goto fail;
if (vkGetSwapchainImagesKHR(vk_device, vk_swapchain, &image_count, NULL) < 0
|| !(vk_images = calloc(image_count, sizeof(*vk_images))))
goto fail;
if (vkGetSwapchainImagesKHR(vk_device, vk_swapchain, &image_count, vk_images) < 0)
{
free(vk_images);
goto fail;
}
if (!(swapchain = malloc(offsetof(struct demo_swapchain, buffers[image_count]))))
{
free(vk_images);
goto fail;
}
swapchain->vk_surface = vk_surface;
swapchain->vk_swapchain = vk_swapchain;
swapchain->vk_fence = vk_fence;
swapchain->vk_instance = vk_instance;
swapchain->vk_device = vk_device;
vkAcquireNextImageKHR(vk_device, vk_swapchain, UINT64_MAX,
VK_NULL_HANDLE, vk_fence, &swapchain->current_buffer);
vkWaitForFences(vk_device, 1, &vk_fence, VK_TRUE, UINT64_MAX);
vkResetFences(vk_device, 1, &vk_fence);
resource_create_info.type = VKD3D_STRUCTURE_TYPE_IMAGE_RESOURCE_CREATE_INFO;
resource_create_info.next = NULL;
resource_create_info.desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
resource_create_info.desc.Alignment = 0;
resource_create_info.desc.Width = desc->width;
resource_create_info.desc.Height = desc->height;
resource_create_info.desc.DepthOrArraySize = 1;
resource_create_info.desc.MipLevels = 1;
resource_create_info.desc.Format = desc->format;
resource_create_info.desc.SampleDesc.Count = 1;
resource_create_info.desc.SampleDesc.Quality = 0;
resource_create_info.desc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
resource_create_info.desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
resource_create_info.flags = VKD3D_RESOURCE_INITIAL_STATE_TRANSITION | VKD3D_RESOURCE_PRESENT_STATE_TRANSITION;
resource_create_info.present_state = D3D12_RESOURCE_STATE_PRESENT;
for (i = 0; i < image_count; ++i)
{
resource_create_info.vk_image = vk_images[i];
if (FAILED(vkd3d_create_image_resource(d3d12_device, &resource_create_info, &swapchain->buffers[i])))
{
for (j = 0; j < i; ++j)
{
ID3D12Resource_Release(swapchain->buffers[j]);
}
free(swapchain);
free(vk_images);
goto fail;
}
}
swapchain->buffer_count = image_count;
free(vk_images);
if (FAILED(ID3D12Device_CreateFence(d3d12_device, 0, 0, &IID_ID3D12Fence, (void **)&swapchain->present_fence)))
{
for (i = 0; i < image_count; ++i)
{
ID3D12Resource_Release(swapchain->buffers[i]);
}
free(swapchain);
goto fail;
}
swapchain->present_count = 0;
ID3D12Device_Release(d3d12_device);
ID3D12CommandQueue_AddRef(swapchain->command_queue = command_queue);
return swapchain;
fail:
if (vk_fence != VK_NULL_HANDLE)
vkDestroyFence(vk_device, vk_fence, NULL);
if (vk_swapchain != VK_NULL_HANDLE)
vkDestroySwapchainKHR(vk_device, vk_swapchain, NULL);
vkDestroySurfaceKHR(vk_instance, vk_surface, NULL);
ID3D12Device_Release(d3d12_device);
return NULL;
}
static inline unsigned int demo_swapchain_get_current_back_buffer_index(struct demo_swapchain *swapchain)
{
return swapchain->current_buffer;
}
static inline ID3D12Resource *demo_swapchain_get_back_buffer(struct demo_swapchain *swapchain, unsigned int index)
{
ID3D12Resource *resource = NULL;
if (index < swapchain->buffer_count && (resource = swapchain->buffers[index]))
ID3D12Resource_AddRef(resource);
return resource;
}
static inline void demo_swapchain_present(struct demo_swapchain *swapchain)
{
VkPresentInfoKHR present_desc;
VkQueue vk_queue;
present_desc.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
present_desc.pNext = NULL;
present_desc.waitSemaphoreCount = 0;
present_desc.pWaitSemaphores = NULL;
present_desc.swapchainCount = 1;
present_desc.pSwapchains = &swapchain->vk_swapchain;
present_desc.pImageIndices = &swapchain->current_buffer;
present_desc.pResults = NULL;
/* Synchronize vkd3d_acquire_vk_queue() with the Direct3D 12 work
* already submitted to the command queue. */
++swapchain->present_count;
ID3D12CommandQueue_Signal(swapchain->command_queue, swapchain->present_fence, swapchain->present_count);
ID3D12Fence_SetEventOnCompletion(swapchain->present_fence, swapchain->present_count, NULL);
vk_queue = vkd3d_acquire_vk_queue(swapchain->command_queue);
vkQueuePresentKHR(vk_queue, &present_desc);
vkd3d_release_vk_queue(swapchain->command_queue);
vkAcquireNextImageKHR(swapchain->vk_device, swapchain->vk_swapchain, UINT64_MAX,
VK_NULL_HANDLE, swapchain->vk_fence, &swapchain->current_buffer);
vkWaitForFences(swapchain->vk_device, 1, &swapchain->vk_fence, VK_TRUE, UINT64_MAX);
vkResetFences(swapchain->vk_device, 1, &swapchain->vk_fence);
}
static inline void demo_swapchain_destroy(struct demo_swapchain *swapchain)
{
unsigned int i;
ID3D12CommandQueue_Release(swapchain->command_queue);
ID3D12Fence_Release(swapchain->present_fence);
for (i = 0; i < swapchain->buffer_count; ++i)
{
ID3D12Resource_Release(swapchain->buffers[i]);
}
vkDestroyFence(swapchain->vk_device, swapchain->vk_fence, NULL);
vkDestroySwapchainKHR(swapchain->vk_device, swapchain->vk_swapchain, NULL);
vkDestroySurfaceKHR(swapchain->vk_instance, swapchain->vk_surface, NULL);
free(swapchain);
}
static inline HANDLE demo_create_event(void)
{
return vkd3d_create_event();
}
static inline unsigned int demo_wait_event(HANDLE event, unsigned int ms)
{
return vkd3d_wait_event(event, ms);
}
static inline void demo_destroy_event(HANDLE event)
{
vkd3d_destroy_event(event);
}
......@@ -31,6 +31,8 @@ struct demo
void *user_data;
void (*idle_func)(struct demo *demo, void *user_data);
UINT (*GetDpiForSystem)(void);
};
struct demo_window
......@@ -48,6 +50,11 @@ struct demo_swapchain
IDXGISwapChain3 *swapchain;
};
static inline void demo_get_dpi(struct demo *demo, double *dpi_x, double *dpi_y)
{
*dpi_x = *dpi_y = demo->GetDpiForSystem();
}
static inline struct demo_window *demo_window_create(struct demo *demo, const char *title,
unsigned int width, unsigned int height, void *user_data)
{
......@@ -191,6 +198,11 @@ static inline void demo_process_events(struct demo *demo)
}
}
static inline UINT demo_GetDpiForSystem(void)
{
return 96;
}
static inline bool demo_init(struct demo *demo, void *user_data)
{
WNDCLASSEXW wc;
......@@ -215,6 +227,11 @@ static inline bool demo_init(struct demo *demo, void *user_data)
demo->user_data = user_data;
demo->idle_func = NULL;
if ((demo->GetDpiForSystem = (void *)GetProcAddress(GetModuleHandleA("user32"), "GetDpiForSystem")))
SetProcessDPIAware();
else
demo->GetDpiForSystem = demo_GetDpiForSystem;
return true;
}
......
This diff is collapsed.
......@@ -48,7 +48,7 @@
#include <math.h>
#include "demo.h"
#include "gears_hlsl.h"
DEMO_EMBED(gears_hlsl, "gears.hlsl");
struct cxg_fence
{
......@@ -681,11 +681,14 @@ static void cxg_load_assets(struct cx_gears *cxg)
hr = demo_create_root_signature(cxg->device, &root_signature_desc, &cxg->root_signature);
assert(SUCCEEDED(hr));
hr = D3DCompile(gears_hlsl, strlen(gears_hlsl), NULL, NULL, NULL, "vs_main", "vs_5_0", 0, 0, &vs, NULL);
hr = D3DCompile(gears_hlsl, gears_hlsl_size, "gears.hlsl",
NULL, NULL, "vs_main", "vs_5_0", 0, 0, &vs, NULL);
assert(SUCCEEDED(hr));
hr = D3DCompile(gears_hlsl, strlen(gears_hlsl), NULL, NULL, NULL, "ps_main_flat", "ps_5_0", 0, 0, &ps_flat, NULL);
hr = D3DCompile(gears_hlsl, gears_hlsl_size, "gears.hlsl",
NULL, NULL, "ps_main_flat", "ps_5_0", 0, 0, &ps_flat, NULL);
assert(SUCCEEDED(hr));
hr = D3DCompile(gears_hlsl, strlen(gears_hlsl), NULL, NULL, NULL, "ps_main_smooth", "ps_5_0", 0, 0, &ps_smooth, NULL);
hr = D3DCompile(gears_hlsl, gears_hlsl_size, "gears.hlsl",
NULL, NULL, "ps_main_smooth", "ps_5_0", 0, 0, &ps_smooth, NULL);
assert(SUCCEEDED(hr));
memset(&pso_desc, 0, sizeof(pso_desc));
......@@ -846,12 +849,16 @@ static int cxg_main(void)
{
unsigned int width = 300, height = 300;
struct cx_gears cxg;
double dpi_x, dpi_y;
memset(&cxg, 0, sizeof(cxg));
if (!demo_init(&cxg.demo, &cxg))
return EXIT_FAILURE;
demo_set_idle_func(&cxg.demo, cxg_idle);
demo_get_dpi(&cxg.demo, &dpi_x, &dpi_y);
width *= dpi_x / 96.0;
height *= dpi_y / 96.0;
cxg.window = demo_window_create(&cxg.demo, "Vkd3d Gears", width, height, &cxg);
demo_window_set_key_press_func(cxg.window, cxg_key_press);
demo_window_set_expose_func(cxg.window, cxg_expose);
......
/*
* Copyright 2016 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
cbuffer gear_block : register(b0)
{
float4x4 mvp_matrix;
float3x3 normal_matrix;
};
struct vs_in
{
float4 position : POSITION;
float3 normal : NORMAL;
float3 diffuse : DIFFUSE;
float4 transform : TRANSFORM;
};
struct vs_out
{
float4 position : SV_POSITION;
float4 colour : COLOR;
};
struct vs_out vs_main(struct vs_in i)
{
const float3 l_pos = float3(5.0, 5.0, 10.0);
float3 dir, normal;
float4 position;
struct vs_out o;
float att;
position.x = i.transform.x * i.position.x - i.transform.y * i.position.y + i.transform.z;
position.y = i.transform.x * i.position.y + i.transform.y * i.position.x + i.transform.w;
position.zw = i.position.zw;
o.position = mul(mvp_matrix, position);
dir = normalize(l_pos - o.position.xyz / o.position.w);
normal.x = i.transform.x * i.normal.x - i.transform.y * i.normal.y;
normal.y = i.transform.x * i.normal.y + i.transform.y * i.normal.x;
normal.z = i.normal.z;
att = 0.2 + dot(dir, normalize(mul(normal_matrix, normal)));
o.colour.xyz = i.diffuse.xyz * att;
o.colour.w = 1.0;
return o;
}
float4 ps_main_smooth(float4 position : SV_POSITION, float4 colour : COLOR) : SV_TARGET
{
return colour;
}
float4 ps_main_flat(float4 position : SV_POSITION, nointerpolation float4 colour : COLOR) : SV_TARGET
{
return colour;
}
static const char gears_hlsl[] =
"cbuffer gear_block : register(b0)\n"
"{\n"
" float4x4 mvp_matrix;\n"
" float3x3 normal_matrix;\n"
"};\n"
"\n"
"struct vs_in\n"
"{\n"
" float4 position : POSITION;\n"
" float3 normal : NORMAL;\n"
" float3 diffuse : DIFFUSE;\n"
" float4 transform : TRANSFORM;\n"
"};\n"
"\n"
"struct vs_out\n"
"{\n"
" float4 position : SV_POSITION;\n"
" float4 colour : COLOR;\n"
"};\n"
"\n"
"struct vs_out vs_main(struct vs_in i)\n"
"{\n"
" const float3 l_pos = float3(5.0, 5.0, 10.0);\n"
" float3 dir, normal;\n"
" float4 position;\n"
" struct vs_out o;\n"
" float att;\n"
"\n"
" position.x = i.transform.x * i.position.x - i.transform.y * i.position.y + i.transform.z;\n"
" position.y = i.transform.x * i.position.y + i.transform.y * i.position.x + i.transform.w;\n"
" position.zw = i.position.zw;\n"
"\n"
" o.position = mul(mvp_matrix, position);\n"
" dir = normalize(l_pos - o.position.xyz / o.position.w);\n"
"\n"
" normal.x = i.transform.x * i.normal.x - i.transform.y * i.normal.y;\n"
" normal.y = i.transform.x * i.normal.y + i.transform.y * i.normal.x;\n"
" normal.z = i.normal.z;\n"
" att = 0.2 + dot(dir, normalize(mul(normal_matrix, normal)));\n"
"\n"
" o.colour.xyz = i.diffuse.xyz * att;\n"
" o.colour.w = 1.0;\n"
"\n"
" return o;\n"
"}\n"
"\n"
"float4 ps_main_smooth(float4 position : SV_POSITION, float4 colour : COLOR) : SV_TARGET\n"
"{\n"
" return colour;\n"
"}\n"
"\n"
"float4 ps_main_flat(float4 position : SV_POSITION, nointerpolation float4 colour : COLOR) : SV_TARGET\n"
"{\n"
" return colour;\n"
"}\n";
......@@ -45,7 +45,7 @@
#include <assert.h>
#include "demo.h"
#include "triangle_hlsl.h"
DEMO_EMBED(triangle_hlsl, "triangle.hlsl");
struct cxt_fence
{
......@@ -285,9 +285,11 @@ static void cxt_load_assets(struct cx_triangle *cxt)
hr = demo_create_root_signature(cxt->device, &root_signature_desc, &cxt->root_signature);
assert(SUCCEEDED(hr));
hr = D3DCompile(triangle_hlsl, strlen(triangle_hlsl), NULL, NULL, NULL, "vs_main", "vs_5_0", 0, 0, &vs, NULL);
hr = D3DCompile(triangle_hlsl, triangle_hlsl_size, "triangle.hlsl",
NULL, NULL, "vs_main", "vs_5_0", 0, 0, &vs, NULL);
assert(SUCCEEDED(hr));
hr = D3DCompile(triangle_hlsl, strlen(triangle_hlsl), NULL, NULL, NULL, "ps_main", "ps_5_0", 0, 0, &ps, NULL);
hr = D3DCompile(triangle_hlsl, triangle_hlsl_size, "triangle.hlsl",
NULL, NULL, "ps_main", "ps_5_0", 0, 0, &ps, NULL);
assert(SUCCEEDED(hr));
memset(&pso_desc, 0, sizeof(pso_desc));
......@@ -366,12 +368,16 @@ static int cxt_main(void)
{
unsigned int width = 640, height = 480;
struct cx_triangle cxt;
double dpi_x, dpi_y;
memset(&cxt, 0, sizeof(cxt));
if (!demo_init(&cxt.demo, NULL))
return EXIT_FAILURE;
demo_get_dpi(&cxt.demo, &dpi_x, &dpi_y);
width *= dpi_x / 96.0;
height *= dpi_y / 96.0;
cxt.window = demo_window_create(&cxt.demo, "Vkd3d Triangle", width, height, &cxt);
demo_window_set_expose_func(cxt.window, cxt_render_frame);
demo_window_set_key_press_func(cxt.window, cxt_key_press);
......
/*
* Copyright 2016 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* This application contains code derived from Microsoft's "HelloTriangle"
* demo, the license for which follows:
*
* Copyright (c) 2015 Microsoft
*
* 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 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.
*/
struct ps_in
{
float4 position : SV_POSITION;
float4 colour : COLOR;
};
struct ps_in vs_main(float4 position : POSITION, float4 colour : COLOR)
{
struct ps_in o;
o.position = position;
o.colour = colour;
return o;
}
float4 ps_main(struct ps_in i) : SV_TARGET
{
return i.colour;
}
static const char triangle_hlsl[] =
"struct ps_in\n"
"{\n"
" float4 position : SV_POSITION;\n"
" float4 colour : COLOR;\n"
"};\n"
"\n"
"struct ps_in vs_main(float4 position : POSITION, float4 colour : COLOR)\n"
"{\n"
" struct ps_in o;\n"
"\n"
" o.position = position;\n"
" o.colour = colour;\n"
"\n"
" return o;\n"
"}\n"
"\n"
"float4 ps_main(struct ps_in i) : SV_TARGET\n"
"{\n"
" return i.colour;\n"
"}\n";
......@@ -11,7 +11,8 @@ rm -fr build
mkdir build
cd build
export LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH-}"
if ../configure --enable-demos --with-spirv-tools DXCOMPILER_LIBS="-L/usr/local/lib" CFLAGS="-g -O2 -Werror" CPPFLAGS="-DVKD3D_SHADER_UNSUPPORTED_DXIL -DVKD3D_SHADER_UNSUPPORTED_GLSL" && \
if ../configure --enable-demos --with-spirv-tools DXCOMPILER_LIBS="-L/usr/local/lib" CFLAGS="-g -O2 -Werror" \
CPPFLAGS="-DVKD3D_SHADER_UNSUPPORTED_GLSL -DVKD3D_ABORT_ON_ERR" && \
make -j$(nproc) ; then
make -j$(nproc) AM_COLOR_TESTS=always check || \
touch ../tests_failed
......