DXGL r328 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r327
|
r328
|
r329
>
Date:
17:26, 18 February 2013
Author:
admin
Status:
new
Tags:
Comment:
Fix Z-buffer surface creation for IDirectDraw interface.
Fix Clear command flags.
Only call DrawIndexedPrimitive in D3DOP_TRIANGLE if wCount is greater than 0.
Modified paths:
/ddraw/glDirect3DDevice.cpp
(modified) (
history
)
/ddraw/glDirectDrawSurface.cpp
(modified) (
history
)
/ddraw/glRenderer.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/glDirect3DDevice.cpp
—
—
@@ -2201,8 +2201,8 @@
2202
2202
if(result == -1) return DDERR_OUTOFMEMORY;
2203
2203
opptr += instruction->bSize;
2204
2204
}
2205
- DrawIndexedPrimitive(D3DPT_TRIANGLELIST,D3DFVF_TLVERTEX,vert_ptr,(desc.dwBufferSize-data.dwVertexOffset)/sizeof(D3DVERTEX),
2206
- (WORD*)ebBuffer,instruction->wCount*3,0);
2205
+ if(instruction->wCount) DrawIndexedPrimitive(D3DPT_TRIANGLELIST,D3DFVF_TLVERTEX,vert_ptr,
2206
+ (desc.dwBufferSize-data.dwVertexOffset)/sizeof(D3DVERTEX), (WORD*)ebBuffer,instruction->wCount*3,0);
2207
2207
break;
2208
2208
case D3DOP_MATRIXLOAD:
2209
2209
opptr += sizeof(D3DINSTRUCTION);
Index: ddraw/glDirectDrawSurface.cpp
—
—
@@ -216,6 +216,28 @@
217
217
buffer = NULL;
218
218
if((dxglcfg.scalingfilter == 0) || (ddInterface->GetBPP() == 8)) magfilter = minfilter = GL_NEAREST;
219
219
else magfilter = minfilter = GL_LINEAR;
220
+ if(ddsd.ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
221
+ {
222
+ ddsd.dwFlags |= DDSD_PIXELFORMAT;
223
+ ddsd.ddpfPixelFormat.dwFlags = DDPF_ZBUFFER;
224
+ ddsd.ddpfPixelFormat.dwZBufferBitDepth = ddsd.dwRefreshRate;
225
+ switch(ddsd.ddpfPixelFormat.dwZBufferBitDepth)
226
+ {
227
+ case 8:
228
+ ddsd.ddpfPixelFormat.dwZBitMask = 0xFF;
229
+ break;
230
+ case 16:
231
+ ddsd.ddpfPixelFormat.dwZBitMask = 0xFFFF;
232
+ break;
233
+ case 24:
234
+ ddsd.ddpfPixelFormat.dwZBitMask = 0xFFFFFF;
235
+ break;
236
+ case 32:
237
+ default:
238
+ ddsd.ddpfPixelFormat.dwZBitMask = 0xFFFFFFFF;
239
+ break;
240
+ }
241
+ }
220
242
if(!(ddsd.dwFlags & DDSD_PIXELFORMAT))
221
243
{
222
244
ZeroMemory(&ddsd.ddpfPixelFormat,sizeof(DDPIXELFORMAT));
Index: ddraw/glRenderer.cpp
—
—
@@ -1202,17 +1202,17 @@
1203
1203
if(target->zbuffer) SetFBO(target->texture,target->GetZBuffer()->texture,target->GetZBuffer()->hasstencil);
1204
1204
else SetFBO(target->texture,0,false);
1205
1205
int clearbits = 0;
1206
- if(D3DCLEAR_TARGET)
1206
+ if(dwFlags & D3DCLEAR_TARGET)
1207
1207
{
1208
1208
clearbits |= GL_COLOR_BUFFER_BIT;
1209
1209
ClearColor(color[0],color[1],color[2],color[3]);
1210
1210
}
1211
- if(D3DCLEAR_ZBUFFER)
1211
+ if(dwFlags & D3DCLEAR_ZBUFFER)
1212
1212
{
1213
1213
clearbits |= GL_DEPTH_BUFFER_BIT;
1214
1214
ClearDepth(dvZ);
1215
1215
}
1216
- if(D3DCLEAR_STENCIL)
1216
+ if(dwFlags & D3DCLEAR_STENCIL)
1217
1217
{
1218
1218
clearbits |= GL_STENCIL_BUFFER_BIT;
1219
1219
ClearStencil(dwStencil);
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version