mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
Compare commits
96 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1eaf73147c | ||
|
d5f810068b | ||
|
21302c09eb | ||
|
1b11b57652 | ||
|
fc652d2b27 | ||
|
43631bde4d | ||
|
bd501ce336 | ||
|
f100f5b726 | ||
|
dd1008867e | ||
|
f21693b284 | ||
|
90e6e418a3 | ||
|
6873b71304 | ||
|
2fa913ccaa | ||
|
3153ce3145 | ||
|
6f6ba8aa56 | ||
|
3857ca06fa | ||
|
718c79b823 | ||
|
d6799bd5d3 | ||
|
da56f41ceb | ||
|
1019bbead6 | ||
|
c0782a9029 | ||
|
4d17758657 | ||
|
520c7457a9 | ||
|
4173158c8b | ||
|
e2aed38509 | ||
|
ba08825ccd | ||
|
35b48a8b04 | ||
|
58c7c4b806 | ||
|
c416627e64 | ||
|
9bdae4dfaa | ||
|
03f9d16047 | ||
|
0a2aaa690e | ||
|
12e397de9a | ||
|
2ec67e0f10 | ||
|
4096d453c4 | ||
|
8044fce040 | ||
|
52069386c4 | ||
|
b711b2d66b | ||
|
fcef269347 | ||
|
588645a79a | ||
|
5af7316a12 | ||
|
d21fd584b1 | ||
|
1c77811648 | ||
|
d93ce28995 | ||
|
fb751b48c5 | ||
|
0a345a2b73 | ||
|
963ea98a52 | ||
|
0ef04659c7 | ||
|
fea50d243c | ||
|
7115a94063 | ||
|
62fd13059b | ||
|
75494a4ae6 | ||
|
6f1f14d97a | ||
|
c9198735fd | ||
|
c644244bcd | ||
|
b6a6a927a7 | ||
|
d1da5436f4 | ||
|
0a07ac6f88 | ||
|
eb119878f7 | ||
|
85856473f6 | ||
|
09d7442cb1 | ||
|
653b109d8f | ||
|
5a1b0dbf44 | ||
|
e56db9bda5 | ||
|
791f8a8faa | ||
|
3bae0c92c7 | ||
|
ab8f418207 | ||
|
eb7b594002 | ||
|
4c13ae5764 | ||
|
ef4990d996 | ||
|
5442f4236c | ||
|
8e5aefb309 | ||
|
a43242a3e6 | ||
|
303ce66cef | ||
|
6b45f290f7 | ||
|
20fc4375ad | ||
|
1e10b5e616 | ||
|
2d4d2e1244 | ||
|
eb70f1aeb5 | ||
|
3d85d77ced | ||
|
763f7dfa61 | ||
|
1655d309bd | ||
|
d600f0488e | ||
|
4ab1a4cef5 | ||
|
73cf9dee8a | ||
|
b74a546034 | ||
|
f8da100052 | ||
|
3fc2fdc37f | ||
|
4c5fd9c7b9 | ||
|
15a0b44ada | ||
|
fb724d60e3 | ||
|
e3123f5bd0 | ||
|
991cddd139 | ||
|
32999fc12b | ||
|
27a6963d6a | ||
|
d5fd309ef8 |
54
ANNOUNCE
54
ANNOUNCE
@@ -1,16 +1,16 @@
|
||||
The Wine team is proud to announce that release 1.5 of vkd3d, the Direct3D to
|
||||
The Wine team is proud to announce that release 1.6 of vkd3d, the Direct3D to
|
||||
Vulkan translation library, is now available.
|
||||
|
||||
This release contains improvements that are listed in the release notes below.
|
||||
The main highlights are:
|
||||
|
||||
- Support for various HLSL features and intrinsics.
|
||||
- Typed unordered access view loads of multicomponent formats.
|
||||
- Initial support for HLSL compute shaders.
|
||||
- More support for HLSL features and intrinsics.
|
||||
- Miscellaneous bug fixes.
|
||||
|
||||
The source is available from the following location:
|
||||
|
||||
https://dl.winehq.org/vkd3d/source/vkd3d-1.5.tar.xz
|
||||
https://dl.winehq.org/vkd3d/source/vkd3d-1.6.tar.xz
|
||||
|
||||
The current source can also be pulled directly from the git repository:
|
||||
|
||||
@@ -21,30 +21,40 @@ for the complete list.
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
What's new in vkd3d 1.5
|
||||
What's new in vkd3d 1.6
|
||||
=======================
|
||||
|
||||
|
||||
*** libvkd3d-shader
|
||||
|
||||
- New features for the HLSL source type:
|
||||
- Improved support for HLSL object types (like e.g. `Texture2D') inside
|
||||
structures and arrays.
|
||||
- Implicitly sized array initialisers.
|
||||
- Support for the dot() intrinsic function.
|
||||
- Support for the ldexp() intrinsic function.
|
||||
- Support for the lerp() intrinsic function.
|
||||
- Support for the logical `and', `or', and `not' operators in shader model 4
|
||||
and 5 targets.
|
||||
- Support for casts from `bool' types in shader model 4 and 5 targets.
|
||||
- Constant folding for integer bitwise operations.
|
||||
- Constant folding for integer min() and max().
|
||||
- Initial support for compute shaders.
|
||||
- Improved support for initialisation and assignment of compound objects
|
||||
like structures and arrays, including casts and implicit conversions.
|
||||
- Support for loads and stores of texture resource unordered-access views.
|
||||
- Support for function attributes. In particular, the required "numthreads"
|
||||
attribute for compute shader entry points is now supported.
|
||||
- Support for the asuint() intrinsic function.
|
||||
- Support for the length() intrinsic function.
|
||||
- Support for the normalize() intrinsic function.
|
||||
- Support for integer division and modulus.
|
||||
- Support for taking the absolute value of integers.
|
||||
- Support for floating-point modulus.
|
||||
|
||||
|
||||
- New interfaces:
|
||||
- The VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV compile option can be used to
|
||||
specify the SPIR-V format to use for typed unordered access view loads.
|
||||
When set to `Unknown', and the `shaderStorageImageReadWithoutFormat'
|
||||
feature is enabled in the target environment, this allows typed loads from
|
||||
multicomponent format unordered access views. If left unspecified, a R32
|
||||
format will be used, like in previous versions of libvkd3d-shader.
|
||||
- The VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_ATOMICS descriptor info flag is
|
||||
used to indicate that atomic operations are used on unordered-access view
|
||||
descriptors.
|
||||
|
||||
|
||||
*** libvkd3d-common
|
||||
|
||||
- vkd3d debug output is prefixed with "vkd3d:" in order to make it easier to
|
||||
distinguish from output produced by applications or other libraries.
|
||||
|
||||
|
||||
*** demos
|
||||
|
||||
- The demos now use libvkd3d-shader to compile HLSL shaders at run-time.
|
||||
|
||||
|
1
AUTHORS
1
AUTHORS
@@ -3,6 +3,7 @@ Andrew Eikum
|
||||
Andrey Gusev
|
||||
Atharva Nimbalkar
|
||||
Biswapriyo Nath
|
||||
Brendan Shanks
|
||||
Chip Davis
|
||||
Conor McCarthy
|
||||
David Gow
|
||||
|
35
Makefile.am
35
Makefile.am
@@ -31,15 +31,6 @@ vkd3d_public_headers = \
|
||||
include/vkd3d_utils.h \
|
||||
include/vkd3d_windows.h
|
||||
|
||||
vkd3d_demos_shaders = \
|
||||
demos/gears.hlsl \
|
||||
demos/gears_ps_flat.h \
|
||||
demos/gears_ps_smooth.h \
|
||||
demos/gears_vs.h \
|
||||
demos/triangle.hlsl \
|
||||
demos/triangle_ps.h \
|
||||
demos/triangle_vs.h
|
||||
|
||||
vkd3d_tests = \
|
||||
tests/vkd3d_api \
|
||||
tests/vkd3d_common \
|
||||
@@ -53,18 +44,24 @@ vkd3d_cross_tests = \
|
||||
vkd3d_shader_tests = \
|
||||
tests/abs.shader_test \
|
||||
tests/arithmetic-float.shader_test \
|
||||
tests/arithmetic-float-uniform.shader_test \
|
||||
tests/arithmetic-int.shader_test \
|
||||
tests/arithmetic-int-uniform.shader_test \
|
||||
tests/arithmetic-uint.shader_test \
|
||||
tests/bitwise.shader_test \
|
||||
tests/cast-broadcast.shader_test \
|
||||
tests/cast-componentwise-equal.shader_test \
|
||||
tests/cast-componentwise-compatible.shader_test \
|
||||
tests/cast-to-float.shader_test \
|
||||
tests/cast-to-half.shader_test \
|
||||
tests/cast-to-int.shader_test \
|
||||
tests/cast-to-uint.shader_test \
|
||||
tests/cbuffer.shader_test \
|
||||
tests/compute.shader_test \
|
||||
tests/conditional.shader_test \
|
||||
tests/floor.shader_test \
|
||||
tests/hlsl-array-dimension.shader_test \
|
||||
tests/hlsl-attributes.shader_test \
|
||||
tests/hlsl-bool-cast.shader_test \
|
||||
tests/hlsl-clamp.shader_test \
|
||||
tests/hlsl-comma.shader_test \
|
||||
@@ -90,14 +87,17 @@ vkd3d_shader_tests = \
|
||||
tests/hlsl-intrinsic-override.shader_test \
|
||||
tests/hlsl-invalid.shader_test \
|
||||
tests/hlsl-ldexp.shader_test \
|
||||
tests/hlsl-length.shader_test \
|
||||
tests/hlsl-lerp.shader_test \
|
||||
tests/hlsl-majority-pragma.shader_test \
|
||||
tests/hlsl-majority-typedef.shader_test \
|
||||
tests/hlsl-matrix-indexing.shader_test \
|
||||
tests/hlsl-mul.shader_test \
|
||||
tests/hlsl-nested-arrays.shader_test \
|
||||
tests/hlsl-normalize.shader_test \
|
||||
tests/hlsl-numeric-constructor-truncation.shader_test \
|
||||
tests/hlsl-numeric-types.shader_test \
|
||||
tests/hlsl-numthreads.shader_test \
|
||||
tests/hlsl-return-implicit-conversion.shader_test \
|
||||
tests/hlsl-return-void.shader_test \
|
||||
tests/hlsl-shape.shader_test \
|
||||
@@ -113,9 +113,10 @@ vkd3d_shader_tests = \
|
||||
tests/logic-operations.shader_test \
|
||||
tests/math.shader_test \
|
||||
tests/matrix-semantics.shader_test \
|
||||
tests/max.shader_test \
|
||||
tests/multiple-rt.shader_test \
|
||||
tests/nointerpolation.shader_test \
|
||||
tests/object-references.shader_test
|
||||
tests/object-references.shader_test \
|
||||
tests/pow.shader_test \
|
||||
tests/preproc-if.shader_test \
|
||||
tests/preproc-ifdef.shader_test \
|
||||
@@ -140,6 +141,7 @@ vkd3d_shader_tests = \
|
||||
tests/texture-load-typed.shader_test \
|
||||
tests/trigonometry.shader_test \
|
||||
tests/uav.shader_test \
|
||||
tests/uav-load.shader_test \
|
||||
tests/writemask-assignop-0.shader_test \
|
||||
tests/writemask-assignop-1.shader_test \
|
||||
tests/writemask-assignop-2.shader_test \
|
||||
@@ -172,6 +174,7 @@ libvkd3d_common_la_SOURCES = \
|
||||
libs/vkd3d-common/error.c \
|
||||
libs/vkd3d-common/memory.c \
|
||||
libs/vkd3d-common/utf8.c
|
||||
libvkd3d_common_la_LIBADD = @PTHREAD_LIBS@
|
||||
|
||||
lib_LTLIBRARIES = libvkd3d-shader.la libvkd3d.la libvkd3d-utils.la
|
||||
|
||||
@@ -242,7 +245,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 4:0:3
|
||||
libvkd3d_shader_la_LDFLAGS = $(AM_LDFLAGS) -version-info 5:0:4
|
||||
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
|
||||
@@ -276,7 +279,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 6:0:5
|
||||
libvkd3d_la_LDFLAGS = $(AM_LDFLAGS) -version-info 7:0:6
|
||||
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
|
||||
@@ -288,7 +291,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 4:1:3
|
||||
libvkd3d_utils_la_LDFLAGS = $(AM_LDFLAGS) -version-info 4:2:3
|
||||
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
|
||||
@@ -339,11 +342,11 @@ DEMOS_LDADD = $(LDADD) libvkd3d-shader.la @DL_LIBS@ @DEMO_LIBS@
|
||||
DEMOS_CFLAGS = $(AM_CFLAGS) @DEMO_CFLAGS@
|
||||
bin_PROGRAMS += $(vkd3d_demos)
|
||||
|
||||
demos_vkd3d_gears_SOURCES = demos/gears.c
|
||||
demos_vkd3d_gears_SOURCES = demos/gears.c demos/gears_hlsl.h
|
||||
demos_vkd3d_gears_CFLAGS = $(DEMOS_CFLAGS)
|
||||
demos_vkd3d_gears_LDADD = $(DEMOS_LDADD) -lm
|
||||
|
||||
demos_vkd3d_triangle_SOURCES = demos/triangle.c
|
||||
demos_vkd3d_triangle_SOURCES = demos/triangle.c demos/triangle_hlsl.h
|
||||
demos_vkd3d_triangle_CFLAGS = $(DEMOS_CFLAGS)
|
||||
demos_vkd3d_triangle_LDADD = $(DEMOS_LDADD)
|
||||
endif
|
||||
@@ -366,8 +369,6 @@ else
|
||||
@echo "widl is required to generate $@"
|
||||
endif
|
||||
|
||||
EXTRA_DIST += $(vkd3d_demos_shaders)
|
||||
|
||||
libvkd3d-utils.pc: $(srcdir)/libs/vkd3d-utils/libvkd3d-utils.pc.in Makefile
|
||||
$(AM_V_GEN)$(SED) -e 's![@]prefix[@]!$(prefix)!g' \
|
||||
-e 's![@]exec_prefix[@]!$(exec_prefix)!g' \
|
||||
|
@@ -1,5 +1,5 @@
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([vkd3d],[1.5])
|
||||
AC_INIT([vkd3d],[1.6])
|
||||
|
||||
AC_CONFIG_AUX_DIR([bin])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <vkd3d_dxgi1_4.h>
|
||||
#include <vkd3d_d3dcompiler.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#define VK_NO_PROTOTYPES
|
||||
#define VK_USE_PLATFORM_XCB_KHR
|
||||
#define VKD3D_UTILS_API_VERSION VKD3D_API_VERSION_1_5
|
||||
#define VKD3D_UTILS_API_VERSION VKD3D_API_VERSION_1_6
|
||||
#include "config.h"
|
||||
#include <vkd3d.h>
|
||||
#include <vkd3d_utils.h>
|
||||
|
@@ -48,9 +48,7 @@
|
||||
#include <math.h>
|
||||
#include "demo.h"
|
||||
|
||||
#include "gears_vs.h"
|
||||
#include "gears_ps_flat.h"
|
||||
#include "gears_ps_smooth.h"
|
||||
#include "gears_hlsl.h"
|
||||
|
||||
struct cxg_fence
|
||||
{
|
||||
@@ -659,6 +657,7 @@ static void cxg_load_assets(struct cx_gears *cxg)
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc;
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE dsv_handle;
|
||||
D3D12_ROOT_PARAMETER root_parameter;
|
||||
ID3DBlob *vs, *ps_flat, *ps_smooth;
|
||||
D3D12_RESOURCE_DESC resource_desc;
|
||||
D3D12_HEAP_PROPERTIES heap_desc;
|
||||
D3D12_RANGE read_range = {0, 0};
|
||||
@@ -682,14 +681,21 @@ 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);
|
||||
assert(SUCCEEDED(hr));
|
||||
hr = D3DCompile(gears_hlsl, strlen(gears_hlsl), NULL, 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);
|
||||
assert(SUCCEEDED(hr));
|
||||
|
||||
memset(&pso_desc, 0, sizeof(pso_desc));
|
||||
pso_desc.InputLayout.pInputElementDescs = il_desc;
|
||||
pso_desc.InputLayout.NumElements = ARRAY_SIZE(il_desc);
|
||||
pso_desc.pRootSignature = cxg->root_signature;
|
||||
pso_desc.VS.pShaderBytecode = g_vs_main;
|
||||
pso_desc.VS.BytecodeLength = sizeof(g_vs_main);
|
||||
pso_desc.PS.pShaderBytecode = g_ps_main_flat;
|
||||
pso_desc.PS.BytecodeLength = sizeof(g_ps_main_flat);
|
||||
pso_desc.VS.pShaderBytecode = ID3D10Blob_GetBufferPointer(vs);
|
||||
pso_desc.VS.BytecodeLength = ID3D10Blob_GetBufferSize(vs);
|
||||
pso_desc.PS.pShaderBytecode = ID3D10Blob_GetBufferPointer(ps_flat);
|
||||
pso_desc.PS.BytecodeLength = ID3D10Blob_GetBufferSize(ps_flat);
|
||||
|
||||
demo_rasterizer_desc_init_default(&pso_desc.RasterizerState);
|
||||
pso_desc.RasterizerState.FrontCounterClockwise = TRUE;
|
||||
@@ -708,12 +714,16 @@ static void cxg_load_assets(struct cx_gears *cxg)
|
||||
&IID_ID3D12PipelineState, (void **)&cxg->pipeline_state_flat);
|
||||
assert(SUCCEEDED(hr));
|
||||
|
||||
pso_desc.PS.pShaderBytecode = g_ps_main_smooth;
|
||||
pso_desc.PS.BytecodeLength = sizeof(g_ps_main_smooth);
|
||||
pso_desc.PS.pShaderBytecode = ID3D10Blob_GetBufferPointer(ps_smooth);
|
||||
pso_desc.PS.BytecodeLength = ID3D10Blob_GetBufferSize(ps_smooth);
|
||||
hr = ID3D12Device_CreateGraphicsPipelineState(cxg->device, &pso_desc,
|
||||
&IID_ID3D12PipelineState, (void **)&cxg->pipeline_state_smooth);
|
||||
assert(SUCCEEDED(hr));
|
||||
|
||||
ID3D10Blob_Release(vs);
|
||||
ID3D10Blob_Release(ps_flat);
|
||||
ID3D10Blob_Release(ps_smooth);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cxg->command_list); ++i)
|
||||
{
|
||||
hr = ID3D12Device_CreateCommandList(cxg->device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT,
|
||||
|
@@ -1,55 +0,0 @@
|
||||
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;
|
||||
}
|
56
demos/gears_hlsl.h
Normal file
56
demos/gears_hlsl.h
Normal file
@@ -0,0 +1,56 @@
|
||||
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";
|
@@ -1,73 +0,0 @@
|
||||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) D3D Shader Disassembler
|
||||
//
|
||||
//
|
||||
// Input signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// SV_POSITION 0 xyzw 0 POS float
|
||||
// COLOR 0 xyzw 1 NONE float xyzw
|
||||
//
|
||||
//
|
||||
// Output signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// SV_TARGET 0 xyzw 0 TARGET float xyzw
|
||||
//
|
||||
ps_5_0
|
||||
dcl_globalFlags refactoringAllowed
|
||||
dcl_input_ps constant v1.xyzw
|
||||
dcl_output o0.xyzw
|
||||
mov o0.xyzw, v1.xyzw
|
||||
ret
|
||||
// Approximately 0 instruction slots used
|
||||
#endif
|
||||
|
||||
const BYTE g_ps_main_flat[] =
|
||||
{
|
||||
68, 88, 66, 67, 254, 211,
|
||||
50, 72, 228, 208, 73, 13,
|
||||
143, 221, 134, 105, 6, 165,
|
||||
26, 140, 1, 0, 0, 0,
|
||||
248, 0, 0, 0, 3, 0,
|
||||
0, 0, 44, 0, 0, 0,
|
||||
128, 0, 0, 0, 180, 0,
|
||||
0, 0, 73, 83, 71, 78,
|
||||
76, 0, 0, 0, 2, 0,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
56, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 0,
|
||||
0, 0, 15, 0, 0, 0,
|
||||
68, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 1, 0,
|
||||
0, 0, 15, 15, 0, 0,
|
||||
83, 86, 95, 80, 79, 83,
|
||||
73, 84, 73, 79, 78, 0,
|
||||
67, 79, 76, 79, 82, 0,
|
||||
171, 171, 79, 83, 71, 78,
|
||||
44, 0, 0, 0, 1, 0,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
32, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 0,
|
||||
0, 0, 15, 0, 0, 0,
|
||||
83, 86, 95, 84, 65, 82,
|
||||
71, 69, 84, 0, 171, 171,
|
||||
83, 72, 69, 88, 60, 0,
|
||||
0, 0, 80, 0, 0, 0,
|
||||
15, 0, 0, 0, 106, 8,
|
||||
0, 1, 98, 8, 0, 3,
|
||||
242, 16, 16, 0, 1, 0,
|
||||
0, 0, 101, 0, 0, 3,
|
||||
242, 32, 16, 0, 0, 0,
|
||||
0, 0, 54, 0, 0, 5,
|
||||
242, 32, 16, 0, 0, 0,
|
||||
0, 0, 70, 30, 16, 0,
|
||||
1, 0, 0, 0, 62, 0,
|
||||
0, 1
|
||||
};
|
@@ -1,73 +0,0 @@
|
||||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) D3D Shader Disassembler
|
||||
//
|
||||
//
|
||||
// Input signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// SV_POSITION 0 xyzw 0 POS float
|
||||
// COLOR 0 xyzw 1 NONE float xyzw
|
||||
//
|
||||
//
|
||||
// Output signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// SV_TARGET 0 xyzw 0 TARGET float xyzw
|
||||
//
|
||||
ps_5_0
|
||||
dcl_globalFlags refactoringAllowed
|
||||
dcl_input_ps linear v1.xyzw
|
||||
dcl_output o0.xyzw
|
||||
mov o0.xyzw, v1.xyzw
|
||||
ret
|
||||
// Approximately 0 instruction slots used
|
||||
#endif
|
||||
|
||||
const BYTE g_ps_main_smooth[] =
|
||||
{
|
||||
68, 88, 66, 67, 80, 239,
|
||||
109, 26, 0, 147, 6, 156,
|
||||
240, 104, 206, 124, 185, 57,
|
||||
18, 98, 1, 0, 0, 0,
|
||||
248, 0, 0, 0, 3, 0,
|
||||
0, 0, 44, 0, 0, 0,
|
||||
128, 0, 0, 0, 180, 0,
|
||||
0, 0, 73, 83, 71, 78,
|
||||
76, 0, 0, 0, 2, 0,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
56, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 0,
|
||||
0, 0, 15, 0, 0, 0,
|
||||
68, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 1, 0,
|
||||
0, 0, 15, 15, 0, 0,
|
||||
83, 86, 95, 80, 79, 83,
|
||||
73, 84, 73, 79, 78, 0,
|
||||
67, 79, 76, 79, 82, 0,
|
||||
171, 171, 79, 83, 71, 78,
|
||||
44, 0, 0, 0, 1, 0,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
32, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 0,
|
||||
0, 0, 15, 0, 0, 0,
|
||||
83, 86, 95, 84, 65, 82,
|
||||
71, 69, 84, 0, 171, 171,
|
||||
83, 72, 69, 88, 60, 0,
|
||||
0, 0, 80, 0, 0, 0,
|
||||
15, 0, 0, 0, 106, 8,
|
||||
0, 1, 98, 16, 0, 3,
|
||||
242, 16, 16, 0, 1, 0,
|
||||
0, 0, 101, 0, 0, 3,
|
||||
242, 32, 16, 0, 0, 0,
|
||||
0, 0, 54, 0, 0, 5,
|
||||
242, 32, 16, 0, 0, 0,
|
||||
0, 0, 70, 30, 16, 0,
|
||||
1, 0, 0, 0, 62, 0,
|
||||
0, 1
|
||||
};
|
272
demos/gears_vs.h
272
demos/gears_vs.h
@@ -1,272 +0,0 @@
|
||||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) D3D Shader Disassembler
|
||||
//
|
||||
//
|
||||
// Input signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// POSITION 0 xyzw 0 NONE float xyzw
|
||||
// NORMAL 0 xyz 1 NONE float xyz
|
||||
// DIFFUSE 0 xyz 2 NONE float xyz
|
||||
// TRANSFORM 0 xyzw 3 NONE float xyzw
|
||||
//
|
||||
//
|
||||
// Output signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// SV_POSITION 0 xyzw 0 POS float xyzw
|
||||
// COLOR 0 xyzw 1 NONE float xyzw
|
||||
//
|
||||
vs_5_0
|
||||
dcl_globalFlags refactoringAllowed
|
||||
dcl_constantbuffer CB0[7], immediateIndexed
|
||||
dcl_input v0.xyzw
|
||||
dcl_input v1.xyz
|
||||
dcl_input v2.xyz
|
||||
dcl_input v3.xyzw
|
||||
dcl_output_siv o0.xyzw, position
|
||||
dcl_output o1.xyzw
|
||||
dcl_temps 2
|
||||
mul r0.x, v0.y, v3.y
|
||||
mad r0.x, v3.x, v0.x, -r0.x
|
||||
dp2 r0.y, v3.yxyy, v0.xyxx
|
||||
add r0.xy, r0.xyxx, v3.zwzz
|
||||
mul r1.xyzw, r0.yyyy, cb0[1].xyzw
|
||||
mad r0.xyzw, cb0[0].xyzw, r0.xxxx, r1.xyzw
|
||||
mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw
|
||||
mad r0.xyzw, cb0[3].xyzw, v0.wwww, r0.xyzw
|
||||
mov o0.xyzw, r0.xyzw
|
||||
div r0.xyz, r0.xyzx, r0.wwww
|
||||
add r0.xyz, -r0.xyzx, l(5.000000, 5.000000, 10.000000, 0.000000)
|
||||
dp3 r0.w, r0.xyzx, r0.xyzx
|
||||
rsq r0.w, r0.w
|
||||
mul r0.xyz, r0.wwww, r0.xyzx
|
||||
mul r0.w, v1.y, v3.y
|
||||
mad r0.w, v3.x, v1.x, -r0.w
|
||||
dp2 r1.x, v3.yxyy, v1.xyxx
|
||||
mul r1.xyz, r1.xxxx, cb0[5].xyzx
|
||||
mad r1.xyz, cb0[4].xyzx, r0.wwww, r1.xyzx
|
||||
mad r1.xyz, cb0[6].xyzx, v1.zzzz, r1.xyzx
|
||||
dp3 r0.w, r1.xyzx, r1.xyzx
|
||||
rsq r0.w, r0.w
|
||||
mul r1.xyz, r0.wwww, r1.xyzx
|
||||
dp3 r0.x, r0.xyzx, r1.xyzx
|
||||
add r0.x, r0.x, l(0.200000)
|
||||
mul o1.xyz, r0.xxxx, v2.xyzx
|
||||
mov o1.w, l(1.000000)
|
||||
ret
|
||||
// Approximately 0 instruction slots used
|
||||
#endif
|
||||
|
||||
const BYTE g_vs_main[] =
|
||||
{
|
||||
68, 88, 66, 67, 82, 90,
|
||||
22, 185, 41, 66, 113, 173,
|
||||
43, 53, 199, 35, 30, 50,
|
||||
78, 7, 1, 0, 0, 0,
|
||||
208, 4, 0, 0, 3, 0,
|
||||
0, 0, 44, 0, 0, 0,
|
||||
192, 0, 0, 0, 20, 1,
|
||||
0, 0, 73, 83, 71, 78,
|
||||
140, 0, 0, 0, 4, 0,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
104, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 0,
|
||||
0, 0, 15, 15, 0, 0,
|
||||
113, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 1, 0,
|
||||
0, 0, 7, 7, 0, 0,
|
||||
120, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 2, 0,
|
||||
0, 0, 7, 7, 0, 0,
|
||||
128, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 3, 0,
|
||||
0, 0, 15, 15, 0, 0,
|
||||
80, 79, 83, 73, 84, 73,
|
||||
79, 78, 0, 78, 79, 82,
|
||||
77, 65, 76, 0, 68, 73,
|
||||
70, 70, 85, 83, 69, 0,
|
||||
84, 82, 65, 78, 83, 70,
|
||||
79, 82, 77, 0, 171, 171,
|
||||
79, 83, 71, 78, 76, 0,
|
||||
0, 0, 2, 0, 0, 0,
|
||||
8, 0, 0, 0, 56, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
1, 0, 0, 0, 3, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
15, 0, 0, 0, 68, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 3, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
15, 0, 0, 0, 83, 86,
|
||||
95, 80, 79, 83, 73, 84,
|
||||
73, 79, 78, 0, 67, 79,
|
||||
76, 79, 82, 0, 171, 171,
|
||||
83, 72, 69, 88, 180, 3,
|
||||
0, 0, 80, 0, 1, 0,
|
||||
237, 0, 0, 0, 106, 8,
|
||||
0, 1, 89, 0, 0, 4,
|
||||
70, 142, 32, 0, 0, 0,
|
||||
0, 0, 7, 0, 0, 0,
|
||||
95, 0, 0, 3, 242, 16,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
95, 0, 0, 3, 114, 16,
|
||||
16, 0, 1, 0, 0, 0,
|
||||
95, 0, 0, 3, 114, 16,
|
||||
16, 0, 2, 0, 0, 0,
|
||||
95, 0, 0, 3, 242, 16,
|
||||
16, 0, 3, 0, 0, 0,
|
||||
103, 0, 0, 4, 242, 32,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
1, 0, 0, 0, 101, 0,
|
||||
0, 3, 242, 32, 16, 0,
|
||||
1, 0, 0, 0, 104, 0,
|
||||
0, 2, 2, 0, 0, 0,
|
||||
56, 0, 0, 7, 18, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
26, 16, 16, 0, 0, 0,
|
||||
0, 0, 26, 16, 16, 0,
|
||||
3, 0, 0, 0, 50, 0,
|
||||
0, 10, 18, 0, 16, 0,
|
||||
0, 0, 0, 0, 10, 16,
|
||||
16, 0, 3, 0, 0, 0,
|
||||
10, 16, 16, 0, 0, 0,
|
||||
0, 0, 10, 0, 16, 128,
|
||||
65, 0, 0, 0, 0, 0,
|
||||
0, 0, 15, 0, 0, 7,
|
||||
34, 0, 16, 0, 0, 0,
|
||||
0, 0, 22, 21, 16, 0,
|
||||
3, 0, 0, 0, 70, 16,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 7, 50, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
70, 0, 16, 0, 0, 0,
|
||||
0, 0, 230, 26, 16, 0,
|
||||
3, 0, 0, 0, 56, 0,
|
||||
0, 8, 242, 0, 16, 0,
|
||||
1, 0, 0, 0, 86, 5,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
70, 142, 32, 0, 0, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
50, 0, 0, 10, 242, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
70, 142, 32, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
6, 0, 16, 0, 0, 0,
|
||||
0, 0, 70, 14, 16, 0,
|
||||
1, 0, 0, 0, 50, 0,
|
||||
0, 10, 242, 0, 16, 0,
|
||||
0, 0, 0, 0, 70, 142,
|
||||
32, 0, 0, 0, 0, 0,
|
||||
2, 0, 0, 0, 166, 26,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
70, 14, 16, 0, 0, 0,
|
||||
0, 0, 50, 0, 0, 10,
|
||||
242, 0, 16, 0, 0, 0,
|
||||
0, 0, 70, 142, 32, 0,
|
||||
0, 0, 0, 0, 3, 0,
|
||||
0, 0, 246, 31, 16, 0,
|
||||
0, 0, 0, 0, 70, 14,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
54, 0, 0, 5, 242, 32,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
70, 14, 16, 0, 0, 0,
|
||||
0, 0, 14, 0, 0, 7,
|
||||
114, 0, 16, 0, 0, 0,
|
||||
0, 0, 70, 2, 16, 0,
|
||||
0, 0, 0, 0, 246, 15,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 11, 114, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
70, 2, 16, 128, 65, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
2, 64, 0, 0, 0, 0,
|
||||
160, 64, 0, 0, 160, 64,
|
||||
0, 0, 32, 65, 0, 0,
|
||||
0, 0, 16, 0, 0, 7,
|
||||
130, 0, 16, 0, 0, 0,
|
||||
0, 0, 70, 2, 16, 0,
|
||||
0, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
68, 0, 0, 5, 130, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
58, 0, 16, 0, 0, 0,
|
||||
0, 0, 56, 0, 0, 7,
|
||||
114, 0, 16, 0, 0, 0,
|
||||
0, 0, 246, 15, 16, 0,
|
||||
0, 0, 0, 0, 70, 2,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
56, 0, 0, 7, 130, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
26, 16, 16, 0, 1, 0,
|
||||
0, 0, 26, 16, 16, 0,
|
||||
3, 0, 0, 0, 50, 0,
|
||||
0, 10, 130, 0, 16, 0,
|
||||
0, 0, 0, 0, 10, 16,
|
||||
16, 0, 3, 0, 0, 0,
|
||||
10, 16, 16, 0, 1, 0,
|
||||
0, 0, 58, 0, 16, 128,
|
||||
65, 0, 0, 0, 0, 0,
|
||||
0, 0, 15, 0, 0, 7,
|
||||
18, 0, 16, 0, 1, 0,
|
||||
0, 0, 22, 21, 16, 0,
|
||||
3, 0, 0, 0, 70, 16,
|
||||
16, 0, 1, 0, 0, 0,
|
||||
56, 0, 0, 8, 114, 0,
|
||||
16, 0, 1, 0, 0, 0,
|
||||
6, 0, 16, 0, 1, 0,
|
||||
0, 0, 70, 130, 32, 0,
|
||||
0, 0, 0, 0, 5, 0,
|
||||
0, 0, 50, 0, 0, 10,
|
||||
114, 0, 16, 0, 1, 0,
|
||||
0, 0, 70, 130, 32, 0,
|
||||
0, 0, 0, 0, 4, 0,
|
||||
0, 0, 246, 15, 16, 0,
|
||||
0, 0, 0, 0, 70, 2,
|
||||
16, 0, 1, 0, 0, 0,
|
||||
50, 0, 0, 10, 114, 0,
|
||||
16, 0, 1, 0, 0, 0,
|
||||
70, 130, 32, 0, 0, 0,
|
||||
0, 0, 6, 0, 0, 0,
|
||||
166, 26, 16, 0, 1, 0,
|
||||
0, 0, 70, 2, 16, 0,
|
||||
1, 0, 0, 0, 16, 0,
|
||||
0, 7, 130, 0, 16, 0,
|
||||
0, 0, 0, 0, 70, 2,
|
||||
16, 0, 1, 0, 0, 0,
|
||||
70, 2, 16, 0, 1, 0,
|
||||
0, 0, 68, 0, 0, 5,
|
||||
130, 0, 16, 0, 0, 0,
|
||||
0, 0, 58, 0, 16, 0,
|
||||
0, 0, 0, 0, 56, 0,
|
||||
0, 7, 114, 0, 16, 0,
|
||||
1, 0, 0, 0, 246, 15,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
70, 2, 16, 0, 1, 0,
|
||||
0, 0, 16, 0, 0, 7,
|
||||
18, 0, 16, 0, 0, 0,
|
||||
0, 0, 70, 2, 16, 0,
|
||||
0, 0, 0, 0, 70, 2,
|
||||
16, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 7, 18, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
10, 0, 16, 0, 0, 0,
|
||||
0, 0, 1, 64, 0, 0,
|
||||
205, 204, 76, 62, 56, 0,
|
||||
0, 7, 114, 32, 16, 0,
|
||||
1, 0, 0, 0, 6, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
70, 18, 16, 0, 2, 0,
|
||||
0, 0, 54, 0, 0, 5,
|
||||
130, 32, 16, 0, 1, 0,
|
||||
0, 0, 1, 64, 0, 0,
|
||||
0, 0, 128, 63, 62, 0,
|
||||
0, 1
|
||||
};
|
@@ -45,8 +45,7 @@
|
||||
#include <assert.h>
|
||||
#include "demo.h"
|
||||
|
||||
#include "triangle_vs.h"
|
||||
#include "triangle_ps.h"
|
||||
#include "triangle_hlsl.h"
|
||||
|
||||
struct cxt_fence
|
||||
{
|
||||
@@ -277,6 +276,7 @@ static void cxt_load_assets(struct cx_triangle *cxt)
|
||||
D3D12_RESOURCE_DESC resource_desc;
|
||||
D3D12_HEAP_PROPERTIES heap_desc;
|
||||
D3D12_RANGE read_range = {0, 0};
|
||||
ID3DBlob *vs, *ps;
|
||||
HRESULT hr;
|
||||
void *data;
|
||||
|
||||
@@ -285,14 +285,19 @@ 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);
|
||||
assert(SUCCEEDED(hr));
|
||||
hr = D3DCompile(triangle_hlsl, strlen(triangle_hlsl), NULL, NULL, NULL, "ps_main", "ps_5_0", 0, 0, &ps, NULL);
|
||||
assert(SUCCEEDED(hr));
|
||||
|
||||
memset(&pso_desc, 0, sizeof(pso_desc));
|
||||
pso_desc.InputLayout.pInputElementDescs = il_desc;
|
||||
pso_desc.InputLayout.NumElements = ARRAY_SIZE(il_desc);
|
||||
pso_desc.pRootSignature = cxt->root_signature;
|
||||
pso_desc.VS.pShaderBytecode = g_vs_main;
|
||||
pso_desc.VS.BytecodeLength = sizeof(g_vs_main);
|
||||
pso_desc.PS.pShaderBytecode = g_ps_main;
|
||||
pso_desc.PS.BytecodeLength = sizeof(g_ps_main);
|
||||
pso_desc.VS.pShaderBytecode = ID3D10Blob_GetBufferPointer(vs);
|
||||
pso_desc.VS.BytecodeLength = ID3D10Blob_GetBufferSize(vs);
|
||||
pso_desc.PS.pShaderBytecode = ID3D10Blob_GetBufferPointer(ps);
|
||||
pso_desc.PS.BytecodeLength = ID3D10Blob_GetBufferSize(ps);
|
||||
demo_rasterizer_desc_init_default(&pso_desc.RasterizerState);
|
||||
demo_blend_desc_init_default(&pso_desc.BlendState);
|
||||
pso_desc.DepthStencilState.DepthEnable = FALSE;
|
||||
@@ -306,6 +311,9 @@ static void cxt_load_assets(struct cx_triangle *cxt)
|
||||
&IID_ID3D12PipelineState, (void **)&cxt->pipeline_state);
|
||||
assert(SUCCEEDED(hr));
|
||||
|
||||
ID3D10Blob_Release(vs);
|
||||
ID3D10Blob_Release(ps);
|
||||
|
||||
hr = ID3D12Device_CreateCommandList(cxt->device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT, cxt->command_allocator,
|
||||
cxt->pipeline_state, &IID_ID3D12GraphicsCommandList, (void **)&cxt->command_list);
|
||||
assert(SUCCEEDED(hr));
|
||||
|
@@ -1,20 +0,0 @@
|
||||
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;
|
||||
}
|
21
demos/triangle_hlsl.h
Normal file
21
demos/triangle_hlsl.h
Normal file
@@ -0,0 +1,21 @@
|
||||
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";
|
@@ -1,73 +0,0 @@
|
||||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) D3D Shader Disassembler
|
||||
//
|
||||
//
|
||||
// Input signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// SV_POSITION 0 xyzw 0 POS float
|
||||
// COLOR 0 xyzw 1 NONE float xyzw
|
||||
//
|
||||
//
|
||||
// Output signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// SV_TARGET 0 xyzw 0 TARGET float xyzw
|
||||
//
|
||||
ps_5_0
|
||||
dcl_globalFlags refactoringAllowed
|
||||
dcl_input_ps linear v1.xyzw
|
||||
dcl_output o0.xyzw
|
||||
mov o0.xyzw, v1.xyzw
|
||||
ret
|
||||
// Approximately 0 instruction slots used
|
||||
#endif
|
||||
|
||||
const BYTE g_ps_main[] =
|
||||
{
|
||||
68, 88, 66, 67, 80, 239,
|
||||
109, 26, 0, 147, 6, 156,
|
||||
240, 104, 206, 124, 185, 57,
|
||||
18, 98, 1, 0, 0, 0,
|
||||
248, 0, 0, 0, 3, 0,
|
||||
0, 0, 44, 0, 0, 0,
|
||||
128, 0, 0, 0, 180, 0,
|
||||
0, 0, 73, 83, 71, 78,
|
||||
76, 0, 0, 0, 2, 0,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
56, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 0,
|
||||
0, 0, 15, 0, 0, 0,
|
||||
68, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 1, 0,
|
||||
0, 0, 15, 15, 0, 0,
|
||||
83, 86, 95, 80, 79, 83,
|
||||
73, 84, 73, 79, 78, 0,
|
||||
67, 79, 76, 79, 82, 0,
|
||||
171, 171, 79, 83, 71, 78,
|
||||
44, 0, 0, 0, 1, 0,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
32, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 0,
|
||||
0, 0, 15, 0, 0, 0,
|
||||
83, 86, 95, 84, 65, 82,
|
||||
71, 69, 84, 0, 171, 171,
|
||||
83, 72, 69, 88, 60, 0,
|
||||
0, 0, 80, 0, 0, 0,
|
||||
15, 0, 0, 0, 106, 8,
|
||||
0, 1, 98, 16, 0, 3,
|
||||
242, 16, 16, 0, 1, 0,
|
||||
0, 0, 101, 0, 0, 3,
|
||||
242, 32, 16, 0, 0, 0,
|
||||
0, 0, 54, 0, 0, 5,
|
||||
242, 32, 16, 0, 0, 0,
|
||||
0, 0, 70, 30, 16, 0,
|
||||
1, 0, 0, 0, 62, 0,
|
||||
0, 1
|
||||
};
|
@@ -1,89 +0,0 @@
|
||||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) D3D Shader Disassembler
|
||||
//
|
||||
//
|
||||
// Input signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// POSITION 0 xyzw 0 NONE float xyzw
|
||||
// COLOR 0 xyzw 1 NONE float xyzw
|
||||
//
|
||||
//
|
||||
// Output signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// SV_POSITION 0 xyzw 0 POS float xyzw
|
||||
// COLOR 0 xyzw 1 NONE float xyzw
|
||||
//
|
||||
vs_5_0
|
||||
dcl_globalFlags refactoringAllowed
|
||||
dcl_input v0.xyzw
|
||||
dcl_input v1.xyzw
|
||||
dcl_output_siv o0.xyzw, position
|
||||
dcl_output o1.xyzw
|
||||
mov o0.xyzw, v0.xyzw
|
||||
mov o1.xyzw, v1.xyzw
|
||||
ret
|
||||
// Approximately 0 instruction slots used
|
||||
#endif
|
||||
|
||||
const BYTE g_vs_main[] =
|
||||
{
|
||||
68, 88, 66, 67, 17, 201,
|
||||
143, 165, 233, 56, 0, 40,
|
||||
84, 255, 207, 20, 40, 195,
|
||||
63, 228, 1, 0, 0, 0,
|
||||
68, 1, 0, 0, 3, 0,
|
||||
0, 0, 44, 0, 0, 0,
|
||||
124, 0, 0, 0, 208, 0,
|
||||
0, 0, 73, 83, 71, 78,
|
||||
72, 0, 0, 0, 2, 0,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
56, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 0,
|
||||
0, 0, 15, 15, 0, 0,
|
||||
65, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 1, 0,
|
||||
0, 0, 15, 15, 0, 0,
|
||||
80, 79, 83, 73, 84, 73,
|
||||
79, 78, 0, 67, 79, 76,
|
||||
79, 82, 0, 171, 79, 83,
|
||||
71, 78, 76, 0, 0, 0,
|
||||
2, 0, 0, 0, 8, 0,
|
||||
0, 0, 56, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 0,
|
||||
0, 0, 3, 0, 0, 0,
|
||||
0, 0, 0, 0, 15, 0,
|
||||
0, 0, 68, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 3, 0, 0, 0,
|
||||
1, 0, 0, 0, 15, 0,
|
||||
0, 0, 83, 86, 95, 80,
|
||||
79, 83, 73, 84, 73, 79,
|
||||
78, 0, 67, 79, 76, 79,
|
||||
82, 0, 171, 171, 83, 72,
|
||||
69, 88, 108, 0, 0, 0,
|
||||
80, 0, 1, 0, 27, 0,
|
||||
0, 0, 106, 8, 0, 1,
|
||||
95, 0, 0, 3, 242, 16,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
95, 0, 0, 3, 242, 16,
|
||||
16, 0, 1, 0, 0, 0,
|
||||
103, 0, 0, 4, 242, 32,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
1, 0, 0, 0, 101, 0,
|
||||
0, 3, 242, 32, 16, 0,
|
||||
1, 0, 0, 0, 54, 0,
|
||||
0, 5, 242, 32, 16, 0,
|
||||
0, 0, 0, 0, 70, 30,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
54, 0, 0, 5, 242, 32,
|
||||
16, 0, 1, 0, 0, 0,
|
||||
70, 30, 16, 0, 1, 0,
|
||||
0, 0, 62, 0, 0, 1
|
||||
};
|
@@ -54,14 +54,32 @@ static inline size_t align(size_t addr, size_t alignment)
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define VKD3D_NORETURN __attribute__((noreturn))
|
||||
# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(printf, fmt, args)))
|
||||
# ifdef __MINGW_PRINTF_FORMAT
|
||||
# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(__MINGW_PRINTF_FORMAT, fmt, args)))
|
||||
# else
|
||||
# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(printf, fmt, args)))
|
||||
# endif
|
||||
# define VKD3D_UNUSED __attribute__((unused))
|
||||
# define VKD3D_UNREACHABLE __builtin_unreachable()
|
||||
#else
|
||||
# define VKD3D_NORETURN
|
||||
# define VKD3D_PRINTF_FUNC(fmt, args)
|
||||
# define VKD3D_UNUSED
|
||||
# define VKD3D_UNREACHABLE (void)0
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
VKD3D_NORETURN static inline void vkd3d_unreachable_(const char *filename, unsigned int line)
|
||||
{
|
||||
fprintf(stderr, "%s:%u: Aborting, reached unreachable code.\n", filename, line);
|
||||
abort();
|
||||
}
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define vkd3d_unreachable() VKD3D_UNREACHABLE
|
||||
#else
|
||||
#define vkd3d_unreachable() vkd3d_unreachable_(__FILE__, __LINE__)
|
||||
#endif
|
||||
|
||||
static inline unsigned int vkd3d_popcount(unsigned int v)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
|
@@ -115,5 +115,6 @@ struct vkd3d_debug_option
|
||||
bool vkd3d_debug_list_has_member(const char *string, const char *member);
|
||||
uint64_t vkd3d_parse_debug_options(const char *string,
|
||||
const struct vkd3d_debug_option *options, unsigned int option_count);
|
||||
void vkd3d_set_thread_name(const char *name);
|
||||
|
||||
#endif /* __VKD3D_DEBUG_H */
|
||||
|
@@ -62,6 +62,7 @@ enum vkd3d_api_version
|
||||
VKD3D_API_VERSION_1_3,
|
||||
VKD3D_API_VERSION_1_4,
|
||||
VKD3D_API_VERSION_1_5,
|
||||
VKD3D_API_VERSION_1_6,
|
||||
|
||||
VKD3D_FORCE_32_BIT_ENUM(VKD3D_API_VERSION),
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user