示例#1
0
static void d3d8_shmem_capture_copy(int idx)
{
	IDirect3DSurface8 *target = data.copy_surfaces[idx];
	D3DLOCKED_RECT rect;
	HRESULT hr;

	if (data.surface_locked[idx])
		return;

	hr = target->LockRect(&rect, nullptr, D3DLOCK_READONLY);
	if (SUCCEEDED(hr)) {
		shmem_copy_data(idx, rect.pBits);
	}
}
示例#2
0
static inline void gl_shmem_capture_queue_copy(void)
{
	for (int i = 0; i < NUM_BUFFERS; i++) {
		if (data.texture_ready[i]) {
			GLvoid *buffer;

			data.texture_ready[i] = false;

			glBindBuffer(GL_PIXEL_PACK_BUFFER, data.pbos[i]);
			if (gl_error("gl_shmem_capture_queue_copy",
						"failed to bind pbo")) {
				return;
			}

			buffer = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
			if (buffer) {
				data.texture_mapped[i] = true;
				shmem_copy_data(i, buffer);
			}
			break;
		}
	}
}
static inline void d3d9_shmem_capture_queue_copy()
{
	for (int i = 0; i < NUM_BUFFERS; i++) {
		IDirect3DSurface9 *target = data.copy_surfaces[i];
		D3DLOCKED_RECT rect;
		HRESULT hr;

		if (!data.issued_queries[i]) {
			continue;
		}
		if (data.queries[i]->GetData(0, 0, 0) != S_OK) {
			continue;
		}

		data.issued_queries[i] = false;

		hr = target->LockRect(&rect, nullptr, D3DLOCK_READONLY);
		if (SUCCEEDED(hr)) {
			data.texture_mapped[i] = true;
			shmem_copy_data(i, rect.pBits);
		}
		break;
	}
}