Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
12f5887a
Commit
12f5887a
authored
Feb 21, 2017
by
Henri Verbeet
Committed by
Alexandre Julliard
Feb 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Parse the shader version in shader_sm4_init().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
60c98caa
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
69 deletions
+66
-69
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+2
-4
glsl_shader.c
dlls/wined3d/glsl_shader.c
+4
-8
shader.c
dlls/wined3d/shader.c
+8
-8
shader_sm1.c
dlls/wined3d/shader_sm1.c
+8
-6
shader_sm4.c
dlls/wined3d/shader_sm4.c
+43
-42
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-1
No files found.
dlls/wined3d/arb_program_shader.c
View file @
12f5887a
...
...
@@ -3510,7 +3510,6 @@ static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader,
const
struct
arb_ps_compile_args
*
args
,
struct
arb_ps_compiled_shader
*
compiled
)
{
const
struct
wined3d_shader_reg_maps
*
reg_maps
=
&
shader
->
reg_maps
;
const
DWORD
*
function
=
shader
->
function
;
GLuint
retval
;
char
fragcolor
[
16
];
DWORD
next_local
=
0
;
...
...
@@ -3810,7 +3809,7 @@ static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader,
}
/* Base Shader Body */
shader_generate_main
(
shader
,
buffer
,
reg_maps
,
function
,
&
priv_ctx
);
shader_generate_main
(
shader
,
buffer
,
reg_maps
,
&
priv_ctx
);
if
(
args
->
super
.
srgb_correction
)
{
arbfp_add_sRGB_correction
(
buffer
,
fragcolor
,
srgbtmp
[
0
],
srgbtmp
[
1
],
srgbtmp
[
2
],
srgbtmp
[
3
],
...
...
@@ -4114,7 +4113,6 @@ static GLuint shader_arb_generate_vshader(const struct wined3d_shader *shader,
const
struct
arb_vshader_private
*
shader_data
=
shader
->
backend_data
;
const
struct
wined3d_shader_reg_maps
*
reg_maps
=
&
shader
->
reg_maps
;
struct
shader_arb_priv
*
priv
=
shader
->
device
->
shader_priv
;
const
DWORD
*
function
=
shader
->
function
;
GLuint
ret
;
DWORD
next_local
=
0
;
struct
shader_arb_ctx_priv
priv_ctx
;
...
...
@@ -4224,7 +4222,7 @@ static GLuint shader_arb_generate_vshader(const struct wined3d_shader *shader,
/* The shader starts with the main function */
priv_ctx
.
in_main_func
=
TRUE
;
/* Base Shader Body */
shader_generate_main
(
shader
,
buffer
,
reg_maps
,
function
,
&
priv_ctx
);
shader_generate_main
(
shader
,
buffer
,
reg_maps
,
&
priv_ctx
);
if
(
!
priv_ctx
.
footer_written
)
vshader_add_footer
(
&
priv_ctx
,
shader_data
,
args
,
reg_maps
,
gl_info
,
buffer
);
...
...
dlls/wined3d/glsl_shader.c
View file @
12f5887a
...
...
@@ -6419,7 +6419,6 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
{
const
struct
wined3d_shader_reg_maps
*
reg_maps
=
&
shader
->
reg_maps
;
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
DWORD
*
function
=
shader
->
function
;
struct
shader_glsl_ctx_priv
priv_ctx
;
BOOL
legacy_context
=
gl_info
->
supported
[
WINED3D_GL_LEGACY_CONTEXT
];
...
...
@@ -6515,7 +6514,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
shader_glsl_input_pack
(
shader
,
buffer
,
&
shader
->
input_signature
,
reg_maps
,
args
,
gl_info
);
/* Base Shader Body */
shader_generate_main
(
shader
,
buffer
,
reg_maps
,
function
,
&
priv_ctx
);
shader_generate_main
(
shader
,
buffer
,
reg_maps
,
&
priv_ctx
);
/* In SM4+ the shader epilogue is generated by the "ret" instruction. */
if
(
reg_maps
->
shader_version
.
major
<
4
)
...
...
@@ -6580,7 +6579,6 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context
const
struct
wined3d_shader_reg_maps
*
reg_maps
=
&
shader
->
reg_maps
;
struct
wined3d_string_buffer
*
buffer
=
&
priv
->
shader_buffer
;
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
DWORD
*
function
=
shader
->
function
;
struct
shader_glsl_ctx_priv
priv_ctx
;
/* Create the hw GLSL shader program and assign it as the shader->prgId */
...
...
@@ -6615,7 +6613,7 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context
shader_addline
(
buffer
,
"void main()
\n
{
\n
"
);
/* Base Shader Body */
shader_generate_main
(
shader
,
buffer
,
reg_maps
,
function
,
&
priv_ctx
);
shader_generate_main
(
shader
,
buffer
,
reg_maps
,
&
priv_ctx
);
/* In SM4+ the shader epilogue is generated by the "ret" instruction. */
if
(
reg_maps
->
shader_version
.
major
<
4
)
...
...
@@ -6637,7 +6635,6 @@ static GLuint shader_glsl_generate_geometry_shader(const struct wined3d_context
const
struct
wined3d_shader_reg_maps
*
reg_maps
=
&
shader
->
reg_maps
;
struct
wined3d_string_buffer
*
buffer
=
&
priv
->
shader_buffer
;
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
DWORD
*
function
=
shader
->
function
;
struct
shader_glsl_ctx_priv
priv_ctx
;
GLuint
shader_id
;
...
...
@@ -6656,7 +6653,7 @@ static GLuint shader_glsl_generate_geometry_shader(const struct wined3d_context
shader_addline
(
buffer
,
"uniform vec4 pos_fixup;
\n
"
);
shader_glsl_generate_sm4_rasterizer_input_setup
(
priv
,
shader
,
args
->
ps_input_count
,
gl_info
);
shader_addline
(
buffer
,
"void main()
\n
{
\n
"
);
shader_generate_main
(
shader
,
buffer
,
reg_maps
,
function
,
&
priv_ctx
);
shader_generate_main
(
shader
,
buffer
,
reg_maps
,
&
priv_ctx
);
shader_addline
(
buffer
,
"}
\n
"
);
TRACE
(
"Compiling shader object %u.
\n
"
,
shader_id
);
...
...
@@ -6696,7 +6693,6 @@ static GLuint shader_glsl_generate_compute_shader(const struct wined3d_context *
const
struct
wined3d_shader_thread_group_size
*
thread_group_size
=
&
shader
->
u
.
cs
.
thread_group_size
;
const
struct
wined3d_shader_reg_maps
*
reg_maps
=
&
shader
->
reg_maps
;
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
DWORD
*
function
=
shader
->
function
;
struct
shader_glsl_ctx_priv
priv_ctx
;
GLuint
shader_id
;
...
...
@@ -6716,7 +6712,7 @@ static GLuint shader_glsl_generate_compute_shader(const struct wined3d_context *
thread_group_size
->
x
,
thread_group_size
->
y
,
thread_group_size
->
z
);
shader_addline
(
buffer
,
"void main()
\n
{
\n
"
);
shader_generate_main
(
shader
,
buffer
,
reg_maps
,
function
,
&
priv_ctx
);
shader_generate_main
(
shader
,
buffer
,
reg_maps
,
&
priv_ctx
);
shader_addline
(
buffer
,
"}
\n
"
);
TRACE
(
"Compiling shader object %u.
\n
"
,
shader_id
);
...
...
dlls/wined3d/shader.c
View file @
12f5887a
...
...
@@ -886,7 +886,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
unsigned
int
cur_loop_depth
=
0
,
max_loop_depth
=
0
;
void
*
fe_data
=
shader
->
frontend_data
;
struct
wined3d_shader_version
shader_version
;
const
DWORD
*
ptr
=
byte_code
;
const
DWORD
*
ptr
;
unsigned
int
i
;
memset
(
reg_maps
,
0
,
sizeof
(
*
reg_maps
));
...
...
@@ -2179,7 +2179,7 @@ static void shader_dump_src_param(struct wined3d_string_buffer *buffer,
/* Shared code in order to generate the bulk of the shader string.
* NOTE: A description of how to parse tokens can be found on MSDN. */
void
shader_generate_main
(
const
struct
wined3d_shader
*
shader
,
struct
wined3d_string_buffer
*
buffer
,
const
struct
wined3d_shader_reg_maps
*
reg_maps
,
const
DWORD
*
byte_code
,
void
*
backend_ctx
)
const
struct
wined3d_shader_reg_maps
*
reg_maps
,
void
*
backend_ctx
)
{
struct
wined3d_device
*
device
=
shader
->
device
;
const
struct
wined3d_shader_frontend
*
fe
=
shader
->
frontend
;
...
...
@@ -2189,7 +2189,7 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_st
struct
wined3d_shader_instruction
ins
;
struct
wined3d_shader_tex_mx
tex_mx
;
struct
wined3d_shader_context
ctx
;
const
DWORD
*
ptr
=
byte_code
;
const
DWORD
*
ptr
;
/* Initialize current parsing state. */
tex_mx
.
current_row
=
0
;
...
...
@@ -2329,13 +2329,13 @@ static void shader_dump_interpolation_mode(struct wined3d_string_buffer *buffer,
}
}
static
void
shader_trace_init
(
const
struct
wined3d_shader_frontend
*
fe
,
void
*
fe_data
,
const
DWORD
*
byte_code
)
static
void
shader_trace_init
(
const
struct
wined3d_shader_frontend
*
fe
,
void
*
fe_data
)
{
struct
wined3d_shader_version
shader_version
;
struct
wined3d_string_buffer
buffer
;
const
DWORD
*
ptr
=
byte_code
;
const
char
*
type_prefix
;
const
char
*
p
,
*
q
;
const
DWORD
*
ptr
;
DWORD
i
;
if
(
!
string_buffer_init
(
&
buffer
))
...
...
@@ -2344,10 +2344,10 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
return
;
}
TRACE
(
"Parsing %p.
\n
"
,
byte_code
);
fe
->
shader_read_header
(
fe_data
,
&
ptr
,
&
shader_version
);
TRACE
(
"Parsing %p.
\n
"
,
ptr
);
switch
(
shader_version
.
type
)
{
case
WINED3D_SHADER_TYPE_VERTEX
:
...
...
@@ -2887,7 +2887,7 @@ static HRESULT shader_set_function(struct wined3d_shader *shader, const DWORD *b
/* First pass: trace shader. */
if
(
TRACE_ON
(
d3d_shader
))
shader_trace_init
(
fe
,
shader
->
frontend_data
,
byte_code
);
shader_trace_init
(
fe
,
shader
->
frontend_data
);
/* Second pass: figure out which registers are used, what the semantics are, etc. */
if
(
FAILED
(
hr
=
shader_get_registers_used
(
shader
,
fe
,
reg_maps
,
&
shader
->
input_signature
,
...
...
dlls/wined3d/shader_sm1.c
View file @
12f5887a
...
...
@@ -213,6 +213,7 @@ struct wined3d_sm1_data
{
struct
wined3d_shader_version
shader_version
;
const
struct
wined3d_sm1_opcode_info
*
opcode_table
;
const
DWORD
*
start
;
struct
wined3d_shader_src_param
src_rel_addr
[
4
];
struct
wined3d_shader_src_param
pred_rel_addr
;
...
...
@@ -537,6 +538,8 @@ static void *shader_sm1_init(const DWORD *byte_code, const struct wined3d_shader
struct
wined3d_sm1_data
*
priv
;
BYTE
major
,
minor
;
TRACE
(
"Version: 0x%08x.
\n
"
,
*
byte_code
);
major
=
WINED3D_SM1_VERSION_MAJOR
(
*
byte_code
);
minor
=
WINED3D_SM1_VERSION_MINOR
(
*
byte_code
);
if
(
WINED3D_SHADER_VERSION
(
major
,
minor
)
>
WINED3D_SHADER_VERSION
(
3
,
0
))
...
...
@@ -568,6 +571,10 @@ static void *shader_sm1_init(const DWORD *byte_code, const struct wined3d_shader
HeapFree
(
GetProcessHeap
(),
0
,
priv
);
return
NULL
;
}
priv
->
shader_version
.
major
=
WINED3D_SM1_VERSION_MAJOR
(
*
byte_code
);
priv
->
shader_version
.
minor
=
WINED3D_SM1_VERSION_MINOR
(
*
byte_code
);
priv
->
start
=
&
byte_code
[
1
];
return
priv
;
}
...
...
@@ -580,13 +587,8 @@ static void shader_sm1_free(void *data)
static
void
shader_sm1_read_header
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_version
*
shader_version
)
{
struct
wined3d_sm1_data
*
priv
=
data
;
DWORD
version_token
;
version_token
=
*
(
*
ptr
)
++
;
TRACE
(
"Version: 0x%08x.
\n
"
,
version_token
);
priv
->
shader_version
.
major
=
WINED3D_SM1_VERSION_MAJOR
(
version_token
);
priv
->
shader_version
.
minor
=
WINED3D_SM1_VERSION_MINOR
(
version_token
);
*
ptr
=
priv
->
start
;
*
shader_version
=
priv
->
shader_version
;
}
...
...
dlls/wined3d/shader_sm4.c
View file @
12f5887a
...
...
@@ -396,7 +396,7 @@ struct wined3d_shader_src_param_entry
struct
wined3d_sm4_data
{
struct
wined3d_shader_version
shader_version
;
const
DWORD
*
end
;
const
DWORD
*
start
,
*
end
;
unsigned
int
output_map
[
MAX_REG_OUTPUT
];
...
...
@@ -1123,15 +1123,56 @@ static enum wined3d_data_type map_data_type(char t)
static
void
*
shader_sm4_init
(
const
DWORD
*
byte_code
,
const
struct
wined3d_shader_signature
*
output_signature
)
{
DWORD
version_token
,
token_count
;
struct
wined3d_sm4_data
*
priv
;
unsigned
int
i
;
version_token
=
byte_code
[
0
];
TRACE
(
"Version: 0x%08x.
\n
"
,
version_token
);
token_count
=
byte_code
[
1
];
TRACE
(
"Token count: %u.
\n
"
,
token_count
);
if
(
!
(
priv
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
priv
))))
{
ERR
(
"Failed to allocate private data
\n
"
);
return
NULL
;
}
priv
->
start
=
&
byte_code
[
2
];
priv
->
end
=
&
byte_code
[
token_count
];
switch
(
version_token
>>
16
)
{
case
WINED3D_SM4_PS
:
priv
->
shader_version
.
type
=
WINED3D_SHADER_TYPE_PIXEL
;
break
;
case
WINED3D_SM4_VS
:
priv
->
shader_version
.
type
=
WINED3D_SHADER_TYPE_VERTEX
;
break
;
case
WINED3D_SM4_GS
:
priv
->
shader_version
.
type
=
WINED3D_SHADER_TYPE_GEOMETRY
;
break
;
case
WINED3D_SM5_HS
:
priv
->
shader_version
.
type
=
WINED3D_SHADER_TYPE_HULL
;
break
;
case
WINED3D_SM5_DS
:
priv
->
shader_version
.
type
=
WINED3D_SHADER_TYPE_DOMAIN
;
break
;
case
WINED3D_SM5_CS
:
priv
->
shader_version
.
type
=
WINED3D_SHADER_TYPE_COMPUTE
;
break
;
default:
FIXME
(
"Unrecognised shader type %#x.
\n
"
,
version_token
>>
16
);
}
priv
->
shader_version
.
major
=
WINED3D_SM4_VERSION_MAJOR
(
version_token
);
priv
->
shader_version
.
minor
=
WINED3D_SM4_VERSION_MINOR
(
version_token
);
memset
(
priv
->
output_map
,
0xff
,
sizeof
(
priv
->
output_map
));
for
(
i
=
0
;
i
<
output_signature
->
element_count
;
++
i
)
{
...
...
@@ -1190,48 +1231,8 @@ static struct wined3d_shader_src_param *get_src_param(struct wined3d_sm4_data *p
static
void
shader_sm4_read_header
(
void
*
data
,
const
DWORD
**
ptr
,
struct
wined3d_shader_version
*
shader_version
)
{
struct
wined3d_sm4_data
*
priv
=
data
;
DWORD
version_token
;
priv
->
end
=
*
ptr
;
version_token
=
*
(
*
ptr
)
++
;
TRACE
(
"Version: 0x%08x.
\n
"
,
version_token
);
TRACE
(
"Token count: %u.
\n
"
,
**
ptr
);
priv
->
end
+=
*
(
*
ptr
)
++
;
switch
(
version_token
>>
16
)
{
case
WINED3D_SM4_PS
:
priv
->
shader_version
.
type
=
WINED3D_SHADER_TYPE_PIXEL
;
break
;
case
WINED3D_SM4_VS
:
priv
->
shader_version
.
type
=
WINED3D_SHADER_TYPE_VERTEX
;
break
;
case
WINED3D_SM4_GS
:
priv
->
shader_version
.
type
=
WINED3D_SHADER_TYPE_GEOMETRY
;
break
;
case
WINED3D_SM5_HS
:
priv
->
shader_version
.
type
=
WINED3D_SHADER_TYPE_HULL
;
break
;
case
WINED3D_SM5_DS
:
priv
->
shader_version
.
type
=
WINED3D_SHADER_TYPE_DOMAIN
;
break
;
case
WINED3D_SM5_CS
:
priv
->
shader_version
.
type
=
WINED3D_SHADER_TYPE_COMPUTE
;
break
;
default:
FIXME
(
"Unrecognized shader type %#x.
\n
"
,
version_token
>>
16
);
}
priv
->
shader_version
.
major
=
WINED3D_SM4_VERSION_MAJOR
(
version_token
);
priv
->
shader_version
.
minor
=
WINED3D_SM4_VERSION_MINOR
(
version_token
);
*
ptr
=
priv
->
start
;
*
shader_version
=
priv
->
shader_version
;
}
...
...
dlls/wined3d/wined3d_private.h
View file @
12f5887a
...
...
@@ -3643,7 +3643,7 @@ void string_buffer_free(struct wined3d_string_buffer *buffer) DECLSPEC_HIDDEN;
unsigned
int
shader_find_free_input_register
(
const
struct
wined3d_shader_reg_maps
*
reg_maps
,
unsigned
int
max
)
DECLSPEC_HIDDEN
;
void
shader_generate_main
(
const
struct
wined3d_shader
*
shader
,
struct
wined3d_string_buffer
*
buffer
,
const
struct
wined3d_shader_reg_maps
*
reg_maps
,
const
DWORD
*
byte_code
,
void
*
backend_ctx
)
DECLSPEC_HIDDEN
;
const
struct
wined3d_shader_reg_maps
*
reg_maps
,
void
*
backend_ctx
)
DECLSPEC_HIDDEN
;
BOOL
shader_match_semantic
(
const
char
*
semantic_name
,
enum
wined3d_decl_usage
usage
)
DECLSPEC_HIDDEN
;
static
inline
BOOL
shader_is_scalar
(
const
struct
wined3d_shader_register
*
reg
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment