daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 1 | // |
daniel@transgaming.com | a390e1e | 2013-01-11 04:09:39 +0000 | [diff] [blame] | 2 | // Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved. |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 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.h: Defines a back-end specific class for the D3D11 renderer. |
| 8 | |
| 9 | #ifndef LIBGLESV2_RENDERER_RENDERER11_H_ |
| 10 | #define LIBGLESV2_RENDERER_RENDERER11_H_ |
| 11 | |
| 12 | #define GL_APICALL |
| 13 | #include <GLES2/gl2.h> |
| 14 | #include <GLES2/gl2ext.h> |
| 15 | #define EGLAPI |
| 16 | #include <EGL/egl.h> |
| 17 | |
| 18 | #include <dxgi.h> |
| 19 | #include <d3d11.h> |
daniel@transgaming.com | 04af90f | 2012-11-28 21:03:09 +0000 | [diff] [blame] | 20 | #include <D3Dcompiler.h> |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 21 | |
| 22 | #include "common/angleutils.h" |
daniel@transgaming.com | 6c87217 | 2012-11-28 19:39:33 +0000 | [diff] [blame] | 23 | #include "libGLESv2/angletypes.h" |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 24 | |
| 25 | #include "libGLESv2/renderer/Renderer.h" |
daniel@transgaming.com | f8ba109 | 2012-11-28 19:37:53 +0000 | [diff] [blame] | 26 | #include "libGLESv2/renderer/RenderStateCache.h" |
daniel@transgaming.com | c5431eb | 2012-12-20 21:10:15 +0000 | [diff] [blame] | 27 | #include "libGLESv2/renderer/InputLayoutCache.h" |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 28 | |
| 29 | namespace rx |
| 30 | { |
| 31 | |
daniel@transgaming.com | c5431eb | 2012-12-20 21:10:15 +0000 | [diff] [blame] | 32 | class VertexDataManager; |
| 33 | class IndexDataManager; |
daniel@transgaming.com | c511430 | 2012-12-20 21:11:36 +0000 | [diff] [blame] | 34 | class StreamingIndexBufferInterface; |
daniel@transgaming.com | c5431eb | 2012-12-20 21:10:15 +0000 | [diff] [blame] | 35 | |
shannon.woods@transgaming.com | 4e48204 | 2013-01-25 21:54:18 +0000 | [diff] [blame] | 36 | enum |
| 37 | { |
| 38 | MAX_VERTEX_UNIFORM_VECTORS_D3D11 = 1024, |
| 39 | MAX_FRAGMENT_UNIFORM_VECTORS_D3D11 = 1024 |
| 40 | }; |
| 41 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 42 | class Renderer11 : public Renderer |
| 43 | { |
| 44 | public: |
| 45 | Renderer11(egl::Display *display, HDC hDc); |
| 46 | virtual ~Renderer11(); |
| 47 | |
daniel@transgaming.com | b64ed28 | 2012-11-28 20:54:02 +0000 | [diff] [blame] | 48 | static Renderer11 *makeRenderer11(Renderer *renderer); |
| 49 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 50 | virtual EGLint initialize(); |
| 51 | virtual bool resetDevice(); |
| 52 | |
| 53 | virtual int generateConfigs(ConfigDesc **configDescList); |
| 54 | virtual void deleteConfigs(ConfigDesc *configDescList); |
| 55 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 56 | virtual void sync(bool block); |
| 57 | |
daniel@transgaming.com | b9bb279 | 2012-11-28 19:36:49 +0000 | [diff] [blame] | 58 | virtual SwapChain *createSwapChain(HWND window, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat); |
| 59 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 60 | virtual void setSamplerState(gl::SamplerType type, int index, const gl::SamplerState &sampler); |
| 61 | virtual void setTexture(gl::SamplerType type, int index, gl::Texture *texture); |
| 62 | |
daniel@transgaming.com | 237bc7e | 2012-11-28 21:01:06 +0000 | [diff] [blame] | 63 | virtual void setRasterizerState(const gl::RasterizerState &rasterState); |
daniel@transgaming.com | 493d4f8 | 2012-11-28 19:35:45 +0000 | [diff] [blame] | 64 | virtual void setBlendState(const gl::BlendState &blendState, const gl::Color &blendColor, |
| 65 | unsigned int sampleMask); |
daniel@transgaming.com | 08c331d | 2012-11-28 19:38:39 +0000 | [diff] [blame] | 66 | virtual void setDepthStencilState(const gl::DepthStencilState &depthStencilState, int stencilRef, |
daniel@transgaming.com | 3a0ef48 | 2012-11-28 21:01:20 +0000 | [diff] [blame] | 67 | int stencilBackRef, bool frontFaceCCW); |
daniel@transgaming.com | 493d4f8 | 2012-11-28 19:35:45 +0000 | [diff] [blame] | 68 | |
daniel@transgaming.com | d55e8c1 | 2012-11-28 21:07:02 +0000 | [diff] [blame] | 69 | virtual void setScissorRectangle(const gl::Rectangle &scissor, bool enabled); |
daniel@transgaming.com | 1298518 | 2012-12-20 20:56:31 +0000 | [diff] [blame] | 70 | virtual bool setViewport(const gl::Rectangle &viewport, float zNear, float zFar, GLenum drawMode, GLenum frontFace, |
daniel@transgaming.com | ed36abd | 2013-01-11 21:15:58 +0000 | [diff] [blame] | 71 | bool ignoreViewport, gl::ProgramBinary *currentProgram); |
daniel@transgaming.com | 493d4f8 | 2012-11-28 19:35:45 +0000 | [diff] [blame] | 72 | |
daniel@transgaming.com | 91207b7 | 2012-11-28 20:56:43 +0000 | [diff] [blame] | 73 | virtual bool applyPrimitiveType(GLenum mode, GLsizei count); |
daniel@transgaming.com | ae39ee2 | 2012-11-28 19:42:02 +0000 | [diff] [blame] | 74 | virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer); |
daniel@transgaming.com | 5fbf177 | 2012-11-28 20:54:43 +0000 | [diff] [blame] | 75 | virtual void applyShaders(gl::ProgramBinary *programBinary); |
shannon.woods@transgaming.com | 21ba647 | 2013-01-25 21:53:32 +0000 | [diff] [blame] | 76 | virtual void applyUniforms(gl::ProgramBinary *programBinary, gl::UniformArray *uniformArray); |
daniel@transgaming.com | 91207b7 | 2012-11-28 20:56:43 +0000 | [diff] [blame] | 77 | virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances); |
daniel@transgaming.com | 3124048 | 2012-11-28 21:06:41 +0000 | [diff] [blame] | 78 | virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo); |
daniel@transgaming.com | 493d4f8 | 2012-11-28 19:35:45 +0000 | [diff] [blame] | 79 | |
daniel@transgaming.com | 91207b7 | 2012-11-28 20:56:43 +0000 | [diff] [blame] | 80 | virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances); |
daniel@transgaming.com | 3124048 | 2012-11-28 21:06:41 +0000 | [diff] [blame] | 81 | virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo); |
daniel@transgaming.com | def9f0f | 2012-11-28 20:53:20 +0000 | [diff] [blame] | 82 | |
daniel@transgaming.com | 084a257 | 2012-11-28 20:55:17 +0000 | [diff] [blame] | 83 | virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer); |
daniel@transgaming.com | d084c62 | 2012-11-28 19:36:05 +0000 | [diff] [blame] | 84 | |
daniel@transgaming.com | c43a605 | 2012-11-28 19:41:51 +0000 | [diff] [blame] | 85 | virtual void markAllStateDirty(); |
| 86 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 87 | // lost device |
| 88 | virtual void markDeviceLost(); |
| 89 | virtual bool isDeviceLost(); |
| 90 | virtual bool testDeviceLost(bool notify); |
| 91 | virtual bool testDeviceResettable(); |
| 92 | |
| 93 | // Renderer capabilities |
| 94 | virtual DWORD getAdapterVendor() const; |
daniel@transgaming.com | ca1ac1f | 2013-01-11 04:13:05 +0000 | [diff] [blame] | 95 | virtual std::string getRendererDescription() const; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 96 | virtual GUID getAdapterIdentifier() const; |
| 97 | |
shannon.woods@transgaming.com | bec04bf | 2013-01-25 21:53:52 +0000 | [diff] [blame] | 98 | virtual bool getBGRATextureSupport() const; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 99 | virtual bool getDXT1TextureSupport(); |
| 100 | virtual bool getDXT3TextureSupport(); |
| 101 | virtual bool getDXT5TextureSupport(); |
| 102 | virtual bool getEventQuerySupport(); |
| 103 | virtual bool getFloat32TextureSupport(bool *filtering, bool *renderable); |
| 104 | virtual bool getFloat16TextureSupport(bool *filtering, bool *renderable); |
| 105 | virtual bool getLuminanceTextureSupport(); |
| 106 | virtual bool getLuminanceAlphaTextureSupport(); |
shannon.woods@transgaming.com | 233fe95 | 2013-01-25 21:51:57 +0000 | [diff] [blame] | 107 | virtual unsigned int getMaxVertexTextureImageUnits() const; |
shannon.woods@transgaming.com | 76cd88c | 2013-01-25 21:54:36 +0000 | [diff] [blame^] | 108 | virtual unsigned int getMaxCombinedTextureImageUnits() const; |
shannon.woods@transgaming.com | 254317d | 2013-01-25 21:54:09 +0000 | [diff] [blame] | 109 | virtual int getMaxVertexUniformVectors() const; |
| 110 | virtual int getMaxFragmentUniformVectors() const; |
shannon.woods@transgaming.com | 28d268e | 2013-01-25 21:54:26 +0000 | [diff] [blame] | 111 | virtual int getMaxVaryingVectors() const; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 112 | virtual bool getNonPower2TextureSupport() const; |
| 113 | virtual bool getDepthTextureSupport() const; |
| 114 | virtual bool getOcclusionQuerySupport() const; |
| 115 | virtual bool getInstancingSupport() const; |
| 116 | virtual bool getTextureFilterAnisotropySupport() const; |
| 117 | virtual float getTextureMaxAnisotropy() const; |
| 118 | virtual bool getShareHandleSupport() const; |
daniel@transgaming.com | 7629bb6 | 2013-01-11 04:12:28 +0000 | [diff] [blame] | 119 | virtual bool getDerivativeInstructionSupport() const; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 120 | |
daniel@transgaming.com | 9549bea | 2012-11-28 20:57:23 +0000 | [diff] [blame] | 121 | virtual int getMajorShaderModel() const; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 122 | virtual float getMaxPointSize() const; |
| 123 | virtual int getMaxTextureWidth() const; |
| 124 | virtual int getMaxTextureHeight() const; |
| 125 | virtual bool get32BitIndexSupport() const; |
| 126 | virtual int getMinSwapInterval() const; |
| 127 | virtual int getMaxSwapInterval() const; |
| 128 | |
| 129 | virtual GLsizei getMaxSupportedSamples() const; |
| 130 | |
daniel@transgaming.com | a9c7142 | 2012-11-28 20:58:45 +0000 | [diff] [blame] | 131 | // Pixel operations |
daniel@transgaming.com | 87705f8 | 2012-12-20 21:10:45 +0000 | [diff] [blame] | 132 | virtual bool copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source); |
| 133 | virtual bool copyToRenderTarget(TextureStorageInterfaceCube *dest, TextureStorageInterfaceCube *source); |
daniel@transgaming.com | ad6aee7 | 2012-11-28 19:33:42 +0000 | [diff] [blame] | 134 | |
shannon.woods@transgaming.com | 664916b | 2013-01-25 21:50:32 +0000 | [diff] [blame] | 135 | virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, |
daniel@transgaming.com | 87705f8 | 2012-12-20 21:10:45 +0000 | [diff] [blame] | 136 | GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level); |
shannon.woods@transgaming.com | 664916b | 2013-01-25 21:50:32 +0000 | [diff] [blame] | 137 | virtual bool copyImage(gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat, |
daniel@transgaming.com | 87705f8 | 2012-12-20 21:10:45 +0000 | [diff] [blame] | 138 | GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level); |
daniel@transgaming.com | 3838088 | 2012-11-28 19:36:39 +0000 | [diff] [blame] | 139 | |
shannon.woods@transgaming.com | 9d971ff | 2013-01-25 21:50:53 +0000 | [diff] [blame] | 140 | bool copyTexture(ID3D11ShaderResourceView *source, const gl::Rectangle &sourceArea, unsigned int sourceWidth, unsigned int sourceHeight, |
| 141 | ID3D11RenderTargetView *dest, const gl::Rectangle &destArea, unsigned int destWidth, unsigned int destHeight, GLenum destFormat); |
| 142 | |
daniel@transgaming.com | 6c87217 | 2012-11-28 19:39:33 +0000 | [diff] [blame] | 143 | virtual bool blitRect(gl::Framebuffer *readTarget, gl::Rectangle *readRect, gl::Framebuffer *drawTarget, gl::Rectangle *drawRect, |
| 144 | bool blitRenderTarget, bool blitDepthStencil); |
| 145 | virtual void readPixels(gl::Framebuffer *framebuffer, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, |
| 146 | GLsizei outputPitch, bool packReverseRowOrder, GLint packAlignment, void* pixels); |
| 147 | |
daniel@transgaming.com | a9c7142 | 2012-11-28 20:58:45 +0000 | [diff] [blame] | 148 | // RenderTarget creation |
daniel@transgaming.com | f242365 | 2012-11-28 20:53:50 +0000 | [diff] [blame] | 149 | virtual RenderTarget *createRenderTarget(SwapChain *swapChain, bool depth); |
| 150 | virtual RenderTarget *createRenderTarget(int width, int height, GLenum format, GLsizei samples, bool depth); |
| 151 | |
daniel@transgaming.com | a9c7142 | 2012-11-28 20:58:45 +0000 | [diff] [blame] | 152 | // Shader operations |
daniel@transgaming.com | 2275f91 | 2012-12-20 21:13:22 +0000 | [diff] [blame] | 153 | virtual ShaderExecutable *loadExecutable(const void *function, size_t length, GLenum type); |
daniel@transgaming.com | a9c7142 | 2012-11-28 20:58:45 +0000 | [diff] [blame] | 154 | virtual ShaderExecutable *compileToExecutable(gl::InfoLog &infoLog, const char *shaderHLSL, GLenum type); |
| 155 | |
daniel@transgaming.com | 244e183 | 2012-12-20 20:52:35 +0000 | [diff] [blame] | 156 | // Image operations |
| 157 | virtual Image *createImage(); |
daniel@transgaming.com | f721fdb | 2012-12-20 20:53:11 +0000 | [diff] [blame] | 158 | virtual void generateMipmap(Image *dest, Image *source); |
daniel@transgaming.com | 413d271 | 2012-12-20 21:11:04 +0000 | [diff] [blame] | 159 | virtual TextureStorage *createTextureStorage2D(SwapChain *swapChain); |
| 160 | virtual TextureStorage *createTextureStorage2D(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, GLsizei width, GLsizei height); |
| 161 | virtual TextureStorage *createTextureStorageCube(int levels, GLenum internalformat, GLenum usage, bool forceRenderable, int size); |
daniel@transgaming.com | 244e183 | 2012-12-20 20:52:35 +0000 | [diff] [blame] | 162 | |
daniel@transgaming.com | 3f255b4 | 2012-12-20 21:07:35 +0000 | [diff] [blame] | 163 | // Buffer creation |
| 164 | virtual VertexBuffer *createVertexBuffer(); |
daniel@transgaming.com | 0b6d774 | 2012-12-20 21:09:47 +0000 | [diff] [blame] | 165 | virtual IndexBuffer *createIndexBuffer(); |
daniel@transgaming.com | 3f255b4 | 2012-12-20 21:07:35 +0000 | [diff] [blame] | 166 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 167 | // D3D11-renderer specific methods |
daniel@transgaming.com | 25072f6 | 2012-11-28 19:31:32 +0000 | [diff] [blame] | 168 | ID3D11Device *getDevice() { return mDevice; } |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 169 | ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; }; |
daniel@transgaming.com | a60160b | 2012-11-28 19:41:15 +0000 | [diff] [blame] | 170 | IDXGIFactory *getDxgiFactory() { return mDxgiFactory; }; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 171 | |
shannon.woods@transgaming.com | fdeacb8 | 2013-01-25 21:52:34 +0000 | [diff] [blame] | 172 | bool getRenderTargetResource(gl::Framebuffer *framebuffer, unsigned int *subresourceIndex, ID3D11Texture2D **resource); |
| 173 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 174 | private: |
| 175 | DISALLOW_COPY_AND_ASSIGN(Renderer11); |
| 176 | |
daniel@transgaming.com | c511430 | 2012-12-20 21:11:36 +0000 | [diff] [blame] | 177 | void drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer); |
daniel@transgaming.com | 4fd1f98 | 2013-01-11 04:12:58 +0000 | [diff] [blame] | 178 | void drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer); |
daniel@transgaming.com | c511430 | 2012-12-20 21:11:36 +0000 | [diff] [blame] | 179 | |
daniel@transgaming.com | ee42a0a | 2013-01-11 04:09:15 +0000 | [diff] [blame] | 180 | void readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &area, |
| 181 | GLenum format, GLenum type, GLsizei outputPitch, bool packReverseRowOrder, |
| 182 | GLint packAlignment, void *pixels); |
| 183 | |
shannon.woods@transgaming.com | 34f507c | 2013-01-25 21:52:15 +0000 | [diff] [blame] | 184 | void maskedClear(const gl::ClearParameters &clearParams); |
| 185 | |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 186 | HMODULE mD3d11Module; |
| 187 | HMODULE mDxgiModule; |
| 188 | HDC mDc; |
| 189 | |
| 190 | bool mDeviceLost; |
| 191 | |
| 192 | void initializeDevice(); |
| 193 | void releaseDeviceResources(); |
daniel@transgaming.com | ca1ac1f | 2013-01-11 04:13:05 +0000 | [diff] [blame] | 194 | int getMinorShaderModel() const; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 195 | |
daniel@transgaming.com | f8ba109 | 2012-11-28 19:37:53 +0000 | [diff] [blame] | 196 | RenderStateCache mStateCache; |
| 197 | |
daniel@transgaming.com | 7b6b83e | 2012-11-28 21:00:30 +0000 | [diff] [blame] | 198 | // current render target states |
daniel@transgaming.com | 80fc332 | 2012-11-28 21:02:13 +0000 | [diff] [blame] | 199 | unsigned int mAppliedRenderTargetSerial; |
| 200 | unsigned int mAppliedDepthbufferSerial; |
| 201 | unsigned int mAppliedStencilbufferSerial; |
daniel@transgaming.com | 7b6b83e | 2012-11-28 21:00:30 +0000 | [diff] [blame] | 202 | bool mDepthStencilInitialized; |
| 203 | bool mRenderTargetDescInitialized; |
| 204 | rx::RenderTarget::Desc mRenderTargetDesc; |
| 205 | unsigned int mCurDepthSize; |
daniel@transgaming.com | 80fc332 | 2012-11-28 21:02:13 +0000 | [diff] [blame] | 206 | unsigned int mCurStencilSize; |
daniel@transgaming.com | 7b6b83e | 2012-11-28 21:00:30 +0000 | [diff] [blame] | 207 | |
daniel@transgaming.com | 54de24f | 2013-01-11 04:07:59 +0000 | [diff] [blame] | 208 | // Currently applied sampler states |
shannon.woods@transgaming.com | 233fe95 | 2013-01-25 21:51:57 +0000 | [diff] [blame] | 209 | bool mForceSetVertexSamplerStates[gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS]; |
| 210 | gl::SamplerState mCurVertexSamplerStates[gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS]; |
daniel@transgaming.com | 54de24f | 2013-01-11 04:07:59 +0000 | [diff] [blame] | 211 | |
| 212 | bool mForceSetPixelSamplerStates[gl::MAX_TEXTURE_IMAGE_UNITS]; |
| 213 | gl::SamplerState mCurPixelSamplerStates[gl::MAX_TEXTURE_IMAGE_UNITS]; |
| 214 | |
daniel@transgaming.com | e33c8bf | 2013-01-11 04:11:33 +0000 | [diff] [blame] | 215 | // Currently applied textures |
shannon.woods@transgaming.com | 233fe95 | 2013-01-25 21:51:57 +0000 | [diff] [blame] | 216 | unsigned int mCurVertexTextureSerials[gl::IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS]; |
daniel@transgaming.com | e33c8bf | 2013-01-11 04:11:33 +0000 | [diff] [blame] | 217 | unsigned int mCurPixelTextureSerials[gl::MAX_TEXTURE_IMAGE_UNITS]; |
| 218 | |
daniel@transgaming.com | f8ba109 | 2012-11-28 19:37:53 +0000 | [diff] [blame] | 219 | // Currently applied blend state |
| 220 | bool mForceSetBlendState; |
| 221 | gl::BlendState mCurBlendState; |
| 222 | gl::Color mCurBlendColor; |
| 223 | unsigned int mCurSampleMask; |
| 224 | |
daniel@transgaming.com | dcf1e67 | 2012-11-28 19:38:19 +0000 | [diff] [blame] | 225 | // Currently applied rasterizer state |
| 226 | bool mForceSetRasterState; |
| 227 | gl::RasterizerState mCurRasterState; |
daniel@transgaming.com | dcf1e67 | 2012-11-28 19:38:19 +0000 | [diff] [blame] | 228 | |
daniel@transgaming.com | 5503fd0 | 2012-11-28 19:38:57 +0000 | [diff] [blame] | 229 | // Currently applied depth stencil state |
| 230 | bool mForceSetDepthStencilState; |
| 231 | gl::DepthStencilState mCurDepthStencilState; |
| 232 | int mCurStencilRef; |
| 233 | int mCurStencilBackRef; |
| 234 | |
daniel@transgaming.com | dcf1e67 | 2012-11-28 19:38:19 +0000 | [diff] [blame] | 235 | // Currently applied scissor rectangle |
| 236 | bool mForceSetScissor; |
daniel@transgaming.com | d55e8c1 | 2012-11-28 21:07:02 +0000 | [diff] [blame] | 237 | bool mScissorEnabled; |
daniel@transgaming.com | dcf1e67 | 2012-11-28 19:38:19 +0000 | [diff] [blame] | 238 | gl::Rectangle mCurScissor; |
daniel@transgaming.com | dcf1e67 | 2012-11-28 19:38:19 +0000 | [diff] [blame] | 239 | |
daniel@transgaming.com | 5367004 | 2012-11-28 20:55:51 +0000 | [diff] [blame] | 240 | // Currently applied viewport |
| 241 | bool mForceSetViewport; |
| 242 | gl::Rectangle mCurViewport; |
| 243 | float mCurNear; |
| 244 | float mCurFar; |
| 245 | |
daniel@transgaming.com | c5431eb | 2012-12-20 21:10:15 +0000 | [diff] [blame] | 246 | unsigned int mAppliedIBSerial; |
daniel@transgaming.com | 7fbf486 | 2013-01-11 04:09:22 +0000 | [diff] [blame] | 247 | unsigned int mAppliedIBOffset; |
| 248 | |
daniel@transgaming.com | e499141 | 2012-12-20 20:55:34 +0000 | [diff] [blame] | 249 | unsigned int mAppliedProgramBinarySerial; |
| 250 | |
shannon.woods@transgaming.com | 5fb979d | 2013-01-25 21:53:04 +0000 | [diff] [blame] | 251 | dx_VertexConstants mVertexConstants; |
| 252 | dx_VertexConstants mAppliedVertexConstants; |
| 253 | ID3D11Buffer *mDriverConstantBufferVS; |
| 254 | |
| 255 | dx_PixelConstants mPixelConstants; |
| 256 | dx_PixelConstants mAppliedPixelConstants; |
| 257 | ID3D11Buffer *mDriverConstantBufferPS; |
daniel@transgaming.com | ed36abd | 2013-01-11 21:15:58 +0000 | [diff] [blame] | 258 | |
daniel@transgaming.com | c5431eb | 2012-12-20 21:10:15 +0000 | [diff] [blame] | 259 | // Vertex, index and input layouts |
| 260 | VertexDataManager *mVertexDataManager; |
| 261 | IndexDataManager *mIndexDataManager; |
| 262 | InputLayoutCache mInputLayoutCache; |
| 263 | |
daniel@transgaming.com | c511430 | 2012-12-20 21:11:36 +0000 | [diff] [blame] | 264 | StreamingIndexBufferInterface *mLineLoopIB; |
daniel@transgaming.com | 4fd1f98 | 2013-01-11 04:12:58 +0000 | [diff] [blame] | 265 | StreamingIndexBufferInterface *mTriangleFanIB; |
daniel@transgaming.com | c511430 | 2012-12-20 21:11:36 +0000 | [diff] [blame] | 266 | |
shannon.woods@transgaming.com | 9d971ff | 2013-01-25 21:50:53 +0000 | [diff] [blame] | 267 | // Texture copy resources |
| 268 | bool mCopyResourcesInitialized; |
| 269 | ID3D11Buffer *mCopyVB; |
| 270 | ID3D11SamplerState *mCopySampler; |
| 271 | ID3D11InputLayout *mCopyIL; |
| 272 | ID3D11VertexShader *mCopyVS; |
| 273 | ID3D11PixelShader *mCopyRGBAPS; |
| 274 | ID3D11PixelShader *mCopyRGBPS; |
| 275 | ID3D11PixelShader *mCopyLumPS; |
| 276 | ID3D11PixelShader *mCopyLumAlphaPS; |
| 277 | |
shannon.woods@transgaming.com | 34f507c | 2013-01-25 21:52:15 +0000 | [diff] [blame] | 278 | // Masked clear resources |
| 279 | bool mClearResourcesInitialized; |
| 280 | ID3D11Buffer *mClearVB; |
| 281 | ID3D11InputLayout *mClearIL; |
| 282 | ID3D11VertexShader *mClearVS; |
| 283 | ID3D11PixelShader *mClearPS; |
| 284 | ID3D11RasterizerState *mClearScissorRS; |
| 285 | ID3D11RasterizerState *mClearNoScissorRS; |
| 286 | |
daniel@transgaming.com | 25072f6 | 2012-11-28 19:31:32 +0000 | [diff] [blame] | 287 | ID3D11Device *mDevice; |
| 288 | D3D_FEATURE_LEVEL mFeatureLevel; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 289 | ID3D11DeviceContext *mDeviceContext; |
daniel@transgaming.com | 65e6537 | 2012-11-28 19:33:50 +0000 | [diff] [blame] | 290 | IDXGIAdapter *mDxgiAdapter; |
daniel@transgaming.com | 1f811f5 | 2012-11-28 20:57:39 +0000 | [diff] [blame] | 291 | DXGI_ADAPTER_DESC mAdapterDescription; |
| 292 | char mDescription[128]; |
daniel@transgaming.com | a60160b | 2012-11-28 19:41:15 +0000 | [diff] [blame] | 293 | IDXGIFactory *mDxgiFactory; |
shannon.woods@transgaming.com | bec04bf | 2013-01-25 21:53:52 +0000 | [diff] [blame] | 294 | |
| 295 | // Cached device caps |
| 296 | bool mBGRATextureSupport; |
daniel@transgaming.com | 1d6aff2 | 2012-11-28 19:30:42 +0000 | [diff] [blame] | 297 | }; |
| 298 | |
| 299 | } |
| 300 | #endif // LIBGLESV2_RENDERER_RENDERER11_H_ |