Add ShaderExecutable and ShaderExecutable9 classes to encapsulate back-end specific shader-isms.

Trac #22155 Signed-off-by: Geoff Lang Signed-off-by: Nicolas Capens Author: Shannon Woods & Daniel Koch git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1498 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 27290c1b
......@@ -275,6 +275,9 @@
'libGLESv2/renderer/RenderTarget9.h',
'libGLESv2/renderer/RenderTarget9.cpp',
'libGLESv2/renderer/ShaderCache.h',
'libGLESv2/renderer/ShaderExecutable.h',
'libGLESv2/renderer/ShaderExecutable9.cpp',
'libGLESv2/renderer/ShaderExecutable9.h',
'libGLESv2/renderer/SwapChain.h',
'libGLESv2/renderer/SwapChain9.cpp',
'libGLESv2/renderer/SwapChain9.h',
......
......@@ -255,6 +255,7 @@ copy "$(OutDir)libGLESv2.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
<ClCompile Include="renderer\RenderTarget11.cpp" />
<ClCompile Include="renderer\RenderTarget9.cpp" />
<ClCompile Include="renderer\RenderStateCache.cpp" />
<ClCompile Include="renderer\ShaderExecutable9.cpp" />
<ClCompile Include="renderer\SwapChain11.cpp" />
<ClCompile Include="renderer\SwapChain9.cpp" />
<ClCompile Include="renderer\TextureStorage.cpp" />
......@@ -299,6 +300,8 @@ copy "$(OutDir)libGLESv2.lib" "$(ProjectDir)..\..\lib\$(Configuration)\"
<ClInclude Include="renderer\RenderTarget9.h" />
<ClInclude Include="renderer\RenderStateCache.h" />
<ClInclude Include="renderer\ShaderCache.h" />
<ClInclude Include="renderer\ShaderExecutable.h" />
<ClInclude Include="renderer\ShaderExecutable9.h" />
<ClInclude Include="renderer\SwapChain.h" />
<ClInclude Include="renderer\SwapChain11.h" />
<ClInclude Include="renderer\SwapChain9.h" />
......
......@@ -131,6 +131,9 @@
<ClCompile Include="renderer\VertexDeclarationCache.cpp">
<Filter>Renderer</Filter>
</ClCompile>
<ClCompile Include="renderer\ShaderExecutable9.cpp">
<Filter>Renderer</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="BinaryStream.h">
......@@ -268,6 +271,12 @@
<ClInclude Include="renderer\VertexDeclarationCache.h">
<Filter>Renderer</Filter>
</ClInclude>
<ClInclude Include="renderer\ShaderExecutable.h">
<Filter>Renderer</Filter>
</ClInclude>
<ClInclude Include="renderer\ShaderExecutable9.h">
<Filter>Renderer</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="libGLESv2.def">
......
//
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ShaderExecutable.h: Defines a renderer-agnostic class to contain shader
// executable implementation details.
#ifndef LIBGLESV2_RENDERER_SHADEREXECUTABLE_H_
#define LIBGLESV2_RENDERER_SHADEREXECUTABLE_H_
#include "common/angleutils.h"
namespace rx
{
class ShaderExecutable
{
public:
ShaderExecutable() {};
virtual ~ShaderExecutable() {};
private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable);
};
}
#endif // LIBGLESV2_RENDERER_SHADEREXECUTABLE9_H_
\ No newline at end of file
//
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ShaderExecutable9.cpp: Implements a D3D9-specific class to contain shader
// executable implementation details.
#include "libGLESv2/renderer/ShaderExecutable9.h"
#include "common/debug.h"
namespace rx
{
ShaderExecutable9::ShaderExecutable9(IDirect3DPixelShader9 *executable, gl::D3DConstantTable *constantTable)
{
mPixelExecutable = executable;
mVertexExecutable = NULL;
mConstantTable = constantTable;
}
ShaderExecutable9::ShaderExecutable9(IDirect3DVertexShader9 *executable, gl::D3DConstantTable *constantTable)
{
mVertexExecutable = executable;
mPixelExecutable = NULL;
mConstantTable = constantTable;
}
ShaderExecutable9::~ShaderExecutable9()
{
if (mVertexExecutable)
{
mVertexExecutable->Release();
}
if (mPixelExecutable)
{
mPixelExecutable->Release();
}
delete mConstantTable;
}
ShaderExecutable9 *ShaderExecutable9::makeShaderExecutable9(ShaderExecutable *executable)
{
ASSERT(dynamic_cast<ShaderExecutable9*>(executable) != NULL);
return static_cast<ShaderExecutable9*>(executable);
}
IDirect3DVertexShader9 *ShaderExecutable9::getVertexShader()
{
// Caller is responsible for releasing the returned shader reference.
if (mVertexExecutable)
{
mVertexExecutable->AddRef();
}
return mVertexExecutable;
}
IDirect3DPixelShader9 *ShaderExecutable9::getPixelShader()
{
// Caller is responsible for releasing the returned shader reference.
if (mPixelExecutable)
{
mPixelExecutable->AddRef();
}
return mPixelExecutable;
}
gl::D3DConstantTable *ShaderExecutable9::getConstantTable()
{
return mConstantTable;
}
}
\ No newline at end of file
//
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ShaderExecutable9.h: Defines a D3D9-specific class to contain shader
// executable implementation details.
#ifndef LIBGLESV2_RENDERER_SHADEREXECUTABLE9_H_
#define LIBGLESV2_RENDERER_SHADEREXECUTABLE9_H_
#include <d3d9.h>
#include "libGLESv2/renderer/ShaderExecutable.h"
#include "libGLESv2/D3DConstantTable.h"
namespace rx
{
class ShaderExecutable9 : public ShaderExecutable
{
public:
ShaderExecutable9(IDirect3DPixelShader9 *executable, gl::D3DConstantTable *constantTable);
ShaderExecutable9(IDirect3DVertexShader9 *executable, gl::D3DConstantTable *constantTable);
virtual ~ShaderExecutable9();
static ShaderExecutable9 *makeShaderExecutable9(ShaderExecutable *executable);
IDirect3DPixelShader9 *getPixelShader();
IDirect3DVertexShader9 *getVertexShader();
gl::D3DConstantTable *getConstantTable();
private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable9);
IDirect3DPixelShader9 *mPixelExecutable;
IDirect3DVertexShader9 *mVertexExecutable;
gl::D3DConstantTable *mConstantTable;
};
}
#endif // LIBGLESV2_RENDERER_SHADEREXECUTABLE9_H_
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment