Module: vkd3d
Branch: master
Commit: a3319339e467beb2f03836842801e9c59eb3f988
URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/a3319339e467beb2f03836842801e…
Author: Francisco Casas <fcasas(a)codeweavers.com>
Date: Wed Feb 21 16:36:43 2024 -0300
vkd3d-shader/hlsl: Lower casts to int using REINTERPRET instead.
I realized that it is better to lower casts to int to FLOOR+REINTERPET
instead of appending a FLOOR to all casts to int and assuming that this
is the case for all of them in d3dbc.c.
This in case we introduce new passes in the future that add casts that
we forget to lower, after the lower_casts_to_bool pass.
---
libs/vkd3d-shader/d3dbc.c | 11 ++++++++++-
libs/vkd3d-shader/hlsl_codegen.c | 15 +++++++--------
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c
index a697a2a8..0f5d34ee 100644
--- a/libs/vkd3d-shader/d3dbc.c
+++ b/libs/vkd3d-shader/d3dbc.c
@@ -2002,7 +2002,10 @@ static void write_sm1_cast(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
{
case HLSL_TYPE_HALF:
case HLSL_TYPE_FLOAT:
- /* A compilation pass applies a FLOOR operation to casts to int, so no change is necessary. */
+ /* A compilation pass turns these into FLOOR+REINTERPRET, so we should not
+ * reach this case unless we are missing something. */
+ hlsl_fixme(ctx, &instr->loc, "Unlowered SM1 cast from float to integer.");
+ break;
case HLSL_TYPE_INT:
case HLSL_TYPE_UINT:
write_sm1_unary_op(ctx, buffer, D3DSIO_MOV, &instr->reg, &arg1->reg, 0, 0);
@@ -2242,6 +2245,12 @@ static void write_sm1_expr(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
assert(instr->reg.allocated);
+ if (expr->op == HLSL_OP1_REINTERPRET)
+ {
+ write_sm1_unary_op(ctx, buffer, D3DSIO_MOV, &instr->reg, &arg1->reg, 0, 0);
+ return;
+ }
+
if (expr->op == HLSL_OP1_CAST)
{
write_sm1_cast(ctx, buffer, instr);
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
index e7fc02d0..413888d8 100644
--- a/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d-shader/hlsl_codegen.c
@@ -2647,10 +2647,11 @@ static bool sort_synthetic_separated_samplers_first(struct hlsl_ctx *ctx)
return false;
}
-/* Append a FLOOR before a CAST to int or uint (which is written as a mere MOV). */
+/* Turn CAST to int or uint into FLOOR + REINTERPRET (which is written as a mere MOV). */
static bool lower_casts_to_int(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
{
- struct hlsl_ir_node *arg, *floor, *cast2;
+ struct hlsl_ir_node *operands[HLSL_MAX_OPERANDS] = { 0 };
+ struct hlsl_ir_node *arg, *floor, *res;
struct hlsl_ir_expr *expr;
if (instr->type != HLSL_IR_EXPR)
@@ -2665,17 +2666,15 @@ static bool lower_casts_to_int(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
if (arg->data_type->base_type != HLSL_TYPE_FLOAT && arg->data_type->base_type != HLSL_TYPE_HALF)
return false;
- /* Check that the argument is not already a FLOOR */
- if (arg->type == HLSL_IR_EXPR && hlsl_ir_expr(arg)->op == HLSL_OP1_FLOOR)
- return false;
-
if (!(floor = hlsl_new_unary_expr(ctx, HLSL_OP1_FLOOR, arg, &instr->loc)))
return false;
hlsl_block_add_instr(block, floor);
- if (!(cast2 = hlsl_new_cast(ctx, floor, instr->data_type, &instr->loc)))
+ memset(operands, 0, sizeof(operands));
+ operands[0] = floor;
+ if (!(res = hlsl_new_expr(ctx, HLSL_OP1_REINTERPRET, operands, instr->data_type, &instr->loc)))
return false;
- hlsl_block_add_instr(block, cast2);
+ hlsl_block_add_instr(block, res);
return true;
}
Module: wine
Branch: master
Commit: 4f80a599b66c4f7ea0e35971c89672b64d9b0fa7
URL: https://gitlab.winehq.org/wine/wine/-/commit/4f80a599b66c4f7ea0e35971c89672…
Author: Eric Pouech <epouech(a)codeweavers.com>
Date: Wed Jan 17 16:04:14 2024 +0100
dbghelp: Mimic native behavior for module name.
Module names appear in three spots in dbghelp:
A) SymGetModuleInfo() .ModuleName
B) module enumeration (as parameter in callback)
C) in symbol/type research in module!name form
Tests show that:
- A) and B) always use only the derivation of the image
name, whatever the passed module name in SymLoadModule().
- C) can use either the form derived from image name
{as A) and B)}, but also the passed module name in
SymLoadModule().
Note: B) is limited to 64 characters, while A) is limited to 32
characters (not tested here).
Signed-off-by: Eric Pouech <epouech(a)codeweavers.com>
---
dlls/dbghelp/dbghelp_private.h | 1 +
dlls/dbghelp/module.c | 8 ++++----
dlls/dbghelp/tests/path.c | 2 --
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index b3a073ff41f..628cb1e6442 100644
--- a/dlls/dbghelp/dbghelp_private.h
+++ b/dlls/dbghelp/dbghelp_private.h
@@ -438,6 +438,7 @@ struct module
struct process* process;
IMAGEHLP_MODULEW64 module;
WCHAR modulename[64]; /* used for enumeration */
+ WCHAR* alt_modulename; /* used in symbol lookup */
struct module* next;
enum dhext_module_type type : 16;
unsigned short is_virtual : 1,
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c
index 2507e65e169..a0de4f65056 100644
--- a/dlls/dbghelp/module.c
+++ b/dlls/dbghelp/module.c
@@ -210,6 +210,7 @@ struct module* module_new(struct process* pcs, const WCHAR* name,
module->module.BaseOfImage = mod_addr;
module->module.ImageSize = size;
module_set_module(module, name);
+ module->alt_modulename = NULL;
module->module.ImageName[0] = '\0';
lstrcpynW(module->module.LoadedImageName, name, ARRAY_SIZE(module->module.LoadedImageName));
module->module.SymType = SymDeferred;
@@ -288,6 +289,7 @@ struct module* module_find_by_nameW(const struct process* pcs, const WCHAR* name
for (module = pcs->lmodules; module; module = module->next)
{
if (!wcsicmp(name, module->modulename)) return module;
+ if (module->alt_modulename && !wcsicmp(name, module->alt_modulename)) return module;
}
SetLastError(ERROR_INVALID_NAME);
return NULL;
@@ -995,11 +997,9 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
}
}
- /* by default module_new fills module.ModuleName from a derivation
- * of LoadedImageName. Overwrite it, if we have better information
- */
+ /* Store alternate name for module when provided. */
if (wModuleName)
- module_set_module(module, wModuleName);
+ module->alt_modulename = pool_wcsdup(&module->pool, wModuleName);
if (wImageName)
lstrcpynW(module->module.ImageName, wImageName, ARRAY_SIZE(module->module.ImageName));
diff --git a/dlls/dbghelp/tests/path.c b/dlls/dbghelp/tests/path.c
index 45b71ed4718..fc9a2e13bf9 100644
--- a/dlls/dbghelp/tests/path.c
+++ b/dlls/dbghelp/tests/path.c
@@ -1789,7 +1789,6 @@ static void test_load_modules_details(void)
}
else
expected_module_name[0] = L'\0';
- todo_wine_if(i >= 2)
ok(!wcsicmp(im.ModuleName, expected_module_name), "Unexpected module name '%ls'\n", im.ModuleName);
ok(!wcsicmp(im.ImageName, test->in_image_name ? test->in_image_name : L""), "Unexpected image name '%ls'\n", im.ImageName);
if ((test->options & SYMOPT_DEFERRED_LOADS) || !test->in_image_name)
@@ -1853,7 +1852,6 @@ static void test_load_modules_details(void)
ret = SymEnumerateModulesW64(dummy, aggregate_module_details_cb, &md);
ok(ret, "SymEnumerateModules64 failed: %lu\n", GetLastError());
ok(md.count == 1, "Unexpected module count %u\n", md.count);
- todo_wine_if(i >= 2)
ok(!wcscmp(md.name, expected_module_name), "Unexpected module name %ls\n", md.name);
free(md.name);
/* native will fail loading symbol in deferred state, so force loading of debug symbols */
Module: wine
Branch: master
Commit: d6d22677da3f60c6769a7a85897493772477207f
URL: https://gitlab.winehq.org/wine/wine/-/commit/d6d22677da3f60c6769a7a85897493…
Author: Eric Pouech <epouech(a)codeweavers.com>
Date: Mon Dec 18 12:59:22 2023 +0100
dbghelp: Change order when trying to load modules.
Change from: dll.so > PE image > ELF/Mach-O images
into PE image > dll.so > ELF/Mach-O images
Main goal is in SymLoadModule*(), to not resynchronize the system
modules list when requesting loading of a PE image.
This can gain quite some time in some situations.
Signed-off-by: Eric Pouech <epouech(a)codeweavers.com>
---
dlls/dbghelp/module.c | 47 ++++++++++++++++++++++++++---------------------
1 file changed, 26 insertions(+), 21 deletions(-)
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c
index f21733c7be9..2507e65e169 100644
--- a/dlls/dbghelp/module.c
+++ b/dlls/dbghelp/module.c
@@ -956,10 +956,12 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
}
}
- pcs->loader->synchronize_module_list(pcs);
-
/* this is a Wine extension to the API just to redo the synchronisation */
- if (!wImageName && !hFile) return 0;
+ if (!wImageName && !hFile)
+ {
+ pcs->loader->synchronize_module_list(pcs);
+ return 0;
+ }
if (Flags & SLMFLAG_VIRTUAL)
{
@@ -968,28 +970,31 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
if (!module) return 0;
module->module.SymType = SymVirtual;
}
- /* check if it's a builtin PE module with a containing ELF module */
- else if (wImageName && module_is_container_loaded(pcs, wImageName, BaseOfDll))
- {
- /* force the loading of DLL as builtin */
- module = pe_load_builtin_module(pcs, wImageName, BaseOfDll, SizeOfDll);
- }
- if (!module)
+ else
{
- /* otherwise, try a regular PE module */
- if (!(module = pe_load_native_module(pcs, wImageName, hFile, BaseOfDll, SizeOfDll)) &&
- wImageName)
+ /* try PE image */
+ module = pe_load_native_module(pcs, wImageName, hFile, BaseOfDll, SizeOfDll);
+ if (!module && wImageName)
{
- /* and finally an ELF or Mach-O module */
- module = pcs->loader->load_module(pcs, wImageName, BaseOfDll);
+ /* It could be either a dll.so file (for which we need the corresponding
+ * system module) or a system module.
+ * In both cases, ensure system module list is up-to-date.
+ */
+ pcs->loader->synchronize_module_list(pcs);
+ if (module_is_container_loaded(pcs, wImageName, BaseOfDll))
+ module = pe_load_builtin_module(pcs, wImageName, BaseOfDll, SizeOfDll);
+ /* at last, try ELF or Mach-O module */
+ if (!module)
+ module = pcs->loader->load_module(pcs, wImageName, BaseOfDll);
+ }
+ if (!module)
+ {
+ WARN("Couldn't locate %s\n", debugstr_w(wImageName));
+ SetLastError(ERROR_NO_MORE_FILES);
+ return 0;
}
}
- if (!module)
- {
- WARN("Couldn't locate %s\n", debugstr_w(wImageName));
- SetLastError(ERROR_NO_MORE_FILES);
- return 0;
- }
+
/* by default module_new fills module.ModuleName from a derivation
* of LoadedImageName. Overwrite it, if we have better information
*/
Module: wine
Branch: master
Commit: 0e3dba2a7ae7de844908647907eeefa0ca64b67c
URL: https://gitlab.winehq.org/wine/wine/-/commit/0e3dba2a7ae7de844908647907eeef…
Author: Eric Pouech <epouech(a)codeweavers.com>
Date: Sat Feb 24 09:19:38 2024 +0100
dbghelp: Relax failure conditions.
dbghelp tests build PDB files, without hash table in TPI stream,
but also no types. Native is able to load these PDB files.
So, don't fail when loading a PDB without a TPI hash table and
without any types.
Signed-off-by: Eric Pouech <epouech(a)codeweavers.com>
---
dlls/dbghelp/msc.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c
index 4d310cd0f21..aeaa55cc713 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/dbghelp/msc.c
@@ -3351,12 +3351,14 @@ static BOOL pdb_init_type_parse(const struct msc_debug_info* msc_dbg,
ERR("-Unsupported hash of size %u\n", ctp->header.hash_value_size);
return FALSE;
}
- ctp->hash_stream = pdb_read_stream(pdb_file, ctp->header.hash_stream);
- /* FIXME always present? if not reconstruct ?*/
- if (!ctp->hash_stream)
+ if (!(ctp->hash_stream = pdb_read_stream(pdb_file, ctp->header.hash_stream)))
{
- ERR("-Missing hash table in PDB file\n");
- return FALSE;
+ if (ctp->header.last_index > ctp->header.first_index)
+ {
+ /* may be reconstruct hash table ? */
+ FIXME("-No hash table, while types exist\n");
+ return FALSE;
+ }
}
ctp->module = msc_dbg->module;
@@ -3388,7 +3390,7 @@ static BOOL pdb_init_type_parse(const struct msc_debug_info* msc_dbg,
/* parse the remap table
* => move listed type_id at first position of their hash buckets so that we force remap to them
*/
- if (ctp->header.type_remap_size)
+ if (ctp->hash_stream && ctp->header.type_remap_size)
{
const unsigned* remap = (const unsigned*)((const BYTE*)ctp->hash_stream + ctp->header.type_remap_offset);
unsigned i, capa, count_present;