diff options
author | Luca Barbieri <[email protected]> | 2010-09-23 13:44:22 +0200 |
---|---|---|
committer | Luca Barbieri <[email protected]> | 2010-09-23 16:06:02 +0200 |
commit | 6c598c78bd17642d731cf57b8369cc794f64ba2f (patch) | |
tree | 27671d42b851a95b1b03bd44d039f75ac505c6e3 /src/gallium/state_trackers/d3d1x/dxgi | |
parent | e5ae4588d150a179974a812887f3b6445d8e2f34 (diff) |
d3d1x: normalize whitespace
Diffstat (limited to 'src/gallium/state_trackers/d3d1x/dxgi')
-rw-r--r-- | src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_loader.cpp | 238 | ||||
-rw-r--r-- | src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp | 356 |
2 files changed, 297 insertions, 297 deletions
diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_loader.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_loader.cpp index e5ba309fe41..7b720194589 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_loader.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_loader.cpp @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.9 + * Version: 7.9 * * Copyright (C) 2010 LunarG Inc. * @@ -16,14 +16,14 @@ * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Authors: - * Chia-I Wu <[email protected]> + * Chia-I Wu <[email protected]> */ #include "dxgi_private.h" @@ -38,153 +38,153 @@ extern "C" static const char * get_search_path(void) { - static const char *search_path; + static const char *search_path; - if (!search_path) { - static char buffer[1024]; - const char *p; - int ret; + if (!search_path) { + static char buffer[1024]; + const char *p; + int ret; - p = getenv("DXGI_DRIVERS_PATH"); - if(!p) - p = getenv("EGL_DRIVERS_PATH"); + p = getenv("DXGI_DRIVERS_PATH"); + if(!p) + p = getenv("EGL_DRIVERS_PATH"); #ifdef __unix__ - if (p && (geteuid() != getuid() || getegid() != getgid())) { - p = NULL; - } + if (p && (geteuid() != getuid() || getegid() != getgid())) { + p = NULL; + } #endif - if (p) { - ret = snprintf(buffer, sizeof(buffer), - "%s:%s", p, DXGI_DRIVER_SEARCH_DIR); - if (ret > 0 && ret < (int)sizeof(buffer)) - search_path = buffer; - } - } - if (!search_path) - search_path = DXGI_DRIVER_SEARCH_DIR; - - return search_path; + if (p) { + ret = snprintf(buffer, sizeof(buffer), + "%s:%s", p, DXGI_DRIVER_SEARCH_DIR); + if (ret > 0 && ret < (int)sizeof(buffer)) + search_path = buffer; + } + } + if (!search_path) + search_path = DXGI_DRIVER_SEARCH_DIR; + + return search_path; } static void for_each_colon_separated(const char *search_path, - bool (*loader)(const char *, size_t, void *), - void *loader_data) + bool (*loader)(const char *, size_t, void *), + void *loader_data) { - const char *cur, *next; - size_t len; + const char *cur, *next; + size_t len; - cur = search_path; - while (cur) { - next = strchr(cur, ':'); - len = (next) ? next - cur : strlen(cur); + cur = search_path; + while (cur) { + next = strchr(cur, ':'); + len = (next) ? next - cur : strlen(cur); - if (!loader(cur, len, loader_data)) - break; + if (!loader(cur, len, loader_data)) + break; - cur = (next) ? next + 1 : NULL; - } + cur = (next) ? next + 1 : NULL; + } } void for_each_in_search_path(bool (*callback)(const char *, size_t, void *), - void *callback_data) + void *callback_data) { - const char *search_path = get_search_path(); - for_each_colon_separated(search_path, callback, callback_data); + const char *search_path = get_search_path(); + for_each_colon_separated(search_path, callback, callback_data); } static struct pipe_module { - boolean initialized; - char *name; - struct util_dl_library *lib; - const struct drm_driver_descriptor *drmdd; - struct pipe_screen *(*swrast_create_screen)(struct sw_winsys *); + boolean initialized; + char *name; + struct util_dl_library *lib; + const struct drm_driver_descriptor *drmdd; + struct pipe_screen *(*swrast_create_screen)(struct sw_winsys *); } pipe_modules[16]; static bool dlopen_pipe_module_cb(const char *dir, size_t len, void *callback_data) { - struct pipe_module *pmod = (struct pipe_module *) callback_data; - char path[1024]; - int ret; - - if (len) { - ret = snprintf(path, sizeof(path), - "%.*s/" PIPE_PREFIX "%s" UTIL_DL_EXT, len, dir, pmod->name); - } - else { - ret = snprintf(path, sizeof(path), - PIPE_PREFIX "%s" UTIL_DL_EXT, pmod->name); - } - if (ret > 0 && ret < (int)sizeof(path)) { - pmod->lib = util_dl_open(path); - } - - return !(pmod->lib); + struct pipe_module *pmod = (struct pipe_module *) callback_data; + char path[1024]; + int ret; + + if (len) { + ret = snprintf(path, sizeof(path), + "%.*s/" PIPE_PREFIX "%s" UTIL_DL_EXT, len, dir, pmod->name); + } + else { + ret = snprintf(path, sizeof(path), + PIPE_PREFIX "%s" UTIL_DL_EXT, pmod->name); + } + if (ret > 0 && ret < (int)sizeof(path)) { + pmod->lib = util_dl_open(path); + } + + return !(pmod->lib); } static bool load_pipe_module(struct pipe_module *pmod, const char *name) { - pmod->name = strdup(name); - if (!pmod->name) - return FALSE; - - for_each_in_search_path(dlopen_pipe_module_cb, (void *) pmod); - if (pmod->lib) { - pmod->drmdd = (const struct drm_driver_descriptor *) - util_dl_get_proc_address(pmod->lib, "driver_descriptor"); - - /* sanity check on the name */ - if (pmod->drmdd && strcmp(pmod->drmdd->name, pmod->name) != 0) - pmod->drmdd = NULL; - - /* swrast */ - if (pmod->drmdd && !pmod->drmdd->driver_name) { - pmod->swrast_create_screen = - (struct pipe_screen *(*)(struct sw_winsys *)) - util_dl_get_proc_address(pmod->lib, "swrast_create_screen"); - if (!pmod->swrast_create_screen) - pmod->drmdd = NULL; - } - - if (!pmod->drmdd) { - util_dl_close(pmod->lib); - pmod->lib = NULL; - } - } - - return (pmod->drmdd != NULL); + pmod->name = strdup(name); + if (!pmod->name) + return FALSE; + + for_each_in_search_path(dlopen_pipe_module_cb, (void *) pmod); + if (pmod->lib) { + pmod->drmdd = (const struct drm_driver_descriptor *) + util_dl_get_proc_address(pmod->lib, "driver_descriptor"); + + /* sanity check on the name */ + if (pmod->drmdd && strcmp(pmod->drmdd->name, pmod->name) != 0) + pmod->drmdd = NULL; + + /* swrast */ + if (pmod->drmdd && !pmod->drmdd->driver_name) { + pmod->swrast_create_screen = + (struct pipe_screen *(*)(struct sw_winsys *)) + util_dl_get_proc_address(pmod->lib, "swrast_create_screen"); + if (!pmod->swrast_create_screen) + pmod->drmdd = NULL; + } + + if (!pmod->drmdd) { + util_dl_close(pmod->lib); + pmod->lib = NULL; + } + } + + return (pmod->drmdd != NULL); } static struct pipe_module * get_pipe_module(const char *name) { - struct pipe_module *pmod = NULL; - unsigned i; - - if (!name) - return NULL; - - for (i = 0; i < sizeof(pipe_modules) / sizeof(pipe_modules[0]); i++) { - if (!pipe_modules[i].initialized || - strcmp(pipe_modules[i].name, name) == 0) { - pmod = &pipe_modules[i]; - break; - } - } - if (!pmod) - return NULL; - - if (!pmod->initialized) { - load_pipe_module(pmod, name); - pmod->initialized = TRUE; - } - - return pmod; + struct pipe_module *pmod = NULL; + unsigned i; + + if (!name) + return NULL; + + for (i = 0; i < sizeof(pipe_modules) / sizeof(pipe_modules[0]); i++) { + if (!pipe_modules[i].initialized || + strcmp(pipe_modules[i].name, name) == 0) { + pmod = &pipe_modules[i]; + break; + } + } + if (!pmod) + return NULL; + + if (!pmod->initialized) { + load_pipe_module(pmod, name); + pmod->initialized = TRUE; + } + + return pmod; } struct native_display; @@ -192,15 +192,15 @@ struct native_display; struct pipe_screen * dxgi_loader_create_drm_screen(struct native_display* dpy, const char *name, int fd) { - struct pipe_module *pmod = get_pipe_module(name); - return (pmod && pmod->drmdd && pmod->drmdd->create_screen) ? - pmod->drmdd->create_screen(fd) : NULL; + struct pipe_module *pmod = get_pipe_module(name); + return (pmod && pmod->drmdd && pmod->drmdd->create_screen) ? + pmod->drmdd->create_screen(fd) : NULL; } struct pipe_screen * dxgi_loader_create_sw_screen(struct native_display* dpy, struct sw_winsys *ws) { - struct pipe_module *pmod = get_pipe_module("swrast"); - return (pmod && pmod->swrast_create_screen) ? - pmod->swrast_create_screen(ws) : NULL; + struct pipe_module *pmod = get_pipe_module("swrast"); + return (pmod && pmod->swrast_create_screen) ? + pmod->swrast_create_screen(ws) : NULL; } diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp index 2149d83a9c6..bf820e9b21b 100644 --- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp +++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp @@ -55,12 +55,12 @@ struct GalliumDXGIObject : public GalliumPrivateDataComObject<Base> this->parent = p_parent; } - virtual HRESULT STDMETHODCALLTYPE GetParent( - __in REFIID riid, - __out void **ppParent) - { - return parent->QueryInterface(riid, ppParent); - } + virtual HRESULT STDMETHODCALLTYPE GetParent( + __in REFIID riid, + __out void **ppParent) + { + return parent->QueryInterface(riid, ppParent); + } }; COM_INTERFACE(IGalliumDXGIBackend, IUnknown) @@ -96,7 +96,7 @@ struct GalliumDXGIIdentityBackend : public GalliumComObject<IGalliumDXGIBackend> struct GalliumDXGIFactory : public GalliumDXGIObject<IDXGIFactory1, IUnknown> { - HWND associated_window; + HWND associated_window; const struct native_platform* platform; void* display; ComPtr<IGalliumDXGIBackend> backend; @@ -104,98 +104,98 @@ struct GalliumDXGIFactory : public GalliumDXGIObject<IDXGIFactory1, IUnknown> GalliumDXGIFactory(const struct native_platform* platform, void* display, IGalliumDXGIBackend* p_backend) : GalliumDXGIObject<IDXGIFactory1, IUnknown>((IUnknown*)NULL), platform(platform), display(display) - { + { if(p_backend) backend = p_backend; else backend.reset(new GalliumDXGIIdentityBackend()); } - virtual HRESULT STDMETHODCALLTYPE EnumAdapters( - UINT Adapter, - __out IDXGIAdapter **ppAdapter) + virtual HRESULT STDMETHODCALLTYPE EnumAdapters( + UINT Adapter, + __out IDXGIAdapter **ppAdapter) { return EnumAdapters1(Adapter, (IDXGIAdapter1**)ppAdapter); } - virtual HRESULT STDMETHODCALLTYPE EnumAdapters1( - UINT Adapter, - __out IDXGIAdapter1 **ppAdapter) - { - *ppAdapter = 0; + virtual HRESULT STDMETHODCALLTYPE EnumAdapters1( + UINT Adapter, + __out IDXGIAdapter1 **ppAdapter) + { + *ppAdapter = 0; if(Adapter == 0) { return GalliumDXGIAdapterCreate(this, platform, display, ppAdapter); } #if 0 // TODO: enable this - if(platform == native_get_x11_platform()) - { - unsigned nscreens = ScreenCount((Display*)display); - if(Adapter < nscreens) - { - unsigned def_screen = DefaultScreen(display); - if(Adapter <= def_screen) - --Adapter; - *ppAdapter = GalliumDXGIAdapterCreate(this, platform, display, Adapter); - return S_OK; - } - } + if(platform == native_get_x11_platform()) + { + unsigned nscreens = ScreenCount((Display*)display); + if(Adapter < nscreens) + { + unsigned def_screen = DefaultScreen(display); + if(Adapter <= def_screen) + --Adapter; + *ppAdapter = GalliumDXGIAdapterCreate(this, platform, display, Adapter); + return S_OK; + } + } #endif return DXGI_ERROR_NOT_FOUND; - } - - /* TODO: this is a mysterious underdocumented magic API - * Can we have multiple windows associated? - * Can we have multiple windows associated if we use multiple factories? - * If so, what should GetWindowAssociation return? - * If not, does a new swapchain steal the association? - * Does this act for existing swapchains? For new swapchains? - */ - virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation( - HWND WindowHandle, - UINT Flags) - { - /* TODO: actually implement, for Wine, X11 and KMS*/ - associated_window = WindowHandle; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation( - __out HWND *pWindowHandle) - { - *pWindowHandle = associated_window; - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE CreateSwapChain( - __in IUnknown *pDevice, - __in DXGI_SWAP_CHAIN_DESC *pDesc, - __out IDXGISwapChain **ppSwapChain) - { - return GalliumDXGISwapChainCreate(this, pDevice, *pDesc, ppSwapChain); - } - - virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter( - HMODULE Module, - __out IDXGIAdapter **ppAdapter) - { - /* TODO: ignore the module, and just create a Gallium software screen */ - *ppAdapter = 0; - return E_NOTIMPL; - } - - /* TODO: support hotplug */ - virtual BOOL STDMETHODCALLTYPE IsCurrent( void) - { - return TRUE; - } + } + + /* TODO: this is a mysterious underdocumented magic API + * Can we have multiple windows associated? + * Can we have multiple windows associated if we use multiple factories? + * If so, what should GetWindowAssociation return? + * If not, does a new swapchain steal the association? + * Does this act for existing swapchains? For new swapchains? + */ + virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation( + HWND WindowHandle, + UINT Flags) + { + /* TODO: actually implement, for Wine, X11 and KMS*/ + associated_window = WindowHandle; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation( + __out HWND *pWindowHandle) + { + *pWindowHandle = associated_window; + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CreateSwapChain( + __in IUnknown *pDevice, + __in DXGI_SWAP_CHAIN_DESC *pDesc, + __out IDXGISwapChain **ppSwapChain) + { + return GalliumDXGISwapChainCreate(this, pDevice, *pDesc, ppSwapChain); + } + + virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter( + HMODULE Module, + __out IDXGIAdapter **ppAdapter) + { + /* TODO: ignore the module, and just create a Gallium software screen */ + *ppAdapter = 0; + return E_NOTIMPL; + } + + /* TODO: support hotplug */ + virtual BOOL STDMETHODCALLTYPE IsCurrent( void) + { + return TRUE; + } }; struct GalliumDXGIAdapter : public GalliumMultiComObject< - GalliumDXGIObject<IDXGIAdapter1, GalliumDXGIFactory>, - IGalliumAdapter> + GalliumDXGIObject<IDXGIAdapter1, GalliumDXGIFactory>, + IGalliumAdapter> { struct native_display* display; const struct native_config** configs; @@ -275,62 +275,62 @@ struct GalliumDXGIAdapter free(connectors); } - virtual HRESULT STDMETHODCALLTYPE EnumOutputs( - UINT Output, - __out IDXGIOutput **ppOutput) + virtual HRESULT STDMETHODCALLTYPE EnumOutputs( + UINT Output, + __out IDXGIOutput **ppOutput) { - if(Output >= (unsigned)num_outputs) - return DXGI_ERROR_NOT_FOUND; + if(Output >= (unsigned)num_outputs) + return DXGI_ERROR_NOT_FOUND; - if(connectors) - { - std::ostringstream ss; - ss << "Output #" << Output; + if(connectors) + { + std::ostringstream ss; + ss << "Output #" << Output; return GalliumDXGIOutputCreate(this, ss.str(), connectors[Output], ppOutput); - } - else - return GalliumDXGIOutputCreate(this, "Unique output", NULL, ppOutput); + } + else + return GalliumDXGIOutputCreate(this, "Unique output", NULL, ppOutput); + } + + virtual HRESULT STDMETHODCALLTYPE GetDesc( + __out DXGI_ADAPTER_DESC *pDesc) + { + memcpy(pDesc, &desc, sizeof(*pDesc)); + return S_OK; } - virtual HRESULT STDMETHODCALLTYPE GetDesc( - __out DXGI_ADAPTER_DESC *pDesc) - { - memcpy(pDesc, &desc, sizeof(*pDesc)); - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE GetDesc1( - __out DXGI_ADAPTER_DESC1 *pDesc) - { - memcpy(pDesc, &desc, sizeof(*pDesc)); - return S_OK; - } - - virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport( - __in REFGUID InterfaceName, - __out LARGE_INTEGER *pUMDVersion) - { - // these number was taken from Windows 7 with Catalyst 10.8: its meaning is unclear - if(InterfaceName == IID_ID3D11Device || InterfaceName == IID_ID3D10Device1 || InterfaceName == IID_ID3D10Device) - { - pUMDVersion->QuadPart = 0x00080011000a0411ULL; - return S_OK; - } - return DXGI_ERROR_UNSUPPORTED; - } - - pipe_screen* STDMETHODCALLTYPE GetGalliumScreen() - { - return display->screen; - } - - pipe_screen* STDMETHODCALLTYPE GetGalliumReferenceSoftwareScreen() - { - // TODO: give a softpipe screen - return display->screen; - } - - pipe_screen* STDMETHODCALLTYPE GetGalliumFastSoftwareScreen() + virtual HRESULT STDMETHODCALLTYPE GetDesc1( + __out DXGI_ADAPTER_DESC1 *pDesc) + { + memcpy(pDesc, &desc, sizeof(*pDesc)); + return S_OK; + } + + virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport( + __in REFGUID InterfaceName, + __out LARGE_INTEGER *pUMDVersion) + { + // these number was taken from Windows 7 with Catalyst 10.8: its meaning is unclear + if(InterfaceName == IID_ID3D11Device || InterfaceName == IID_ID3D10Device1 || InterfaceName == IID_ID3D10Device) + { + pUMDVersion->QuadPart = 0x00080011000a0411ULL; + return S_OK; + } + return DXGI_ERROR_UNSUPPORTED; + } + + pipe_screen* STDMETHODCALLTYPE GetGalliumScreen() + { + return display->screen; + } + + pipe_screen* STDMETHODCALLTYPE GetGalliumReferenceSoftwareScreen() + { + // TODO: give a softpipe screen + return display->screen; + } + + pipe_screen* STDMETHODCALLTYPE GetGalliumFastSoftwareScreen() { // TODO: give an llvmpipe screen return display->screen; @@ -407,7 +407,7 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE GetDesc( - __out DXGI_OUTPUT_DESC *pDesc) + __out DXGI_OUTPUT_DESC *pDesc) { *pDesc = desc; return S_OK; @@ -416,8 +416,8 @@ use_fake_mode: virtual HRESULT STDMETHODCALLTYPE GetDisplayModeList( DXGI_FORMAT EnumFormat, UINT Flags, - __inout UINT *pNumModes, - __out_ecount_part_opt(*pNumModes,*pNumModes) DXGI_MODE_DESC *pDesc) + __inout UINT *pNumModes, + __out_ecount_part_opt(*pNumModes,*pNumModes) DXGI_MODE_DESC *pDesc) { /* TODO: should we return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE when we don't * support modesetting instead of fake modes? @@ -452,9 +452,9 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE FindClosestMatchingMode( - __in const DXGI_MODE_DESC *pModeToMatch, - __out DXGI_MODE_DESC *pClosestMatch, - __in_opt IUnknown *pConcernedDevice) + __in const DXGI_MODE_DESC *pModeToMatch, + __out DXGI_MODE_DESC *pClosestMatch, + __in_opt IUnknown *pConcernedDevice) { /* TODO: actually implement this */ DXGI_FORMAT dxgi_format = pModeToMatch->Format; @@ -482,7 +482,7 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE TakeOwnership( - __in IUnknown *pDevice, + __in IUnknown *pDevice, BOOL Exclusive) { return S_OK; @@ -493,14 +493,14 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE GetGammaControlCapabilities( - __out DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps) + __out DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps) { memset(pGammaCaps, 0, sizeof(*pGammaCaps)); return S_OK; } virtual HRESULT STDMETHODCALLTYPE SetGammaControl( - __in const DXGI_GAMMA_CONTROL *pArray) + __in const DXGI_GAMMA_CONTROL *pArray) { if(!gamma) gamma = new DXGI_GAMMA_CONTROL; @@ -509,7 +509,7 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE GetGammaControl( - __out DXGI_GAMMA_CONTROL *pArray) + __out DXGI_GAMMA_CONTROL *pArray) { if(gamma) *pArray = *gamma; @@ -528,19 +528,19 @@ use_fake_mode: } virtual HRESULT STDMETHODCALLTYPE SetDisplaySurface( - __in IDXGISurface *pScanoutSurface) + __in IDXGISurface *pScanoutSurface) { return E_NOTIMPL; } virtual HRESULT STDMETHODCALLTYPE GetDisplaySurfaceData( - __in IDXGISurface *pDestination) + __in IDXGISurface *pDestination) { return E_NOTIMPL; } virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( - __out DXGI_FRAME_STATISTICS *pStats) + __out DXGI_FRAME_STATISTICS *pStats) { memset(pStats, 0, sizeof(*pStats)); #ifdef _WIN32 @@ -579,7 +579,7 @@ use_fake_mode: * GetBuffer(n) with n > 0 points to resources that are identical to buffer 0, but * are classified as "read-only resources" (due to DXGI_USAGE_READ_ONLY), * meaning that you can't create render target views on them, or use them as - * a CopyResource/CopySubresourceRegion destination. + * a CopyResource/CopySubresourceRegion destination. * It appears the only valid operation is to use them as a source for CopyResource * and CopySubresourceRegion as well as just waiting for them to become * buffer 0 again. @@ -620,17 +620,17 @@ use_fake_mode: * * There are three strategies: * 1. Use a single buffer, and always copy it to a window system provided buffer, or - * just give the buffer to the window system if it supports that + * just give the buffer to the window system if it supports that * 2. Rotate the buffers in the D3D1x implementation, and recreate and rebind the views. - * Don't support driver-provided command lists + * Don't support driver-provided command lists * 3. Add this rotation functionality to the Gallium driver, with the idea that it would rotate - * remap GPU virtual memory, so that virtual address are unchanged, but the physical - * ones are rotated (so that pushbuffers remain valid). - * If the driver does not support this, either fall back to (1), or have a layer doing this, - * putting a deferred context layer over this intermediate layer. + * remap GPU virtual memory, so that virtual address are unchanged, but the physical + * ones are rotated (so that pushbuffers remain valid). + * If the driver does not support this, either fall back to (1), or have a layer doing this, + * putting a deferred context layer over this intermediate layer. * * (2) is not acceptable since it prevents an optimal implementation. - * (3) is the ideal solution, but it is complicated. + * (3) is the ideal solution, but it is complicated. * * Hence, we implement (1) for now, and will switch to (3) later. * @@ -872,7 +872,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX if(desc.SwapEffect == DXGI_SWAP_EFFECT_SEQUENTIAL && desc.BufferCount != 1) { - std::cerr << "Gallium DXGI: if DXGI_SWAP_EFFECT_SEQUENTIAL is specified, only BufferCount == 1 is implemented, but " << desc.BufferCount << " was specified: ignoring this" << std::endl; + std::cerr << "Gallium DXGI: if DXGI_SWAP_EFFECT_SEQUENTIAL is specified, only BufferCount == 1 is implemented, but " << desc.BufferCount << " was specified: ignoring this" << std::endl; // change the returned desc, so that the application might perhaps notice what we did and react well desc.BufferCount = 1; } @@ -940,16 +940,16 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX pipe->destroy(pipe); } - virtual HRESULT STDMETHODCALLTYPE GetDevice( - __in REFIID riid, - __out void **ppDevice) - { - return dxgi_device->QueryInterface(riid, ppDevice); - } + virtual HRESULT STDMETHODCALLTYPE GetDevice( + __in REFIID riid, + __out void **ppDevice) + { + return dxgi_device->QueryInterface(riid, ppDevice); + } - HRESULT create_buffer0() - { - HRESULT hr; + HRESULT create_buffer0() + { + HRESULT hr; ComPtr<IDXGISurface> new_buffer0; DXGI_USAGE usage = DXGI_USAGE_BACK_BUFFER | DXGI_USAGE_RENDER_TARGET_OUTPUT; if(desc.SwapEffect == DXGI_SWAP_EFFECT_DISCARD) @@ -987,7 +987,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX templat.format = gallium_buffer0->format; gallium_buffer0_view = pipe->create_sampler_view(pipe, gallium_buffer0, &templat); return S_OK; - } + } bool validate() { @@ -1158,9 +1158,9 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetBuffer( - UINT Buffer, - __in REFIID riid, - __out void **ppSurface) + UINT Buffer, + __in REFIID riid, + __out void **ppSurface) { if(Buffer > 0) { @@ -1182,7 +1182,7 @@ end_present: /* TODO: implement somehow */ virtual HRESULT STDMETHODCALLTYPE SetFullscreenState( BOOL Fullscreen, - __in_opt IDXGIOutput *pTarget) + __in_opt IDXGIOutput *pTarget) { fullscreen = Fullscreen; target = pTarget; @@ -1190,8 +1190,8 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetFullscreenState( - __out BOOL *pFullscreen, - __out IDXGIOutput **ppTarget) + __out BOOL *pFullscreen, + __out IDXGIOutput **ppTarget) { if(pFullscreen) *pFullscreen = fullscreen; @@ -1201,7 +1201,7 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetDesc( - __out DXGI_SWAP_CHAIN_DESC *pDesc) + __out DXGI_SWAP_CHAIN_DESC *pDesc) { *pDesc = desc; return S_OK; @@ -1243,14 +1243,14 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetContainingOutput( - __out IDXGIOutput **ppOutput) + __out IDXGIOutput **ppOutput) { *ppOutput = adapter->outputs[0].ref(); return S_OK; } virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( - __out DXGI_FRAME_STATISTICS *pStats) + __out DXGI_FRAME_STATISTICS *pStats) { memset(pStats, 0, sizeof(*pStats)); #ifdef _WIN32 @@ -1263,7 +1263,7 @@ end_present: } virtual HRESULT STDMETHODCALLTYPE GetLastPresentCount( - __out UINT *pLastPresentCount) + __out UINT *pLastPresentCount) { *pLastPresentCount = present_count; return S_OK; @@ -1389,11 +1389,11 @@ void STDMETHODCALLTYPE GalliumDXGIMakeDefault() } /* TODO: why did Microsoft add this? should we do something different for DXGI 1.0 and 1.1? - * Or perhaps what they actually mean is "only create a single factory in your application"? - * TODO: should we use a singleton here, so we never have multiple DXGI objects for the same thing? */ - HRESULT STDMETHODCALLTYPE CreateDXGIFactory1( - __in REFIID riid, - __out void **ppFactory + * Or perhaps what they actually mean is "only create a single factory in your application"? + * TODO: should we use a singleton here, so we never have multiple DXGI objects for the same thing? */ + HRESULT STDMETHODCALLTYPE CreateDXGIFactory1( + __in REFIID riid, + __out void **ppFactory ) { GalliumDXGIFactory* factory; @@ -1409,9 +1409,9 @@ void STDMETHODCALLTYPE GalliumDXGIMakeDefault() return hres; } - HRESULT STDMETHODCALLTYPE CreateDXGIFactory( - __in REFIID riid, - __out void **ppFactory + HRESULT STDMETHODCALLTYPE CreateDXGIFactory( + __in REFIID riid, + __out void **ppFactory ) { return CreateDXGIFactory1(riid, ppFactory); |