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
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index 19fd8c5..88187ad 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -233,7 +233,7 @@
{
if (!mHasBeenCurrent)
{
- mSupportsShaderModel3 = mRenderer->getShaderModel3Support();
+ mMajorShaderModel = mRenderer->getMajorShaderModel();
mMaximumPointSize = mRenderer->getMaxPointSize();
mSupportsVertexTexture = mRenderer->getVertexTextureSupport();
mSupportsNonPower2Texture = mRenderer->getNonPower2TextureSupport();
@@ -2213,19 +2213,19 @@
return (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
}
-bool Context::supportsShaderModel3() const
+int Context::getMajorShaderModel() const
{
- return mSupportsShaderModel3;
+ return mMajorShaderModel;
}
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
{
- 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
@@ -2240,7 +2240,7 @@
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
diff --git a/src/libGLESv2/Context.h b/src/libGLESv2/Context.h
index 8ce8076..4d962b1 100644
--- a/src/libGLESv2/Context.h
+++ b/src/libGLESv2/Context.h
@@ -379,7 +379,7 @@
GLenum getResetStatus();
virtual bool isResetNotificationEnabled();
- bool supportsShaderModel3() const;
+ int getMajorShaderModel() const;
float getMaximumPointSize() const;
int getMaximumVaryingVectors() const;
unsigned int getMaximumVertexTextureImageUnits() const;
@@ -495,7 +495,7 @@
BindingPointer<ProgramBinary> mCurrentProgramBinary;
Framebuffer *mBoundDrawFramebuffer;
- bool mSupportsShaderModel3;
+ int mMajorShaderModel;
float mMaximumPointSize;
bool mSupportsVertexTexture;
bool mSupportsNonPower2Texture;
diff --git a/src/libGLESv2/ProgramBinary.cpp b/src/libGLESv2/ProgramBinary.cpp
index 25af4d2..2f9e122 100644
--- a/src/libGLESv2/ProgramBinary.cpp
+++ b/src/libGLESv2/ProgramBinary.cpp
@@ -1317,7 +1317,7 @@
}
// Write the HLSL input/output declarations
- const bool sm3 = mRenderer->getShaderModel3Support();
+ const bool sm3 = mRenderer->getMajorShaderModel() >= 3;
Context *context = getContext();
const int maxVaryingVectors = context->getMaximumVaryingVectors();
@@ -1930,8 +1930,8 @@
return false;
}
- const char *vertexProfile = mRenderer->getShaderModel3Support() ? "vs_3_0" : "vs_2_0";
- const char *pixelProfile = mRenderer->getShaderModel3Support() ? "ps_3_0" : "ps_2_0";
+ const char *vertexProfile = mRenderer->getMajorShaderModel() >= 3 ? "vs_3_0" : "vs_2_0";
+ const char *pixelProfile = mRenderer->getMajorShaderModel() >= 3 ? "ps_3_0" : "ps_2_0";
ID3D10Blob *vertexBinary = compileToBinary(infoLog, vertexHLSL.c_str(), vertexProfile, &mConstantTableVS);
ID3D10Blob *pixelBinary = compileToBinary(infoLog, pixelHLSL.c_str(), pixelProfile, &mConstantTablePS);
diff --git a/src/libGLESv2/renderer/Renderer.h b/src/libGLESv2/renderer/Renderer.h
index 5719ac7..4aee4e9 100644
--- a/src/libGLESv2/renderer/Renderer.h
+++ b/src/libGLESv2/renderer/Renderer.h
@@ -131,7 +131,7 @@
virtual float getTextureMaxAnisotropy() const = 0;
virtual bool getShareHandleSupport() const = 0;
- virtual bool getShaderModel3Support() const = 0;
+ virtual int getMajorShaderModel() const = 0;
virtual float getMaxPointSize() const = 0;
virtual int getMaxTextureWidth() const = 0;
virtual int getMaxTextureHeight() const = 0;
diff --git a/src/libGLESv2/renderer/Renderer11.cpp b/src/libGLESv2/renderer/Renderer11.cpp
index 9bd37ba..b8094a6 100644
--- a/src/libGLESv2/renderer/Renderer11.cpp
+++ b/src/libGLESv2/renderer/Renderer11.cpp
@@ -709,11 +709,15 @@
return false && !gl::perfActive();
}
-bool Renderer11::getShaderModel3Support() const
+int Renderer11::getMajorShaderModel() const
{
- // TODO
- UNIMPLEMENTED();
- return true;
+ switch (mFeatureLevel)
+ {
+ 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
diff --git a/src/libGLESv2/renderer/Renderer11.h b/src/libGLESv2/renderer/Renderer11.h
index af99636..d1e0974 100644
--- a/src/libGLESv2/renderer/Renderer11.h
+++ b/src/libGLESv2/renderer/Renderer11.h
@@ -101,7 +101,7 @@
virtual float getTextureMaxAnisotropy() const;
virtual bool getShareHandleSupport() const;
- virtual bool getShaderModel3Support() const;
+ virtual int getMajorShaderModel() const;
virtual float getMaxPointSize() const;
virtual int getMaxTextureWidth() const;
virtual int getMaxTextureHeight() const;
diff --git a/src/libGLESv2/renderer/Renderer9.cpp b/src/libGLESv2/renderer/Renderer9.cpp
index 7feb01b..176b0ec 100644
--- a/src/libGLESv2/renderer/Renderer9.cpp
+++ b/src/libGLESv2/renderer/Renderer9.cpp
@@ -1950,9 +1950,9 @@
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
diff --git a/src/libGLESv2/renderer/Renderer9.h b/src/libGLESv2/renderer/Renderer9.h
index 0c321c1..eca55e2 100644
--- a/src/libGLESv2/renderer/Renderer9.h
+++ b/src/libGLESv2/renderer/Renderer9.h
@@ -137,7 +137,7 @@
virtual float getTextureMaxAnisotropy() const;
virtual bool getShareHandleSupport() const;
- virtual bool getShaderModel3Support() const;
+ virtual int getMajorShaderModel() const;
virtual float getMaxPointSize() const;
virtual int getMaxTextureWidth() const;
virtual int getMaxTextureHeight() const;