Compiler - match pixel and vertex shader profiles

TRAC #11717 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@94 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent cbbca00b
...@@ -251,6 +251,20 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface) ...@@ -251,6 +251,20 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
{ {
depthStencil->Release(); depthStencil->Release();
} }
D3DCAPS9 capabilities;
device->GetDeviceCaps(&capabilities);
if (capabilities.PixelShaderVersion == D3DPS_VERSION(3, 0))
{
mPsProfile = "ps_3_0";
mVsProfile = "vs_3_0";
}
else // egl::Display guarantees support for at least 2.0
{
mPsProfile = "ps_2_0";
mVsProfile = "vs_2_0";
}
} }
void Context::setClearColor(float red, float green, float blue, float alpha) void Context::setClearColor(float red, float green, float blue, float alpha)
...@@ -1642,6 +1656,16 @@ GLenum Context::getError() ...@@ -1642,6 +1656,16 @@ GLenum Context::getError()
return GL_NO_ERROR; return GL_NO_ERROR;
} }
const char *Context::getPixelShaderProfile()
{
return mPsProfile;
}
const char *Context::getVertexShaderProfile()
{
return mVsProfile;
}
void Context::detachBuffer(GLuint buffer) void Context::detachBuffer(GLuint buffer)
{ {
// [OpenGL ES 2.0.24] section 2.9 page 22: // [OpenGL ES 2.0.24] section 2.9 page 22:
......
...@@ -277,6 +277,9 @@ class Context : public State ...@@ -277,6 +277,9 @@ class Context : public State
GLenum getError(); GLenum getError();
const char *getPixelShaderProfile();
const char *getVertexShaderProfile();
private: private:
DISALLOW_COPY_AND_ASSIGN(Context); DISALLOW_COPY_AND_ASSIGN(Context);
...@@ -333,6 +336,9 @@ class Context : public State ...@@ -333,6 +336,9 @@ class Context : public State
bool mInvalidFramebufferOperation; bool mInvalidFramebufferOperation;
bool mHasBeenCurrent; bool mHasBeenCurrent;
const char *mPsProfile;
const char *mVsProfile;
}; };
} }
......
...@@ -423,9 +423,9 @@ void Program::link() ...@@ -423,9 +423,9 @@ void Program::link()
return; return;
} }
IDirect3DDevice9 *device = getDevice(); Context *context = getContext();
const char *vertexProfile = D3DXGetVertexShaderProfile(device); const char *vertexProfile = context->getVertexShaderProfile();
const char *pixelProfile = D3DXGetPixelShaderProfile(device); const char *pixelProfile = context->getPixelShaderProfile();
const char *pixelHLSL = mFragmentShader->linkHLSL(); const char *pixelHLSL = mFragmentShader->linkHLSL();
const char *vertexHLSL = mVertexShader->linkHLSL(pixelHLSL); const char *vertexHLSL = mVertexShader->linkHLSL(pixelHLSL);
...@@ -434,6 +434,7 @@ void Program::link() ...@@ -434,6 +434,7 @@ void Program::link()
if (vertexBinary && pixelBinary) if (vertexBinary && pixelBinary)
{ {
IDirect3DDevice9 *device = getDevice();
HRESULT vertexResult = device->CreateVertexShader((DWORD*)vertexBinary->GetBufferPointer(), &mVertexExecutable); HRESULT vertexResult = device->CreateVertexShader((DWORD*)vertexBinary->GetBufferPointer(), &mVertexExecutable);
HRESULT pixelResult = device->CreatePixelShader((DWORD*)pixelBinary->GetBufferPointer(), &mPixelExecutable); HRESULT pixelResult = device->CreatePixelShader((DWORD*)pixelBinary->GetBufferPointer(), &mPixelExecutable);
......
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