Wine-devel
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
November 2019
- 85 participants
- 778 discussions
[PATCH v4 01/10] vbscript: Move the global lists to the script dispatch object.
by Gabriel Ivăncescu 25 Nov '19
by Gabriel Ivăncescu 25 Nov '19
25 Nov '19
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
---
dlls/vbscript/compile.c | 15 +++++----
dlls/vbscript/interp.c | 39 +++++++++++-----------
dlls/vbscript/vbdisp.c | 34 +++++++++++++------
dlls/vbscript/vbscript.c | 70 +++++++++++++---------------------------
dlls/vbscript/vbscript.h | 41 ++++++++++++-----------
5 files changed, 97 insertions(+), 102 deletions(-)
diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c
index bc00209..9ddfacf 100644
--- a/dlls/vbscript/compile.c
+++ b/dlls/vbscript/compile.c
@@ -1758,21 +1758,22 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
static BOOL lookup_script_identifier(script_ctx_t *script, const WCHAR *identifier)
{
+ ScriptDisp *obj = script->script_obj;
class_desc_t *class;
vbscode_t *code;
unsigned i;
- for(i = 0; i < script->global_vars_cnt; i++) {
- if(!wcsicmp(script->global_vars[i]->name, identifier))
+ for(i = 0; i < obj->global_vars_cnt; i++) {
+ if(!wcsicmp(obj->global_vars[i]->name, identifier))
return TRUE;
}
- for(i = 0; i < script->global_funcs_cnt; i++) {
- if(!wcsicmp(script->global_funcs[i]->name, identifier))
+ for(i = 0; i < obj->global_funcs_cnt; i++) {
+ if(!wcsicmp(obj->global_funcs[i]->name, identifier))
return TRUE;
}
- for(class = script->classes; class; class = class->next) {
+ for(class = obj->classes; class; class = class->next) {
if(!wcsicmp(class->name, identifier))
return TRUE;
}
@@ -1977,8 +1978,8 @@ HRESULT compile_procedure(script_ctx_t *script, const WCHAR *src, const WCHAR *d
desc->func_cnt = 1;
desc->funcs->entries[VBDISP_CALLGET] = &code->main_code;
- desc->next = script->procs;
- script->procs = desc;
+ desc->next = script->script_obj->procs;
+ script->script_obj->procs = desc;
*ret = desc;
return S_OK;
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index d15a1b5..66ad206 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -94,7 +94,7 @@ static BOOL lookup_dynamic_vars(dynamic_var_t *var, const WCHAR *name, ref_t *re
return FALSE;
}
-static BOOL lookup_global_vars(script_ctx_t *script, const WCHAR *name, ref_t *ref)
+static BOOL lookup_global_vars(ScriptDisp *script, const WCHAR *name, ref_t *ref)
{
dynamic_var_t **vars = script->global_vars;
size_t i, cnt = script->global_vars_cnt;
@@ -112,6 +112,7 @@ static BOOL lookup_global_vars(script_ctx_t *script, const WCHAR *name, ref_t *r
static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_t invoke_type, ref_t *ref)
{
+ ScriptDisp *script_obj = ctx->script->script_obj;
named_item_t *item;
IDispatch *disp;
unsigned i;
@@ -175,11 +176,11 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
}
}
- if(lookup_global_vars(ctx->script, name, ref))
+ if(lookup_global_vars(script_obj, name, ref))
return S_OK;
- for(i = 0; i < ctx->script->global_funcs_cnt; i++) {
- function_t *func = ctx->script->global_funcs[i];
+ for(i = 0; i < script_obj->global_funcs_cnt; i++) {
+ function_t *func = script_obj->global_funcs[i];
if(!wcsicmp(func->name, name)) {
ref->type = REF_FUNC;
ref->u.f = func;
@@ -221,12 +222,13 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
static HRESULT add_dynamic_var(exec_ctx_t *ctx, const WCHAR *name,
BOOL is_const, VARIANT **out_var)
{
+ ScriptDisp *script_obj = ctx->script->script_obj;
dynamic_var_t *new_var;
heap_pool_t *heap;
WCHAR *str;
unsigned size;
- heap = ctx->func->type == FUNC_GLOBAL ? &ctx->script->heap : &ctx->heap;
+ heap = ctx->func->type == FUNC_GLOBAL ? &script_obj->heap : &ctx->heap;
new_var = heap_pool_alloc(heap, sizeof(*new_var));
if(!new_var)
@@ -243,19 +245,19 @@ static HRESULT add_dynamic_var(exec_ctx_t *ctx, const WCHAR *name,
V_VT(&new_var->v) = VT_EMPTY;
if(ctx->func->type == FUNC_GLOBAL) {
- size_t cnt = ctx->script->global_vars_cnt + 1;
- if(cnt > ctx->script->global_vars_size) {
+ size_t cnt = script_obj->global_vars_cnt + 1;
+ if(cnt > script_obj->global_vars_size) {
dynamic_var_t **new_vars;
- if(ctx->script->global_vars)
- new_vars = heap_realloc(ctx->script->global_vars, cnt * 2 * sizeof(*new_vars));
+ if(script_obj->global_vars)
+ new_vars = heap_realloc(script_obj->global_vars, cnt * 2 * sizeof(*new_vars));
else
new_vars = heap_alloc(cnt * 2 * sizeof(*new_vars));
if(!new_vars)
return E_OUTOFMEMORY;
- ctx->script->global_vars = new_vars;
- ctx->script->global_vars_size = cnt * 2;
+ script_obj->global_vars = new_vars;
+ script_obj->global_vars_size = cnt * 2;
}
- ctx->script->global_vars[ctx->script->global_vars_cnt++] = new_var;
+ script_obj->global_vars[script_obj->global_vars_cnt++] = new_var;
}else {
new_var->next = ctx->dynamic_vars;
ctx->dynamic_vars = new_var;
@@ -1113,7 +1115,7 @@ static HRESULT interp_new(exec_ctx_t *ctx)
return stack_push(ctx, &v);
}
- for(class_desc = ctx->script->classes; class_desc; class_desc = class_desc->next) {
+ for(class_desc = ctx->script->script_obj->classes; class_desc; class_desc = class_desc->next) {
if(!wcsicmp(class_desc->name, arg))
break;
}
@@ -1133,6 +1135,7 @@ static HRESULT interp_new(exec_ctx_t *ctx)
static HRESULT interp_dim(exec_ctx_t *ctx)
{
+ ScriptDisp *script_obj = ctx->script->script_obj;
const BSTR ident = ctx->instr->arg1.bstr;
const unsigned array_id = ctx->instr->arg2.uint;
const array_desc_t *array_desc;
@@ -1146,13 +1149,13 @@ static HRESULT interp_dim(exec_ctx_t *ctx)
if(ctx->func->type == FUNC_GLOBAL) {
unsigned i;
- for(i = 0; i < ctx->script->global_vars_cnt; i++) {
- if(!wcsicmp(ctx->script->global_vars[i]->name, ident))
+ for(i = 0; i < script_obj->global_vars_cnt; i++) {
+ if(!wcsicmp(script_obj->global_vars[i]->name, ident))
break;
}
- assert(i < ctx->script->global_vars_cnt);
- v = &ctx->script->global_vars[i]->v;
- array_ref = &ctx->script->global_vars[i]->array;
+ assert(i < script_obj->global_vars_cnt);
+ v = &script_obj->global_vars[i]->v;
+ array_ref = &script_obj->global_vars[i]->array;
}else {
ref_t ref;
diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c
index a5e5d2c..60a7965 100644
--- a/dlls/vbscript/vbdisp.c
+++ b/dlls/vbscript/vbdisp.c
@@ -817,11 +817,26 @@ static ULONG WINAPI ScriptDisp_Release(IDispatchEx *iface)
{
ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface);
LONG ref = InterlockedDecrement(&This->ref);
+ unsigned i;
TRACE("(%p) ref=%d\n", This, ref);
if(!ref) {
assert(!This->ctx);
+
+ while (This->procs)
+ {
+ class_desc_t *class_desc = This->procs;
+ This->procs = class_desc->next;
+ heap_free(class_desc);
+ }
+
+ for (i = 0; i < This->global_vars_cnt; i++)
+ release_dynamic_var(This->global_vars[i]);
+
+ heap_pool_free(&This->heap);
+ heap_free(This->global_vars);
+ heap_free(This->global_funcs);
heap_free(This);
}
@@ -899,15 +914,15 @@ static HRESULT WINAPI ScriptDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DW
if(!This->ctx)
return E_UNEXPECTED;
- for(i = 0; i < This->ctx->global_vars_cnt; i++) {
- if(!wcsicmp(This->ctx->global_vars[i]->name, bstrName)) {
+ for(i = 0; i < This->global_vars_cnt; i++) {
+ if(!wcsicmp(This->global_vars[i]->name, bstrName)) {
*pid = i + 1;
return S_OK;
}
}
- for(i = 0; i < This->ctx->global_funcs_cnt; i++) {
- if(!wcsicmp(This->ctx->global_funcs[i]->name, bstrName)) {
+ for(i = 0; i < This->global_funcs_cnt; i++) {
+ if(!wcsicmp(This->global_funcs[i]->name, bstrName)) {
*pid = i + 1 + DISPID_FUNCTION_MASK;
return S_OK;
}
@@ -928,14 +943,14 @@ static HRESULT WINAPI ScriptDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
if (id & DISPID_FUNCTION_MASK)
{
id &= ~DISPID_FUNCTION_MASK;
- if (id > This->ctx->global_funcs_cnt)
+ if (id > This->global_funcs_cnt)
return DISP_E_MEMBERNOTFOUND;
switch (wFlags)
{
case DISPATCH_METHOD:
case DISPATCH_METHOD | DISPATCH_PROPERTYGET:
- hres = exec_script(This->ctx, TRUE, This->ctx->global_funcs[id - 1], NULL, pdp, pvarRes);
+ hres = exec_script(This->ctx, TRUE, This->global_funcs[id - 1], NULL, pdp, pvarRes);
break;
default:
FIXME("Unsupported flags %x\n", wFlags);
@@ -945,16 +960,16 @@ static HRESULT WINAPI ScriptDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
return hres;
}
- if (id > This->ctx->global_vars_cnt)
+ if (id > This->global_vars_cnt)
return DISP_E_MEMBERNOTFOUND;
- if (This->ctx->global_vars[id - 1]->is_const)
+ if (This->global_vars[id - 1]->is_const)
{
FIXME("const not supported\n");
return E_NOTIMPL;
}
- return invoke_variant_prop(This->ctx, &This->ctx->global_vars[id - 1]->v, wFlags, pdp, pvarRes);
+ return invoke_variant_prop(This->ctx, &This->global_vars[id - 1]->v, wFlags, pdp, pvarRes);
}
static HRESULT WINAPI ScriptDisp_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
@@ -1028,6 +1043,7 @@ HRESULT create_script_disp(script_ctx_t *ctx, ScriptDisp **ret)
script_disp->IDispatchEx_iface.lpVtbl = &ScriptDispVtbl;
script_disp->ref = 1;
script_disp->ctx = ctx;
+ heap_pool_init(&script_disp->heap);
*ret = script_disp;
return S_OK;
diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c
index 803a54a..f789036 100644
--- a/dlls/vbscript/vbscript.c
+++ b/dlls/vbscript/vbscript.c
@@ -82,41 +82,42 @@ static inline BOOL is_started(VBScript *This)
static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code, VARIANT *res)
{
+ ScriptDisp *obj = ctx->script_obj;
function_t *func_iter, **new_funcs;
dynamic_var_t *var, **new_vars;
size_t cnt, i;
- cnt = ctx->global_vars_cnt + code->main_code.var_cnt;
- if (cnt > ctx->global_vars_size)
+ cnt = obj->global_vars_cnt + code->main_code.var_cnt;
+ if (cnt > obj->global_vars_size)
{
- if (ctx->global_vars)
- new_vars = heap_realloc(ctx->global_vars, cnt * sizeof(*new_vars));
+ if (obj->global_vars)
+ new_vars = heap_realloc(obj->global_vars, cnt * sizeof(*new_vars));
else
new_vars = heap_alloc(cnt * sizeof(*new_vars));
if (!new_vars)
return E_OUTOFMEMORY;
- ctx->global_vars = new_vars;
- ctx->global_vars_size = cnt;
+ obj->global_vars = new_vars;
+ obj->global_vars_size = cnt;
}
- cnt = ctx->global_funcs_cnt;
+ cnt = obj->global_funcs_cnt;
for (func_iter = code->funcs; func_iter; func_iter = func_iter->next)
cnt++;
- if (cnt > ctx->global_funcs_size)
+ if (cnt > obj->global_funcs_size)
{
- if (ctx->global_funcs)
- new_funcs = heap_realloc(ctx->global_funcs, cnt * sizeof(*new_funcs));
+ if (obj->global_funcs)
+ new_funcs = heap_realloc(obj->global_funcs, cnt * sizeof(*new_funcs));
else
new_funcs = heap_alloc(cnt * sizeof(*new_funcs));
if (!new_funcs)
return E_OUTOFMEMORY;
- ctx->global_funcs = new_funcs;
- ctx->global_funcs_size = cnt;
+ obj->global_funcs = new_funcs;
+ obj->global_funcs_size = cnt;
}
for (i = 0; i < code->main_code.var_cnt; i++)
{
- if (!(var = heap_pool_alloc(&ctx->heap, sizeof(*var))))
+ if (!(var = heap_pool_alloc(&obj->heap, sizeof(*var))))
return E_OUTOFMEMORY;
var->name = code->main_code.vars[i].name;
@@ -124,24 +125,24 @@ static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code, VARIANT *res
var->is_const = FALSE;
var->array = NULL;
- ctx->global_vars[ctx->global_vars_cnt + i] = var;
+ obj->global_vars[obj->global_vars_cnt + i] = var;
}
- ctx->global_vars_cnt += code->main_code.var_cnt;
+ obj->global_vars_cnt += code->main_code.var_cnt;
for (func_iter = code->funcs; func_iter; func_iter = func_iter->next)
{
- for (i = 0; i < ctx->global_funcs_cnt; i++)
+ for (i = 0; i < obj->global_funcs_cnt; i++)
{
- if (!wcsicmp(ctx->global_funcs[i]->name, func_iter->name))
+ if (!wcsicmp(obj->global_funcs[i]->name, func_iter->name))
{
/* global function already exists, replace it */
- ctx->global_funcs[i] = func_iter;
+ obj->global_funcs[i] = func_iter;
break;
}
}
- if (i == ctx->global_funcs_cnt)
- ctx->global_funcs[ctx->global_funcs_cnt++] = func_iter;
+ if (i == obj->global_funcs_cnt)
+ obj->global_funcs[obj->global_funcs_cnt++] = func_iter;
}
if (code->classes)
@@ -156,8 +157,8 @@ static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code, VARIANT *res
class = class->next;
}
- class->next = ctx->classes;
- ctx->classes = code->classes;
+ class->next = obj->classes;
+ obj->classes = code->classes;
code->last_class = class;
}
@@ -210,24 +211,10 @@ IDispatch *lookup_named_item(script_ctx_t *ctx, const WCHAR *name, unsigned flag
static void release_script(script_ctx_t *ctx)
{
vbscode_t *code, *code_next;
- class_desc_t *class_desc;
- unsigned i;
collect_objects(ctx);
clear_ei(&ctx->ei);
- for(i = 0; i < ctx->global_vars_cnt; i++)
- release_dynamic_var(ctx->global_vars[i]);
-
- heap_free(ctx->global_vars);
- heap_free(ctx->global_funcs);
- ctx->global_vars = NULL;
- ctx->global_vars_cnt = 0;
- ctx->global_vars_size = 0;
- ctx->global_funcs = NULL;
- ctx->global_funcs_cnt = 0;
- ctx->global_funcs_size = 0;
-
LIST_FOR_EACH_ENTRY_SAFE(code, code_next, &ctx->code_list, vbscode_t, entry)
{
if(code->is_persistent)
@@ -249,13 +236,6 @@ static void release_script(script_ctx_t *ctx)
heap_free(iter);
}
- while(ctx->procs) {
- class_desc = ctx->procs;
- ctx->procs = class_desc->next;
-
- heap_free(class_desc);
- }
-
if(ctx->host_global) {
IDispatch_Release(ctx->host_global);
ctx->host_global = NULL;
@@ -278,9 +258,6 @@ static void release_script(script_ctx_t *ctx)
script_obj->ctx = NULL;
IDispatchEx_Release(&script_obj->IDispatchEx_iface);
}
-
- heap_pool_free(&ctx->heap);
- heap_pool_init(&ctx->heap);
}
static void release_code_list(script_ctx_t *ctx)
@@ -1054,7 +1031,6 @@ HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pU
}
ctx->safeopt = INTERFACE_USES_DISPEX;
- heap_pool_init(&ctx->heap);
list_init(&ctx->objects);
list_init(&ctx->code_list);
list_init(&ctx->named_items);
diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
index 1cc36fd..f4e7bc7 100644
--- a/dlls/vbscript/vbscript.h
+++ b/dlls/vbscript/vbscript.h
@@ -120,11 +120,31 @@ struct _vbdisp_t {
VARIANT props[1];
};
+typedef struct _dynamic_var_t {
+ struct _dynamic_var_t *next;
+ VARIANT v;
+ const WCHAR *name;
+ BOOL is_const;
+ SAFEARRAY *array;
+} dynamic_var_t;
+
typedef struct {
IDispatchEx IDispatchEx_iface;
LONG ref;
+ dynamic_var_t **global_vars;
+ size_t global_vars_cnt;
+ size_t global_vars_size;
+
+ function_t **global_funcs;
+ size_t global_funcs_cnt;
+ size_t global_funcs_size;
+
+ class_desc_t *classes;
+ class_desc_t *procs;
+
script_ctx_t *ctx;
+ heap_pool_t heap;
} ScriptDisp;
typedef struct _builtin_prop_t builtin_prop_t;
@@ -158,14 +178,6 @@ static inline VARIANT *get_arg(DISPPARAMS *dp, DWORD i)
return dp->rgvarg + dp->cArgs-i-1;
}
-typedef struct _dynamic_var_t {
- struct _dynamic_var_t *next;
- VARIANT v;
- const WCHAR *name;
- BOOL is_const;
- SAFEARRAY *array;
-} dynamic_var_t;
-
struct _script_ctx_t {
IActiveScriptSite *site;
LCID lcid;
@@ -182,19 +194,6 @@ struct _script_ctx_t {
EXCEPINFO ei;
- dynamic_var_t **global_vars;
- size_t global_vars_cnt;
- size_t global_vars_size;
-
- function_t **global_funcs;
- size_t global_funcs_cnt;
- size_t global_funcs_size;
-
- class_desc_t *classes;
- class_desc_t *procs;
-
- heap_pool_t heap;
-
struct list objects;
struct list code_list;
struct list named_items;
--
2.21.0
1
9
[PATCH vkd3d 7/7] vkd3d: Return valid node masks in external resource heap properties.
by Henri Verbeet 25 Nov '19
by Henri Verbeet 25 Nov '19
25 Nov '19
From: Conor McCarthy <cmccarthy(a)codeweavers.com>
Hitman 2 calls GetHeapProperties() for each swapchain buffer and checks if
the creation node mask is 1. If not then it fails to store the resource
pointers for later rendering.
Signed-off-by: Conor McCarthy <cmccarthy(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patch 174171.
libs/vkd3d/resource.c | 2 ++
tests/vkd3d_api.c | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c
index 89733ce..f5cdf4a 100644
--- a/libs/vkd3d/resource.c
+++ b/libs/vkd3d/resource.c
@@ -1522,6 +1522,8 @@ static HRESULT STDMETHODCALLTYPE d3d12_resource_GetHeapProperties(ID3D12Resource
{
memset(heap_properties, 0, sizeof(*heap_properties));
heap_properties->Type = D3D12_HEAP_TYPE_DEFAULT;
+ heap_properties->CreationNodeMask = 1;
+ heap_properties->VisibleNodeMask = 1;
}
if (flags)
*flags = D3D12_HEAP_FLAG_NONE;
diff --git a/tests/vkd3d_api.c b/tests/vkd3d_api.c
index 135782d..d4fe79a 100644
--- a/tests/vkd3d_api.c
+++ b/tests/vkd3d_api.c
@@ -907,8 +907,8 @@ static void test_external_resource_map(void)
"Got unexpected CPU page property %#x.\n", heap_properties.CPUPageProperty);
ok(heap_properties.MemoryPoolPreference == D3D12_MEMORY_POOL_UNKNOWN,
"Got unexpected memory pool preference %#x.\n", heap_properties.MemoryPoolPreference);
- todo ok(!!heap_properties.CreationNodeMask, "Got unexpected node mask %#x.\n", heap_properties.CreationNodeMask);
- todo ok(!!heap_properties.VisibleNodeMask, "Got unexpected node mask %#x.\n", heap_properties.VisibleNodeMask);
+ ok(!!heap_properties.CreationNodeMask, "Got unexpected node mask %#x.\n", heap_properties.CreationNodeMask);
+ ok(!!heap_properties.VisibleNodeMask, "Got unexpected node mask %#x.\n", heap_properties.VisibleNodeMask);
ID3D12Resource_Release(vk_resource);
vk_device = vkd3d_get_vk_device(device);
--
2.11.0
1
0
[PATCH vkd3d 6/7] vkd3d: Add tests for external resource heap properties.
by Henri Verbeet 25 Nov '19
by Henri Verbeet 25 Nov '19
25 Nov '19
From: Conor McCarthy <cmccarthy(a)codeweavers.com>
Signed-off-by: Conor McCarthy <cmccarthy(a)codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patch 174172.
tests/vkd3d_api.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/vkd3d_api.c b/tests/vkd3d_api.c
index a9a7fc1..135782d 100644
--- a/tests/vkd3d_api.c
+++ b/tests/vkd3d_api.c
@@ -854,7 +854,9 @@ static VkDeviceMemory allocate_vulkan_image_memory(ID3D12Device *device,
static void test_external_resource_map(void)
{
struct vkd3d_image_resource_create_info resource_create_info;
+ D3D12_HEAP_PROPERTIES heap_properties;
D3D12_GPU_VIRTUAL_ADDRESS gpu_address;
+ D3D12_HEAP_FLAGS heap_flags;
ID3D12Resource *vk_resource;
VkDeviceMemory vk_memory;
ID3D12Device *device;
@@ -898,6 +900,16 @@ static void test_external_resource_map(void)
gpu_address = ID3D12Resource_GetGPUVirtualAddress(vk_resource);
ok(!gpu_address, "Got unexpected GPU virtual address %#"PRIx64".\n", gpu_address);
+ hr = ID3D12Resource_GetHeapProperties(vk_resource, &heap_properties, &heap_flags);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(heap_properties.Type == D3D12_HEAP_TYPE_DEFAULT, "Got unexpected heap type %#x.\n", heap_properties.Type);
+ ok(heap_properties.CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_UNKNOWN,
+ "Got unexpected CPU page property %#x.\n", heap_properties.CPUPageProperty);
+ ok(heap_properties.MemoryPoolPreference == D3D12_MEMORY_POOL_UNKNOWN,
+ "Got unexpected memory pool preference %#x.\n", heap_properties.MemoryPoolPreference);
+ todo ok(!!heap_properties.CreationNodeMask, "Got unexpected node mask %#x.\n", heap_properties.CreationNodeMask);
+ todo ok(!!heap_properties.VisibleNodeMask, "Got unexpected node mask %#x.\n", heap_properties.VisibleNodeMask);
+
ID3D12Resource_Release(vk_resource);
vk_device = vkd3d_get_vk_device(device);
vkDestroyImage(vk_device, vk_image, NULL);
--
2.11.0
1
0
[PATCH vkd3d 5/7] vkd3d: Handle DXGI_FORMAT_R11G11B10_FLOAT in d3d12_command_list_ClearUnorderedAccessViewUint().
by Henri Verbeet 25 Nov '19
by Henri Verbeet 25 Nov '19
25 Nov '19
From: Philip Rebohle <philip.rebohle(a)tu-dortmund.de>
There is no bit-compatible UINT format, so we'll use DXGI_FORMAT_R32_UINT.
Signed-off-by: Philip Rebohle <philip.rebohle(a)tu-dortmund.de>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patch 173344.
libs/vkd3d/command.c | 19 ++++++++++++++++++-
tests/d3d12.c | 8 ++++----
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index e3810e2..75af27d 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -4979,6 +4979,22 @@ static void d3d12_command_list_clear_uav(struct d3d12_command_list *list,
}
}
+static const struct vkd3d_format *vkd3d_fixup_clear_uav_uint_colour(struct d3d12_device *device,
+ DXGI_FORMAT dxgi_format, VkClearColorValue *colour)
+{
+ switch (dxgi_format)
+ {
+ case DXGI_FORMAT_R11G11B10_FLOAT:
+ colour->uint32[0] = (colour->uint32[0] & 0x7ff)
+ | ((colour->uint32[1] & 0x7ff) << 11)
+ | ((colour->uint32[2] & 0x3ff) << 22);
+ return vkd3d_get_format(device, DXGI_FORMAT_R32_UINT, false);
+
+ default:
+ return NULL;
+ }
+}
+
static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID3D12GraphicsCommandList1 *iface,
D3D12_GPU_DESCRIPTOR_HANDLE gpu_handle, D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle, ID3D12Resource *resource,
const UINT values[4], UINT rect_count, const D3D12_RECT *rects)
@@ -5000,7 +5016,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID
if (view->format->type != VKD3D_FORMAT_TYPE_UINT)
{
- if (!(uint_format = vkd3d_find_uint_format(device, view->format->dxgi_format)))
+ if (!(uint_format = vkd3d_find_uint_format(device, view->format->dxgi_format))
+ && !(uint_format = vkd3d_fixup_clear_uav_uint_colour(device, view->format->dxgi_format, &colour)))
{
ERR("Unhandled format %#x.\n", view->format->dxgi_format);
return;
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 5d549e2..52de007 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -4839,11 +4839,11 @@ static void test_clear_unordered_access_view_buffer(void)
{0x100, 0, 0, 0}, 0, false, true},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0, 0, 0, 0}, 0, false, true},
+ {0, 0, 0, 0}, 0},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x7ff, 0x7ff, 0x3ff, 0}, 0xffffffff, false, true},
+ {0x7ff, 0x7ff, 0x3ff, 0}, 0xffffffff},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x7ff, 0, 0x3ff, 0}, 0xffc007ff, false, true},
+ {0x7ff, 0, 0x3ff, 0}, 0xffc007ff},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0x40000000 /* 2.0f */, 0}, 0x801e0380, true},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
@@ -5011,7 +5011,7 @@ static void test_clear_unordered_access_view_image(void)
{DXGI_FORMAT_R8G8B8A8_UINT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x04030201},
{DXGI_FORMAT_R8G8B8A8_UINT, 1, 1, 0, 0, 1, 0, {}, {0x123, 0, 0, 0}, 0x00000023, false, true},
{DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x04030201},
- {DXGI_FORMAT_R11G11B10_FLOAT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00c01001, false, true},
+ {DXGI_FORMAT_R11G11B10_FLOAT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00c01001},
/* Test float clears with formats. */
{DXGI_FORMAT_R16G16_UNORM, 1, 1, 0, 0, 1, 0, {},
{0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff8000, true},
--
2.11.0
1
0
[PATCH vkd3d 4/7] vkd3d: Re-implement d3d12_command_list_ClearUnorderedAccessViewUint().
by Henri Verbeet 25 Nov '19
by Henri Verbeet 25 Nov '19
25 Nov '19
From: Philip Rebohle <philip.rebohle(a)tu-dortmund.de>
Addresses the following limitations of the previous implementation:
- Only R32_{UINT,TYPELESS} were supported for buffers.
- Clearing an image UAV did not behave correctly for images with non-UINT formats.
- Due to the use of transfer operations, extra memory barriers were needed.
If necessary, this will create a temporary view with a bit-compatible
UINT format for the resource in order to perform a bit-exact clear.
Signed-off-by: Philip Rebohle <philip.rebohle(a)tu-dortmund.de>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patches 173346, 173347 and 173324.
libs/vkd3d/command.c | 116 ++++++++++++++++-----------------------------
libs/vkd3d/resource.c | 20 ++------
libs/vkd3d/utils.c | 31 ++++++++++++
libs/vkd3d/vkd3d_private.h | 19 ++++++++
tests/d3d12.c | 22 ++++-----
5 files changed, 104 insertions(+), 104 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index ade51ba..e3810e2 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -4984,96 +4984,60 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID
const UINT values[4], UINT rect_count, const D3D12_RECT *rects)
{
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList1(iface);
- const struct vkd3d_vk_device_procs *vk_procs;
- const struct vkd3d_vulkan_info *vk_info;
- const struct d3d12_desc *cpu_descriptor;
+ struct d3d12_device *device = list->device;
+ struct vkd3d_view *view, *uint_view = NULL;
+ struct vkd3d_texture_view_desc view_desc;
+ const struct vkd3d_format *uint_format;
struct d3d12_resource *resource_impl;
- VkBufferMemoryBarrier buffer_barrier;
- VkImageMemoryBarrier image_barrier;
- VkPipelineStageFlags stage_mask;
- VkImageSubresourceRange range;
- VkClearColorValue color;
+ VkClearColorValue colour;
TRACE("iface %p, gpu_handle %#"PRIx64", cpu_handle %lx, resource %p, values %p, rect_count %u, rects %p.\n",
iface, gpu_handle.ptr, cpu_handle.ptr, resource, values, rect_count, rects);
- vk_procs = &list->device->vk_procs;
- vk_info = &list->device->vk_info;
-
resource_impl = unsafe_impl_from_ID3D12Resource(resource);
+ view = d3d12_desc_from_cpu_handle(cpu_handle)->u.view;
+ memcpy(colour.uint32, values, sizeof(colour.uint32));
- d3d12_command_list_track_resource_usage(list, resource_impl);
-
- if (rect_count)
- {
- FIXME("Clear rects not supported.\n");
- return;
- }
-
- d3d12_command_list_end_current_render_pass(list);
-
- cpu_descriptor = d3d12_desc_from_cpu_handle(cpu_handle);
-
- if (d3d12_resource_is_buffer(resource_impl))
+ if (view->format->type != VKD3D_FORMAT_TYPE_UINT)
{
- if (cpu_descriptor->u.view->format->vk_format != VK_FORMAT_R32_UINT)
+ if (!(uint_format = vkd3d_find_uint_format(device, view->format->dxgi_format)))
{
- FIXME("Not supported for UAV descriptor %p.\n", cpu_descriptor);
+ ERR("Unhandled format %#x.\n", view->format->dxgi_format);
return;
}
- VK_CALL(vkCmdFillBuffer(list->vk_command_buffer, resource_impl->u.vk_buffer,
- cpu_descriptor->u.view->info.buffer.offset, cpu_descriptor->u.view->info.buffer.size, values[0]));
-
- buffer_barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
- buffer_barrier.pNext = NULL;
- buffer_barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
- buffer_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- buffer_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- buffer_barrier.buffer = resource_impl->u.vk_buffer;
- buffer_barrier.offset = cpu_descriptor->u.view->info.buffer.offset;
- buffer_barrier.size = cpu_descriptor->u.view->info.buffer.size;
-
- vk_barrier_parameters_from_d3d12_resource_state(D3D12_RESOURCE_STATE_UNORDERED_ACCESS, 0,
- resource_impl, list->vk_queue_flags, vk_info, &buffer_barrier.dstAccessMask, &stage_mask, NULL);
-
- VK_CALL(vkCmdPipelineBarrier(list->vk_command_buffer,
- VK_PIPELINE_STAGE_TRANSFER_BIT, stage_mask, 0,
- 0, NULL, 1, &buffer_barrier, 0, NULL));
+ if (d3d12_resource_is_buffer(resource_impl))
+ {
+ if (!vkd3d_create_buffer_view(device, resource_impl->u.vk_buffer, uint_format,
+ view->info.buffer.offset, view->info.buffer.size, &uint_view))
+ {
+ ERR("Failed to create buffer view.\n");
+ return;
+ }
+ }
+ else
+ {
+ memset(&view_desc, 0, sizeof(view_desc));
+ view_desc.view_type = view->info.texture.vk_view_type;
+ view_desc.format = uint_format;
+ view_desc.miplevel_idx = view->info.texture.miplevel_idx;
+ view_desc.miplevel_count = 1;
+ view_desc.layer_idx = view->info.texture.layer_idx;
+ view_desc.layer_count = view->info.texture.layer_count;
+
+ if (!vkd3d_create_texture_view(device, resource_impl->u.vk_image, &view_desc, &uint_view))
+ {
+ ERR("Failed to create image view.\n");
+ return;
+ }
+ }
+ view = uint_view;
}
- else
- {
- color.uint32[0] = values[0];
- color.uint32[1] = values[1];
- color.uint32[2] = values[2];
- color.uint32[3] = values[3];
-
- range.aspectMask = cpu_descriptor->u.view->format->vk_aspect_mask;
- range.baseMipLevel = cpu_descriptor->u.view->info.texture.miplevel_idx;
- range.levelCount = 1;
- range.baseArrayLayer = cpu_descriptor->u.view->info.texture.layer_idx;
- range.layerCount = cpu_descriptor->u.view->info.texture.layer_count;
-
- VK_CALL(vkCmdClearColorImage(list->vk_command_buffer,
- resource_impl->u.vk_image, VK_IMAGE_LAYOUT_GENERAL, &color, 1, &range));
-
- image_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_barrier.pNext = NULL;
- image_barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
- image_barrier.oldLayout = VK_IMAGE_LAYOUT_GENERAL;
- image_barrier.newLayout = VK_IMAGE_LAYOUT_GENERAL;
- image_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- image_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
- image_barrier.image = resource_impl->u.vk_image;
- image_barrier.subresourceRange = range;
-
- vk_barrier_parameters_from_d3d12_resource_state(D3D12_RESOURCE_STATE_UNORDERED_ACCESS, 0,
- resource_impl, list->vk_queue_flags, vk_info, &image_barrier.dstAccessMask, &stage_mask, NULL);
- VK_CALL(vkCmdPipelineBarrier(list->vk_command_buffer,
- VK_PIPELINE_STAGE_TRANSFER_BIT, stage_mask, 0,
- 0, NULL, 0, NULL, 1, &image_barrier));
- }
+ d3d12_command_list_clear_uav(list, resource_impl, view, &colour, rect_count, rects);
+
+ if (uint_view)
+ vkd3d_view_decref(uint_view, device);
}
static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewFloat(ID3D12GraphicsCommandList1 *iface,
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c
index 7d22ba4..89733ce 100644
--- a/libs/vkd3d/resource.c
+++ b/libs/vkd3d/resource.c
@@ -2150,8 +2150,7 @@ static bool vkd3d_create_vk_buffer_view(struct d3d12_device *device,
return vr == VK_SUCCESS;
}
-static bool vkd3d_create_buffer_view(struct d3d12_device *device,
- VkBuffer vk_buffer, const struct vkd3d_format *format,
+bool vkd3d_create_buffer_view(struct d3d12_device *device, VkBuffer vk_buffer, const struct vkd3d_format *format,
VkDeviceSize offset, VkDeviceSize size, struct vkd3d_view **view)
{
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
@@ -2350,18 +2349,6 @@ static void vk_component_mapping_compose(VkComponentMapping *dst, const VkCompon
dst->a = swizzle_vk_component(&a, a.a, b->a);
}
-struct vkd3d_texture_view_desc
-{
- VkImageViewType view_type;
- const struct vkd3d_format *format;
- unsigned int miplevel_idx;
- unsigned int miplevel_count;
- unsigned int layer_idx;
- unsigned int layer_count;
- VkComponentMapping components;
- bool allowed_swizzle;
-};
-
static bool init_default_texture_view_desc(struct vkd3d_texture_view_desc *desc,
struct d3d12_resource *resource, DXGI_FORMAT view_format)
{
@@ -2409,9 +2396,8 @@ static bool init_default_texture_view_desc(struct vkd3d_texture_view_desc *desc,
return true;
}
-static bool vkd3d_create_texture_view(struct d3d12_device *device,
- VkImage vk_image, const struct vkd3d_texture_view_desc *desc,
- struct vkd3d_view **view)
+bool vkd3d_create_texture_view(struct d3d12_device *device, VkImage vk_image,
+ const struct vkd3d_texture_view_desc *desc, struct vkd3d_view **view)
{
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
const struct vkd3d_format *format = desc->format;
diff --git a/libs/vkd3d/utils.c b/libs/vkd3d/utils.c
index cf0448d..7abfd42 100644
--- a/libs/vkd3d/utils.c
+++ b/libs/vkd3d/utils.c
@@ -451,6 +451,37 @@ const struct vkd3d_format *vkd3d_get_format(const struct d3d12_device *device,
return NULL;
}
+const struct vkd3d_format *vkd3d_find_uint_format(const struct d3d12_device *device, DXGI_FORMAT dxgi_format)
+{
+ DXGI_FORMAT typeless_format = DXGI_FORMAT_UNKNOWN;
+ const struct vkd3d_format *vkd3d_format;
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(vkd3d_format_compatibility_info); ++i)
+ {
+ if (vkd3d_format_compatibility_info[i].format == dxgi_format)
+ {
+ typeless_format = vkd3d_format_compatibility_info[i].typeless_format;
+ break;
+ }
+ }
+
+ if (!typeless_format)
+ return NULL;
+
+ for (i = 0; i < ARRAY_SIZE(vkd3d_format_compatibility_info); ++i)
+ {
+ if (vkd3d_format_compatibility_info[i].typeless_format != typeless_format)
+ continue;
+
+ vkd3d_format = vkd3d_get_format(device, vkd3d_format_compatibility_info[i].format, false);
+ if (vkd3d_format->type == VKD3D_FORMAT_TYPE_UINT)
+ return vkd3d_format;
+ }
+
+ return NULL;
+}
+
void vkd3d_format_copy_data(const struct vkd3d_format *format, const uint8_t *src,
unsigned int src_row_pitch, unsigned int src_slice_pitch, uint8_t *dst, unsigned int dst_row_pitch,
unsigned int dst_slice_pitch, unsigned int w, unsigned int h, unsigned int d)
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index 933c7c4..df8d1a1 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -497,6 +497,23 @@ struct vkd3d_view
void vkd3d_view_decref(struct vkd3d_view *view, struct d3d12_device *device) DECLSPEC_HIDDEN;
void vkd3d_view_incref(struct vkd3d_view *view) DECLSPEC_HIDDEN;
+struct vkd3d_texture_view_desc
+{
+ VkImageViewType view_type;
+ const struct vkd3d_format *format;
+ unsigned int miplevel_idx;
+ unsigned int miplevel_count;
+ unsigned int layer_idx;
+ unsigned int layer_count;
+ VkComponentMapping components;
+ bool allowed_swizzle;
+};
+
+bool vkd3d_create_buffer_view(struct d3d12_device *device, VkBuffer vk_buffer, const struct vkd3d_format *format,
+ VkDeviceSize offset, VkDeviceSize size, struct vkd3d_view **view) DECLSPEC_HIDDEN;
+bool vkd3d_create_texture_view(struct d3d12_device *device, VkImage vk_image,
+ const struct vkd3d_texture_view_desc *desc, struct vkd3d_view **view) DECLSPEC_HIDDEN;
+
struct d3d12_desc
{
uint32_t magic;
@@ -1225,6 +1242,8 @@ void vkd3d_format_copy_data(const struct vkd3d_format *format, const uint8_t *sr
const struct vkd3d_format *vkd3d_get_format(const struct d3d12_device *device,
DXGI_FORMAT dxgi_format, bool depth_stencil) DECLSPEC_HIDDEN;
+const struct vkd3d_format *vkd3d_find_uint_format(const struct d3d12_device *device,
+ DXGI_FORMAT dxgi_format) DECLSPEC_HIDDEN;
HRESULT vkd3d_init_format_info(struct d3d12_device *device) DECLSPEC_HIDDEN;
void vkd3d_cleanup_format_info(struct d3d12_device *device) DECLSPEC_HIDDEN;
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 3b5264f..5d549e2 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -4808,19 +4808,19 @@ static void test_clear_unordered_access_view_buffer(void)
{11, 0, 0, 0}, 11},
{DXGI_FORMAT_R32_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0, 0, 0, 0}, 0, false, true},
+ {0, 0, 0, 0}, 0},
{DXGI_FORMAT_R32_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {1, 0, 0, 0}, 1, false, true},
+ {1, 0, 0, 0}, 1},
{DXGI_FORMAT_R32_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x3f800000 /* 1.0f */, 0, 0, 0}, 0x3f800000 /* 1.0f */, true},
{DXGI_FORMAT_R16G16_UINT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x1234, 0xabcd, 0, 0}, 0xabcd1234, false, true},
+ {0x1234, 0xabcd, 0, 0}, 0xabcd1234},
{DXGI_FORMAT_R16G16_UINT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x10000, 0, 0, 0}, 0, false, true},
{DXGI_FORMAT_R16G16_UNORM, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x1234, 0xabcd, 0, 0}, 0xabcd1234, false, true},
+ {0x1234, 0xabcd, 0, 0}, 0xabcd1234},
{DXGI_FORMAT_R16G16_UNORM, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff8000, true},
{DXGI_FORMAT_R16G16_UNORM, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
@@ -4829,12 +4829,12 @@ static void test_clear_unordered_access_view_buffer(void)
{0xbf800000 /* -1.0f */, 0 /* 0.0f */, 0x3f000000 /* 1.0f */, 0x3f000000 /* 1.0f */}, 0, true},
{DXGI_FORMAT_R16G16_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x1234, 0xabcd, 0, 0}, 0xabcd1234, false, true},
+ {0x1234, 0xabcd, 0, 0}, 0xabcd1234},
{DXGI_FORMAT_R16G16_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0x3c003800, true},
{DXGI_FORMAT_R8G8B8A8_UINT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x11, 0x22, 0x33, 0x44}, 0x44332211, false, true},
+ {0x11, 0x22, 0x33, 0x44}, 0x44332211},
{DXGI_FORMAT_R8G8B8A8_UINT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x100, 0, 0, 0}, 0, false, true},
@@ -4995,22 +4995,22 @@ static void test_clear_unordered_access_view_image(void)
{0x3f000000, 0, 0, 0}, 0x3f000000, true},
/* Test a single clear rect. */
{DXGI_FORMAT_R32_FLOAT, 1, 1, 0, 0, 1, 1, {{1, 2, IMAGE_SIZE - 4, IMAGE_SIZE - 2}},
- {1, 0, 0, 0}, 1, false, true},
+ {1, 0, 0, 0}, 1},
{DXGI_FORMAT_R32_FLOAT, 1, 1, 0, 0, 1, 1, {{1, 2, IMAGE_SIZE - 4, IMAGE_SIZE - 2}},
{0x3f000000, 0, 0, 0}, 0x3f000000, true},
/* Test multiple clear rects. */
{DXGI_FORMAT_R32_FLOAT, 1, 1, 0, 0, 1, 2, {{1, 2, 3, 4}, {5, 6, 7, 8}},
- {1, 0, 0, 0}, 1, false, true},
+ {1, 0, 0, 0}, 1},
{DXGI_FORMAT_R32_FLOAT, 1, 1, 0, 0, 1, 2, {{1, 2, 3, 4}, {5, 6, 7, 8}},
{0x3f000000, 0, 0, 0}, 0x3f000000, true},
/* Test uint clears with formats. */
{DXGI_FORMAT_R16G16_UINT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00020001},
{DXGI_FORMAT_R16G16_UINT, 1, 1, 0, 0, 1, 0, {}, {0x12345, 0, 0, 0}, 0x00002345, false, true},
- {DXGI_FORMAT_R16G16_UNORM, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00020001, false, true},
- {DXGI_FORMAT_R16G16_FLOAT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00020001, false, true},
+ {DXGI_FORMAT_R16G16_UNORM, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00020001},
+ {DXGI_FORMAT_R16G16_FLOAT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00020001},
{DXGI_FORMAT_R8G8B8A8_UINT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x04030201},
{DXGI_FORMAT_R8G8B8A8_UINT, 1, 1, 0, 0, 1, 0, {}, {0x123, 0, 0, 0}, 0x00000023, false, true},
- {DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x04030201, false, true},
+ {DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x04030201},
{DXGI_FORMAT_R11G11B10_FLOAT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00c01001, false, true},
/* Test float clears with formats. */
{DXGI_FORMAT_R16G16_UNORM, 1, 1, 0, 0, 1, 0, {},
--
2.11.0
1
0
[PATCH vkd3d 3/7] vkd3d: Set VK_IMAGE_MUTABLE_FORMAT_BIT for UAV images with non-UINT formats.
by Henri Verbeet 25 Nov '19
by Henri Verbeet 25 Nov '19
25 Nov '19
From: Philip Rebohle <philip.rebohle(a)tu-dortmund.de>
Needed to support ClearUnorderedAccessViewUint() for all formats.
Signed-off-by: Philip Rebohle <philip.rebohle(a)tu-dortmund.de>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patch 173343.
libs/vkd3d/resource.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c
index 8615464..7d22ba4 100644
--- a/libs/vkd3d/resource.c
+++ b/libs/vkd3d/resource.c
@@ -864,13 +864,17 @@ static HRESULT vkd3d_create_image(struct d3d12_device *device,
image_info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
image_info.pNext = NULL;
image_info.flags = 0;
- if (!(desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) && format->type == VKD3D_FORMAT_TYPE_TYPELESS)
+ if (desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)
+ {
+ /* Format compatibility rules are more relaxed for UAVs. */
+ if (format->type != VKD3D_FORMAT_TYPE_UINT)
+ image_info.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
+ }
+ else if (!(desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) && format->type == VKD3D_FORMAT_TYPE_TYPELESS)
{
image_info.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
- /* Format compatibility rules are more relaxed for UAVs. */
- if (!(desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)
- && (compat_list = vkd3d_get_format_compatibility_list(device, desc->Format)))
+ if ((compat_list = vkd3d_get_format_compatibility_list(device, desc->Format)))
{
format_list.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR;
format_list.pNext = NULL;
--
2.11.0
1
0
[PATCH vkd3d 2/7] vkd3d: Implement d3d12_command_list_ClearUnorderedAccessViewFloat().
by Henri Verbeet 25 Nov '19
by Henri Verbeet 25 Nov '19
25 Nov '19
From: Philip Rebohle <philip.rebohle(a)tu-dortmund.de>
Signed-off-by: Philip Rebohle <philip.rebohle(a)tu-dortmund.de>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patches 173323 and 173350.
Makefile.am | 1 +
libs/vkd3d/command.c | 184 ++++++++++++++++++++-
libs/vkd3d/device.c | 6 +
libs/vkd3d/state.c | 222 +++++++++++++++++++++++---
libs/vkd3d/vkd3d_private.h | 38 +++++
libs/vkd3d/vkd3d_shaders.h | 388 +++++++++++++++++++++++++++++++++++++++++++++
tests/d3d12.c | 48 +++---
7 files changed, 836 insertions(+), 51 deletions(-)
create mode 100644 libs/vkd3d/vkd3d_shaders.h
diff --git a/Makefile.am b/Makefile.am
index 2b0e8f3..00a5f58 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -108,6 +108,7 @@ libvkd3d_la_SOURCES = \
libs/vkd3d/vkd3d.map \
libs/vkd3d/vkd3d_main.c \
libs/vkd3d/vkd3d_private.h \
+ libs/vkd3d/vkd3d_shaders.h \
libs/vkd3d/vulkan_procs.h \
libs/vkd3d_version.c
libvkd3d_la_LDFLAGS = $(AM_LDFLAGS) -version-info 2:0:1
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index 297054b..ade51ba 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -4803,6 +4803,182 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearRenderTargetView(ID3D12Gra
&clear_value, rect_count, rects);
}
+struct vkd3d_uav_clear_pipeline
+{
+ VkDescriptorSetLayout vk_set_layout;
+ VkPipelineLayout vk_pipeline_layout;
+ VkPipeline vk_pipeline;
+ VkExtent3D group_size;
+};
+
+static void vkd3d_uav_clear_state_get_buffer_pipeline(const struct vkd3d_uav_clear_state *state,
+ enum vkd3d_format_type format_type, struct vkd3d_uav_clear_pipeline *info)
+{
+ const struct vkd3d_uav_clear_pipelines *pipelines;
+
+ pipelines = format_type == VKD3D_FORMAT_TYPE_UINT ? &state->pipelines_uint : &state->pipelines_float;
+ info->vk_set_layout = state->vk_set_layout_buffer;
+ info->vk_pipeline_layout = state->vk_pipeline_layout_buffer;
+ info->vk_pipeline = pipelines->buffer;
+ info->group_size = (VkExtent3D){128, 1, 1};
+}
+
+static void vkd3d_uav_clear_state_get_image_pipeline(const struct vkd3d_uav_clear_state *state,
+ VkImageViewType image_view_type, enum vkd3d_format_type format_type, struct vkd3d_uav_clear_pipeline *info)
+{
+ const struct vkd3d_uav_clear_pipelines *pipelines;
+
+ pipelines = format_type == VKD3D_FORMAT_TYPE_UINT ? &state->pipelines_uint : &state->pipelines_float;
+ info->vk_set_layout = state->vk_set_layout_image;
+ info->vk_pipeline_layout = state->vk_pipeline_layout_image;
+
+ switch (image_view_type)
+ {
+ case VK_IMAGE_VIEW_TYPE_1D:
+ info->vk_pipeline = pipelines->image_1d;
+ info->group_size = (VkExtent3D){64, 1, 1};
+ break;
+
+ case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
+ info->vk_pipeline = pipelines->image_1d_array;
+ info->group_size = (VkExtent3D){64, 1, 1};
+ break;
+
+ case VK_IMAGE_VIEW_TYPE_2D:
+ info->vk_pipeline = pipelines->image_2d;
+ info->group_size = (VkExtent3D){8, 8, 1};
+ break;
+
+ case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
+ info->vk_pipeline = pipelines->image_2d_array;
+ info->group_size = (VkExtent3D){8, 8, 1};
+ break;
+
+ case VK_IMAGE_VIEW_TYPE_3D:
+ info->vk_pipeline = pipelines->image_3d;
+ info->group_size = (VkExtent3D){8, 8, 1};
+ break;
+
+ default:
+ ERR("Unhandled view type %#x.\n", image_view_type);
+ info->vk_pipeline = VK_NULL_HANDLE;
+ info->group_size = (VkExtent3D){0, 0, 0};
+ break;
+ }
+}
+
+static void d3d12_command_list_clear_uav(struct d3d12_command_list *list,
+ struct d3d12_resource *resource, struct vkd3d_view *view, const VkClearColorValue *clear_colour,
+ unsigned int rect_count, const D3D12_RECT *rects)
+{
+ const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
+ unsigned int i, miplevel_idx, layer_count;
+ struct vkd3d_uav_clear_pipeline pipeline;
+ struct vkd3d_uav_clear_args clear_args;
+ VkDescriptorImageInfo image_info;
+ D3D12_RECT full_rect, curr_rect;
+ VkWriteDescriptorSet write_set;
+
+ d3d12_command_list_track_resource_usage(list, resource);
+ d3d12_command_list_end_current_render_pass(list);
+
+ d3d12_command_list_invalidate_current_pipeline(list);
+ d3d12_command_list_invalidate_bindings(list, list->state);
+ d3d12_command_list_invalidate_root_parameters(list, VK_PIPELINE_BIND_POINT_COMPUTE);
+
+ if (!d3d12_command_allocator_add_view(list->allocator, view))
+ WARN("Failed to add view.\n");
+
+ clear_args.colour = *clear_colour;
+
+ write_set.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
+ write_set.pNext = NULL;
+ write_set.dstBinding = 0;
+ write_set.dstArrayElement = 0;
+ write_set.descriptorCount = 1;
+
+ if (d3d12_resource_is_buffer(resource))
+ {
+ write_set.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
+ write_set.pImageInfo = NULL;
+ write_set.pBufferInfo = NULL;
+ write_set.pTexelBufferView = &view->u.vk_buffer_view;
+
+ miplevel_idx = 0;
+ layer_count = 1;
+ vkd3d_uav_clear_state_get_buffer_pipeline(&list->device->uav_clear_state,
+ view->format->type, &pipeline);
+ }
+ else
+ {
+ image_info.sampler = VK_NULL_HANDLE;
+ image_info.imageView = view->u.vk_image_view;
+ image_info.imageLayout = VK_IMAGE_LAYOUT_GENERAL;
+
+ write_set.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
+ write_set.pImageInfo = &image_info;
+ write_set.pBufferInfo = NULL;
+ write_set.pTexelBufferView = NULL;
+
+ miplevel_idx = view->info.texture.miplevel_idx;
+ layer_count = view->info.texture.vk_view_type == VK_IMAGE_VIEW_TYPE_3D
+ ? d3d12_resource_desc_get_depth(&resource->desc, miplevel_idx)
+ : view->info.texture.layer_count;
+ vkd3d_uav_clear_state_get_image_pipeline(&list->device->uav_clear_state,
+ view->info.texture.vk_view_type, view->format->type, &pipeline);
+ }
+
+ if (!(write_set.dstSet = d3d12_command_allocator_allocate_descriptor_set(
+ list->allocator, pipeline.vk_set_layout)))
+ {
+ ERR("Failed to allocate descriptor set.\n");
+ return;
+ }
+
+ VK_CALL(vkUpdateDescriptorSets(list->device->vk_device, 1, &write_set, 0, NULL));
+
+ full_rect.left = 0;
+ full_rect.right = d3d12_resource_desc_get_width(&resource->desc, miplevel_idx);
+ full_rect.top = 0;
+ full_rect.bottom = d3d12_resource_desc_get_height(&resource->desc, miplevel_idx);
+
+ if (!rect_count)
+ {
+ rects = &full_rect;
+ rect_count = 1;
+ }
+
+ VK_CALL(vkCmdBindPipeline(list->vk_command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline.vk_pipeline));
+
+ VK_CALL(vkCmdBindDescriptorSets(list->vk_command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE,
+ pipeline.vk_pipeline_layout, 0, 1, &write_set.dstSet, 0, NULL));
+
+ for (i = 0; i < rect_count; ++i)
+ {
+ /* Clamp to the actual resource region and skip empty rectangles. */
+ curr_rect.left = max(rects[i].left, full_rect.left);
+ curr_rect.top = max(rects[i].top, full_rect.top);
+ curr_rect.right = min(rects[i].right, full_rect.right);
+ curr_rect.bottom = min(rects[i].bottom, full_rect.bottom);
+
+ if (curr_rect.left >= curr_rect.right || curr_rect.top >= curr_rect.bottom)
+ continue;
+
+ clear_args.offset.x = curr_rect.left;
+ clear_args.offset.y = curr_rect.top;
+ clear_args.extent.width = curr_rect.right - curr_rect.left;
+ clear_args.extent.height = curr_rect.bottom - curr_rect.top;
+
+ VK_CALL(vkCmdPushConstants(list->vk_command_buffer, pipeline.vk_pipeline_layout,
+ VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(clear_args), &clear_args));
+
+ VK_CALL(vkCmdDispatch(list->vk_command_buffer,
+ vkd3d_compute_workgroup_count(clear_args.extent.width, pipeline.group_size.width),
+ vkd3d_compute_workgroup_count(clear_args.extent.height, pipeline.group_size.height),
+ vkd3d_compute_workgroup_count(layer_count, pipeline.group_size.depth)));
+ }
+}
+
static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewUint(ID3D12GraphicsCommandList1 *iface,
D3D12_GPU_DESCRIPTOR_HANDLE gpu_handle, D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle, ID3D12Resource *resource,
const UINT values[4], UINT rect_count, const D3D12_RECT *rects)
@@ -4906,13 +5082,17 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearUnorderedAccessViewFloat(I
{
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList1(iface);
struct d3d12_resource *resource_impl;
+ VkClearColorValue colour;
+ struct vkd3d_view *view;
- FIXME("iface %p, gpu_handle %#"PRIx64", cpu_handle %lx, resource %p, values %p, rect_count %u, rects %p stub!\n",
+ TRACE("iface %p, gpu_handle %#"PRIx64", cpu_handle %lx, resource %p, values %p, rect_count %u, rects %p.\n",
iface, gpu_handle.ptr, cpu_handle.ptr, resource, values, rect_count, rects);
resource_impl = unsafe_impl_from_ID3D12Resource(resource);
+ view = d3d12_desc_from_cpu_handle(cpu_handle)->u.view;
+ memcpy(colour.float32, values, sizeof(colour.float32));
- d3d12_command_list_track_resource_usage(list, resource_impl);
+ d3d12_command_list_clear_uav(list, resource_impl, view, &colour, rect_count, rects);
}
static void STDMETHODCALLTYPE d3d12_command_list_DiscardResource(ID3D12GraphicsCommandList1 *iface,
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c
index 0624318..59859ad 100644
--- a/libs/vkd3d/device.c
+++ b/libs/vkd3d/device.c
@@ -2154,6 +2154,7 @@ static ULONG STDMETHODCALLTYPE d3d12_device_Release(ID3D12Device *iface)
vkd3d_private_store_destroy(&device->private_store);
vkd3d_cleanup_format_info(device);
+ vkd3d_uav_clear_state_cleanup(&device->uav_clear_state, device);
vkd3d_destroy_null_resources(&device->null_resources, device);
vkd3d_gpu_va_allocator_cleanup(&device->gpu_va_allocator);
vkd3d_render_pass_cache_cleanup(&device->render_pass_cache, device);
@@ -3447,6 +3448,9 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
if (FAILED(hr = vkd3d_init_null_resources(&device->null_resources, device)))
goto out_cleanup_format_info;
+ if (FAILED(hr = vkd3d_uav_clear_state_init(&device->uav_clear_state, device)))
+ goto out_destroy_null_resources;
+
vkd3d_render_pass_cache_init(&device->render_pass_cache);
vkd3d_gpu_va_allocator_init(&device->gpu_va_allocator);
@@ -3458,6 +3462,8 @@ static HRESULT d3d12_device_init(struct d3d12_device *device,
return S_OK;
+out_destroy_null_resources:
+ vkd3d_destroy_null_resources(&device->null_resources, device);
out_cleanup_format_info:
vkd3d_cleanup_format_info(device);
out_stop_fence_worker:
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index a321fa4..e1f7da9 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -18,6 +18,7 @@
*/
#include "vkd3d_private.h"
+#include "vkd3d_shaders.h"
/* ID3D12RootSignature */
static inline struct d3d12_root_signature *impl_from_ID3D12RootSignature(ID3D12RootSignature *iface)
@@ -1384,6 +1385,37 @@ static HRESULT create_shader_stage(struct d3d12_device *device,
return S_OK;
}
+static HRESULT vkd3d_create_compute_pipeline(struct d3d12_device *device,
+ const D3D12_SHADER_BYTECODE *code, const struct vkd3d_shader_interface_info *shader_interface,
+ VkPipelineLayout vk_pipeline_layout, VkPipeline *vk_pipeline)
+{
+ const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
+ VkComputePipelineCreateInfo pipeline_info;
+ VkResult vr;
+ HRESULT hr;
+
+ pipeline_info.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
+ pipeline_info.pNext = NULL;
+ pipeline_info.flags = 0;
+ if (FAILED(hr = create_shader_stage(device, &pipeline_info.stage,
+ VK_SHADER_STAGE_COMPUTE_BIT, code, shader_interface, NULL)))
+ return hr;
+ pipeline_info.layout = vk_pipeline_layout;
+ pipeline_info.basePipelineHandle = VK_NULL_HANDLE;
+ pipeline_info.basePipelineIndex = -1;
+
+ vr = VK_CALL(vkCreateComputePipelines(device->vk_device,
+ VK_NULL_HANDLE, 1, &pipeline_info, NULL, vk_pipeline));
+ VK_CALL(vkDestroyShaderModule(device->vk_device, pipeline_info.stage.module, NULL));
+ if (vr < 0)
+ {
+ WARN("Failed to create Vulkan compute pipeline, hr %#x.", hr);
+ return hresult_from_vk_result(vr);
+ }
+
+ return S_OK;
+}
+
static HRESULT d3d12_pipeline_state_init_compute_uav_counters(struct d3d12_pipeline_state *state,
struct d3d12_device *device, const struct d3d12_root_signature *root_signature,
const struct vkd3d_shader_scan_info *shader_info)
@@ -1470,10 +1502,9 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
struct vkd3d_shader_interface_info shader_interface;
const struct d3d12_root_signature *root_signature;
- VkComputePipelineCreateInfo pipeline_info;
struct vkd3d_shader_scan_info shader_info;
+ VkPipelineLayout vk_pipeline_layout;
struct vkd3d_shader_code dxbc;
- VkResult vr;
HRESULT hr;
int ret;
@@ -1519,36 +1550,18 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
shader_interface.uav_counters = state->uav_counters;
shader_interface.uav_counter_count = vkd3d_popcount(state->uav_counter_mask);
- pipeline_info.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
- pipeline_info.pNext = NULL;
- pipeline_info.flags = 0;
- if (FAILED(hr = create_shader_stage(device, &pipeline_info.stage,
- VK_SHADER_STAGE_COMPUTE_BIT, &desc->CS, &shader_interface, NULL)))
- {
- if (state->vk_set_layout)
- VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, state->vk_set_layout, NULL));
- if (state->vk_pipeline_layout)
- VK_CALL(vkDestroyPipelineLayout(device->vk_device, state->vk_pipeline_layout, NULL));
- vkd3d_free(state->uav_counters);
- return hr;
- }
- pipeline_info.layout = state->vk_pipeline_layout
+ vk_pipeline_layout = state->vk_pipeline_layout
? state->vk_pipeline_layout : root_signature->vk_pipeline_layout;
- pipeline_info.basePipelineHandle = VK_NULL_HANDLE;
- pipeline_info.basePipelineIndex = -1;
-
- vr = VK_CALL(vkCreateComputePipelines(device->vk_device, VK_NULL_HANDLE,
- 1, &pipeline_info, NULL, &state->u.compute.vk_pipeline));
- VK_CALL(vkDestroyShaderModule(device->vk_device, pipeline_info.stage.module, NULL));
- if (vr)
+ if (FAILED(hr = vkd3d_create_compute_pipeline(device, &desc->CS, &shader_interface,
+ vk_pipeline_layout, &state->u.compute.vk_pipeline)))
{
- WARN("Failed to create Vulkan compute pipeline, vr %d.\n", vr);
+ WARN("Failed to create Vulkan compute pipeline, hr %#x.\n", hr);
if (state->vk_set_layout)
VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, state->vk_set_layout, NULL));
if (state->vk_pipeline_layout)
VK_CALL(vkDestroyPipelineLayout(device->vk_device, state->vk_pipeline_layout, NULL));
vkd3d_free(state->uav_counters);
- return hresult_from_vk_result(vr);
+ return hr;
}
if (FAILED(hr = vkd3d_private_store_init(&state->private_store)))
@@ -2802,3 +2815,162 @@ VkPipeline d3d12_pipeline_state_get_or_create_pipeline(struct d3d12_pipeline_sta
ERR("Could not get the pipeline compiled by other thread from the cache.\n");
return vk_pipeline;
}
+
+static void vkd3d_uav_clear_pipelines_cleanup(struct vkd3d_uav_clear_pipelines *pipelines,
+ struct d3d12_device *device)
+{
+ const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
+
+ VK_CALL(vkDestroyPipeline(device->vk_device, pipelines->image_3d, NULL));
+ VK_CALL(vkDestroyPipeline(device->vk_device, pipelines->image_2d_array, NULL));
+ VK_CALL(vkDestroyPipeline(device->vk_device, pipelines->image_2d, NULL));
+ VK_CALL(vkDestroyPipeline(device->vk_device, pipelines->image_1d_array, NULL));
+ VK_CALL(vkDestroyPipeline(device->vk_device, pipelines->image_1d, NULL));
+ VK_CALL(vkDestroyPipeline(device->vk_device, pipelines->buffer, NULL));
+}
+
+void vkd3d_uav_clear_state_cleanup(struct vkd3d_uav_clear_state *state, struct d3d12_device *device)
+{
+ const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
+
+ vkd3d_uav_clear_pipelines_cleanup(&state->pipelines_uint, device);
+ vkd3d_uav_clear_pipelines_cleanup(&state->pipelines_float, device);
+
+ VK_CALL(vkDestroyPipelineLayout(device->vk_device, state->vk_pipeline_layout_image, NULL));
+ VK_CALL(vkDestroyPipelineLayout(device->vk_device, state->vk_pipeline_layout_buffer, NULL));
+
+ VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, state->vk_set_layout_image, NULL));
+ VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, state->vk_set_layout_buffer, NULL));
+}
+
+HRESULT vkd3d_uav_clear_state_init(struct vkd3d_uav_clear_state *state, struct d3d12_device *device)
+{
+ struct vkd3d_shader_push_constant_buffer push_constant;
+ struct vkd3d_shader_interface_info shader_interface;
+ struct vkd3d_shader_resource_binding binding;
+ VkDescriptorSetLayoutBinding set_binding;
+ VkPushConstantRange push_constant_range;
+ unsigned int i;
+ HRESULT hr;
+
+ const struct
+ {
+ VkDescriptorSetLayout *set_layout;
+ VkPipelineLayout *pipeline_layout;
+ VkDescriptorType descriptor_type;
+ }
+ set_layouts[] =
+ {
+ {&state->vk_set_layout_buffer, &state->vk_pipeline_layout_buffer, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER},
+ {&state->vk_set_layout_image, &state->vk_pipeline_layout_image, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE},
+ };
+
+ const struct
+ {
+ VkPipeline *pipeline;
+ VkPipelineLayout *pipeline_layout;
+ D3D12_SHADER_BYTECODE code;
+ }
+ pipelines[] =
+ {
+#define SHADER_CODE(name) {name, sizeof(name)}
+ {&state->pipelines_float.buffer, &state->vk_pipeline_layout_buffer,
+ SHADER_CODE(cs_uav_clear_buffer_float_code)},
+ {&state->pipelines_float.image_1d, &state->vk_pipeline_layout_image,
+ SHADER_CODE(cs_uav_clear_1d_float_code)},
+ {&state->pipelines_float.image_1d_array, &state->vk_pipeline_layout_image,
+ SHADER_CODE(cs_uav_clear_1d_array_float_code)},
+ {&state->pipelines_float.image_2d, &state->vk_pipeline_layout_image,
+ SHADER_CODE(cs_uav_clear_2d_float_code)},
+ {&state->pipelines_float.image_2d_array, &state->vk_pipeline_layout_image,
+ SHADER_CODE(cs_uav_clear_2d_array_float_code)},
+ {&state->pipelines_float.image_3d, &state->vk_pipeline_layout_image,
+ SHADER_CODE(cs_uav_clear_3d_float_code)},
+
+ {&state->pipelines_uint.buffer, &state->vk_pipeline_layout_buffer,
+ SHADER_CODE(cs_uav_clear_buffer_uint_code)},
+ {&state->pipelines_uint.image_1d, &state->vk_pipeline_layout_image,
+ SHADER_CODE(cs_uav_clear_1d_uint_code)},
+ {&state->pipelines_uint.image_1d_array, &state->vk_pipeline_layout_image,
+ SHADER_CODE(cs_uav_clear_1d_array_uint_code)},
+ {&state->pipelines_uint.image_2d, &state->vk_pipeline_layout_image,
+ SHADER_CODE(cs_uav_clear_2d_uint_code)},
+ {&state->pipelines_uint.image_2d_array, &state->vk_pipeline_layout_image,
+ SHADER_CODE(cs_uav_clear_2d_array_uint_code)},
+ {&state->pipelines_uint.image_3d, &state->vk_pipeline_layout_image,
+ SHADER_CODE(cs_uav_clear_3d_uint_code)},
+#undef SHADER_CODE
+ };
+
+ memset(state, 0, sizeof(*state));
+
+ set_binding.binding = 0;
+ set_binding.descriptorCount = 1;
+ set_binding.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT;
+ set_binding.pImmutableSamplers = NULL;
+
+ binding.type = VKD3D_SHADER_DESCRIPTOR_TYPE_UAV;
+ binding.register_index = 0;
+ binding.shader_visibility = VKD3D_SHADER_VISIBILITY_COMPUTE;
+ binding.binding.set = 0;
+ binding.binding.binding = 0;
+
+ push_constant_range.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT;
+ push_constant_range.offset = 0;
+ push_constant_range.size = sizeof(struct vkd3d_uav_clear_args);
+
+ push_constant.register_index = 0;
+ push_constant.shader_visibility = VKD3D_SHADER_VISIBILITY_COMPUTE;
+ push_constant.offset = 0;
+ push_constant.size = sizeof(struct vkd3d_uav_clear_args);
+
+ for (i = 0; i < ARRAY_SIZE(set_layouts); ++i)
+ {
+ set_binding.descriptorType = set_layouts[i].descriptor_type;
+
+ if (FAILED(hr = vkd3d_create_descriptor_set_layout(device, 0, 1, &set_binding, set_layouts[i].set_layout)))
+ {
+ ERR("Failed to create descriptor set layout %u, hr %#x.", i, hr);
+ goto fail;
+ }
+
+ if (FAILED(hr = vkd3d_create_pipeline_layout(device, 1, set_layouts[i].set_layout,
+ 1, &push_constant_range, set_layouts[i].pipeline_layout)))
+ {
+ ERR("Failed to create pipeline layout %u, hr %#x.", i, hr);
+ goto fail;
+ }
+ }
+
+ shader_interface.type = VKD3D_SHADER_STRUCTURE_TYPE_SHADER_INTERFACE_INFO;
+ shader_interface.next = NULL;
+ shader_interface.bindings = &binding;
+ shader_interface.binding_count = 1;
+ shader_interface.push_constant_buffers = &push_constant;
+ shader_interface.push_constant_buffer_count = 1;
+ shader_interface.combined_samplers = NULL;
+ shader_interface.combined_sampler_count = 0;
+ shader_interface.uav_counters = NULL;
+ shader_interface.uav_counter_count = 0;
+
+ for (i = 0; i < ARRAY_SIZE(pipelines); ++i)
+ {
+ if (pipelines[i].pipeline_layout == &state->vk_pipeline_layout_buffer)
+ binding.flags = VKD3D_SHADER_BINDING_FLAG_BUFFER;
+ else
+ binding.flags = VKD3D_SHADER_BINDING_FLAG_IMAGE;
+
+ if (FAILED(hr = vkd3d_create_compute_pipeline(device, &pipelines[i].code, &shader_interface,
+ *pipelines[i].pipeline_layout, pipelines[i].pipeline)))
+ {
+ ERR("Failed to create compute pipeline %u, hr %#x.", i, hr);
+ goto fail;
+ }
+ }
+
+ return S_OK;
+
+fail:
+ vkd3d_uav_clear_state_cleanup(state, device);
+ return hr;
+}
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index c6bfe96..933c7c4 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -1059,6 +1059,38 @@ struct vkd3d_format_compatibility_list
VkFormat vk_formats[VKD3D_MAX_COMPATIBLE_FORMAT_COUNT];
};
+struct vkd3d_uav_clear_args
+{
+ VkClearColorValue colour;
+ VkOffset2D offset;
+ VkExtent2D extent;
+};
+
+struct vkd3d_uav_clear_pipelines
+{
+ VkPipeline buffer;
+ VkPipeline image_1d;
+ VkPipeline image_1d_array;
+ VkPipeline image_2d;
+ VkPipeline image_2d_array;
+ VkPipeline image_3d;
+};
+
+struct vkd3d_uav_clear_state
+{
+ VkDescriptorSetLayout vk_set_layout_buffer;
+ VkDescriptorSetLayout vk_set_layout_image;
+
+ VkPipelineLayout vk_pipeline_layout_buffer;
+ VkPipelineLayout vk_pipeline_layout_image;
+
+ struct vkd3d_uav_clear_pipelines pipelines_float;
+ struct vkd3d_uav_clear_pipelines pipelines_uint;
+};
+
+HRESULT vkd3d_uav_clear_state_init(struct vkd3d_uav_clear_state *state, struct d3d12_device *device) DECLSPEC_HIDDEN;
+void vkd3d_uav_clear_state_cleanup(struct vkd3d_uav_clear_state *state, struct d3d12_device *device) DECLSPEC_HIDDEN;
+
/* ID3D12Device */
struct d3d12_device
{
@@ -1104,6 +1136,7 @@ struct d3d12_device
unsigned int format_compatibility_list_count;
const struct vkd3d_format_compatibility_list *format_compatibility_lists;
struct vkd3d_null_resources null_resources;
+ struct vkd3d_uav_clear_state uav_clear_state;
};
HRESULT d3d12_device_create(struct vkd3d_instance *instance,
@@ -1237,6 +1270,11 @@ static inline unsigned int d3d12_resource_desc_get_sub_resource_count(const D3D1
return d3d12_resource_desc_get_layer_count(desc) * desc->MipLevels;
}
+static inline unsigned int vkd3d_compute_workgroup_count(unsigned int thread_count, unsigned int workgroup_size)
+{
+ return (thread_count + workgroup_size - 1) / workgroup_size;
+}
+
VkCompareOp vk_compare_op_from_d3d12(D3D12_COMPARISON_FUNC op) DECLSPEC_HIDDEN;
VkSampleCountFlagBits vk_samples_from_dxgi_sample_desc(const DXGI_SAMPLE_DESC *desc) DECLSPEC_HIDDEN;
VkSampleCountFlagBits vk_samples_from_sample_count(unsigned int sample_count) DECLSPEC_HIDDEN;
diff --git a/libs/vkd3d/vkd3d_shaders.h b/libs/vkd3d/vkd3d_shaders.h
new file mode 100644
index 0000000..b2a90cd
--- /dev/null
+++ b/libs/vkd3d/vkd3d_shaders.h
@@ -0,0 +1,388 @@
+/*
+ * Copyright 2019 Philip Rebohle
+ *
+ * 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
+ */
+
+#ifndef __VKD3D_SHADERS_H
+#define __VKD3D_SHADERS_H
+
+static const uint32_t cs_uav_clear_buffer_float_code[] =
+{
+#if 0
+ RWBuffer<float4> dst;
+
+ struct
+ {
+ float4 clear_value;
+ int2 dst_offset;
+ int2 dst_extent;
+ } u_info;
+
+ [numthreads(128, 1, 1)]
+ void main(int3 thread_id : SV_DispatchThreadID)
+ {
+ if (thread_id.x < u_info.dst_extent.x)
+ dst[u_info.dst_offset.x + thread_id.x] = u_info.clear_value;
+ }
+#endif
+ 0x43425844, 0xe114ba61, 0xff6a0d0b, 0x7b25c8f4, 0xfcf7cf22, 0x00000001, 0x0000010c, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000b8, 0x00050050, 0x0000002e, 0x0100086a,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400089c, 0x0011e000, 0x00000000, 0x00005555,
+ 0x0200005f, 0x00020012, 0x02000068, 0x00000001, 0x0400009b, 0x00000080, 0x00000001, 0x00000001,
+ 0x07000022, 0x00100012, 0x00000000, 0x0002000a, 0x0020802a, 0x00000000, 0x00000001, 0x0304001f,
+ 0x0010000a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0002000a, 0x0020800a, 0x00000000,
+ 0x00000001, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100006, 0x00000000, 0x00208e46, 0x00000000,
+ 0x00000000, 0x01000015, 0x0100003e,
+};
+
+static const uint32_t cs_uav_clear_buffer_uint_code[] =
+{
+#if 0
+ RWBuffer<uint4> dst;
+
+ struct
+ {
+ uint4 clear_value;
+ int2 dst_offset;
+ int2 dst_extent;
+ } u_info;
+
+ [numthreads(128, 1, 1)]
+ void main(int3 thread_id : SV_DispatchThreadID)
+ {
+ if (thread_id.x < u_info.dst_extent.x)
+ dst[u_info.dst_offset.x + thread_id.x] = u_info.clear_value;
+ }
+#endif
+ 0x43425844, 0x3afd0cfd, 0x5145c166, 0x5b9f76b8, 0xa73775cd, 0x00000001, 0x0000010c, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000b8, 0x00050050, 0x0000002e, 0x0100086a,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400089c, 0x0011e000, 0x00000000, 0x00004444,
+ 0x0200005f, 0x00020012, 0x02000068, 0x00000001, 0x0400009b, 0x00000080, 0x00000001, 0x00000001,
+ 0x07000022, 0x00100012, 0x00000000, 0x0002000a, 0x0020802a, 0x00000000, 0x00000001, 0x0304001f,
+ 0x0010000a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0002000a, 0x0020800a, 0x00000000,
+ 0x00000001, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100006, 0x00000000, 0x00208e46, 0x00000000,
+ 0x00000000, 0x01000015, 0x0100003e,
+};
+
+static const uint32_t cs_uav_clear_1d_array_float_code[] =
+{
+#if 0
+ RWTexture1DArray<float4> dst;
+
+ struct
+ {
+ float4 clear_value;
+ int2 dst_offset;
+ int2 dst_extent;
+ } u_info;
+
+ [numthreads(64, 1, 1)]
+ void main(int3 thread_id : SV_DispatchThreadID)
+ {
+ if (thread_id.x < u_info.dst_extent.x)
+ dst[int2(u_info.dst_offset.x + thread_id.x, thread_id.y)] = u_info.clear_value;
+ }
+#endif
+ 0x43425844, 0x3d73bc2d, 0x2b635f3d, 0x6bf98e92, 0xbe0aa5d9, 0x00000001, 0x0000011c, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000c8, 0x00050050, 0x00000032, 0x0100086a,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400389c, 0x0011e000, 0x00000000, 0x00005555,
+ 0x0200005f, 0x00020032, 0x02000068, 0x00000001, 0x0400009b, 0x00000040, 0x00000001, 0x00000001,
+ 0x07000022, 0x00100012, 0x00000000, 0x0002000a, 0x0020802a, 0x00000000, 0x00000001, 0x0304001f,
+ 0x0010000a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0002000a, 0x0020800a, 0x00000000,
+ 0x00000001, 0x04000036, 0x001000e2, 0x00000000, 0x00020556, 0x080000a4, 0x0011e0f2, 0x00000000,
+ 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x01000015, 0x0100003e,
+};
+
+static const uint32_t cs_uav_clear_1d_array_uint_code[] =
+{
+#if 0
+ RWTexture1DArray<uint4> dst;
+
+ struct
+ {
+ uint4 clear_value;
+ int2 dst_offset;
+ int2 dst_extent;
+ } u_info;
+
+ [numthreads(64, 1, 1)]
+ void main(int3 thread_id : SV_DispatchThreadID)
+ {
+ if (thread_id.x < u_info.dst_extent.x)
+ dst[int2(u_info.dst_offset.x + thread_id.x, thread_id.y)] = u_info.clear_value;
+ }
+#endif
+ 0x43425844, 0x2f0ca457, 0x72068b34, 0xd9dadc2b, 0xd3178c3e, 0x00000001, 0x0000011c, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000c8, 0x00050050, 0x00000032, 0x0100086a,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400389c, 0x0011e000, 0x00000000, 0x00004444,
+ 0x0200005f, 0x00020032, 0x02000068, 0x00000001, 0x0400009b, 0x00000040, 0x00000001, 0x00000001,
+ 0x07000022, 0x00100012, 0x00000000, 0x0002000a, 0x0020802a, 0x00000000, 0x00000001, 0x0304001f,
+ 0x0010000a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0002000a, 0x0020800a, 0x00000000,
+ 0x00000001, 0x04000036, 0x001000e2, 0x00000000, 0x00020556, 0x080000a4, 0x0011e0f2, 0x00000000,
+ 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x01000015, 0x0100003e,
+};
+
+static const uint32_t cs_uav_clear_1d_float_code[] =
+{
+#if 0
+ RWTexture1D<float4> dst;
+
+ struct
+ {
+ float4 clear_value;
+ int2 dst_offset;
+ int2 dst_extent;
+ } u_info;
+
+ [numthreads(64, 1, 1)]
+ void main(int3 thread_id : SV_DispatchThreadID)
+ {
+ if (thread_id.x < u_info.dst_extent.x)
+ dst[u_info.dst_offset.x + thread_id.x] = u_info.clear_value;
+ }
+#endif
+ 0x43425844, 0x05266503, 0x4b97006f, 0x01a5cc63, 0xe617d0a1, 0x00000001, 0x0000010c, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000b8, 0x00050050, 0x0000002e, 0x0100086a,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400109c, 0x0011e000, 0x00000000, 0x00005555,
+ 0x0200005f, 0x00020012, 0x02000068, 0x00000001, 0x0400009b, 0x00000040, 0x00000001, 0x00000001,
+ 0x07000022, 0x00100012, 0x00000000, 0x0002000a, 0x0020802a, 0x00000000, 0x00000001, 0x0304001f,
+ 0x0010000a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0002000a, 0x0020800a, 0x00000000,
+ 0x00000001, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100006, 0x00000000, 0x00208e46, 0x00000000,
+ 0x00000000, 0x01000015, 0x0100003e,
+};
+
+static const uint32_t cs_uav_clear_1d_uint_code[] =
+{
+#if 0
+ RWTexture1D<uint4> dst;
+
+ struct
+ {
+ uint4 clear_value;
+ int2 dst_offset;
+ int2 dst_extent;
+ } u_info;
+
+ [numthreads(64, 1, 1)]
+ void main(int3 thread_id : SV_DispatchThreadID)
+ {
+ if (thread_id.x < u_info.dst_extent.x)
+ dst[u_info.dst_offset.x + thread_id.x] = u_info.clear_value;
+ }
+#endif
+ 0x43425844, 0x19d5c8f2, 0x3ca4ac24, 0x9e258499, 0xf0463fd6, 0x00000001, 0x0000010c, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000b8, 0x00050050, 0x0000002e, 0x0100086a,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400109c, 0x0011e000, 0x00000000, 0x00004444,
+ 0x0200005f, 0x00020012, 0x02000068, 0x00000001, 0x0400009b, 0x00000040, 0x00000001, 0x00000001,
+ 0x07000022, 0x00100012, 0x00000000, 0x0002000a, 0x0020802a, 0x00000000, 0x00000001, 0x0304001f,
+ 0x0010000a, 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0002000a, 0x0020800a, 0x00000000,
+ 0x00000001, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100006, 0x00000000, 0x00208e46, 0x00000000,
+ 0x00000000, 0x01000015, 0x0100003e,
+};
+
+static const uint32_t cs_uav_clear_2d_array_float_code[] =
+{
+#if 0
+ RWTexture2DArray<float4> dst;
+
+ struct
+ {
+ float4 clear_value;
+ int2 dst_offset;
+ int2 dst_extent;
+ } u_info;
+
+ [numthreads(8, 8, 1)]
+ void main(int3 thread_id : SV_DispatchThreadID)
+ {
+ if (all(thread_id.xy < u_info.dst_extent.xy))
+ dst[int3(u_info.dst_offset.xy + thread_id.xy, thread_id.z)] = u_info.clear_value;
+ }
+#endif
+ 0x43425844, 0x924d2d2c, 0xb9166376, 0x99f83871, 0x8ef65025, 0x00000001, 0x00000138, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000e4, 0x00050050, 0x00000039, 0x0100086a,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400409c, 0x0011e000, 0x00000000, 0x00005555,
+ 0x0200005f, 0x00020072, 0x02000068, 0x00000001, 0x0400009b, 0x00000008, 0x00000008, 0x00000001,
+ 0x07000022, 0x00100032, 0x00000000, 0x00020046, 0x00208ae6, 0x00000000, 0x00000001, 0x07000001,
+ 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a,
+ 0x00000000, 0x0700001e, 0x00100032, 0x00000000, 0x00020046, 0x00208046, 0x00000000, 0x00000001,
+ 0x04000036, 0x001000c2, 0x00000000, 0x00020aa6, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100e46,
+ 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x01000015, 0x0100003e,
+};
+
+static const uint32_t cs_uav_clear_2d_array_uint_code[] =
+{
+#if 0
+ RWTexture2DArray<uint4> dst;
+
+ struct
+ {
+ uint4 clear_value;
+ int2 dst_offset;
+ int2 dst_extent;
+ } u_info;
+
+ [numthreads(8, 8, 1)]
+ void main(int3 thread_id : SV_DispatchThreadID)
+ {
+ if (all(thread_id.xy < u_info.dst_extent.xy))
+ dst[int3(u_info.dst_offset.xy + thread_id.xy, thread_id.z)] = u_info.clear_value;
+ }
+#endif
+ 0x43425844, 0xa92219d4, 0xa2c5e47d, 0x0d308500, 0xf32197b4, 0x00000001, 0x00000138, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000e4, 0x00050050, 0x00000039, 0x0100086a,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400409c, 0x0011e000, 0x00000000, 0x00004444,
+ 0x0200005f, 0x00020072, 0x02000068, 0x00000001, 0x0400009b, 0x00000008, 0x00000008, 0x00000001,
+ 0x07000022, 0x00100032, 0x00000000, 0x00020046, 0x00208ae6, 0x00000000, 0x00000001, 0x07000001,
+ 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a,
+ 0x00000000, 0x0700001e, 0x00100032, 0x00000000, 0x00020046, 0x00208046, 0x00000000, 0x00000001,
+ 0x04000036, 0x001000c2, 0x00000000, 0x00020aa6, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100e46,
+ 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x01000015, 0x0100003e,
+};
+
+static const uint32_t cs_uav_clear_2d_float_code[] =
+{
+#if 0
+ RWTexture2D<float4> dst;
+
+ struct
+ {
+ float4 clear_value;
+ int2 dst_offset;
+ int2 dst_extent;
+ } u_info;
+
+ [numthreads(8, 8, 1)]
+ void main(int3 thread_id : SV_DispatchThreadID)
+ {
+ if (all(thread_id.xy < u_info.dst_extent.xy))
+ dst[u_info.dst_offset.xy + thread_id.xy] = u_info.clear_value;
+ }
+#endif
+ 0x43425844, 0x6e735b3f, 0x7348c4fa, 0xb3634e42, 0x50e2d99b, 0x00000001, 0x00000128, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000d4, 0x00050050, 0x00000035, 0x0100086a,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400189c, 0x0011e000, 0x00000000, 0x00005555,
+ 0x0200005f, 0x00020032, 0x02000068, 0x00000001, 0x0400009b, 0x00000008, 0x00000008, 0x00000001,
+ 0x07000022, 0x00100032, 0x00000000, 0x00020046, 0x00208ae6, 0x00000000, 0x00000001, 0x07000001,
+ 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a,
+ 0x00000000, 0x0700001e, 0x001000f2, 0x00000000, 0x00020546, 0x00208546, 0x00000000, 0x00000001,
+ 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000,
+ 0x01000015, 0x0100003e,
+};
+
+static const uint32_t cs_uav_clear_2d_uint_code[] =
+{
+#if 0
+ RWTexture2D<uint4> dst;
+
+ struct
+ {
+ uint4 clear_value;
+ int2 dst_offset;
+ int2 dst_extent;
+ } u_info;
+
+ [numthreads(8, 8, 1)]
+ void main(int3 thread_id : SV_DispatchThreadID)
+ {
+ if (all(thread_id.xy < u_info.dst_extent.xy))
+ dst[u_info.dst_offset.xy + thread_id.xy] = u_info.clear_value;
+ }
+#endif
+ 0x43425844, 0xf01db5dd, 0xc7dc5e55, 0xb017c1a8, 0x55abd52d, 0x00000001, 0x00000128, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000d4, 0x00050050, 0x00000035, 0x0100086a,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400189c, 0x0011e000, 0x00000000, 0x00004444,
+ 0x0200005f, 0x00020032, 0x02000068, 0x00000001, 0x0400009b, 0x00000008, 0x00000008, 0x00000001,
+ 0x07000022, 0x00100032, 0x00000000, 0x00020046, 0x00208ae6, 0x00000000, 0x00000001, 0x07000001,
+ 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a,
+ 0x00000000, 0x0700001e, 0x001000f2, 0x00000000, 0x00020546, 0x00208546, 0x00000000, 0x00000001,
+ 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000000,
+ 0x01000015, 0x0100003e,
+};
+
+static const uint32_t cs_uav_clear_3d_float_code[] =
+{
+#if 0
+ RWTexture3D<float4> dst;
+
+ struct
+ {
+ float4 clear_value;
+ int2 dst_offset;
+ int2 dst_extent;
+ } u_info;
+
+ [numthreads(8, 8, 1)]
+ void main(int3 thread_id : SV_DispatchThreadID)
+ {
+ if (all(thread_id.xy < u_info.dst_extent.xy))
+ dst[int3(u_info.dst_offset.xy, 0) + thread_id.xyz] = u_info.clear_value;
+ }
+#endif
+ 0x43425844, 0x5d8f36a0, 0x30fa86a5, 0xfec7f2ef, 0xdfd76cbb, 0x00000001, 0x00000138, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000e4, 0x00050050, 0x00000039, 0x0100086a,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400289c, 0x0011e000, 0x00000000, 0x00005555,
+ 0x0200005f, 0x00020072, 0x02000068, 0x00000001, 0x0400009b, 0x00000008, 0x00000008, 0x00000001,
+ 0x07000022, 0x00100032, 0x00000000, 0x00020046, 0x00208ae6, 0x00000000, 0x00000001, 0x07000001,
+ 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a,
+ 0x00000000, 0x0700001e, 0x00100032, 0x00000000, 0x00020046, 0x00208046, 0x00000000, 0x00000001,
+ 0x04000036, 0x001000c2, 0x00000000, 0x00020aa6, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100e46,
+ 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x01000015, 0x0100003e,
+};
+
+static const uint32_t cs_uav_clear_3d_uint_code[] =
+{
+#if 0
+ RWTexture3D<uint4> dst;
+
+ struct
+ {
+ uint4 clear_value;
+ int2 dst_offset;
+ int2 dst_extent;
+ } u_info;
+
+ [numthreads(8, 8, 1)]
+ void main(int3 thread_id : SV_DispatchThreadID)
+ {
+ if (all(thread_id.xy < u_info.dst_extent.xy))
+ dst[int3(u_info.dst_offset.xy, 0) + thread_id.xyz] = u_info.clear_value;
+ }
+#endif
+ 0x43425844, 0x5b9c95b1, 0xc9bde4e3, 0x9aaff806, 0x24a1d264, 0x00000001, 0x00000138, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x0000004c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x00000008, 0x00000000, 0x00000008, 0x58454853, 0x000000e4, 0x00050050, 0x00000039, 0x0100086a,
+ 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0400289c, 0x0011e000, 0x00000000, 0x00004444,
+ 0x0200005f, 0x00020072, 0x02000068, 0x00000001, 0x0400009b, 0x00000008, 0x00000008, 0x00000001,
+ 0x07000022, 0x00100032, 0x00000000, 0x00020046, 0x00208ae6, 0x00000000, 0x00000001, 0x07000001,
+ 0x00100012, 0x00000000, 0x0010001a, 0x00000000, 0x0010000a, 0x00000000, 0x0304001f, 0x0010000a,
+ 0x00000000, 0x0700001e, 0x00100032, 0x00000000, 0x00020046, 0x00208046, 0x00000000, 0x00000001,
+ 0x04000036, 0x001000c2, 0x00000000, 0x00020aa6, 0x080000a4, 0x0011e0f2, 0x00000000, 0x00100e46,
+ 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x01000015, 0x0100003e,
+};
+
+#endif /* __VKD3D_SHADERS_H */
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 5284138..3b5264f 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -4812,7 +4812,7 @@ static void test_clear_unordered_access_view_buffer(void)
{DXGI_FORMAT_R32_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{1, 0, 0, 0}, 1, false, true},
{DXGI_FORMAT_R32_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x3f800000 /* 1.0f */, 0, 0, 0}, 0x3f800000 /* 1.0f */, true, true},
+ {0x3f800000 /* 1.0f */, 0, 0, 0}, 0x3f800000 /* 1.0f */, true},
{DXGI_FORMAT_R16G16_UINT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x1234, 0xabcd, 0, 0}, 0xabcd1234, false, true},
@@ -4822,16 +4822,16 @@ static void test_clear_unordered_access_view_buffer(void)
{DXGI_FORMAT_R16G16_UNORM, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x1234, 0xabcd, 0, 0}, 0xabcd1234, false, true},
{DXGI_FORMAT_R16G16_UNORM, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff8000, true, true},
+ {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff8000, true},
{DXGI_FORMAT_R16G16_UNORM, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x40000000 /* 2.0f */, 0 /* 0.0f */, 0, 0}, 0x0000ffff, true, true},
+ {0x40000000 /* 2.0f */, 0 /* 0.0f */, 0, 0}, 0x0000ffff, true},
{DXGI_FORMAT_R16G16_UNORM, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0xbf800000 /* -1.0f */, 0 /* 0.0f */, 0x3f000000 /* 1.0f */, 0x3f000000 /* 1.0f */}, 0, true, true},
+ {0xbf800000 /* -1.0f */, 0 /* 0.0f */, 0x3f000000 /* 1.0f */, 0x3f000000 /* 1.0f */}, 0, true},
{DXGI_FORMAT_R16G16_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x1234, 0xabcd, 0, 0}, 0xabcd1234, false, true},
{DXGI_FORMAT_R16G16_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0x3c003800, true, true},
+ {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0x3c003800, true},
{DXGI_FORMAT_R8G8B8A8_UINT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x11, 0x22, 0x33, 0x44}, 0x44332211, false, true},
@@ -4845,10 +4845,10 @@ static void test_clear_unordered_access_view_buffer(void)
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x7ff, 0, 0x3ff, 0}, 0xffc007ff, false, true},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
- {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0x40000000 /* 2.0f */, 0}, 0x801e0380, true, true},
+ {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0x40000000 /* 2.0f */, 0}, 0x801e0380, true},
{DXGI_FORMAT_R11G11B10_FLOAT, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
{0x3f000000 /* 1.0f */, 0 /* 0.0f */, 0xbf800000 /* -1.0f */, 0x3f000000 /* 1.0f */},
- 0x00000380, true, true},
+ 0x00000380, true},
};
memset(&desc, 0, sizeof(desc));
@@ -4982,48 +4982,48 @@ static void test_clear_unordered_access_view_image(void)
tests[] =
{
/* Test clearing a specific mip level. */
- {DXGI_FORMAT_R32_FLOAT, 2, 1, 0, 0, 1, 0, {}, {1, 0, 0, 0}, 1, false, false},
- {DXGI_FORMAT_R32_FLOAT, 2, 1, 1, 0, 1, 0, {}, {1, 0, 0, 0}, 1, false, false},
- {DXGI_FORMAT_R32_FLOAT, 2, 1, 0, 0, 1, 0, {}, {0x3f000000, 0, 0, 0}, 0x3f000000, true, true},
- {DXGI_FORMAT_R32_FLOAT, 2, 1, 1, 0, 1, 0, {}, {0x3f000000, 0, 0, 0}, 0x3f000000, true, true},
+ {DXGI_FORMAT_R32_FLOAT, 2, 1, 0, 0, 1, 0, {}, {1, 0, 0, 0}, 1},
+ {DXGI_FORMAT_R32_FLOAT, 2, 1, 1, 0, 1, 0, {}, {1, 0, 0, 0}, 1},
+ {DXGI_FORMAT_R32_FLOAT, 2, 1, 0, 0, 1, 0, {}, {0x3f000000, 0, 0, 0}, 0x3f000000, true},
+ {DXGI_FORMAT_R32_FLOAT, 2, 1, 1, 0, 1, 0, {}, {0x3f000000, 0, 0, 0}, 0x3f000000, true},
/* Test clearing specific array layers. */
- {DXGI_FORMAT_R32_FLOAT, 1, IMAGE_SIZE, 0, 0, IMAGE_SIZE, 0, {}, {1, 0, 0, 0}, 1, false, false},
- {DXGI_FORMAT_R32_FLOAT, 1, IMAGE_SIZE, 0, 3, 2, 0, {}, {1, 0, 0, 0}, 1, false, false},
+ {DXGI_FORMAT_R32_FLOAT, 1, IMAGE_SIZE, 0, 0, IMAGE_SIZE, 0, {}, {1, 0, 0, 0}, 1},
+ {DXGI_FORMAT_R32_FLOAT, 1, IMAGE_SIZE, 0, 3, 2, 0, {}, {1, 0, 0, 0}, 1},
{DXGI_FORMAT_R32_FLOAT, 1, IMAGE_SIZE, 0, 0, IMAGE_SIZE, 0, {},
- {0x3f000000, 0, 0, 0}, 0x3f000000, true, true},
+ {0x3f000000, 0, 0, 0}, 0x3f000000, true},
{DXGI_FORMAT_R32_FLOAT, 1, IMAGE_SIZE, 0, 3, 2, 0, {},
- {0x3f000000, 0, 0, 0}, 0x3f000000, true, true},
+ {0x3f000000, 0, 0, 0}, 0x3f000000, true},
/* Test a single clear rect. */
{DXGI_FORMAT_R32_FLOAT, 1, 1, 0, 0, 1, 1, {{1, 2, IMAGE_SIZE - 4, IMAGE_SIZE - 2}},
{1, 0, 0, 0}, 1, false, true},
{DXGI_FORMAT_R32_FLOAT, 1, 1, 0, 0, 1, 1, {{1, 2, IMAGE_SIZE - 4, IMAGE_SIZE - 2}},
- {0x3f000000, 0, 0, 0}, 0x3f000000, true, true},
+ {0x3f000000, 0, 0, 0}, 0x3f000000, true},
/* Test multiple clear rects. */
{DXGI_FORMAT_R32_FLOAT, 1, 1, 0, 0, 1, 2, {{1, 2, 3, 4}, {5, 6, 7, 8}},
{1, 0, 0, 0}, 1, false, true},
{DXGI_FORMAT_R32_FLOAT, 1, 1, 0, 0, 1, 2, {{1, 2, 3, 4}, {5, 6, 7, 8}},
- {0x3f000000, 0, 0, 0}, 0x3f000000, true, true},
+ {0x3f000000, 0, 0, 0}, 0x3f000000, true},
/* Test uint clears with formats. */
- {DXGI_FORMAT_R16G16_UINT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00020001, false, false},
+ {DXGI_FORMAT_R16G16_UINT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00020001},
{DXGI_FORMAT_R16G16_UINT, 1, 1, 0, 0, 1, 0, {}, {0x12345, 0, 0, 0}, 0x00002345, false, true},
{DXGI_FORMAT_R16G16_UNORM, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00020001, false, true},
{DXGI_FORMAT_R16G16_FLOAT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00020001, false, true},
- {DXGI_FORMAT_R8G8B8A8_UINT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x04030201, false, false},
+ {DXGI_FORMAT_R8G8B8A8_UINT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x04030201},
{DXGI_FORMAT_R8G8B8A8_UINT, 1, 1, 0, 0, 1, 0, {}, {0x123, 0, 0, 0}, 0x00000023, false, true},
{DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x04030201, false, true},
{DXGI_FORMAT_R11G11B10_FLOAT, 1, 1, 0, 0, 1, 0, {}, {1, 2, 3, 4}, 0x00c01001, false, true},
/* Test float clears with formats. */
{DXGI_FORMAT_R16G16_UNORM, 1, 1, 0, 0, 1, 0, {},
- {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff8000, true, true},
+ {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff8000, true},
{DXGI_FORMAT_R16G16_FLOAT, 1, 1, 0, 0, 1, 0, {},
- {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0x3c003800, true, true},
+ {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0x3c003800, true},
{DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1, 0, 0, 1, 0, {},
- {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0x0000ff80, true, true},
+ {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0x0000ff80, true},
{DXGI_FORMAT_R8G8B8A8_UNORM, 1, 1, 0, 0, 1, 0, {},
- {0, 0, 0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */}, 0xff800000, true, true},
+ {0, 0, 0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */}, 0xff800000, true},
{DXGI_FORMAT_R11G11B10_FLOAT, 1, 1, 0, 0, 1, 0, {},
{0x3f000000 /* 1.0f */, 0 /* 0.0f */, 0xbf800000 /* -1.0f */, 0x3f000000 /* 1.0f */},
- 0x00000380, true, true},
+ 0x00000380, true},
};
static const struct
--
2.11.0
1
0
25 Nov '19
From: Hans-Kristian Arntzen <post(a)arntzen-software.no>
This also fixes a format specifier warning in an ERR for the 32-bit Linux
build.
Signed-off-by: Hans-Kristian Arntzen <post(a)arntzen-software.no>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patch 174182.
libs/vkd3d/vkd3d_private.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index 84b5ff2..c6bfe96 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -205,13 +205,13 @@ HRESULT vkd3d_fence_worker_stop(struct vkd3d_fence_worker *worker,
struct vkd3d_gpu_va_allocation
{
D3D12_GPU_VIRTUAL_ADDRESS base;
- SIZE_T size;
+ size_t size;
void *ptr;
};
struct vkd3d_gpu_va_slab
{
- SIZE_T size;
+ size_t size;
void *ptr;
};
--
2.11.0
1
0
25 Nov '19
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/kernel32/tests/thread.c | 132 +++++++++++++++++++++++++++++++++++
include/winternl.h | 9 ++-
2 files changed, 140 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c
index ddbbec93ad..180eed8241 100644
--- a/dlls/kernel32/tests/thread.c
+++ b/dlls/kernel32/tests/thread.c
@@ -105,6 +105,8 @@ static NTSTATUS (WINAPI *pNtQueryInformationThread)(HANDLE,THREADINFOCLASS,PVOID
static BOOL (WINAPI *pGetThreadGroupAffinity)(HANDLE,GROUP_AFFINITY*);
static BOOL (WINAPI *pSetThreadGroupAffinity)(HANDLE,const GROUP_AFFINITY*,GROUP_AFFINITY*);
static NTSTATUS (WINAPI *pNtSetInformationThread)(HANDLE,THREADINFOCLASS,LPCVOID,ULONG);
+static HRESULT (WINAPI *pSetThreadDescription)(HANDLE,const WCHAR *);
+static HRESULT (WINAPI *pGetThreadDescription)(HANDLE,WCHAR **);
static HANDLE create_target_process(const char *arg)
{
@@ -2111,6 +2113,133 @@ todo_wine
CloseHandle(thread);
}
+static void test_thread_description(void)
+{
+ THREAD_DESCRIPTION_INFORMATION *thread_desc;
+ static const WCHAR *desc = L"thread_desc";
+ ULONG len, len2, desc_len;
+ NTSTATUS status;
+ char buff[128];
+ WCHAR *ptr;
+ HRESULT hr;
+
+ if (!pGetThreadDescription)
+ {
+ skip("Thread description API is not supported.\n");
+ return;
+ }
+
+ desc_len = lstrlenW(desc) * sizeof(*desc);
+ thread_desc = (THREAD_DESCRIPTION_INFORMATION *)buff;
+
+ /* Initial description. */
+ ptr = NULL;
+ hr = pGetThreadDescription(GetCurrentThread(), &ptr);
+ ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to get thread description, hr %#x.\n", hr);
+ ok(!lstrcmpW(ptr, L""), "Unexpected description %s.\n", wine_dbgstr_w(ptr));
+ LocalFree(ptr);
+
+ len = 0;
+ status = pNtQueryInformationThread(GetCurrentThread(), ThreadDescription, NULL, 0, &len);
+ ok(status == STATUS_BUFFER_TOO_SMALL, "Unexpected status %#x.\n", status);
+ ok(len == sizeof(*thread_desc), "Unexpected structure length %u.\n", len);
+
+ len2 = 0;
+ thread_desc->Length = 1;
+ thread_desc->Description = (WCHAR *)thread_desc;
+ status = pNtQueryInformationThread(GetCurrentThread(), ThreadDescription, thread_desc, len, &len2);
+ ok(!status, "Failed to get thread info, status %#x.\n", status);
+ ok(len2 == sizeof(*thread_desc), "Unexpected structure length %u.\n", len);
+ ok(!thread_desc->Length, "Unexpected description length %#x.\n", thread_desc->Length);
+ ok(thread_desc->Description == (WCHAR *)(thread_desc + 1), "Unexpected description string pointer %p, %p.\n",
+ thread_desc->Description, thread_desc);
+
+ hr = pSetThreadDescription(GetCurrentThread(), NULL);
+ ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to set thread description, hr %#x.\n", hr);
+
+ hr = pSetThreadDescription(GetCurrentThread(), desc);
+ ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to set thread description, hr %#x.\n", hr);
+
+ ptr = NULL;
+ hr = pGetThreadDescription(GetCurrentThread(), &ptr);
+ ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to get thread description, hr %#x.\n", hr);
+ ok(!lstrcmpW(ptr, desc), "Unexpected description %s.\n", wine_dbgstr_w(ptr));
+ LocalFree(ptr);
+
+ len = 0;
+ status = pNtQueryInformationThread(GetCurrentThread(), ThreadDescription, NULL, 0, &len);
+ ok(status == STATUS_BUFFER_TOO_SMALL, "Failed to get thread info, status %#x.\n", status);
+ ok(len == sizeof(*thread_desc) + desc_len, "Unexpected structure length %u.\n", len);
+
+ len = 0;
+ status = pNtQueryInformationThread(GetCurrentThread(), ThreadDescription, buff, sizeof(buff), &len);
+ ok(!status, "Failed to get thread info.\n");
+ ok(len == sizeof(*thread_desc) + desc_len, "Unexpected structure length %u.\n", len);
+
+ ok(thread_desc->Length == (desc_len << 16 | desc_len), "Unexpected description length %#x.\n",
+ thread_desc->Length);
+ ok(thread_desc->Description == (WCHAR *)(thread_desc + 1), "Unexpected description string pointer %p, %p.\n",
+ thread_desc->Description, thread_desc);
+ ok(!memcmp(thread_desc->Description, desc, desc_len), "Unexpected description string.\n");
+
+ /* Partial results. */
+ len = 0;
+ status = pNtQueryInformationThread(GetCurrentThread(), ThreadDescription, NULL, 0, &len);
+ ok(status == STATUS_BUFFER_TOO_SMALL, "Unexpected status %#x.\n", status);
+ ok(len == sizeof(*thread_desc) + desc_len, "Unexpected structure length %u.\n", len);
+
+ status = pNtQueryInformationThread(GetCurrentThread(), ThreadDescription, buff, len - sizeof(WCHAR), &len);
+ ok(status == STATUS_BUFFER_TOO_SMALL, "Unexpected status %#x.\n", status);
+ ok(len == sizeof(*thread_desc) + desc_len, "Unexpected structure length %u.\n", len);
+
+ /* Change description. */
+ thread_desc->Length = 8 << 16 | 8;
+ lstrcpyW((WCHAR *)(thread_desc + 1), L"desc");
+
+ status = pNtSetInformationThread(GetCurrentThread(), ThreadDescription, thread_desc, sizeof(*thread_desc));
+ ok(status == STATUS_SUCCESS, "Failed to set thread description, status %#x.\n", status);
+
+ ptr = NULL;
+ hr = pGetThreadDescription(GetCurrentThread(), &ptr);
+ ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to get thread description, hr %#x.\n", hr);
+ ok(!lstrcmpW(ptr, L"desc"), "Unexpected description %s.\n", wine_dbgstr_w(ptr));
+ LocalFree(ptr);
+
+ status = pNtSetInformationThread(GetCurrentThread(), ThreadDescription, thread_desc, sizeof(*thread_desc) - 1);
+ ok(status == STATUS_INFO_LENGTH_MISMATCH, "Unexpected status %#x.\n", status);
+
+ status = NtSetInformationThread(GetCurrentThread(), ThreadDescription, NULL, sizeof(*thread_desc));
+ ok(status == STATUS_ACCESS_VIOLATION, "Unexpected status %#x.\n", status);
+
+ thread_desc->Description = NULL;
+ status = pNtSetInformationThread(GetCurrentThread(), ThreadDescription, thread_desc, sizeof(*thread_desc));
+ ok(status == STATUS_ACCESS_VIOLATION, "Unexpected status %#x.\n", status);
+
+ hr = pSetThreadDescription(GetCurrentThread(), NULL);
+ ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to set thread description, hr %#x.\n", hr);
+
+ ptr = NULL;
+ hr = pGetThreadDescription(GetCurrentThread(), &ptr);
+ ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to get thread description, hr %#x.\n", hr);
+ ok(!lstrcmpW(ptr, L""), "Unexpected description %s.\n", wine_dbgstr_w(ptr));
+ LocalFree(ptr);
+
+ /* Set with 0 length/NULL pointer. */
+ hr = pSetThreadDescription(GetCurrentThread(), L"123");
+ ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to set thread description, hr %#x.\n", hr);
+
+ thread_desc->Length = 0;
+ thread_desc->Description = NULL;
+ status = pNtSetInformationThread(GetCurrentThread(), ThreadDescription, thread_desc, sizeof(*thread_desc));
+ ok(!status, "Failed to set thread description, status %#x.\n", status);
+
+ ptr = NULL;
+ hr = pGetThreadDescription(GetCurrentThread(), &ptr);
+ ok(hr == HRESULT_FROM_NT(STATUS_SUCCESS), "Failed to get thread description, hr %#x.\n", hr);
+ ok(!lstrcmpW(ptr, L""), "Unexpected description %s.\n", wine_dbgstr_w(ptr));
+ LocalFree(ptr);
+}
+
static void init_funcs(void)
{
HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
@@ -2147,6 +2276,8 @@ static void init_funcs(void)
X(GetThreadGroupAffinity);
X(SetThreadGroupAffinity);
+ X(SetThreadDescription);
+ X(GetThreadDescription);
X(FlsAlloc);
X(FlsFree);
@@ -2223,6 +2354,7 @@ START_TEST(thread)
test_ThreadErrorMode();
test_thread_fpu_cw();
test_thread_actctx();
+ test_thread_description();
test_threadpool();
}
diff --git a/include/winternl.h b/include/winternl.h
index 8b895a9392..d5c8d76ccf 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -974,7 +974,7 @@ typedef enum _SYSTEM_INFORMATION_CLASS {
} SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS;
typedef enum _THREADINFOCLASS {
- ThreadBasicInformation,
+ ThreadBasicInformation = 0,
ThreadTimes,
ThreadPriority,
ThreadBasePriority,
@@ -1008,6 +1008,7 @@ typedef enum _THREADINFOCLASS {
ThreadUmsInformation,
ThreadCounterProfiling,
ThreadIdealProcessorEx,
+ ThreadDescription = 38,
MaxThreadInfoClass
} THREADINFOCLASS;
@@ -1027,6 +1028,12 @@ typedef struct _THREAD_DESCRIPTOR_INFORMATION
LDT_ENTRY Entry;
} THREAD_DESCRIPTOR_INFORMATION, *PTHREAD_DESCRIPTOR_INFORMATION;
+typedef struct _THREAD_DESCRIPTION_INFORMATION
+{
+ DWORD Length;
+ WCHAR *Description;
+} THREAD_DESCRIPTION_INFORMATION, *PTHREAD_DESCRIPTION_INFORMATION;
+
typedef struct _KERNEL_USER_TIMES {
LARGE_INTEGER CreateTime;
LARGE_INTEGER ExitTime;
--
2.24.0
3
6
[PATCH vkd3d v2 1/2] vkd3d: Add more features to CheckFeatureSupport().
by Conor McCarthy 25 Nov '19
by Conor McCarthy 25 Nov '19
25 Nov '19
Some games, e.g. Hitman 2, do not check for success, and if the feature
check is unimplemented they will use uninitialised data as the result.
Signed-off-by: Conor McCarthy <cmccarthy(a)codeweavers.com>
---
v2: Fix corrupt patch.
Supersedes 174442.
---
include/vkd3d_d3d12.idl | 141 +++++++++++++++++++
libs/vkd3d/device.c | 276 +++++++++++++++++++++++++++++++++++++
libs/vkd3d/vkd3d_private.h | 5 +
3 files changed, 422 insertions(+)
diff --git a/include/vkd3d_d3d12.idl b/include/vkd3d_d3d12.idl
index 8246424..3747c8e 100644
--- a/include/vkd3d_d3d12.idl
+++ b/include/vkd3d_d3d12.idl
@@ -1608,6 +1608,141 @@ typedef struct D3D12_FEATURE_DATA_SHADER_MODEL
D3D_SHADER_MODEL HighestShaderModel;
} D3D12_FEATURE_DATA_SHADER_MODEL;
+typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS1
+{
+ BOOL WaveOps;
+ UINT WaveLaneCountMin;
+ UINT WaveLaneCountMax;
+ UINT TotalLaneCount;
+ BOOL ExpandedComputeResourceStates;
+ BOOL Int64ShaderOps;
+} D3D12_FEATURE_DATA_D3D12_OPTIONS1;
+
+typedef enum D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER
+{
+ D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED = 0,
+ D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_1 = 1,
+ D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_2 = 2,
+} D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER;
+
+typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS2
+{
+ BOOL DepthBoundsTestSupported;
+ D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER ProgrammableSamplePositionsTier;
+} D3D12_FEATURE_DATA_D3D12_OPTIONS2;
+
+typedef enum D3D12_SHADER_CACHE_SUPPORT_FLAGS
+{
+ D3D12_SHADER_CACHE_SUPPORT_NONE = 0x0,
+ D3D12_SHADER_CACHE_SUPPORT_SINGLE_PSO = 0x1,
+ D3D12_SHADER_CACHE_SUPPORT_LIBRARY = 0x2,
+ D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_INPROC_CACHE = 0x4,
+ D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_DISK_CACHE = 0x8,
+} D3D12_SHADER_CACHE_SUPPORT_FLAGS;
+
+typedef struct D3D12_FEATURE_DATA_SHADER_CACHE
+{
+ D3D12_SHADER_CACHE_SUPPORT_FLAGS SupportFlags;
+} D3D12_FEATURE_DATA_SHADER_CACHE;
+
+typedef struct D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY
+{
+ D3D12_COMMAND_LIST_TYPE CommandListType;
+ UINT Priority;
+ BOOL PriorityForTypeIsSupported;
+} D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY;
+
+typedef struct D3D12_FEATURE_DATA_ARCHITECTURE1
+{
+ UINT NodeIndex;
+ BOOL TileBasedRenderer;
+ BOOL UMA;
+ BOOL CacheCoherentUMA;
+ BOOL IsolatedMMU;
+} D3D12_FEATURE_DATA_ARCHITECTURE1;
+
+typedef enum D3D12_COMMAND_LIST_SUPPORT_FLAGS
+{
+ D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE = 0x0,
+ D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT = 0x1,
+ D3D12_COMMAND_LIST_SUPPORT_FLAG_BUNDLE = 0x2,
+ D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE = 0x4,
+ D3D12_COMMAND_LIST_SUPPORT_FLAG_COPY = 0x8,
+} D3D12_COMMAND_LIST_SUPPORT_FLAGS;
+
+typedef enum D3D12_VIEW_INSTANCING_TIER
+{
+ D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED = 0,
+ D3D12_VIEW_INSTANCING_TIER_1 = 1,
+ D3D12_VIEW_INSTANCING_TIER_2 = 2,
+ D3D12_VIEW_INSTANCING_TIER_3 = 3,
+} D3D12_VIEW_INSTANCING_TIER;
+
+typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS3
+{
+ BOOL CopyQueueTimestampQueriesSupported;
+ BOOL CastingFullyTypedFormatSupported;
+ D3D12_COMMAND_LIST_SUPPORT_FLAGS WriteBufferImmediateSupportFlags;
+ D3D12_VIEW_INSTANCING_TIER ViewInstancingTier;
+ BOOL BarycentricsSupported;
+} D3D12_FEATURE_DATA_D3D12_OPTIONS3;
+
+typedef struct D3D12_FEATURE_DATA_EXISTING_HEAPS
+{
+ BOOL Supported;
+} D3D12_FEATURE_DATA_EXISTING_HEAPS;
+
+typedef enum D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER
+{
+ D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0 = 0,
+ D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_1 = 1,
+} D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER;
+
+typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS4
+{
+ BOOL MSAA64KBAlignedTextureSupported;
+ D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER SharedResourceCompatibilityTier;
+ BOOL Native16BitShaderOpsSupported;
+} D3D12_FEATURE_DATA_D3D12_OPTIONS4;
+
+typedef enum D3D12_HEAP_SERIALIZATION_TIER
+{
+ D3D12_HEAP_SERIALIZATION_TIER_0 = 0,
+ D3D12_HEAP_SERIALIZATION_TIER_10 = 10,
+} D3D12_HEAP_SERIALIZATION_TIER;
+
+typedef struct D3D12_FEATURE_DATA_SERIALIZATION
+{
+ UINT NodeIndex;
+ D3D12_HEAP_SERIALIZATION_TIER HeapSerializationTier;
+} D3D12_FEATURE_DATA_SERIALIZATION;
+
+typedef struct D3D12_FEATURE_DATA_CROSS_NODE
+{
+ D3D12_CROSS_NODE_SHARING_TIER SharingTier;
+ BOOL AtomicShaderInstructions;
+} D3D12_FEATURE_DATA_CROSS_NODE;
+
+typedef enum D3D12_RENDER_PASS_TIER
+{
+ D3D12_RENDER_PASS_TIER_0 = 0,
+ D3D12_RENDER_PASS_TIER_1 = 1,
+ D3D12_RENDER_PASS_TIER_2 = 2,
+} D3D12_RENDER_PASS_TIER;
+
+typedef enum D3D12_RAYTRACING_TIER
+{
+ D3D12_RAYTRACING_TIER_NOT_SUPPORTED = 0,
+ D3D12_RAYTRACING_TIER_1_0 = 10,
+} D3D12_RAYTRACING_TIER;
+
+typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS5
+{
+ BOOL SRVOnlyTiledResourceTier3;
+ D3D12_RENDER_PASS_TIER RenderPassesTier;
+ D3D12_RAYTRACING_TIER RaytracingTier;
+} D3D12_FEATURE_DATA_D3D12_OPTIONS5;
+
typedef enum D3D12_FEATURE
{
D3D12_FEATURE_D3D12_OPTIONS = 0,
@@ -1624,6 +1759,12 @@ typedef enum D3D12_FEATURE
D3D12_FEATURE_D3D12_OPTIONS2 = 18,
D3D12_FEATURE_SHADER_CACHE = 19,
D3D12_FEATURE_COMMAND_QUEUE_PRIORITY = 20,
+ D3D12_FEATURE_D3D12_OPTIONS3 = 21,
+ D3D12_FEATURE_EXISTING_HEAPS = 22,
+ D3D12_FEATURE_D3D12_OPTIONS4 = 23,
+ D3D12_FEATURE_SERIALIZATION = 24,
+ D3D12_FEATURE_CROSS_NODE = 25,
+ D3D12_FEATURE_D3D12_OPTIONS5 = 27,
} D3D12_FEATURE;
typedef struct D3D12_MEMCPY_DEST
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c
index 7ff567d..cd850c9 100644
--- a/libs/vkd3d/device.c
+++ b/libs/vkd3d/device.c
@@ -1336,6 +1336,33 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
device->feature_options.VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation = FALSE;
device->feature_options.ResourceHeapTier = D3D12_RESOURCE_HEAP_TIER_2;
+ device->feature_options1.WaveOps = FALSE;
+ device->feature_options1.WaveLaneCountMin = 0;
+ device->feature_options1.WaveLaneCountMax = 0;
+ device->feature_options1.TotalLaneCount = 0;
+ device->feature_options1.ExpandedComputeResourceStates = TRUE;
+ device->feature_options1.Int64ShaderOps = features->shaderInt64;
+
+ /* Depth bounds test is enabled in D3D12_DEPTH_STENCIL_DESC1, which is not supported. */
+ device->feature_options2.DepthBoundsTestSupported = FALSE;
+ /* d3d12_command_list_SetSamplePositions() is not implemented. */
+ device->feature_options2.ProgrammableSamplePositionsTier = D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED;
+
+ device->feature_options3.CopyQueueTimestampQueriesSupported = FALSE;
+ device->feature_options3.CastingFullyTypedFormatSupported = FALSE;
+ device->feature_options3.WriteBufferImmediateSupportFlags = D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE;
+ device->feature_options3.ViewInstancingTier = D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED;
+ device->feature_options3.BarycentricsSupported = FALSE;
+
+ /* Alignment support can be tested later. */
+ device->feature_options4.MSAA64KBAlignedTextureSupported = FALSE;
+ device->feature_options4.SharedResourceCompatibilityTier = D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0;
+ device->feature_options4.Native16BitShaderOpsSupported = features->shaderInt16;
+
+ device->feature_options5.SRVOnlyTiledResourceTier3 = FALSE;
+ device->feature_options5.RenderPassesTier = D3D12_RENDER_PASS_TIER_0;
+ device->feature_options5.RaytracingTier = D3D12_RAYTRACING_TIER_NOT_SUPPORTED;
+
if ((vr = VK_CALL(vkEnumerateDeviceExtensionProperties(physical_device, NULL, &count, NULL))) < 0)
{
ERR("Failed to enumerate device extensions, vr %d.\n", vr);
@@ -1590,6 +1617,8 @@ static HRESULT d3d12_device_create_vkd3d_queues(struct d3d12_device *device,
else
goto out_destroy_queues;
+ device->feature_options3.CopyQueueTimestampQueriesSupported = !!device->copy_queue->timestamp_bits;
+
return S_OK;
out_destroy_queues:
@@ -2433,6 +2462,27 @@ bool d3d12_device_is_uma(struct d3d12_device *device, bool *coherent)
return true;
}
+static bool d3d12_is_64k_msaa_supported(struct d3d12_device *device)
+{
+ D3D12_RESOURCE_ALLOCATION_INFO info;
+ D3D12_RESOURCE_DESC resource_desc;
+
+ memset(&resource_desc, 0, sizeof(resource_desc));
+ resource_desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
+ resource_desc.Width = 1024;
+ resource_desc.Height = 1024;
+ resource_desc.DepthOrArraySize = 1;
+ resource_desc.MipLevels = 1;
+ resource_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ resource_desc.SampleDesc.Count = 4;
+ resource_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
+
+ /* FIXME: is some cases Vulkan requires 0x20000 or more for non-MSAA resources which must have
+ * 0x10000 in their description, so we might resonably return true here for 0x20000 or 0x40000. */
+ return SUCCEEDED(vkd3d_get_image_allocation_info(device, &resource_desc, &info))
+ && info.Alignment <= 0x10000;
+}
+
static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device *iface,
D3D12_FEATURE feature, void *feature_data, UINT feature_data_size)
{
@@ -2683,6 +2733,27 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device *
return S_OK;
}
+ case D3D12_FEATURE_D3D12_OPTIONS1:
+ {
+ D3D12_FEATURE_DATA_D3D12_OPTIONS1 *data = feature_data;
+
+ if (feature_data_size != sizeof(*data))
+ {
+ WARN("Invalid size %u.\n", feature_data_size);
+ return E_INVALIDARG;
+ }
+
+ *data = device->feature_options1;
+
+ TRACE("Wave ops %#x.\n", data->WaveOps);
+ TRACE("Min wave lane count %#x.\n", data->WaveLaneCountMin);
+ TRACE("Max wave lane count %#x.\n", data->WaveLaneCountMax);
+ TRACE("Total lane count %#x.\n", data->TotalLaneCount);
+ TRACE("Expanded compute resource states %#x.\n", data->ExpandedComputeResourceStates);
+ TRACE("Int64 shader ops %#x.\n", data->Int64ShaderOps);
+ return S_OK;
+ }
+
case D3D12_FEATURE_ROOT_SIGNATURE:
{
D3D12_FEATURE_DATA_ROOT_SIGNATURE *data = feature_data;
@@ -2700,6 +2771,211 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device *
return S_OK;
}
+ case D3D12_FEATURE_ARCHITECTURE1:
+ {
+ D3D12_FEATURE_DATA_ARCHITECTURE1 *data = feature_data;
+ bool coherent;
+
+ if (feature_data_size != sizeof(*data))
+ {
+ WARN("Invalid size %u.\n", feature_data_size);
+ return E_INVALIDARG;
+ }
+
+ if (data->NodeIndex)
+ {
+ FIXME("Multi-adapter not supported.\n");
+ return E_INVALIDARG;
+ }
+
+ WARN("Assuming device does not support tile based rendering.\n");
+ data->TileBasedRenderer = FALSE;
+
+ data->UMA = d3d12_device_is_uma(device, &coherent);
+ data->CacheCoherentUMA = data->UMA ? coherent : FALSE;
+
+ WARN("Assuming device does not have an isolated memory management unit.\n");
+ data->IsolatedMMU = FALSE;
+
+ TRACE("Tile based renderer %#x, UMA %#x, cache coherent UMA %#x, isolated MMU %#x.\n",
+ data->TileBasedRenderer, data->UMA, data->CacheCoherentUMA, data->IsolatedMMU);
+ return S_OK;
+ }
+
+ case D3D12_FEATURE_D3D12_OPTIONS2:
+ {
+ D3D12_FEATURE_DATA_D3D12_OPTIONS2 *data = feature_data;
+
+ if (feature_data_size != sizeof(*data))
+ {
+ WARN("Invalid size %u.\n", feature_data_size);
+ return E_INVALIDARG;
+ }
+
+ *data = device->feature_options2;
+
+ TRACE("Depth bounds test %#x.\n", data->DepthBoundsTestSupported);
+ TRACE("Programmable sample positions tier %#x.\n", data->ProgrammableSamplePositionsTier);
+ return S_OK;
+ }
+
+ case D3D12_FEATURE_SHADER_CACHE:
+ {
+ D3D12_FEATURE_DATA_SHADER_CACHE *data = feature_data;
+
+ if (feature_data_size != sizeof(*data))
+ {
+ WARN("Invalid size %u.\n", feature_data_size);
+ return E_INVALIDARG;
+ }
+
+ /* FIXME: The D3D12 documentation states that D3D12_SHADER_CACHE_SUPPORT_SINGLE_PSO is
+ * always supported, but the CachedPSO field of D3D12_GRAPHICS_PIPELINE_STATE_DESC is
+ * ignored and GetCachedBlob() is a stub. */
+ data->SupportFlags = D3D12_SHADER_CACHE_SUPPORT_NONE;
+
+ TRACE("Shader cache support %#x.\n", data->SupportFlags);
+ return S_OK;
+ }
+
+ case D3D12_FEATURE_COMMAND_QUEUE_PRIORITY:
+ {
+ D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY *data = feature_data;
+
+ if (feature_data_size != sizeof(*data))
+ {
+ WARN("Invalid size %u.\n", feature_data_size);
+ return E_INVALIDARG;
+ }
+
+ switch (data->CommandListType)
+ {
+ case D3D12_COMMAND_LIST_TYPE_DIRECT:
+ case D3D12_COMMAND_LIST_TYPE_COMPUTE:
+ case D3D12_COMMAND_LIST_TYPE_COPY:
+ data->PriorityForTypeIsSupported = FALSE;
+ TRACE("Command list type %#x, priority %u, supported %#x.\n",
+ data->CommandListType, data->Priority, data->PriorityForTypeIsSupported);
+ return S_OK;
+
+ default:
+ FIXME("Unhandled command list type %#x.\n", data->CommandListType);
+ return E_INVALIDARG;
+ }
+ }
+
+ case D3D12_FEATURE_D3D12_OPTIONS3:
+ {
+ D3D12_FEATURE_DATA_D3D12_OPTIONS3 *data = feature_data;
+
+ if (feature_data_size != sizeof(*data))
+ {
+ WARN("Invalid size %u.\n", feature_data_size);
+ return E_INVALIDARG;
+ }
+
+ *data = device->feature_options3;
+
+ TRACE("Copy queue timestamp queries %#x.\n", data->CopyQueueTimestampQueriesSupported);
+ TRACE("Casting fully typed format %#x.\n", data->CastingFullyTypedFormatSupported);
+ TRACE("Write buffer immediate %#x.\n", data->WriteBufferImmediateSupportFlags);
+ TRACE("View instancing tier %#x.\n", data->ViewInstancingTier);
+ TRACE("Barycentrics %#x.\n", data->BarycentricsSupported);
+ return S_OK;
+ }
+
+ case D3D12_FEATURE_EXISTING_HEAPS:
+ {
+ D3D12_FEATURE_DATA_EXISTING_HEAPS *data = feature_data;
+
+ if (feature_data_size != sizeof(*data))
+ {
+ WARN("Invalid size %u.\n", feature_data_size);
+ return E_INVALIDARG;
+ }
+
+ data->Supported = FALSE;
+
+ TRACE("Existing heaps %#x.\n", data->Supported);
+ return S_OK;
+ }
+
+ case D3D12_FEATURE_D3D12_OPTIONS4:
+ {
+ D3D12_FEATURE_DATA_D3D12_OPTIONS4 *data = feature_data;
+
+ if (feature_data_size != sizeof(*data))
+ {
+ WARN("Invalid size %u.\n", feature_data_size);
+ return E_INVALIDARG;
+ }
+
+ *data = device->feature_options4;
+ data->MSAA64KBAlignedTextureSupported = d3d12_is_64k_msaa_supported(device);
+
+ TRACE("64KB aligned MSAA textures %#x.\n", data->MSAA64KBAlignedTextureSupported);
+ TRACE("Shared resource compatibility tier %#x.\n", data->SharedResourceCompatibilityTier);
+ TRACE("Native 16-bit shader ops %#x.\n", data->Native16BitShaderOpsSupported);
+ return S_OK;
+ }
+
+ case D3D12_FEATURE_SERIALIZATION:
+ {
+ D3D12_FEATURE_DATA_SERIALIZATION *data = feature_data;
+
+ if (feature_data_size != sizeof(*data))
+ {
+ WARN("Invalid size %u.\n", feature_data_size);
+ return E_INVALIDARG;
+ }
+ if (data->NodeIndex)
+ {
+ FIXME("Multi-adapter not supported.\n");
+ return E_INVALIDARG;
+ }
+
+ data->HeapSerializationTier = D3D12_HEAP_SERIALIZATION_TIER_0;
+
+ TRACE("Heap serialization tier %#x.\n", data->HeapSerializationTier);
+ return S_OK;
+ }
+
+ case D3D12_FEATURE_CROSS_NODE:
+ {
+ D3D12_FEATURE_DATA_CROSS_NODE *data = feature_data;
+
+ if (feature_data_size != sizeof(*data))
+ {
+ WARN("Invalid size %u.\n", feature_data_size);
+ return E_INVALIDARG;
+ }
+
+ data->SharingTier = D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED;
+ data->AtomicShaderInstructions = FALSE;
+
+ TRACE("Cross node sharing tier %#x.\n", data->SharingTier);
+ TRACE("Cross node shader atomics %#x.\n", data->AtomicShaderInstructions);
+ return S_OK;
+ }
+
+ case D3D12_FEATURE_D3D12_OPTIONS5:
+ {
+ D3D12_FEATURE_DATA_D3D12_OPTIONS5 *data = feature_data;
+
+ if (feature_data_size != sizeof(*data))
+ {
+ WARN("Invalid size %u.\n", feature_data_size);
+ return E_INVALIDARG;
+ }
+
+ *data = device->feature_options5;
+
+ TRACE("SRV tiled resource tier 3 only %#x.\n", data->SRVOnlyTiledResourceTier3);
+ TRACE("Render pass tier %#x.\n", data->RenderPassesTier);
+ TRACE("Ray tracing tier %#x.\n", data->RaytracingTier);
+ return S_OK;
+ }
+
default:
FIXME("Unhandled feature %#x.\n", feature);
return E_NOTIMPL;
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index 9edf96e..7ba1db4 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -1086,6 +1086,11 @@ struct d3d12_device
PFN_vkd3d_memory_usage_callback pfn_memory_usage_callback;
D3D12_FEATURE_DATA_D3D12_OPTIONS feature_options;
+ D3D12_FEATURE_DATA_D3D12_OPTIONS1 feature_options1;
+ D3D12_FEATURE_DATA_D3D12_OPTIONS2 feature_options2;
+ D3D12_FEATURE_DATA_D3D12_OPTIONS3 feature_options3;
+ D3D12_FEATURE_DATA_D3D12_OPTIONS4 feature_options4;
+ D3D12_FEATURE_DATA_D3D12_OPTIONS5 feature_options5;
struct vkd3d_vulkan_info vk_info;
--
2.24.0
1
1