Retrieve the shader model number instead of a shader model 3 support boolean.

TRAC #22072 Signed-off-by: Daniel Koch Signed-off-by: Geoff Lang Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1495 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent dedd1a0f
...@@ -233,7 +233,7 @@ void Context::makeCurrent(egl::Surface *surface) ...@@ -233,7 +233,7 @@ void Context::makeCurrent(egl::Surface *surface)
{ {
if (!mHasBeenCurrent) if (!mHasBeenCurrent)
{ {
mSupportsShaderModel3 = mRenderer->getShaderModel3Support(); mMajorShaderModel = mRenderer->getMajorShaderModel();
mMaximumPointSize = mRenderer->getMaxPointSize(); mMaximumPointSize = mRenderer->getMaxPointSize();
mSupportsVertexTexture = mRenderer->getVertexTextureSupport(); mSupportsVertexTexture = mRenderer->getVertexTextureSupport();
mSupportsNonPower2Texture = mRenderer->getNonPower2TextureSupport(); mSupportsNonPower2Texture = mRenderer->getNonPower2TextureSupport();
...@@ -2213,19 +2213,19 @@ bool Context::isResetNotificationEnabled() ...@@ -2213,19 +2213,19 @@ bool Context::isResetNotificationEnabled()
return (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT); return (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
} }
bool Context::supportsShaderModel3() const int Context::getMajorShaderModel() const
{ {
return mSupportsShaderModel3; return mMajorShaderModel;
} }
float Context::getMaximumPointSize() const float Context::getMaximumPointSize() const
{ {
return mSupportsShaderModel3 ? mMaximumPointSize : ALIASED_POINT_SIZE_RANGE_MAX_SM2; return mMajorShaderModel >= 3 ? mMaximumPointSize : ALIASED_POINT_SIZE_RANGE_MAX_SM2;
} }
int Context::getMaximumVaryingVectors() const int Context::getMaximumVaryingVectors() const
{ {
return mSupportsShaderModel3 ? MAX_VARYING_VECTORS_SM3 : MAX_VARYING_VECTORS_SM2; return mMajorShaderModel >= 3 ? MAX_VARYING_VECTORS_SM3 : MAX_VARYING_VECTORS_SM2;
} }
unsigned int Context::getMaximumVertexTextureImageUnits() const unsigned int Context::getMaximumVertexTextureImageUnits() const
...@@ -2240,7 +2240,7 @@ unsigned int Context::getMaximumCombinedTextureImageUnits() const ...@@ -2240,7 +2240,7 @@ unsigned int Context::getMaximumCombinedTextureImageUnits() const
int Context::getMaximumFragmentUniformVectors() const int Context::getMaximumFragmentUniformVectors() const
{ {
return mSupportsShaderModel3 ? MAX_FRAGMENT_UNIFORM_VECTORS_SM3 : MAX_FRAGMENT_UNIFORM_VECTORS_SM2; return mMajorShaderModel >= 3 ? MAX_FRAGMENT_UNIFORM_VECTORS_SM3 : MAX_FRAGMENT_UNIFORM_VECTORS_SM2;
} }
int Context::getMaxSupportedSamples() const int Context::getMaxSupportedSamples() const
......
...@@ -379,7 +379,7 @@ class Context ...@@ -379,7 +379,7 @@ class Context
GLenum getResetStatus(); GLenum getResetStatus();
virtual bool isResetNotificationEnabled(); virtual bool isResetNotificationEnabled();
bool supportsShaderModel3() const; int getMajorShaderModel() const;
float getMaximumPointSize() const; float getMaximumPointSize() const;
int getMaximumVaryingVectors() const; int getMaximumVaryingVectors() const;
unsigned int getMaximumVertexTextureImageUnits() const; unsigned int getMaximumVertexTextureImageUnits() const;
...@@ -495,7 +495,7 @@ class Context ...@@ -495,7 +495,7 @@ class Context
BindingPointer<ProgramBinary> mCurrentProgramBinary; BindingPointer<ProgramBinary> mCurrentProgramBinary;
Framebuffer *mBoundDrawFramebuffer; Framebuffer *mBoundDrawFramebuffer;
bool mSupportsShaderModel3; int mMajorShaderModel;
float mMaximumPointSize; float mMaximumPointSize;
bool mSupportsVertexTexture; bool mSupportsVertexTexture;
bool mSupportsNonPower2Texture; bool mSupportsNonPower2Texture;
......
...@@ -1317,7 +1317,7 @@ bool ProgramBinary::linkVaryings(InfoLog &infoLog, std::string& pixelHLSL, std:: ...@@ -1317,7 +1317,7 @@ bool ProgramBinary::linkVaryings(InfoLog &infoLog, std::string& pixelHLSL, std::
} }
// Write the HLSL input/output declarations // Write the HLSL input/output declarations
const bool sm3 = mRenderer->getShaderModel3Support(); const bool sm3 = mRenderer->getMajorShaderModel() >= 3;
Context *context = getContext(); Context *context = getContext();
const int maxVaryingVectors = context->getMaximumVaryingVectors(); const int maxVaryingVectors = context->getMaximumVaryingVectors();
...@@ -1930,8 +1930,8 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin ...@@ -1930,8 +1930,8 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin
return false; return false;
} }
const char *vertexProfile = mRenderer->getShaderModel3Support() ? "vs_3_0" : "vs_2_0"; const char *vertexProfile = mRenderer->getMajorShaderModel() >= 3 ? "vs_3_0" : "vs_2_0";
const char *pixelProfile = mRenderer->getShaderModel3Support() ? "ps_3_0" : "ps_2_0"; const char *pixelProfile = mRenderer->getMajorShaderModel() >= 3 ? "ps_3_0" : "ps_2_0";
ID3D10Blob *vertexBinary = compileToBinary(infoLog, vertexHLSL.c_str(), vertexProfile, &mConstantTableVS); ID3D10Blob *vertexBinary = compileToBinary(infoLog, vertexHLSL.c_str(), vertexProfile, &mConstantTableVS);
ID3D10Blob *pixelBinary = compileToBinary(infoLog, pixelHLSL.c_str(), pixelProfile, &mConstantTablePS); ID3D10Blob *pixelBinary = compileToBinary(infoLog, pixelHLSL.c_str(), pixelProfile, &mConstantTablePS);
......
...@@ -131,7 +131,7 @@ class Renderer ...@@ -131,7 +131,7 @@ class Renderer
virtual float getTextureMaxAnisotropy() const = 0; virtual float getTextureMaxAnisotropy() const = 0;
virtual bool getShareHandleSupport() const = 0; virtual bool getShareHandleSupport() const = 0;
virtual bool getShaderModel3Support() const = 0; virtual int getMajorShaderModel() const = 0;
virtual float getMaxPointSize() const = 0; virtual float getMaxPointSize() const = 0;
virtual int getMaxTextureWidth() const = 0; virtual int getMaxTextureWidth() const = 0;
virtual int getMaxTextureHeight() const = 0; virtual int getMaxTextureHeight() const = 0;
......
...@@ -709,11 +709,15 @@ bool Renderer11::getShareHandleSupport() const ...@@ -709,11 +709,15 @@ bool Renderer11::getShareHandleSupport() const
return false && !gl::perfActive(); return false && !gl::perfActive();
} }
bool Renderer11::getShaderModel3Support() const int Renderer11::getMajorShaderModel() const
{ {
// TODO switch (mFeatureLevel)
UNIMPLEMENTED(); {
return true; case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MAJOR_VERSION; // 5
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MAJOR_VERSION; // 4
default: UNREACHABLE(); return 0;
}
} }
float Renderer11::getMaxPointSize() const float Renderer11::getMaxPointSize() const
......
...@@ -101,7 +101,7 @@ class Renderer11 : public Renderer ...@@ -101,7 +101,7 @@ class Renderer11 : public Renderer
virtual float getTextureMaxAnisotropy() const; virtual float getTextureMaxAnisotropy() const;
virtual bool getShareHandleSupport() const; virtual bool getShareHandleSupport() const;
virtual bool getShaderModel3Support() const; virtual int getMajorShaderModel() const;
virtual float getMaxPointSize() const; virtual float getMaxPointSize() const;
virtual int getMaxTextureWidth() const; virtual int getMaxTextureWidth() const;
virtual int getMaxTextureHeight() const; virtual int getMaxTextureHeight() const;
......
...@@ -1950,9 +1950,9 @@ bool Renderer9::getShareHandleSupport() const ...@@ -1950,9 +1950,9 @@ bool Renderer9::getShareHandleSupport() const
return (mD3d9Ex != NULL) && !gl::perfActive(); return (mD3d9Ex != NULL) && !gl::perfActive();
} }
bool Renderer9::getShaderModel3Support() const int Renderer9::getMajorShaderModel() const
{ {
return mDeviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0); return D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion);
} }
float Renderer9::getMaxPointSize() const float Renderer9::getMaxPointSize() const
......
...@@ -137,7 +137,7 @@ class Renderer9 : public Renderer ...@@ -137,7 +137,7 @@ class Renderer9 : public Renderer
virtual float getTextureMaxAnisotropy() const; virtual float getTextureMaxAnisotropy() const;
virtual bool getShareHandleSupport() const; virtual bool getShareHandleSupport() const;
virtual bool getShaderModel3Support() const; virtual int getMajorShaderModel() const;
virtual float getMaxPointSize() const; virtual float getMaxPointSize() const;
virtual int getMaxTextureWidth() const; virtual int getMaxTextureWidth() const;
virtual int getMaxTextureHeight() const; virtual int getMaxTextureHeight() const;
......
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