daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | // Renderer11.cpp: Implements a back-end specific class for the D3D11 renderer. |
| 8 | |
| 9 | #include "common/debug.h" |
daniel@transgaming.com | 5503fd0 | 2012-11-28 19:38:57 +0000 | [diff] [blame] | 10 | #include "libGLESv2/main.h" |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 11 | #include "libGLESv2/utilities.h" |
daniel@transgaming.com | dcf1e67 | 2012-11-28 19:38:19 +0000 | [diff] [blame] | 12 | #include "libGLESv2/mathutil.h" |
daniel@transgaming.com | 5367004 | 2012-11-28 20:55:51 +0000 | [diff] [blame] | 13 | #include "libGLESv2/Program.h" |
| 14 | #include "libGLESv2/ProgramBinary.h" |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 15 | #include "libGLESv2/renderer/Renderer11.h" |
daniel@transgaming.com | b6b27bc | 2012-11-28 20:54:30 +0000 | [diff] [blame] | 16 | #include "libGLESv2/renderer/RenderTarget11.h" |
daniel@transgaming.com | 65e6537 | 2012-11-28 19:33:50 +0000 | [diff] [blame] | 17 | #include "libGLESv2/renderer/renderer11_utils.h" |
daniel@transgaming.com | a60160b | 2012-11-28 19:41:15 +0000 | [diff] [blame] | 18 | #include "libGLESv2/renderer/SwapChain11.h" |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 19 | |
| 20 | #include "libEGL/Config.h" |
| 21 | #include "libEGL/Display.h" |
| 22 | |
| 23 | namespace rx |
| 24 | { |
daniel@transgaming.com | 65e6537 | 2012-11-28 19:33:50 +0000 | [diff] [blame] | 25 | static const DXGI_FORMAT RenderTargetFormats[] = |
| 26 | { |
| 27 | DXGI_FORMAT_R8G8B8A8_UNORM |
| 28 | }; |
| 29 | |
| 30 | static const DXGI_FORMAT DepthStencilFormats[] = |
| 31 | { |
| 32 | DXGI_FORMAT_D24_UNORM_S8_UINT |
| 33 | }; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 34 | |
| 35 | Renderer11::Renderer11(egl::Display *display, HDC hDc) : Renderer(display), mDc(hDc) |
| 36 | { |
| 37 | mD3d11Module = NULL; |
| 38 | mDxgiModule = NULL; |
| 39 | |
daniel@transgaming.com | b9bb279 | 2012-11-28 19:36:49 +0000 | [diff] [blame] | 40 | mDeviceLost = false; |
| 41 | |
daniel@transgaming.com | 25072f6 | 2012-11-28 19:31:32 +0000 | [diff] [blame] | 42 | mDevice = NULL; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 43 | mDeviceContext = NULL; |
daniel@transgaming.com | 65e6537 | 2012-11-28 19:33:50 +0000 | [diff] [blame] | 44 | mDxgiAdapter = NULL; |
| 45 | mDxgiFactory = NULL; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | Renderer11::~Renderer11() |
| 49 | { |
| 50 | releaseDeviceResources(); |
| 51 | |
daniel@transgaming.com | 65e6537 | 2012-11-28 19:33:50 +0000 | [diff] [blame] | 52 | if (mDxgiFactory) |
| 53 | { |
| 54 | mDxgiFactory->Release(); |
| 55 | mDxgiFactory = NULL; |
| 56 | } |
| 57 | |
| 58 | if (mDxgiAdapter) |
| 59 | { |
| 60 | mDxgiAdapter->Release(); |
| 61 | mDxgiAdapter = NULL; |
| 62 | } |
| 63 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 64 | if (mDeviceContext) |
| 65 | { |
| 66 | mDeviceContext->Release(); |
| 67 | mDeviceContext = NULL; |
| 68 | } |
| 69 | |
daniel@transgaming.com | 25072f6 | 2012-11-28 19:31:32 +0000 | [diff] [blame] | 70 | if (mDevice) |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 71 | { |
daniel@transgaming.com | 25072f6 | 2012-11-28 19:31:32 +0000 | [diff] [blame] | 72 | mDevice->Release(); |
| 73 | mDevice = NULL; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | if (mD3d11Module) |
| 77 | { |
daniel@transgaming.com | c1e2634 | 2012-11-28 19:31:16 +0000 | [diff] [blame] | 78 | FreeLibrary(mD3d11Module); |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 79 | mD3d11Module = NULL; |
| 80 | } |
| 81 | |
| 82 | if (mDxgiModule) |
| 83 | { |
daniel@transgaming.com | c1e2634 | 2012-11-28 19:31:16 +0000 | [diff] [blame] | 84 | FreeLibrary(mDxgiModule); |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 85 | mDxgiModule = NULL; |
| 86 | } |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 87 | } |
| 88 | |
daniel@transgaming.com | b64ed28 | 2012-11-28 20:54:02 +0000 | [diff] [blame] | 89 | Renderer11 *Renderer11::makeRenderer11(Renderer *renderer) |
| 90 | { |
| 91 | ASSERT(dynamic_cast<rx::Renderer11*>(renderer) != NULL); |
| 92 | return static_cast<rx::Renderer11*>(renderer); |
| 93 | } |
| 94 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 95 | EGLint Renderer11::initialize() |
| 96 | { |
daniel@transgaming.com | c1e2634 | 2012-11-28 19:31:16 +0000 | [diff] [blame] | 97 | mDxgiModule = LoadLibrary(TEXT("dxgi.dll")); |
| 98 | mD3d11Module = LoadLibrary(TEXT("d3d11.dll")); |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 99 | |
| 100 | if (mD3d11Module == NULL || mDxgiModule == NULL) |
| 101 | { |
daniel@transgaming.com | c1e2634 | 2012-11-28 19:31:16 +0000 | [diff] [blame] | 102 | ERR("Could not load D3D11 or DXGI library - aborting!\n"); |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 103 | return EGL_NOT_INITIALIZED; |
| 104 | } |
| 105 | |
daniel@transgaming.com | c1e2634 | 2012-11-28 19:31:16 +0000 | [diff] [blame] | 106 | PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(mD3d11Module, "D3D11CreateDevice"); |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 107 | |
daniel@transgaming.com | c1e2634 | 2012-11-28 19:31:16 +0000 | [diff] [blame] | 108 | if (D3D11CreateDevice == NULL) |
| 109 | { |
| 110 | ERR("Could not retrieve D3D11CreateDevice address - aborting!\n"); |
| 111 | return EGL_NOT_INITIALIZED; |
| 112 | } |
daniel@transgaming.com | 25072f6 | 2012-11-28 19:31:32 +0000 | [diff] [blame] | 113 | |
| 114 | D3D_FEATURE_LEVEL featureLevel[] = |
| 115 | { |
| 116 | D3D_FEATURE_LEVEL_11_0, |
| 117 | D3D_FEATURE_LEVEL_10_1, |
| 118 | D3D_FEATURE_LEVEL_10_0, |
| 119 | }; |
| 120 | |
daniel@transgaming.com | c1e2634 | 2012-11-28 19:31:16 +0000 | [diff] [blame] | 121 | HRESULT result = D3D11CreateDevice(NULL, |
| 122 | D3D_DRIVER_TYPE_HARDWARE, |
| 123 | NULL, |
daniel@transgaming.com | a60160b | 2012-11-28 19:41:15 +0000 | [diff] [blame] | 124 | #if defined(_DEBUG) |
| 125 | D3D11_CREATE_DEVICE_DEBUG, |
| 126 | #else |
| 127 | 0, |
| 128 | #endif |
daniel@transgaming.com | 25072f6 | 2012-11-28 19:31:32 +0000 | [diff] [blame] | 129 | featureLevel, |
| 130 | sizeof(featureLevel)/sizeof(featureLevel[0]), |
daniel@transgaming.com | c1e2634 | 2012-11-28 19:31:16 +0000 | [diff] [blame] | 131 | D3D11_SDK_VERSION, |
daniel@transgaming.com | 25072f6 | 2012-11-28 19:31:32 +0000 | [diff] [blame] | 132 | &mDevice, |
| 133 | &mFeatureLevel, |
daniel@transgaming.com | c1e2634 | 2012-11-28 19:31:16 +0000 | [diff] [blame] | 134 | &mDeviceContext); |
daniel@transgaming.com | 25072f6 | 2012-11-28 19:31:32 +0000 | [diff] [blame] | 135 | |
| 136 | if (!mDevice || FAILED(result)) |
daniel@transgaming.com | c1e2634 | 2012-11-28 19:31:16 +0000 | [diff] [blame] | 137 | { |
| 138 | ERR("Could not create D3D11 device - aborting!\n"); |
| 139 | return EGL_NOT_INITIALIZED; // Cleanup done by destructor through glDestroyRenderer |
| 140 | } |
daniel@transgaming.com | 65e6537 | 2012-11-28 19:33:50 +0000 | [diff] [blame] | 141 | |
| 142 | IDXGIDevice *dxgiDevice = NULL; |
| 143 | result = mDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice); |
| 144 | |
| 145 | if (FAILED(result)) |
| 146 | { |
| 147 | ERR("Could not query DXGI device - aborting!\n"); |
| 148 | return EGL_NOT_INITIALIZED; |
| 149 | } |
| 150 | |
| 151 | result = dxgiDevice->GetParent(__uuidof(IDXGIAdapter), (void**)&mDxgiAdapter); |
| 152 | |
| 153 | if (FAILED(result)) |
| 154 | { |
| 155 | ERR("Could not retrieve DXGI adapter - aborting!\n"); |
| 156 | return EGL_NOT_INITIALIZED; |
| 157 | } |
| 158 | |
| 159 | dxgiDevice->Release(); |
| 160 | |
| 161 | result = mDxgiAdapter->GetParent(__uuidof(IDXGIFactory), (void**)&mDxgiFactory); |
| 162 | |
| 163 | if (!mDxgiFactory || FAILED(result)) |
| 164 | { |
| 165 | ERR("Could not create DXGI factory - aborting!\n"); |
| 166 | return EGL_NOT_INITIALIZED; |
| 167 | } |
| 168 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 169 | initializeDevice(); |
| 170 | |
| 171 | return EGL_SUCCESS; |
| 172 | } |
| 173 | |
| 174 | // do any one-time device initialization |
| 175 | // NOTE: this is also needed after a device lost/reset |
| 176 | // to reset the scene status and ensure the default states are reset. |
| 177 | void Renderer11::initializeDevice() |
| 178 | { |
daniel@transgaming.com | f8ba109 | 2012-11-28 19:37:53 +0000 | [diff] [blame] | 179 | mStateCache.initialize(mDevice); |
| 180 | |
daniel@transgaming.com | c43a605 | 2012-11-28 19:41:51 +0000 | [diff] [blame] | 181 | markAllStateDirty(); |
| 182 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 183 | // Permanent non-default states |
| 184 | // TODO |
daniel@transgaming.com | c1e2634 | 2012-11-28 19:31:16 +0000 | [diff] [blame] | 185 | // UNIMPLEMENTED(); |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 186 | } |
| 187 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 188 | int Renderer11::generateConfigs(ConfigDesc **configDescList) |
| 189 | { |
daniel@transgaming.com | e3e826d | 2012-11-28 19:42:35 +0000 | [diff] [blame] | 190 | unsigned int numRenderFormats = sizeof(RenderTargetFormats) / sizeof(RenderTargetFormats[0]); |
| 191 | unsigned int numDepthFormats = sizeof(DepthStencilFormats) / sizeof(DepthStencilFormats[0]); |
daniel@transgaming.com | 65e6537 | 2012-11-28 19:33:50 +0000 | [diff] [blame] | 192 | (*configDescList) = new ConfigDesc[numRenderFormats * numDepthFormats]; |
| 193 | int numConfigs = 0; |
| 194 | |
daniel@transgaming.com | e3e826d | 2012-11-28 19:42:35 +0000 | [diff] [blame] | 195 | for (unsigned int formatIndex = 0; formatIndex < numRenderFormats; formatIndex++) |
daniel@transgaming.com | 65e6537 | 2012-11-28 19:33:50 +0000 | [diff] [blame] | 196 | { |
daniel@transgaming.com | e3e826d | 2012-11-28 19:42:35 +0000 | [diff] [blame] | 197 | for (unsigned int depthStencilIndex = 0; depthStencilIndex < numDepthFormats; depthStencilIndex++) |
daniel@transgaming.com | 65e6537 | 2012-11-28 19:33:50 +0000 | [diff] [blame] | 198 | { |
| 199 | DXGI_FORMAT renderTargetFormat = RenderTargetFormats[formatIndex]; |
| 200 | |
| 201 | UINT formatSupport = 0; |
| 202 | HRESULT result = mDevice->CheckFormatSupport(renderTargetFormat, &formatSupport); |
| 203 | |
| 204 | if (SUCCEEDED(result) && (formatSupport & D3D11_FORMAT_SUPPORT_RENDER_TARGET)) |
| 205 | { |
| 206 | DXGI_FORMAT depthStencilFormat = DepthStencilFormats[depthStencilIndex]; |
| 207 | |
| 208 | UINT formatSupport = 0; |
| 209 | HRESULT result = mDevice->CheckFormatSupport(depthStencilFormat, &formatSupport); |
| 210 | |
| 211 | if (SUCCEEDED(result) && (formatSupport & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL)) |
| 212 | { |
| 213 | ConfigDesc newConfig; |
| 214 | newConfig.renderTargetFormat = d3d11_gl::ConvertBackBufferFormat(renderTargetFormat); |
| 215 | newConfig.depthStencilFormat = d3d11_gl::ConvertDepthStencilFormat(depthStencilFormat); |
| 216 | newConfig.multiSample = 0; // FIXME: enumerate multi-sampling |
| 217 | newConfig.fastConfig = true; // Assume all DX11 format conversions to be fast |
| 218 | |
| 219 | (*configDescList)[numConfigs++] = newConfig; |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | return numConfigs; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | void Renderer11::deleteConfigs(ConfigDesc *configDescList) |
| 229 | { |
| 230 | delete [] (configDescList); |
| 231 | } |
| 232 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 233 | void Renderer11::sync(bool block) |
| 234 | { |
| 235 | // TODO |
| 236 | UNIMPLEMENTED(); |
| 237 | } |
| 238 | |
daniel@transgaming.com | b9bb279 | 2012-11-28 19:36:49 +0000 | [diff] [blame] | 239 | SwapChain *Renderer11::createSwapChain(HWND window, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat) |
| 240 | { |
daniel@transgaming.com | a60160b | 2012-11-28 19:41:15 +0000 | [diff] [blame] | 241 | return new rx::SwapChain11(this, window, shareHandle, backBufferFormat, depthBufferFormat); |
daniel@transgaming.com | b9bb279 | 2012-11-28 19:36:49 +0000 | [diff] [blame] | 242 | } |
| 243 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 244 | void Renderer11::setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &samplerState) |
| 245 | { |
| 246 | // TODO |
| 247 | UNIMPLEMENTED(); |
| 248 | } |
| 249 | |
| 250 | void Renderer11::setTexture(gl::SamplerType type, int index, gl::Texture *texture) |
| 251 | { |
| 252 | // TODO |
| 253 | UNIMPLEMENTED(); |
| 254 | } |
| 255 | |
daniel@transgaming.com | 493d4f8 | 2012-11-28 19:35:45 +0000 | [diff] [blame] | 256 | void Renderer11::setRasterizerState(const gl::RasterizerState &rasterState, unsigned int depthSize) |
| 257 | { |
daniel@transgaming.com | dcf1e67 | 2012-11-28 19:38:19 +0000 | [diff] [blame] | 258 | if (mForceSetRasterState || |
| 259 | memcmp(&rasterState, &mCurRasterState, sizeof(gl::RasterizerState)) != 0 || |
| 260 | depthSize != mCurDepthSize) |
| 261 | { |
| 262 | ID3D11RasterizerState *dxRasterState = mStateCache.getRasterizerState(rasterState, depthSize); |
| 263 | if (!dxRasterState) |
| 264 | { |
| 265 | ERR("NULL blend state returned by RenderStateCache::getRasterizerState, setting the " |
| 266 | "rasterizer state."); |
| 267 | } |
| 268 | |
| 269 | mDeviceContext->RSSetState(dxRasterState); |
| 270 | |
| 271 | if (dxRasterState) |
| 272 | { |
| 273 | dxRasterState->Release(); |
| 274 | } |
| 275 | mCurRasterState = rasterState; |
| 276 | mCurDepthSize = depthSize; |
| 277 | } |
| 278 | |
| 279 | mForceSetRasterState = false; |
daniel@transgaming.com | 493d4f8 | 2012-11-28 19:35:45 +0000 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | void Renderer11::setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor, |
| 283 | unsigned int sampleMask) |
| 284 | { |
daniel@transgaming.com | f8ba109 | 2012-11-28 19:37:53 +0000 | [diff] [blame] | 285 | if (mForceSetBlendState || |
| 286 | memcmp(&blendState, &mCurBlendState, sizeof(gl::BlendState)) != 0 || |
| 287 | memcmp(&blendColor, &mCurBlendColor, sizeof(gl::Color)) != 0 || |
| 288 | sampleMask != mCurSampleMask) |
| 289 | { |
| 290 | ID3D11BlendState *dxBlendState = mStateCache.getBlendState(blendState); |
| 291 | if (!dxBlendState) |
| 292 | { |
| 293 | ERR("NULL blend state returned by RenderStateCache::getBlendState, setting the default " |
| 294 | "blend state."); |
| 295 | } |
| 296 | |
| 297 | const float blendColors[] = { blendColor.red, blendColor.green, blendColor.blue, blendColor.alpha }; |
| 298 | mDeviceContext->OMSetBlendState(dxBlendState, blendColors, sampleMask); |
| 299 | |
| 300 | if (dxBlendState) |
| 301 | { |
| 302 | dxBlendState->Release(); |
| 303 | } |
| 304 | mCurBlendState = blendState; |
| 305 | mCurBlendColor = blendColor; |
| 306 | mCurSampleMask = sampleMask; |
| 307 | } |
| 308 | |
| 309 | mForceSetBlendState = false; |
daniel@transgaming.com | 493d4f8 | 2012-11-28 19:35:45 +0000 | [diff] [blame] | 310 | } |
| 311 | |
daniel@transgaming.com | 08c331d | 2012-11-28 19:38:39 +0000 | [diff] [blame] | 312 | void Renderer11::setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef, |
| 313 | int stencilBackRef, bool frontFaceCCW, unsigned int stencilSize) |
daniel@transgaming.com | 493d4f8 | 2012-11-28 19:35:45 +0000 | [diff] [blame] | 314 | { |
daniel@transgaming.com | 5503fd0 | 2012-11-28 19:38:57 +0000 | [diff] [blame] | 315 | if (mForceSetDepthStencilState || |
| 316 | memcmp(&depthStencilState, &mCurDepthStencilState, sizeof(gl::DepthStencilState)) != 0 || |
| 317 | stencilRef != mCurStencilRef || stencilBackRef != mCurStencilBackRef) |
| 318 | { |
| 319 | if (depthStencilState.stencilWritemask != depthStencilState.stencilBackWritemask || |
| 320 | stencilRef != stencilBackRef || |
| 321 | depthStencilState.stencilMask != depthStencilState.stencilBackMask) |
| 322 | { |
| 323 | ERR("Separate front/back stencil writemasks, reference values, or stencil mask values are " |
| 324 | "invalid under WebGL."); |
| 325 | return error(GL_INVALID_OPERATION); |
| 326 | } |
| 327 | |
| 328 | ID3D11DepthStencilState *dxDepthStencilState = mStateCache.getDepthStencilState(depthStencilState); |
| 329 | if (!dxDepthStencilState) |
| 330 | { |
| 331 | ERR("NULL depth stencil state returned by RenderStateCache::getDepthStencilState, " |
| 332 | "setting the default depth stencil state."); |
| 333 | } |
| 334 | |
| 335 | mDeviceContext->OMSetDepthStencilState(dxDepthStencilState, static_cast<UINT>(stencilRef)); |
| 336 | |
| 337 | if (dxDepthStencilState) |
| 338 | { |
| 339 | dxDepthStencilState->Release(); |
| 340 | } |
| 341 | mCurDepthStencilState = depthStencilState; |
| 342 | mCurStencilRef = stencilRef; |
| 343 | mCurStencilBackRef = stencilBackRef; |
| 344 | } |
| 345 | |
| 346 | mForceSetDepthStencilState = false; |
daniel@transgaming.com | 493d4f8 | 2012-11-28 19:35:45 +0000 | [diff] [blame] | 347 | } |
| 348 | |
| 349 | void Renderer11::setScissorRectangle(const gl::Rectangle& scissor, unsigned int renderTargetWidth, |
| 350 | unsigned int renderTargetHeight) |
| 351 | { |
daniel@transgaming.com | dcf1e67 | 2012-11-28 19:38:19 +0000 | [diff] [blame] | 352 | if (mForceSetScissor || |
| 353 | renderTargetWidth != mCurRenderTargetWidth || |
| 354 | renderTargetHeight != mCurRenderTargetHeight || |
| 355 | memcmp(&scissor, &mCurScissor, sizeof(gl::Rectangle)) != 0) |
| 356 | { |
| 357 | D3D11_RECT rect; |
| 358 | rect.left = gl::clamp(scissor.x, 0, static_cast<int>(renderTargetWidth)); |
daniel@transgaming.com | 1dd557a | 2012-11-28 19:44:00 +0000 | [diff] [blame] | 359 | rect.top = gl::clamp(scissor.y, 0, static_cast<int>(renderTargetHeight)); |
daniel@transgaming.com | dcf1e67 | 2012-11-28 19:38:19 +0000 | [diff] [blame] | 360 | rect.right = gl::clamp(scissor.x + scissor.width, 0, static_cast<int>(renderTargetWidth)); |
daniel@transgaming.com | 1dd557a | 2012-11-28 19:44:00 +0000 | [diff] [blame] | 361 | rect.bottom = gl::clamp(scissor.y + scissor.height, 0, static_cast<int>(renderTargetHeight)); |
daniel@transgaming.com | dcf1e67 | 2012-11-28 19:38:19 +0000 | [diff] [blame] | 362 | |
| 363 | mDeviceContext->RSSetScissorRects(1, &rect); |
| 364 | |
| 365 | mCurScissor = scissor; |
| 366 | mCurRenderTargetWidth = renderTargetWidth; |
| 367 | mCurRenderTargetHeight = renderTargetHeight; |
| 368 | } |
| 369 | |
| 370 | mForceSetScissor = false; |
daniel@transgaming.com | 493d4f8 | 2012-11-28 19:35:45 +0000 | [diff] [blame] | 371 | } |
| 372 | |
daniel@transgaming.com | 83e80ee | 2012-11-28 19:40:53 +0000 | [diff] [blame] | 373 | bool Renderer11::setViewport(const gl::Rectangle& viewport, float zNear, float zFar, |
| 374 | unsigned int renderTargetWidth, unsigned int renderTargetHeight, |
| 375 | gl::ProgramBinary *currentProgram, bool forceSetUniforms) |
| 376 | { |
daniel@transgaming.com | 5367004 | 2012-11-28 20:55:51 +0000 | [diff] [blame] | 377 | bool viewportChanged = mForceSetViewport || memcmp(&viewport, &mCurViewport, sizeof(gl::Rectangle)) != 0 || |
| 378 | zNear != mCurNear || zFar != mCurFar; |
| 379 | |
| 380 | D3D11_VIEWPORT dxViewport; |
| 381 | dxViewport.TopLeftX = gl::clamp(viewport.x, 0, static_cast<int>(renderTargetWidth)); |
| 382 | dxViewport.TopLeftY = gl::clamp(viewport.y, 0, static_cast<int>(renderTargetHeight)); |
| 383 | dxViewport.Width = gl::clamp(viewport.width, 0, static_cast<int>(renderTargetWidth) - static_cast<int>(dxViewport.TopLeftX)); |
| 384 | dxViewport.Height = gl::clamp(viewport.height, 0, static_cast<int>(renderTargetHeight) - static_cast<int>(dxViewport.TopLeftY)); |
| 385 | dxViewport.MinDepth = zNear; |
| 386 | dxViewport.MaxDepth = zFar; |
| 387 | |
| 388 | if (dxViewport.Width <= 0 || dxViewport.Height <= 0) |
| 389 | { |
| 390 | return false; // Nothing to render |
| 391 | } |
| 392 | |
| 393 | if (viewportChanged) |
| 394 | { |
| 395 | mDeviceContext->RSSetViewports(1, &dxViewport); |
| 396 | |
| 397 | mCurViewport = viewport; |
| 398 | mCurNear = zNear; |
| 399 | mCurFar = zFar; |
| 400 | } |
| 401 | |
| 402 | if (currentProgram && (viewportChanged || forceSetUniforms)) |
| 403 | { |
| 404 | GLint halfPixelSize = currentProgram->getDxHalfPixelSizeLocation(); |
| 405 | GLfloat xy[2] = { 0.0f, 0.0f }; |
| 406 | currentProgram->setUniform2fv(halfPixelSize, 1, xy); |
| 407 | |
| 408 | // These values are used for computing gl_FragCoord in Program::linkVaryings(). |
| 409 | GLint coord = currentProgram->getDxCoordLocation(); |
| 410 | GLfloat whxy[4] = { viewport.width * 0.5f, |
| 411 | viewport.height * 0.5f, |
| 412 | viewport.x + (viewport.width * 0.5f), |
| 413 | viewport.y + (viewport.height * 0.5f) }; |
| 414 | currentProgram->setUniform4fv(coord, 1, whxy); |
| 415 | |
| 416 | GLint depth = currentProgram->getDxDepthLocation(); |
| 417 | GLfloat dz[2] = { (zFar - zNear) * 0.5f, (zNear + zFar) * 0.5f }; |
| 418 | currentProgram->setUniform2fv(depth, 1, dz); |
| 419 | |
| 420 | GLint depthRange = currentProgram->getDxDepthRangeLocation(); |
| 421 | GLfloat nearFarDiff[3] = { zNear, zFar, zFar - zNear }; |
| 422 | currentProgram->setUniform3fv(depthRange, 1, nearFarDiff); |
| 423 | } |
| 424 | |
| 425 | mForceSetViewport = false; |
daniel@transgaming.com | 83e80ee | 2012-11-28 19:40:53 +0000 | [diff] [blame] | 426 | return true; |
| 427 | } |
| 428 | |
daniel@transgaming.com | 91207b7 | 2012-11-28 20:56:43 +0000 | [diff] [blame] | 429 | bool Renderer11::applyPrimitiveType(GLenum mode, GLsizei count) |
| 430 | { |
| 431 | // TODO |
| 432 | UNIMPLEMENTED(); |
| 433 | |
| 434 | return false; |
| 435 | } |
| 436 | |
| 437 | bool Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer) |
daniel@transgaming.com | 493d4f8 | 2012-11-28 19:35:45 +0000 | [diff] [blame] | 438 | { |
| 439 | // TODO |
| 440 | UNIMPLEMENTED(); |
daniel@transgaming.com | dcf1e67 | 2012-11-28 19:38:19 +0000 | [diff] [blame] | 441 | |
| 442 | mForceSetScissor = true; |
daniel@transgaming.com | 5367004 | 2012-11-28 20:55:51 +0000 | [diff] [blame] | 443 | mForceSetViewport = true; |
daniel@transgaming.com | ae39ee2 | 2012-11-28 19:42:02 +0000 | [diff] [blame] | 444 | |
| 445 | return true; |
daniel@transgaming.com | 493d4f8 | 2012-11-28 19:35:45 +0000 | [diff] [blame] | 446 | } |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 447 | |
daniel@transgaming.com | 91207b7 | 2012-11-28 20:56:43 +0000 | [diff] [blame] | 448 | GLenum Renderer11::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances) |
daniel@transgaming.com | def9f0f | 2012-11-28 20:53:20 +0000 | [diff] [blame] | 449 | { |
| 450 | // TODO |
| 451 | UNIMPLEMENTED(); |
| 452 | |
| 453 | return GL_OUT_OF_MEMORY; |
| 454 | } |
| 455 | |
daniel@transgaming.com | 91207b7 | 2012-11-28 20:56:43 +0000 | [diff] [blame] | 456 | GLenum Renderer11::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, gl::TranslatedIndexData *indexInfo) |
| 457 | { |
| 458 | // TODO |
| 459 | UNIMPLEMENTED(); |
| 460 | |
| 461 | return GL_OUT_OF_MEMORY; |
| 462 | } |
| 463 | |
| 464 | void Renderer11::drawArrays(GLenum mode, GLsizei count, GLsizei instances) |
| 465 | { |
| 466 | // TODO |
| 467 | UNIMPLEMENTED(); |
| 468 | } |
| 469 | |
daniel@transgaming.com | 97400dd | 2012-11-28 20:57:00 +0000 | [diff] [blame] | 470 | void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const gl::TranslatedIndexData &indexInfo) |
daniel@transgaming.com | 91207b7 | 2012-11-28 20:56:43 +0000 | [diff] [blame] | 471 | { |
| 472 | // TODO |
| 473 | UNIMPLEMENTED(); |
| 474 | } |
| 475 | |
daniel@transgaming.com | 5fbf177 | 2012-11-28 20:54:43 +0000 | [diff] [blame] | 476 | void Renderer11::applyShaders(gl::ProgramBinary *programBinary) |
| 477 | { |
| 478 | // TODO |
| 479 | UNIMPLEMENTED(); |
| 480 | } |
| 481 | |
daniel@transgaming.com | 084a257 | 2012-11-28 20:55:17 +0000 | [diff] [blame] | 482 | void Renderer11::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer) |
daniel@transgaming.com | d084c62 | 2012-11-28 19:36:05 +0000 | [diff] [blame] | 483 | { |
| 484 | // TODO |
| 485 | UNIMPLEMENTED(); |
| 486 | } |
| 487 | |
daniel@transgaming.com | c43a605 | 2012-11-28 19:41:51 +0000 | [diff] [blame] | 488 | void Renderer11::markAllStateDirty() |
| 489 | { |
| 490 | mForceSetBlendState = true; |
| 491 | mForceSetRasterState = true; |
| 492 | mForceSetDepthStencilState = true; |
| 493 | mForceSetScissor = true; |
daniel@transgaming.com | 5367004 | 2012-11-28 20:55:51 +0000 | [diff] [blame] | 494 | mForceSetViewport = true; |
daniel@transgaming.com | c43a605 | 2012-11-28 19:41:51 +0000 | [diff] [blame] | 495 | } |
| 496 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 497 | void Renderer11::releaseDeviceResources() |
| 498 | { |
| 499 | // TODO |
daniel@transgaming.com | c1e2634 | 2012-11-28 19:31:16 +0000 | [diff] [blame] | 500 | // UNIMPLEMENTED(); |
daniel@transgaming.com | f8ba109 | 2012-11-28 19:37:53 +0000 | [diff] [blame] | 501 | mStateCache.clear(); |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 502 | } |
| 503 | |
| 504 | void Renderer11::markDeviceLost() |
| 505 | { |
| 506 | mDeviceLost = true; |
| 507 | } |
| 508 | |
| 509 | bool Renderer11::isDeviceLost() |
| 510 | { |
| 511 | return mDeviceLost; |
| 512 | } |
| 513 | |
| 514 | // set notify to true to broadcast a message to all contexts of the device loss |
| 515 | bool Renderer11::testDeviceLost(bool notify) |
| 516 | { |
| 517 | bool isLost = false; |
| 518 | |
| 519 | // TODO |
daniel@transgaming.com | b9bb279 | 2012-11-28 19:36:49 +0000 | [diff] [blame] | 520 | //UNIMPLEMENTED(); |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 521 | |
| 522 | if (isLost) |
| 523 | { |
| 524 | // ensure we note the device loss -- |
| 525 | // we'll probably get this done again by markDeviceLost |
| 526 | // but best to remember it! |
| 527 | // Note that we don't want to clear the device loss status here |
| 528 | // -- this needs to be done by resetDevice |
| 529 | mDeviceLost = true; |
| 530 | if (notify) |
| 531 | { |
| 532 | mDisplay->notifyDeviceLost(); |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | return isLost; |
| 537 | } |
| 538 | |
| 539 | bool Renderer11::testDeviceResettable() |
| 540 | { |
| 541 | HRESULT status = D3D_OK; |
| 542 | |
| 543 | // TODO |
| 544 | UNIMPLEMENTED(); |
| 545 | |
| 546 | switch (status) |
| 547 | { |
| 548 | case D3DERR_DEVICENOTRESET: |
| 549 | case D3DERR_DEVICEHUNG: |
| 550 | return true; |
| 551 | default: |
| 552 | return false; |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | bool Renderer11::resetDevice() |
| 557 | { |
| 558 | releaseDeviceResources(); |
| 559 | |
| 560 | // TODO |
| 561 | UNIMPLEMENTED(); |
| 562 | |
| 563 | // reset device defaults |
| 564 | initializeDevice(); |
| 565 | mDeviceLost = false; |
| 566 | |
| 567 | return true; |
| 568 | } |
| 569 | |
| 570 | DWORD Renderer11::getAdapterVendor() const |
| 571 | { |
| 572 | // TODO |
| 573 | UNIMPLEMENTED(); |
| 574 | return 0; |
| 575 | } |
| 576 | |
| 577 | const char *Renderer11::getAdapterDescription() const |
| 578 | { |
| 579 | // TODO |
| 580 | UNIMPLEMENTED(); |
| 581 | return "UNIMPLEMENTED"; |
| 582 | } |
| 583 | |
| 584 | GUID Renderer11::getAdapterIdentifier() const |
| 585 | { |
| 586 | // TODO |
| 587 | UNIMPLEMENTED(); |
| 588 | GUID foo = {}; |
| 589 | return foo; |
| 590 | } |
| 591 | |
| 592 | bool Renderer11::getDXT1TextureSupport() |
| 593 | { |
| 594 | // TODO |
| 595 | UNIMPLEMENTED(); |
| 596 | return false; |
| 597 | } |
| 598 | |
| 599 | bool Renderer11::getDXT3TextureSupport() |
| 600 | { |
| 601 | // TODO |
| 602 | UNIMPLEMENTED(); |
| 603 | return false; |
| 604 | } |
| 605 | |
| 606 | bool Renderer11::getDXT5TextureSupport() |
| 607 | { |
| 608 | // TODO |
| 609 | UNIMPLEMENTED(); |
| 610 | return false; |
| 611 | } |
| 612 | |
| 613 | bool Renderer11::getDepthTextureSupport() const |
| 614 | { |
| 615 | // TODO |
| 616 | UNIMPLEMENTED(); |
| 617 | return false; |
| 618 | } |
| 619 | |
| 620 | bool Renderer11::getFloat32TextureSupport(bool *filtering, bool *renderable) |
| 621 | { |
| 622 | // TODO |
| 623 | UNIMPLEMENTED(); |
| 624 | |
| 625 | *filtering = false; |
| 626 | *renderable = false; |
| 627 | return false; |
| 628 | } |
| 629 | |
| 630 | bool Renderer11::getFloat16TextureSupport(bool *filtering, bool *renderable) |
| 631 | { |
| 632 | // TODO |
| 633 | UNIMPLEMENTED(); |
| 634 | |
| 635 | *filtering = false; |
| 636 | *renderable = false; |
| 637 | return false; |
| 638 | } |
| 639 | |
| 640 | bool Renderer11::getLuminanceTextureSupport() |
| 641 | { |
| 642 | // TODO |
| 643 | UNIMPLEMENTED(); |
| 644 | return false; |
| 645 | } |
| 646 | |
| 647 | bool Renderer11::getLuminanceAlphaTextureSupport() |
| 648 | { |
| 649 | // TODO |
| 650 | UNIMPLEMENTED(); |
| 651 | return false; |
| 652 | } |
| 653 | |
| 654 | bool Renderer11::getTextureFilterAnisotropySupport() const |
| 655 | { |
| 656 | // TODO |
| 657 | UNIMPLEMENTED(); |
| 658 | return false; |
| 659 | } |
| 660 | |
| 661 | float Renderer11::getTextureMaxAnisotropy() const |
| 662 | { |
| 663 | // TODO |
| 664 | UNIMPLEMENTED(); |
| 665 | return 1.0f; |
| 666 | } |
| 667 | |
| 668 | bool Renderer11::getEventQuerySupport() |
| 669 | { |
| 670 | // TODO |
| 671 | UNIMPLEMENTED(); |
| 672 | return false; |
| 673 | } |
| 674 | |
| 675 | bool Renderer11::getVertexTextureSupport() const |
| 676 | { |
| 677 | // TODO |
| 678 | UNIMPLEMENTED(); |
| 679 | return false; |
| 680 | } |
| 681 | |
| 682 | bool Renderer11::getNonPower2TextureSupport() const |
| 683 | { |
| 684 | // TODO |
| 685 | UNIMPLEMENTED(); |
| 686 | return false; |
| 687 | } |
| 688 | |
| 689 | bool Renderer11::getOcclusionQuerySupport() const |
| 690 | { |
| 691 | // TODO |
| 692 | UNIMPLEMENTED(); |
| 693 | return false; |
| 694 | } |
| 695 | |
| 696 | bool Renderer11::getInstancingSupport() const |
| 697 | { |
| 698 | // TODO |
| 699 | UNIMPLEMENTED(); |
| 700 | return false; |
| 701 | } |
| 702 | |
| 703 | bool Renderer11::getShareHandleSupport() const |
| 704 | { |
| 705 | // TODO |
daniel@transgaming.com | b9bb279 | 2012-11-28 19:36:49 +0000 | [diff] [blame] | 706 | //UNIMPLEMENTED(); |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 707 | |
| 708 | // PIX doesn't seem to support using share handles, so disable them. |
| 709 | return false && !gl::perfActive(); |
| 710 | } |
| 711 | |
daniel@transgaming.com | 9549bea | 2012-11-28 20:57:23 +0000 | [diff] [blame^] | 712 | int Renderer11::getMajorShaderModel() const |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 713 | { |
daniel@transgaming.com | 9549bea | 2012-11-28 20:57:23 +0000 | [diff] [blame^] | 714 | switch (mFeatureLevel) |
| 715 | { |
| 716 | case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MAJOR_VERSION; // 5 |
| 717 | case D3D_FEATURE_LEVEL_10_1: |
| 718 | case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MAJOR_VERSION; // 4 |
| 719 | default: UNREACHABLE(); return 0; |
| 720 | } |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 721 | } |
| 722 | |
| 723 | float Renderer11::getMaxPointSize() const |
| 724 | { |
| 725 | // TODO |
| 726 | UNIMPLEMENTED(); |
| 727 | return 1.0f; |
| 728 | } |
| 729 | |
| 730 | int Renderer11::getMaxTextureWidth() const |
| 731 | { |
daniel@transgaming.com | 25072f6 | 2012-11-28 19:31:32 +0000 | [diff] [blame] | 732 | switch (mFeatureLevel) |
| 733 | { |
| 734 | case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384 |
| 735 | case D3D_FEATURE_LEVEL_10_1: |
| 736 | case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192 |
| 737 | default: UNREACHABLE(); return 0; |
| 738 | } |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 739 | } |
| 740 | |
| 741 | int Renderer11::getMaxTextureHeight() const |
| 742 | { |
daniel@transgaming.com | 25072f6 | 2012-11-28 19:31:32 +0000 | [diff] [blame] | 743 | switch (mFeatureLevel) |
| 744 | { |
| 745 | case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 16384 |
| 746 | case D3D_FEATURE_LEVEL_10_1: |
| 747 | case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; // 8192 |
| 748 | default: UNREACHABLE(); return 0; |
| 749 | } |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 750 | } |
| 751 | |
| 752 | bool Renderer11::get32BitIndexSupport() const |
| 753 | { |
daniel@transgaming.com | 25072f6 | 2012-11-28 19:31:32 +0000 | [diff] [blame] | 754 | switch (mFeatureLevel) |
| 755 | { |
| 756 | case D3D_FEATURE_LEVEL_11_0: |
| 757 | case D3D_FEATURE_LEVEL_10_1: |
| 758 | case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP >= 32; // true |
| 759 | default: UNREACHABLE(); return false; |
| 760 | } |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 761 | } |
| 762 | |
| 763 | int Renderer11::getMinSwapInterval() const |
| 764 | { |
daniel@transgaming.com | 8c7b1a9 | 2012-11-28 19:34:06 +0000 | [diff] [blame] | 765 | return 0; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 766 | } |
| 767 | |
| 768 | int Renderer11::getMaxSwapInterval() const |
| 769 | { |
daniel@transgaming.com | 8c7b1a9 | 2012-11-28 19:34:06 +0000 | [diff] [blame] | 770 | return 4; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 771 | } |
| 772 | |
| 773 | int Renderer11::getMaxSupportedSamples() const |
| 774 | { |
| 775 | // TODO |
| 776 | UNIMPLEMENTED(); |
| 777 | return 1; |
| 778 | } |
| 779 | |
daniel@transgaming.com | 31b13e1 | 2012-11-28 19:34:30 +0000 | [diff] [blame] | 780 | bool Renderer11::copyToRenderTarget(TextureStorage2D *dest, TextureStorage2D *source) |
daniel@transgaming.com | ad6aee7 | 2012-11-28 19:33:42 +0000 | [diff] [blame] | 781 | { |
| 782 | // TODO |
| 783 | UNIMPLEMENTED(); |
| 784 | return false; |
| 785 | } |
| 786 | |
daniel@transgaming.com | 31b13e1 | 2012-11-28 19:34:30 +0000 | [diff] [blame] | 787 | bool Renderer11::copyToRenderTarget(TextureStorageCubeMap *dest, TextureStorageCubeMap *source) |
daniel@transgaming.com | ad6aee7 | 2012-11-28 19:33:42 +0000 | [diff] [blame] | 788 | { |
| 789 | // TODO |
| 790 | UNIMPLEMENTED(); |
| 791 | return false; |
| 792 | } |
| 793 | |
daniel@transgaming.com | 3838088 | 2012-11-28 19:36:39 +0000 | [diff] [blame] | 794 | bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, |
| 795 | GLint xoffset, GLint yoffset, TextureStorage2D *storage, GLint level) |
| 796 | { |
| 797 | // TODO |
| 798 | UNIMPLEMENTED(); |
| 799 | return false; |
| 800 | } |
| 801 | |
| 802 | bool Renderer11::copyImage(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, |
| 803 | GLint xoffset, GLint yoffset, TextureStorageCubeMap *storage, GLenum target, GLint level) |
| 804 | { |
| 805 | // TODO |
| 806 | UNIMPLEMENTED(); |
| 807 | return false; |
| 808 | } |
| 809 | |
daniel@transgaming.com | f242365 | 2012-11-28 20:53:50 +0000 | [diff] [blame] | 810 | RenderTarget *Renderer11::createRenderTarget(SwapChain *swapChain, bool depth) |
| 811 | { |
daniel@transgaming.com | b6b27bc | 2012-11-28 20:54:30 +0000 | [diff] [blame] | 812 | SwapChain11 *swapChain11 = SwapChain11::makeSwapChain11(swapChain); |
| 813 | RenderTarget11 *renderTarget = NULL; |
| 814 | if (depth) |
| 815 | { |
| 816 | renderTarget = new RenderTarget11(this, swapChain11->getDepthStencil(), swapChain11->getWidth(), swapChain11->getHeight()); |
| 817 | } |
| 818 | else |
| 819 | { |
| 820 | renderTarget = new RenderTarget11(this, swapChain11->getRenderTarget(), swapChain11->getWidth(), swapChain11->getHeight()); |
| 821 | } |
| 822 | return renderTarget; |
daniel@transgaming.com | f242365 | 2012-11-28 20:53:50 +0000 | [diff] [blame] | 823 | } |
| 824 | |
| 825 | RenderTarget *Renderer11::createRenderTarget(int width, int height, GLenum format, GLsizei samples, bool depth) |
| 826 | { |
| 827 | // TODO |
| 828 | UNIMPLEMENTED(); |
| 829 | return NULL; |
| 830 | } |
| 831 | |
daniel@transgaming.com | 6c87217 | 2012-11-28 19:39:33 +0000 | [diff] [blame] | 832 | bool Renderer11::blitRect(gl::Framebuffer *readTarget, gl::Rectangle *readRect, gl::Framebuffer *drawTarget, gl::Rectangle *drawRect, |
| 833 | bool blitRenderTarget, bool blitDepthStencil) |
| 834 | { |
| 835 | // TODO |
| 836 | UNIMPLEMENTED(); |
| 837 | return false; |
| 838 | } |
| 839 | |
| 840 | void Renderer11::readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, |
| 841 | GLsizei outputPitch, bool packReverseRowOrder, GLint packAlignment, void* pixels) |
| 842 | { |
| 843 | // TODO |
| 844 | UNIMPLEMENTED(); |
| 845 | return; |
| 846 | } |
| 847 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 848 | } |