daniel@transgaming.com | 813bb78 | 2012-11-28 21:03:30 +0000 | [diff] [blame] | 1 | // |
shannon.woods@transgaming.com | 358e88d | 2013-01-25 21:53:11 +0000 | [diff] [blame^] | 2 | // Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved. |
daniel@transgaming.com | 813bb78 | 2012-11-28 21:03:30 +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 | // ShaderExecutable11.cpp: Implements a D3D11-specific class to contain shader |
| 8 | // executable implementation details. |
| 9 | |
| 10 | #include "libGLESv2/renderer/ShaderExecutable11.h" |
| 11 | |
| 12 | #include "common/debug.h" |
| 13 | |
| 14 | namespace rx |
| 15 | { |
| 16 | |
daniel@transgaming.com | 7b18d0c | 2012-11-28 21:04:10 +0000 | [diff] [blame] | 17 | ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11PixelShader *executable) |
| 18 | : ShaderExecutable(function, length) |
daniel@transgaming.com | 813bb78 | 2012-11-28 21:03:30 +0000 | [diff] [blame] | 19 | { |
| 20 | mPixelExecutable = executable; |
| 21 | mVertexExecutable = NULL; |
shannon.woods@transgaming.com | 358e88d | 2013-01-25 21:53:11 +0000 | [diff] [blame^] | 22 | |
| 23 | mConstantBuffer = NULL; |
daniel@transgaming.com | 813bb78 | 2012-11-28 21:03:30 +0000 | [diff] [blame] | 24 | } |
| 25 | |
daniel@transgaming.com | 7b18d0c | 2012-11-28 21:04:10 +0000 | [diff] [blame] | 26 | ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable) |
| 27 | : ShaderExecutable(function, length) |
daniel@transgaming.com | 813bb78 | 2012-11-28 21:03:30 +0000 | [diff] [blame] | 28 | { |
| 29 | mVertexExecutable = executable; |
| 30 | mPixelExecutable = NULL; |
shannon.woods@transgaming.com | 358e88d | 2013-01-25 21:53:11 +0000 | [diff] [blame^] | 31 | |
| 32 | mConstantBuffer = NULL; |
daniel@transgaming.com | 813bb78 | 2012-11-28 21:03:30 +0000 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | ShaderExecutable11::~ShaderExecutable11() |
| 36 | { |
| 37 | if (mVertexExecutable) |
| 38 | { |
| 39 | mVertexExecutable->Release(); |
| 40 | } |
| 41 | if (mPixelExecutable) |
| 42 | { |
| 43 | mPixelExecutable->Release(); |
| 44 | } |
shannon.woods@transgaming.com | 358e88d | 2013-01-25 21:53:11 +0000 | [diff] [blame^] | 45 | |
| 46 | if (mConstantBuffer) |
| 47 | { |
| 48 | mConstantBuffer->Release(); |
| 49 | } |
daniel@transgaming.com | 813bb78 | 2012-11-28 21:03:30 +0000 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | ShaderExecutable11 *ShaderExecutable11::makeShaderExecutable11(ShaderExecutable *executable) |
| 53 | { |
| 54 | ASSERT(dynamic_cast<ShaderExecutable11*>(executable) != NULL); |
| 55 | return static_cast<ShaderExecutable11*>(executable); |
| 56 | } |
| 57 | |
shannon.woods@transgaming.com | 358e88d | 2013-01-25 21:53:11 +0000 | [diff] [blame^] | 58 | ID3D11VertexShader *ShaderExecutable11::getVertexShader() const |
daniel@transgaming.com | 813bb78 | 2012-11-28 21:03:30 +0000 | [diff] [blame] | 59 | { |
| 60 | return mVertexExecutable; |
| 61 | } |
| 62 | |
shannon.woods@transgaming.com | 358e88d | 2013-01-25 21:53:11 +0000 | [diff] [blame^] | 63 | ID3D11PixelShader *ShaderExecutable11::getPixelShader() const |
daniel@transgaming.com | 813bb78 | 2012-11-28 21:03:30 +0000 | [diff] [blame] | 64 | { |
| 65 | return mPixelExecutable; |
| 66 | } |
| 67 | |
shannon.woods@transgaming.com | 358e88d | 2013-01-25 21:53:11 +0000 | [diff] [blame^] | 68 | ID3D11Buffer *ShaderExecutable11::getConstantBuffer() |
| 69 | { |
| 70 | return mConstantBuffer; |
| 71 | } |
| 72 | |
daniel@transgaming.com | 813bb78 | 2012-11-28 21:03:30 +0000 | [diff] [blame] | 73 | } |