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
8e37fcd2
Commit
8e37fcd2
authored
Jan 06, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jan 08, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move applying shader constants to the state table.
parent
f2dfbe76
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
15 deletions
+57
-15
device.c
dlls/wined3d/device.c
+12
-0
drawprim.c
dlls/wined3d/drawprim.c
+1
-5
state.c
dlls/wined3d/state.c
+38
-9
wined3d_private.h
dlls/wined3d/wined3d_private.h
+6
-1
No files found.
dlls/wined3d/device.c
View file @
8e37fcd2
...
...
@@ -3328,6 +3328,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantB(
This
->
updateStateBlock
->
set
.
vertexShaderConstantsB
[
i
]
=
TRUE
;
}
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_VERTEXSHADERCONSTANT
);
return
WINED3D_OK
;
}
...
...
@@ -3375,6 +3377,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantI(
This
->
updateStateBlock
->
set
.
vertexShaderConstantsI
[
i
]
=
TRUE
;
}
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_VERTEXSHADERCONSTANT
);
return
WINED3D_OK
;
}
...
...
@@ -3427,6 +3431,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantF(
This
->
updateStateBlock
->
changed
.
vertexShaderConstantsF
[
i
]
=
TRUE
;
}
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_VERTEXSHADERCONSTANT
);
return
WINED3D_OK
;
}
...
...
@@ -3606,6 +3612,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB(
This
->
updateStateBlock
->
set
.
pixelShaderConstantsB
[
i
]
=
TRUE
;
}
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_PIXELSHADERCONSTANT
);
return
WINED3D_OK
;
}
...
...
@@ -3653,6 +3661,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantI(
This
->
updateStateBlock
->
set
.
pixelShaderConstantsI
[
i
]
=
TRUE
;
}
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_PIXELSHADERCONSTANT
);
return
WINED3D_OK
;
}
...
...
@@ -3705,6 +3715,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF(
This
->
updateStateBlock
->
changed
.
pixelShaderConstantsF
[
i
]
=
TRUE
;
}
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_PIXELSHADERCONSTANT
);
return
WINED3D_OK
;
}
...
...
dlls/wined3d/drawprim.c
View file @
8e37fcd2
...
...
@@ -1106,10 +1106,7 @@ inline static void drawPrimitiveDrawStrided(
int
minIndex
,
long
StartIdx
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
/* Load any global constants/uniforms that may have been set by the application */
This
->
shader_backend
->
shader_load_constants
(
iface
,
usePixelShaderFunction
,
useVertexShaderFunction
);
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
/* Draw vertex-by-vertex */
if
(
This
->
useDrawStridedSlow
)
...
...
@@ -1272,7 +1269,6 @@ void drawPrimitive(IWineD3DDevice *iface,
}
This
->
numDirtyEntries
=
0
;
/* This makes the whole list clean */
if
(
TRACE_ON
(
d3d_draw
)
&&
wined3d_settings
.
offscreen_rendering_mode
==
ORM_FBO
)
{
check_fbo_status
(
iface
);
}
...
...
dlls/wined3d/state.c
View file @
8e37fcd2
...
...
@@ -1810,6 +1810,22 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock) {
}
}
static
void
shaderconstant
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
)
{
IWineD3DDeviceImpl
*
device
=
stateblock
->
wineD3DDevice
;
/* Vertex and pixel shader states will call a shader upload, don't do anything as long one of them
* has an update pending
*/
if
(
isStateDirty
(
device
,
STATE_VDECL
)
||
isStateDirty
(
device
,
STATE_PIXELSHADER
))
{
return
;
}
device
->
shader_backend
->
shader_load_constants
((
IWineD3DDevice
*
)
device
,
stateblock
->
pixelShader
&&
((
IWineD3DPixelShaderImpl
*
)
stateblock
->
pixelShader
)
->
baseShader
.
function
,
stateblock
->
vertexShader
&&
((
IWineD3DVertexShaderImpl
*
)
stateblock
->
vertexShader
)
->
baseShader
.
function
);
}
static
void
pixelshader
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
)
{
int
i
;
...
...
@@ -1838,6 +1854,10 @@ static void pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock) {
(
IWineD3DDevice
*
)
stateblock
->
wineD3DDevice
,
TRUE
,
!
stateblock
->
vertexShader
?
FALSE
:
((
IWineD3DVertexShaderImpl
*
)
stateblock
->
vertexShader
)
->
baseShader
.
function
!=
NULL
);
if
(
!
isStateDirty
(
stateblock
->
wineD3DDevice
,
STATE_VERTEXSHADERCONSTANT
))
{
shaderconstant
(
STATE_VERTEXSHADERCONSTANT
,
stateblock
);
}
}
stateblock
->
wineD3DDevice
->
last_was_pshader
=
TRUE
;
}
else
{
...
...
@@ -1856,6 +1876,10 @@ static void pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock) {
(
IWineD3DDevice
*
)
stateblock
->
wineD3DDevice
,
FALSE
,
!
stateblock
->
vertexShader
?
FALSE
:
((
IWineD3DVertexShaderImpl
*
)
stateblock
->
vertexShader
)
->
baseShader
.
function
!=
NULL
);
if
(
!
isStateDirty
(
stateblock
->
wineD3DDevice
,
STATE_VERTEXSHADERCONSTANT
))
{
shaderconstant
(
STATE_VERTEXSHADERCONSTANT
,
stateblock
);
}
}
}
}
...
...
@@ -2649,16 +2673,20 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock) {
* in order to determine if we need to do any swizzling for D3DCOLOR
* registers. If the shader is already compiled this call will do nothing. */
IWineD3DVertexShader_CompileShader
(
stateblock
->
vertexShader
);
}
/* Vertex and pixel shaders are applied together for now, so let the last dirty state do the
* application
*/
if
(
!
isStateDirty
(
device
,
STATE_PIXELSHADER
))
{
BOOL
usePixelShaderFunction
=
device
->
ps_selected_mode
!=
SHADER_NONE
&&
stateblock
->
pixelShader
&&
((
IWineD3DPixelShaderImpl
*
)
stateblock
->
pixelShader
)
->
baseShader
.
function
;
/* Vertex and pixel shaders are applied together for now, so let the last dirty state do the
* application
*/
if
(
!
isStateDirty
(
device
,
STATE_PIXELSHADER
))
{
BOOL
usePixelShaderFunction
=
device
->
ps_selected_mode
!=
SHADER_NONE
&&
stateblock
->
pixelShader
&&
((
IWineD3DPixelShaderImpl
*
)
stateblock
->
pixelShader
)
->
baseShader
.
function
;
device
->
shader_backend
->
shader_select
((
IWineD3DDevice
*
)
device
,
usePixelShaderFunction
,
useVertexShaderFunction
);
device
->
shader_backend
->
shader_select
((
IWineD3DDevice
*
)
device
,
usePixelShaderFunction
,
useVertexShaderFunction
);
if
(
!
isStateDirty
(
stateblock
->
wineD3DDevice
,
STATE_VERTEXSHADERCONSTANT
)
&&
(
useVertexShaderFunction
||
usePixelShaderFunction
))
{
shaderconstant
(
STATE_VERTEXSHADERCONSTANT
,
stateblock
);
}
}
...
...
@@ -3704,5 +3732,6 @@ const struct StateEntry StateTable[] =
{
/* , STATE_VDECL */
STATE_VDECL
,
vertexdeclaration
},
{
/* , STATE_VSHADER */
STATE_VDECL
,
vertexdeclaration
},
{
/* , STATE_VIEWPORT */
STATE_VIEWPORT
,
viewport
},
{
/* , STATE_VERTEXSHADERCONSTANT */
STATE_VERTEXSHADERCONSTANT
,
shaderconstant
},
{
/* , STATE_PIXELSHADERCONSTANT */
STATE_VERTEXSHADERCONSTANT
,
shaderconstant
},
};
dlls/wined3d/wined3d_private.h
View file @
8e37fcd2
...
...
@@ -436,7 +436,12 @@ typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock);
#define STATE_VIEWPORT (STATE_VSHADER + 1)
#define STATE_IS_VIEWPORT(a) ((a) == STATE_VIEWPORT)
#define STATE_HIGHEST (STATE_VIEWPORT)
#define STATE_VERTEXSHADERCONSTANT (STATE_VIEWPORT + 1)
#define STATE_PIXELSHADERCONSTANT (STATE_VERTEXSHADERCONSTANT + 1)
#define STATE_IS_VERTEXSHADERCONSTANT(a) ((a) == STATE_VERTEXSHADERCONSTANT)
#define STATE_IS_PIXELSHADERCONSTANT(a) ((a) == STATE_PIXELSHADERCONSTANT)
#define STATE_HIGHEST (STATE_PIXELSHADERCONSTANT)
struct
StateEntry
{
...
...
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