wined3d: Explicitly pass the byte-code format to shader creation functions (AFL).
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7840485ac2
commit
7ad37a64b1
|
@ -77,6 +77,7 @@ static HRESULT shdr_handler(const char *data, DWORD data_size, DWORD tag, void *
|
|||
FIXME("Multiple shader code chunks.\n");
|
||||
desc->byte_code = (const DWORD *)data;
|
||||
desc->byte_code_size = data_size;
|
||||
desc->format = WINED3D_SHADER_BYTE_CODE_FORMAT_SM4;
|
||||
break;
|
||||
|
||||
case TAG_AON9:
|
||||
|
@ -105,6 +106,7 @@ static HRESULT shdr_handler(const char *data, DWORD data_size, DWORD tag, void *
|
|||
FIXME("Multiple shader code chunks.\n");
|
||||
desc->byte_code = (const DWORD *)byte_code;
|
||||
desc->byte_code_size = data_size - header->byte_code_offset;
|
||||
desc->format = WINED3D_SHADER_BYTE_CODE_FORMAT_SM1;
|
||||
TRACE("Feature level 9 shader version 0%08x, 0%08x.\n", header->shader_version, *desc->byte_code);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -118,6 +118,7 @@ HRESULT d3d8_vertex_shader_init(struct d3d8_vertex_shader *shader, struct d3d8_d
|
|||
|
||||
desc.byte_code = byte_code;
|
||||
desc.byte_code_size = ~(size_t)0;
|
||||
desc.format = WINED3D_SHADER_BYTE_CODE_FORMAT_SM1;
|
||||
desc.input_signature.element_count = 0;
|
||||
desc.output_signature.element_count = 0;
|
||||
desc.max_version = 1;
|
||||
|
@ -168,6 +169,7 @@ HRESULT d3d8_pixel_shader_init(struct d3d8_pixel_shader *shader, struct d3d8_dev
|
|||
|
||||
desc.byte_code = byte_code;
|
||||
desc.byte_code_size = ~(size_t)0;
|
||||
desc.format = WINED3D_SHADER_BYTE_CODE_FORMAT_SM1;
|
||||
desc.input_signature.element_count = 0;
|
||||
desc.output_signature.element_count = 0;
|
||||
desc.max_version = 1;
|
||||
|
|
|
@ -144,6 +144,7 @@ HRESULT vertexshader_init(struct d3d9_vertexshader *shader, struct d3d9_device *
|
|||
|
||||
desc.byte_code = byte_code;
|
||||
desc.byte_code_size = ~(size_t)0;
|
||||
desc.format = WINED3D_SHADER_BYTE_CODE_FORMAT_SM1;
|
||||
desc.input_signature.element_count = 0;
|
||||
desc.output_signature.element_count = 0;
|
||||
desc.max_version = 3;
|
||||
|
@ -296,6 +297,7 @@ HRESULT pixelshader_init(struct d3d9_pixelshader *shader, struct d3d9_device *de
|
|||
|
||||
desc.byte_code = byte_code;
|
||||
desc.byte_code_size = ~(size_t)0;
|
||||
desc.format = WINED3D_SHADER_BYTE_CODE_FORMAT_SM1;
|
||||
desc.input_signature.element_count = 0;
|
||||
desc.output_signature.element_count = 0;
|
||||
desc.max_version = 3;
|
||||
|
|
|
@ -392,24 +392,18 @@ static void shader_signature_from_usage(struct wined3d_shader_signature_element
|
|||
e->mask = write_mask;
|
||||
}
|
||||
|
||||
static const struct wined3d_shader_frontend *shader_select_frontend(DWORD version_token)
|
||||
static const struct wined3d_shader_frontend *shader_select_frontend(enum wined3d_shader_byte_code_format format)
|
||||
{
|
||||
switch (version_token >> 16)
|
||||
switch (format)
|
||||
{
|
||||
case WINED3D_SM1_VS:
|
||||
case WINED3D_SM1_PS:
|
||||
case WINED3D_SHADER_BYTE_CODE_FORMAT_SM1:
|
||||
return &sm1_shader_frontend;
|
||||
|
||||
case WINED3D_SM4_PS:
|
||||
case WINED3D_SM4_VS:
|
||||
case WINED3D_SM4_GS:
|
||||
case WINED3D_SM5_HS:
|
||||
case WINED3D_SM5_DS:
|
||||
case WINED3D_SM5_CS:
|
||||
case WINED3D_SHADER_BYTE_CODE_FORMAT_SM4:
|
||||
return &sm4_shader_frontend;
|
||||
|
||||
default:
|
||||
FIXME("Unrecognised version token %#x.\n", version_token);
|
||||
WARN("Invalid byte code format %#x specified.\n", format);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -2854,7 +2848,8 @@ const struct wined3d_shader_backend_ops none_shader_backend =
|
|||
};
|
||||
|
||||
static HRESULT shader_set_function(struct wined3d_shader *shader, const DWORD *byte_code,
|
||||
size_t byte_code_size, DWORD float_const_count, enum wined3d_shader_type type, unsigned int max_version)
|
||||
size_t byte_code_size, enum wined3d_shader_byte_code_format format,
|
||||
DWORD float_const_count, enum wined3d_shader_type type, unsigned int max_version)
|
||||
{
|
||||
struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps;
|
||||
const struct wined3d_shader_frontend *fe;
|
||||
|
@ -2862,8 +2857,9 @@ static HRESULT shader_set_function(struct wined3d_shader *shader, const DWORD *b
|
|||
unsigned int backend_version;
|
||||
const struct wined3d_d3d_info *d3d_info = &shader->device->adapter->d3d_info;
|
||||
|
||||
TRACE("shader %p, byte_code %p, byte_code_size %#lx, float_const_count %u, type %#x, max_version %u.\n",
|
||||
shader, byte_code, (long)byte_code_size, float_const_count, type, max_version);
|
||||
TRACE("shader %p, byte_code %p, byte_code_size %#lx, format %#x, "
|
||||
"float_const_count %u, type %#x, max_version %u.\n",
|
||||
shader, byte_code, (long)byte_code_size, format, float_const_count, type, max_version);
|
||||
|
||||
list_init(&shader->constantsF);
|
||||
list_init(&shader->constantsB);
|
||||
|
@ -2871,8 +2867,7 @@ static HRESULT shader_set_function(struct wined3d_shader *shader, const DWORD *b
|
|||
shader->lconst_inf_or_nan = FALSE;
|
||||
list_init(®_maps->indexable_temps);
|
||||
|
||||
fe = shader_select_frontend(*byte_code);
|
||||
if (!fe)
|
||||
if (!(fe = shader_select_frontend(format)))
|
||||
{
|
||||
FIXME("Unable to find frontend for shader.\n");
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
@ -3192,8 +3187,8 @@ static HRESULT shader_init(struct wined3d_shader *shader, struct wined3d_device
|
|||
list_init(&shader->linked_programs);
|
||||
list_add_head(&device->shaders, &shader->shader_list_entry);
|
||||
|
||||
if (FAILED(hr = shader_set_function(shader, desc->byte_code,
|
||||
desc->byte_code_size, float_const_count, type, desc->max_version)))
|
||||
if (FAILED(hr = shader_set_function(shader, desc->byte_code, desc->byte_code_size,
|
||||
desc->format, float_const_count, type, desc->max_version)))
|
||||
{
|
||||
WARN("Failed to set function, hr %#x.\n", hr);
|
||||
shader_cleanup(shader);
|
||||
|
|
|
@ -800,6 +800,12 @@ enum wined3d_display_rotation
|
|||
WINED3D_DISPLAY_ROTATION_270 = 4,
|
||||
};
|
||||
|
||||
enum wined3d_shader_byte_code_format
|
||||
{
|
||||
WINED3D_SHADER_BYTE_CODE_FORMAT_SM1 = 0,
|
||||
WINED3D_SHADER_BYTE_CODE_FORMAT_SM4 = 1,
|
||||
};
|
||||
|
||||
#define WINED3DCOLORWRITEENABLE_RED (1u << 0)
|
||||
#define WINED3DCOLORWRITEENABLE_GREEN (1u << 1)
|
||||
#define WINED3DCOLORWRITEENABLE_BLUE (1u << 2)
|
||||
|
@ -1960,6 +1966,7 @@ struct wined3d_shader_desc
|
|||
{
|
||||
const DWORD *byte_code;
|
||||
size_t byte_code_size;
|
||||
enum wined3d_shader_byte_code_format format;
|
||||
struct wined3d_shader_signature input_signature;
|
||||
struct wined3d_shader_signature output_signature;
|
||||
unsigned int max_version;
|
||||
|
|
Loading…
Reference in New Issue