gfx/angle/src/libGLESv2/renderer/ShaderExecutable11.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 #include "precompiled.h"
michael@0 2 //
michael@0 3 // Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
michael@0 4 // Use of this source code is governed by a BSD-style license that can be
michael@0 5 // found in the LICENSE file.
michael@0 6 //
michael@0 7
michael@0 8 // ShaderExecutable11.cpp: Implements a D3D11-specific class to contain shader
michael@0 9 // executable implementation details.
michael@0 10
michael@0 11 #include "libGLESv2/renderer/ShaderExecutable11.h"
michael@0 12
michael@0 13 #include "common/debug.h"
michael@0 14
michael@0 15 namespace rx
michael@0 16 {
michael@0 17
michael@0 18 ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11PixelShader *executable)
michael@0 19 : ShaderExecutable(function, length)
michael@0 20 {
michael@0 21 mPixelExecutable = executable;
michael@0 22 mVertexExecutable = NULL;
michael@0 23 mGeometryExecutable = NULL;
michael@0 24
michael@0 25 mConstantBuffer = NULL;
michael@0 26 }
michael@0 27
michael@0 28 ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable)
michael@0 29 : ShaderExecutable(function, length)
michael@0 30 {
michael@0 31 mVertexExecutable = executable;
michael@0 32 mPixelExecutable = NULL;
michael@0 33 mGeometryExecutable = NULL;
michael@0 34
michael@0 35 mConstantBuffer = NULL;
michael@0 36 }
michael@0 37
michael@0 38 ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11GeometryShader *executable)
michael@0 39 : ShaderExecutable(function, length)
michael@0 40 {
michael@0 41 mGeometryExecutable = executable;
michael@0 42 mVertexExecutable = NULL;
michael@0 43 mPixelExecutable = NULL;
michael@0 44
michael@0 45 mConstantBuffer = NULL;
michael@0 46 }
michael@0 47
michael@0 48 ShaderExecutable11::~ShaderExecutable11()
michael@0 49 {
michael@0 50 if (mVertexExecutable)
michael@0 51 {
michael@0 52 mVertexExecutable->Release();
michael@0 53 }
michael@0 54 if (mPixelExecutable)
michael@0 55 {
michael@0 56 mPixelExecutable->Release();
michael@0 57 }
michael@0 58 if (mGeometryExecutable)
michael@0 59 {
michael@0 60 mGeometryExecutable->Release();
michael@0 61 }
michael@0 62
michael@0 63 if (mConstantBuffer)
michael@0 64 {
michael@0 65 mConstantBuffer->Release();
michael@0 66 }
michael@0 67 }
michael@0 68
michael@0 69 ShaderExecutable11 *ShaderExecutable11::makeShaderExecutable11(ShaderExecutable *executable)
michael@0 70 {
michael@0 71 ASSERT(HAS_DYNAMIC_TYPE(ShaderExecutable11*, executable));
michael@0 72 return static_cast<ShaderExecutable11*>(executable);
michael@0 73 }
michael@0 74
michael@0 75 ID3D11VertexShader *ShaderExecutable11::getVertexShader() const
michael@0 76 {
michael@0 77 return mVertexExecutable;
michael@0 78 }
michael@0 79
michael@0 80 ID3D11PixelShader *ShaderExecutable11::getPixelShader() const
michael@0 81 {
michael@0 82 return mPixelExecutable;
michael@0 83 }
michael@0 84
michael@0 85 ID3D11GeometryShader *ShaderExecutable11::getGeometryShader() const
michael@0 86 {
michael@0 87 return mGeometryExecutable;
michael@0 88 }
michael@0 89
michael@0 90 ID3D11Buffer *ShaderExecutable11::getConstantBuffer(ID3D11Device *device, unsigned int registerCount)
michael@0 91 {
michael@0 92 if (!mConstantBuffer && registerCount > 0)
michael@0 93 {
michael@0 94 D3D11_BUFFER_DESC constantBufferDescription = {0};
michael@0 95 constantBufferDescription.ByteWidth = registerCount * sizeof(float[4]);
michael@0 96 constantBufferDescription.Usage = D3D11_USAGE_DYNAMIC;
michael@0 97 constantBufferDescription.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
michael@0 98 constantBufferDescription.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
michael@0 99 constantBufferDescription.MiscFlags = 0;
michael@0 100 constantBufferDescription.StructureByteStride = 0;
michael@0 101
michael@0 102 HRESULT result = device->CreateBuffer(&constantBufferDescription, NULL, &mConstantBuffer);
michael@0 103 ASSERT(SUCCEEDED(result));
michael@0 104 }
michael@0 105
michael@0 106 return mConstantBuffer;
michael@0 107 }
michael@0 108
michael@0 109 }

mercurial