Skip to content
Snippets Groups Projects

Compare revisions

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

Source

Select target project
No results found

Target

Select target project
  • wine/vkd3d
  • stefan/vkd3d
  • cmccarthy/vkd3d
  • giomasce/vkd3d
  • fcasas/vkd3d
  • jactry/vkd3d
  • ReDress/vkd3d
  • mstorsjo/vkd3d
  • huw/vkd3d
  • julliard/vkd3d
  • bshanks/vkd3d
  • zfigura/vkd3d
  • hverbeet/vkd3d
  • DarkShadow44/vkd3d
  • nsivov/vkd3d
  • dhary686/vkd3d
  • Mystral/vkd3d
  • maljaf/vkd3d
  • smcv/vkd3d
  • flibitijibibo/vkd3d
  • q4a/vkd3d
  • jsikorski/vkd3d
  • alesliehughes/vkd3d-alesliehughes
  • vitorhnn/vkd3d
  • agusev/vkd3d
  • etang-cw/vkd3d
  • petrathekat/vkd3d
  • simon.mr995/vkd3d
  • sgwaki/vkd3d
  • jacek/vkd3d
  • fweimer/vkd3d
  • Clara/vkd3d
  • disini/vkd3d
  • antenabr2/vkd3d
  • gilvbp/vkd3d
  • yshui/vkd3d
  • shaunren/vkd3d
  • jennetsaryyewa96/vkd3d
  • Jamesattay/vkd3d
  • zacemmneeto77/vkd3d
  • GermanAizek/vkd3d
  • opespinach/vkd3d
  • ruslanboyka201/vkd3d
  • navi/vkd3d
  • Feifan/vkd3d
  • yashmhmdly172/vkd3d
  • Sec32fun32/vkd3d
  • ritalat/vkd3d
  • ivyl/vkd3d
  • baikaishiuc/vkd3d
  • austin987/vkd3d
  • TornadoCookie/vkd3d
52 results
Show changes
Commits on Source (2)
  • Giovanni Mascellani's avatar
    vkd3d-shader: Expose the whole profile when dumping an HLSL shader. · ab09c0b4
    Giovanni Mascellani authored and Alexandre Julliard's avatar Alexandre Julliard committed
    The profile cannot be reliably devised by analyzing the HLSL code,
    so it's useful to have it included in the file name.
    ab09c0b4
  • Giovanni Mascellani's avatar
    vkd3d-shader: Dump shaders as soon as possible. · dd96fe50
    Giovanni Mascellani authored and Alexandre Julliard's avatar Alexandre Julliard committed
    So that they are dumped even if parsing fails, which is a circumstance
    in which one likely wants to see the problematic shader.
    
    The downside of that is that for shader types other than HLSL
    the profile is not written any more in the filename. This should
    not be a big problem, because in those cases the shader describes
    its own type.
    
    When dumping an HLSL shader, the id is brought in front of the profile
    in the file name, in order to make it more tab-friendly: when dealing
    with a directory full of shaders it's likely that the id determines
    the profile, but the other way around.
    dd96fe50
...@@ -3260,7 +3260,7 @@ unsigned int hlsl_combine_swizzles(unsigned int first, unsigned int second, unsi ...@@ -3260,7 +3260,7 @@ unsigned int hlsl_combine_swizzles(unsigned int first, unsigned int second, unsi
return ret; return ret;
} }
static const struct hlsl_profile_info *get_target_info(const char *target) const struct hlsl_profile_info *hlsl_get_target_info(const char *target)
{ {
unsigned int i; unsigned int i;
...@@ -3627,14 +3627,12 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d ...@@ -3627,14 +3627,12 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
} }
entry_point = hlsl_source_info->entry_point ? hlsl_source_info->entry_point : "main"; entry_point = hlsl_source_info->entry_point ? hlsl_source_info->entry_point : "main";
if (!(profile = get_target_info(hlsl_source_info->profile))) if (!(profile = hlsl_get_target_info(hlsl_source_info->profile)))
{ {
FIXME("Unknown compilation target %s.\n", debugstr_a(hlsl_source_info->profile)); FIXME("Unknown compilation target %s.\n", debugstr_a(hlsl_source_info->profile));
return VKD3D_ERROR_NOT_IMPLEMENTED; return VKD3D_ERROR_NOT_IMPLEMENTED;
} }
vkd3d_shader_dump_shader(compile_info->source_type, profile->type, &compile_info->source);
if (compile_info->target_type == VKD3D_SHADER_TARGET_D3D_BYTECODE && profile->major_version > 3) if (compile_info->target_type == VKD3D_SHADER_TARGET_D3D_BYTECODE && profile->major_version > 3)
{ {
vkd3d_shader_error(message_context, NULL, VKD3D_SHADER_ERROR_HLSL_INCOMPATIBLE_PROFILE, vkd3d_shader_error(message_context, NULL, VKD3D_SHADER_ERROR_HLSL_INCOMPATIBLE_PROFILE,
......
...@@ -1169,6 +1169,7 @@ void hlsl_free_var(struct hlsl_ir_var *decl); ...@@ -1169,6 +1169,7 @@ void hlsl_free_var(struct hlsl_ir_var *decl);
struct hlsl_ir_function *hlsl_get_function(struct hlsl_ctx *ctx, const char *name); struct hlsl_ir_function *hlsl_get_function(struct hlsl_ctx *ctx, const char *name);
struct hlsl_ir_function_decl *hlsl_get_func_decl(struct hlsl_ctx *ctx, const char *name); struct hlsl_ir_function_decl *hlsl_get_func_decl(struct hlsl_ctx *ctx, const char *name);
const struct hlsl_profile_info *hlsl_get_target_info(const char *target);
struct hlsl_type *hlsl_get_type(struct hlsl_scope *scope, const char *name, bool recursive, bool case_insensitive); struct hlsl_type *hlsl_get_type(struct hlsl_scope *scope, const char *name, bool recursive, bool case_insensitive);
struct hlsl_ir_var *hlsl_get_var(struct hlsl_scope *scope, const char *name); struct hlsl_ir_var *hlsl_get_var(struct hlsl_scope *scope, const char *name);
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "vkd3d_shader_private.h" #include "vkd3d_shader_private.h"
#include "vkd3d_version.h" #include "vkd3d_version.h"
#include "hlsl.h"
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
...@@ -381,7 +382,7 @@ void set_u32(struct vkd3d_bytecode_buffer *buffer, size_t offset, uint32_t value ...@@ -381,7 +382,7 @@ void set_u32(struct vkd3d_bytecode_buffer *buffer, size_t offset, uint32_t value
memcpy(buffer->data + offset, &value, sizeof(value)); memcpy(buffer->data + offset, &value, sizeof(value));
} }
static void vkd3d_shader_dump_blob(const char *path, const char *prefix, static void vkd3d_shader_dump_blob(const char *path, const char *profile,
const char *suffix, const void *data, size_t size) const char *suffix, const void *data, size_t size)
{ {
static LONG shader_id = 0; static LONG shader_id = 0;
...@@ -391,7 +392,10 @@ static void vkd3d_shader_dump_blob(const char *path, const char *prefix, ...@@ -391,7 +392,10 @@ static void vkd3d_shader_dump_blob(const char *path, const char *prefix,
id = InterlockedIncrement(&shader_id) - 1; id = InterlockedIncrement(&shader_id) - 1;
snprintf(filename, ARRAY_SIZE(filename), "%s/vkd3d-shader-%s-%u.%s", path, prefix, id, suffix); if (profile)
snprintf(filename, ARRAY_SIZE(filename), "%s/vkd3d-shader-%u-%s.%s", path, id, profile, suffix);
else
snprintf(filename, ARRAY_SIZE(filename), "%s/vkd3d-shader-%u.%s", path, id, suffix);
if ((f = fopen(filename, "wb"))) if ((f = fopen(filename, "wb")))
{ {
if (fwrite(data, 1, size, f) != size) if (fwrite(data, 1, size, f) != size)
...@@ -423,9 +427,12 @@ static const char *shader_get_source_type_suffix(enum vkd3d_shader_source_type t ...@@ -423,9 +427,12 @@ static const char *shader_get_source_type_suffix(enum vkd3d_shader_source_type t
} }
} }
void vkd3d_shader_dump_shader(enum vkd3d_shader_source_type source_type, void vkd3d_shader_dump_shader(const struct vkd3d_shader_compile_info *compile_info)
enum vkd3d_shader_type shader_type, const struct vkd3d_shader_code *shader)
{ {
const struct vkd3d_shader_code *shader = &compile_info->source;
const struct vkd3d_shader_hlsl_source_info *hlsl_source_info;
const struct hlsl_profile_info *profile;
const char *profile_name = NULL;
static bool enabled = true; static bool enabled = true;
const char *path; const char *path;
...@@ -438,8 +445,19 @@ void vkd3d_shader_dump_shader(enum vkd3d_shader_source_type source_type, ...@@ -438,8 +445,19 @@ void vkd3d_shader_dump_shader(enum vkd3d_shader_source_type source_type,
return; return;
} }
vkd3d_shader_dump_blob(path, shader_get_type_prefix(shader_type), if (compile_info->source_type == VKD3D_SHADER_SOURCE_HLSL)
shader_get_source_type_suffix(source_type), shader->code, shader->size); {
if (!(hlsl_source_info = vkd3d_find_struct(compile_info->next, HLSL_SOURCE_INFO)))
return;
if (!(profile = hlsl_get_target_info(hlsl_source_info->profile)))
return;
profile_name = profile->name;
}
vkd3d_shader_dump_blob(path, profile_name, shader_get_source_type_suffix(compile_info->source_type),
shader->code, shader->size);
} }
static void init_scan_signature_info(const struct vkd3d_shader_compile_info *info) static void init_scan_signature_info(const struct vkd3d_shader_compile_info *info)
...@@ -1307,6 +1325,8 @@ int vkd3d_shader_scan(const struct vkd3d_shader_compile_info *compile_info, char ...@@ -1307,6 +1325,8 @@ int vkd3d_shader_scan(const struct vkd3d_shader_compile_info *compile_info, char
vkd3d_shader_message_context_init(&message_context, compile_info->log_level); vkd3d_shader_message_context_init(&message_context, compile_info->log_level);
vkd3d_shader_dump_shader(compile_info);
switch (compile_info->source_type) switch (compile_info->source_type)
{ {
case VKD3D_SHADER_SOURCE_DXBC_TPF: case VKD3D_SHADER_SOURCE_DXBC_TPF:
...@@ -1348,8 +1368,6 @@ static int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser, ...@@ -1348,8 +1368,6 @@ static int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser,
struct vkd3d_shader_compile_info scan_info; struct vkd3d_shader_compile_info scan_info;
int ret; int ret;
vkd3d_shader_dump_shader(compile_info->source_type, parser->shader_version.type, &compile_info->source);
scan_info = *compile_info; scan_info = *compile_info;
if ((ret = scan_with_parser(&scan_info, message_context, &scan_descriptor_info, parser)) < 0) if ((ret = scan_with_parser(&scan_info, message_context, &scan_descriptor_info, parser)) < 0)
...@@ -1433,8 +1451,6 @@ static int compile_d3d_bytecode(const struct vkd3d_shader_compile_info *compile_ ...@@ -1433,8 +1451,6 @@ static int compile_d3d_bytecode(const struct vkd3d_shader_compile_info *compile_
return ret; return ret;
} }
vkd3d_shader_dump_shader(compile_info->source_type, parser->shader_version.type, &compile_info->source);
if (compile_info->target_type == VKD3D_SHADER_TARGET_D3D_ASM) if (compile_info->target_type == VKD3D_SHADER_TARGET_D3D_ASM)
{ {
ret = vkd3d_dxbc_binary_to_text(&parser->instructions, &parser->shader_version, compile_info, out); ret = vkd3d_dxbc_binary_to_text(&parser->instructions, &parser->shader_version, compile_info, out);
...@@ -1481,6 +1497,8 @@ int vkd3d_shader_compile(const struct vkd3d_shader_compile_info *compile_info, ...@@ -1481,6 +1497,8 @@ int vkd3d_shader_compile(const struct vkd3d_shader_compile_info *compile_info,
vkd3d_shader_message_context_init(&message_context, compile_info->log_level); vkd3d_shader_message_context_init(&message_context, compile_info->log_level);
vkd3d_shader_dump_shader(compile_info);
switch (compile_info->source_type) switch (compile_info->source_type)
{ {
case VKD3D_SHADER_SOURCE_DXBC_TPF: case VKD3D_SHADER_SOURCE_DXBC_TPF:
......
...@@ -1324,8 +1324,7 @@ void vkd3d_shader_vnote(struct vkd3d_shader_message_context *context, const stru ...@@ -1324,8 +1324,7 @@ void vkd3d_shader_vnote(struct vkd3d_shader_message_context *context, const stru
void vkd3d_shader_vwarning(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location, void vkd3d_shader_vwarning(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
enum vkd3d_shader_error error, const char *format, va_list args); enum vkd3d_shader_error error, const char *format, va_list args);
void vkd3d_shader_dump_shader(enum vkd3d_shader_source_type source_type, void vkd3d_shader_dump_shader(const struct vkd3d_shader_compile_info *compile_info);
enum vkd3d_shader_type shader_type, const struct vkd3d_shader_code *shader);
void vkd3d_shader_trace_text_(const char *text, size_t size, const char *function); void vkd3d_shader_trace_text_(const char *text, size_t size, const char *function);
#define vkd3d_shader_trace_text(text, size) \ #define vkd3d_shader_trace_text(text, size) \
vkd3d_shader_trace_text_(text, size, __FUNCTION__) vkd3d_shader_trace_text_(text, size, __FUNCTION__)
......