Add a get*Function method to the ShaderExecutable interface
Trac #22155
Signed-off-by: Geoff Lang
Signed-off-by: Nicolas Capens
This allows ProgramBinary::save to avoid knowing about D3D9 shaders
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1508 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/renderer/ShaderExecutable.h b/src/libGLESv2/renderer/ShaderExecutable.h
index d43f378..7130b77 100644
--- a/src/libGLESv2/renderer/ShaderExecutable.h
+++ b/src/libGLESv2/renderer/ShaderExecutable.h
@@ -21,6 +21,9 @@
ShaderExecutable() {};
virtual ~ShaderExecutable() {};
+ virtual bool getVertexFunction(void *pData, UINT *pSizeOfData) = 0;
+ virtual bool getPixelFunction(void *pData, UINT *pSizeOfData) = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable);
};
diff --git a/src/libGLESv2/renderer/ShaderExecutable9.cpp b/src/libGLESv2/renderer/ShaderExecutable9.cpp
index 0a19af1..e81a652 100644
--- a/src/libGLESv2/renderer/ShaderExecutable9.cpp
+++ b/src/libGLESv2/renderer/ShaderExecutable9.cpp
@@ -48,6 +48,26 @@
return static_cast<ShaderExecutable9*>(executable);
}
+bool ShaderExecutable9::getVertexFunction(void *pData, UINT *pSizeOfData)
+{
+ HRESULT hr = D3DERR_INVALIDCALL;
+ if (mVertexExecutable)
+ {
+ hr = mVertexExecutable->GetFunction(pData, pSizeOfData);
+ }
+ return SUCCEEDED(hr);
+}
+
+bool ShaderExecutable9::getPixelFunction(void *pData, UINT *pSizeOfData)
+{
+ HRESULT hr = D3DERR_INVALIDCALL;
+ if (mPixelExecutable)
+ {
+ hr = mPixelExecutable->GetFunction(pData, pSizeOfData);
+ }
+ return SUCCEEDED(hr);
+}
+
IDirect3DVertexShader9 *ShaderExecutable9::getVertexShader()
{
return mVertexExecutable;
diff --git a/src/libGLESv2/renderer/ShaderExecutable9.h b/src/libGLESv2/renderer/ShaderExecutable9.h
index 721dee0..734ea32 100644
--- a/src/libGLESv2/renderer/ShaderExecutable9.h
+++ b/src/libGLESv2/renderer/ShaderExecutable9.h
@@ -25,6 +25,9 @@
ShaderExecutable9(IDirect3DVertexShader9 *executable, gl::D3DConstantTable *constantTable);
virtual ~ShaderExecutable9();
+ virtual bool getVertexFunction(void *pData, UINT *pSizeOfData);
+ virtual bool getPixelFunction(void *pData, UINT *pSizeOfData);
+
static ShaderExecutable9 *makeShaderExecutable9(ShaderExecutable *executable);
IDirect3DPixelShader9 *getPixelShader();