Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
e9927d6f
Commit
e9927d6f
authored
May 09, 2006
by
Jason Green
Committed by
Alexandre Julliard
May 10, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Further split GLSL & ARB_v/f_program generation and allow GLSL functions to be called.
parent
246677ae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
25 deletions
+65
-25
baseshader.c
dlls/wined3d/baseshader.c
+58
-25
wined3d_private.h
dlls/wined3d/wined3d_private.h
+7
-0
No files found.
dlls/wined3d/baseshader.c
View file @
e9927d6f
...
...
@@ -238,6 +238,43 @@ void shader_program_dump_decl_usage(
}
}
/** Generate the variable & register declarations for the ARB_vertex_program
output target */
void
generate_arb_declarations
(
IWineD3DBaseShader
*
iface
,
SHADER_BUFFER
*
buffer
)
{
IWineD3DBaseShaderImpl
*
This
=
(
IWineD3DBaseShaderImpl
*
)
iface
;
DWORD
i
;
for
(
i
=
0
;
i
<
This
->
baseShader
.
limits
.
temporary
;
i
++
)
{
if
(
This
->
baseShader
.
temps_used
&
(
1
<<
i
))
shader_addline
(
buffer
,
"TEMP R%lu;
\n
"
,
i
);
}
for
(
i
=
0
;
i
<
This
->
baseShader
.
limits
.
address
;
i
++
)
{
if
(
This
->
baseShader
.
textures_used
&
(
1
<<
i
))
shader_addline
(
buffer
,
"ADDRESS A%ld;
\n
"
,
i
);
}
for
(
i
=
0
;
i
<
This
->
baseShader
.
limits
.
texture
;
i
++
)
{
if
(
This
->
baseShader
.
textures_used
&
(
1
<<
i
))
shader_addline
(
buffer
,
"TEMP T%lu;
\n
"
,
i
);
}
/* Texture coordinate registers must be pre-loaded */
for
(
i
=
0
;
i
<
This
->
baseShader
.
limits
.
texture
;
i
++
)
{
if
(
This
->
baseShader
.
textures_used
&
(
1
<<
i
))
shader_addline
(
buffer
,
"MOV T%lu, fragment.texcoord[%lu];
\n
"
,
i
,
i
);
}
}
/** Generate the variable & register declarations for the GLSL
output target */
void
generate_glsl_declarations
(
IWineD3DBaseShader
*
iface
,
SHADER_BUFFER
*
buffer
)
{
FIXME
(
"GLSL not fully implemented yet.
\n
"
);
}
/** Shared code in order to generate the bulk of the shader string.
Use the shader_header_fct & shader_footer_fct to add strings
that are specific to pixel or vertex functions
...
...
@@ -267,26 +304,10 @@ void generate_base_shader(
*/
/* Pre-declare registers */
for
(
i
=
0
;
i
<
This
->
baseShader
.
limits
.
temporary
;
i
++
)
{
if
(
This
->
baseShader
.
temps_used
&
(
1
<<
i
))
shader_addline
(
buffer
,
"TEMP R%lu;
\n
"
,
i
);
}
for
(
i
=
0
;
i
<
This
->
baseShader
.
limits
.
address
;
i
++
)
{
if
(
This
->
baseShader
.
textures_used
&
(
1
<<
i
))
shader_addline
(
buffer
,
"ADDRESS A%ld;
\n
"
,
i
);
}
for
(
i
=
0
;
i
<
This
->
baseShader
.
limits
.
texture
;
i
++
)
{
if
(
This
->
baseShader
.
textures_used
&
(
1
<<
i
))
shader_addline
(
buffer
,
"TEMP T%lu;
\n
"
,
i
);
}
/* Texture coordinate registers must be pre-loaded */
for
(
i
=
0
;
i
<
This
->
baseShader
.
limits
.
texture
;
i
++
)
{
if
(
This
->
baseShader
.
textures_used
&
(
1
<<
i
))
shader_addline
(
buffer
,
"MOV T%lu, fragment.texcoord[%lu];
\n
"
,
i
,
i
);
}
if
(
USING_GLSL
)
generate_glsl_declarations
(
iface
,
buffer
);
else
generate_arb_declarations
(
iface
,
buffer
);
/* Second pass, process opcodes */
if
(
NULL
!=
pToken
)
{
...
...
@@ -318,15 +339,22 @@ void generate_base_shader(
++
pToken
;
}
/* Unhandled opcode */
}
else
if
(
GLNAME_REQUIRE_GLSL
==
curOpcode
->
glname
)
{
/* Using GLSL & no generator function exists */
}
else
if
(
USING_GLSL
&&
curOpcode
->
hw_glsl_fct
==
NULL
)
{
FIXME
(
"Token %s is not yet implemented with GLSL
\n
"
,
curOpcode
->
name
);
pToken
+=
curOpcode
->
num_params
;
/* Unhandled opcode in ARB */
}
else
if
(
!
USING_GLSL
&&
GLNAME_REQUIRE_GLSL
==
curOpcode
->
glname
)
{
FIXME
(
"Token %s requires greater functionality than "
"Vertex or Fragment_Program_ARB supports
\n
"
,
curOpcode
->
name
);
pToken
+=
curOpcode
->
num_params
;
/* If a generator function is set, use it */
}
else
if
(
curOpcode
->
hw_fct
!=
NULL
)
{
/* If a generator function is set for current shader target, use it */
}
else
if
((
!
USING_GLSL
&&
curOpcode
->
hw_fct
!=
NULL
)
||
(
USING_GLSL
&&
curOpcode
->
hw_glsl_fct
!=
NULL
))
{
SHADER_OPCODE_ARG
hw_arg
;
...
...
@@ -341,7 +369,12 @@ void generate_base_shader(
hw_arg
.
src
[
i
-
1
]
=
*
(
pToken
+
i
);
}
curOpcode
->
hw_fct
(
&
hw_arg
);
/* Call appropriate function for output target */
if
(
USING_GLSL
)
curOpcode
->
hw_glsl_fct
(
&
hw_arg
);
else
curOpcode
->
hw_fct
(
&
hw_arg
);
pToken
+=
curOpcode
->
num_params
;
}
else
{
...
...
dlls/wined3d/wined3d_private.h
View file @
e9927d6f
...
...
@@ -1201,6 +1201,13 @@ struct SHADER_OPCODE_ARG;
typedef
void
(
*
shader_fct_t
)();
typedef
void
(
*
SHADER_HANDLER
)
(
struct
SHADER_OPCODE_ARG
*
);
/* This must be 0 in the main branch until GLSL is at least mostly implemented.
Also, think about making it a winecfg option to use GLSL (if the card supports it)
or ARB_vertex_program. Ideally, we want to use GLSL if it's available, but until
everything is implemented, we'll probably have better luck with the ARB generation */
#define USING_GLSL 0
#define SHADER_PGMSIZE 65535
typedef
struct
SHADER_BUFFER
{
char
*
buffer
;
...
...
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