render: D3D9 doesn't need to check for stream offset support anymore. We don't use offsets at all now. Too slow.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c
index 695b51e..9d000cc 100644
--- a/src/render/direct3d/SDL_render_d3d.c
+++ b/src/render/direct3d/SDL_render_d3d.c
@@ -70,7 +70,6 @@ typedef struct
SDL_bool updateSize;
SDL_bool beginScene;
SDL_bool enableSeparateAlphaBlend;
- SDL_bool supportsStreamOffset;
D3DTEXTUREFILTERTYPE scaleMode[8];
IDirect3DSurface9 *defaultRenderTarget;
IDirect3DSurface9 *currentRenderTarget;
@@ -1199,44 +1198,40 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti
}
/* upload the new VBO data for this set of commands. */
- if (data->supportsStreamOffset) {
- vbo = data->vertexBuffers[vboidx];
- if (!vbo || (data->vertexBufferSize[vboidx] < vertsize)) {
- const DWORD usage = D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY;
- const DWORD fvf = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1;
- if (vbo) {
- IDirect3DVertexBuffer9_Release(vbo);
- }
-
- if (FAILED(IDirect3DDevice9_CreateVertexBuffer(data->device, vertsize, usage, fvf, D3DPOOL_DEFAULT, &vbo, NULL))) {
- vbo = NULL;
- }
- data->vertexBuffers[vboidx] = vbo;
- data->vertexBufferSize[vboidx] = vbo ? vertsize : 0;
+ vbo = data->vertexBuffers[vboidx];
+ if (!vbo || (data->vertexBufferSize[vboidx] < vertsize)) {
+ const DWORD usage = D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY;
+ const DWORD fvf = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1;
+ if (vbo) {
+ IDirect3DVertexBuffer9_Release(vbo);
}
- if (vbo) {
- void *ptr;
- if (FAILED(IDirect3DVertexBuffer9_Lock(vbo, 0, vertsize, &ptr, D3DLOCK_DISCARD))) {
- vbo = NULL; /* oh well, we'll do immediate mode drawing. :( */
- } else {
- SDL_memcpy(ptr, vertices, vertsize);
- if (FAILED(IDirect3DVertexBuffer9_Unlock(vbo))) {
- vbo = NULL; /* oh well, we'll do immediate mode drawing. :( */
- }
- }
+ if (FAILED(IDirect3DDevice9_CreateVertexBuffer(data->device, vertsize, usage, fvf, D3DPOOL_DEFAULT, &vbo, NULL))) {
+ vbo = NULL;
}
+ data->vertexBuffers[vboidx] = vbo;
+ data->vertexBufferSize[vboidx] = vbo ? vertsize : 0;
+ }
- /* cycle through a few VBOs so D3D has some time with the data before we replace it. */
- if (vbo) {
- data->currentVertexBuffer++;
- if (data->currentVertexBuffer >= SDL_arraysize(data->vertexBuffers)) {
- data->currentVertexBuffer = 0;
+ if (vbo) {
+ void *ptr;
+ if (FAILED(IDirect3DVertexBuffer9_Lock(vbo, 0, vertsize, &ptr, D3DLOCK_DISCARD))) {
+ vbo = NULL; /* oh well, we'll do immediate mode drawing. :( */
+ } else {
+ SDL_memcpy(ptr, vertices, vertsize);
+ if (FAILED(IDirect3DVertexBuffer9_Unlock(vbo))) {
+ vbo = NULL; /* oh well, we'll do immediate mode drawing. :( */
}
}
}
- if (!vbo && !data->reportedVboProblem) {
+ /* cycle through a few VBOs so D3D has some time with the data before we replace it. */
+ if (vbo) {
+ data->currentVertexBuffer++;
+ if (data->currentVertexBuffer >= SDL_arraysize(data->vertexBuffers)) {
+ data->currentVertexBuffer = 0;
+ }
+ } else if (!data->reportedVboProblem) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "SDL failed to get a vertex buffer for this Direct3D 9 rendering batch!");
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Dropping back to a slower method.");
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "This might be a brief hiccup, but if performance is bad, this is probably why.");
@@ -1709,8 +1704,6 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
device_flags |= D3DCREATE_MULTITHREADED;
}
- data->supportsStreamOffset = ((caps.DevCaps2 & D3DDEVCAPS2_STREAMOFFSET) == D3DDEVCAPS2_STREAMOFFSET);
-
result = IDirect3D9_CreateDevice(data->d3d, data->adapter,
D3DDEVTYPE_HAL,
pparams.hDeviceWindow,