Add D3D version and shader models to renderer string reported by GetString.

It looks like this now: ANGLE (NVIDIA Quadro 600 Direct3D9Ex vs_3_0 ps_3_0) I also noticed that the strings returned by GetString are not all static so I fixed that as well. Review URL: https://codereview.appspot.com/7068058 Author: apatrick@chromium.org <apatrick@chromium.org@736b8ea6-26fd-11df-bfd4-992fa37f6226> Manual merge from Master by daniel@transgaming.com git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1709 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 4fd1f989
#define MAJOR_VERSION 1
#define MINOR_VERSION 1
#define BUILD_VERSION 0
#define BUILD_REVISION 1645
#define BUILD_REVISION 1647
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
......@@ -10,6 +10,7 @@
#include "libGLESv2/Context.h"
#include <algorithm>
#include <sstream>
#include "libEGL/Display.h"
......@@ -33,6 +34,16 @@
namespace gl
{
static const char* makeStaticString(const std::string& str)
{
static std::set<std::string> strings;
std::set<std::string>::iterator it = strings.find(str);
if (it != strings.end())
return it->c_str();
return strings.insert(str).first->c_str();
}
Context::Context(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess) : mRenderer(renderer)
{
ASSERT(robustAccess == false); // Unimplemented
......@@ -146,6 +157,9 @@ Context::Context(const gl::Context *shareContext, rx::Renderer *renderer, bool n
mState.unpackAlignment = 4;
mState.packReverseRowOrder = false;
mExtensionString = NULL;
mRendererString = NULL;
mInvalidEnum = false;
mInvalidValue = false;
mInvalidOperation = false;
......@@ -2498,125 +2512,130 @@ void Context::setVertexAttribDivisor(GLuint index, GLuint divisor)
// Vendor extensions
void Context::initExtensionString()
{
mExtensionString = "";
std::string extensionString = "";
// OES extensions
if (supports32bitIndices())
{
mExtensionString += "GL_OES_element_index_uint ";
extensionString += "GL_OES_element_index_uint ";
}
mExtensionString += "GL_OES_packed_depth_stencil ";
mExtensionString += "GL_OES_get_program_binary ";
mExtensionString += "GL_OES_rgb8_rgba8 ";
extensionString += "GL_OES_packed_depth_stencil ";
extensionString += "GL_OES_get_program_binary ";
extensionString += "GL_OES_rgb8_rgba8 ";
if (supportsDerivativeInstructions())
{
mExtensionString += "GL_OES_standard_derivatives ";
extensionString += "GL_OES_standard_derivatives ";
}
if (supportsFloat16Textures())
{
mExtensionString += "GL_OES_texture_half_float ";
extensionString += "GL_OES_texture_half_float ";
}
if (supportsFloat16LinearFilter())
{
mExtensionString += "GL_OES_texture_half_float_linear ";
extensionString += "GL_OES_texture_half_float_linear ";
}
if (supportsFloat32Textures())
{
mExtensionString += "GL_OES_texture_float ";
extensionString += "GL_OES_texture_float ";
}
if (supportsFloat32LinearFilter())
{
mExtensionString += "GL_OES_texture_float_linear ";
extensionString += "GL_OES_texture_float_linear ";
}
if (supportsNonPower2Texture())
{
mExtensionString += "GL_OES_texture_npot ";
extensionString += "GL_OES_texture_npot ";
}
// Multi-vendor (EXT) extensions
if (supportsOcclusionQueries())
{
mExtensionString += "GL_EXT_occlusion_query_boolean ";
extensionString += "GL_EXT_occlusion_query_boolean ";
}
mExtensionString += "GL_EXT_read_format_bgra ";
mExtensionString += "GL_EXT_robustness ";
extensionString += "GL_EXT_read_format_bgra ";
extensionString += "GL_EXT_robustness ";
if (supportsDXT1Textures())
{
mExtensionString += "GL_EXT_texture_compression_dxt1 ";
extensionString += "GL_EXT_texture_compression_dxt1 ";
}
if (supportsTextureFilterAnisotropy())
{
mExtensionString += "GL_EXT_texture_filter_anisotropic ";
extensionString += "GL_EXT_texture_filter_anisotropic ";
}
mExtensionString += "GL_EXT_texture_format_BGRA8888 ";
mExtensionString += "GL_EXT_texture_storage ";
extensionString += "GL_EXT_texture_format_BGRA8888 ";
extensionString += "GL_EXT_texture_storage ";
// ANGLE-specific extensions
if (supportsDepthTextures())
{
mExtensionString += "GL_ANGLE_depth_texture ";
extensionString += "GL_ANGLE_depth_texture ";
}
mExtensionString += "GL_ANGLE_framebuffer_blit ";
extensionString += "GL_ANGLE_framebuffer_blit ";
if (getMaxSupportedSamples() != 0)
{
mExtensionString += "GL_ANGLE_framebuffer_multisample ";
extensionString += "GL_ANGLE_framebuffer_multisample ";
}
if (supportsInstancing())
{
mExtensionString += "GL_ANGLE_instanced_arrays ";
extensionString += "GL_ANGLE_instanced_arrays ";
}
mExtensionString += "GL_ANGLE_pack_reverse_row_order ";
extensionString += "GL_ANGLE_pack_reverse_row_order ";
if (supportsDXT3Textures())
{
mExtensionString += "GL_ANGLE_texture_compression_dxt3 ";
extensionString += "GL_ANGLE_texture_compression_dxt3 ";
}
if (supportsDXT5Textures())
{
mExtensionString += "GL_ANGLE_texture_compression_dxt5 ";
extensionString += "GL_ANGLE_texture_compression_dxt5 ";
}
mExtensionString += "GL_ANGLE_texture_usage ";
mExtensionString += "GL_ANGLE_translated_shader_source ";
extensionString += "GL_ANGLE_texture_usage ";
extensionString += "GL_ANGLE_translated_shader_source ";
// Other vendor-specific extensions
if (supportsEventQueries())
{
mExtensionString += "GL_NV_fence ";
extensionString += "GL_NV_fence ";
}
std::string::size_type end = mExtensionString.find_last_not_of(' ');
std::string::size_type end = extensionString.find_last_not_of(' ');
if (end != std::string::npos)
{
mExtensionString.resize(end+1);
extensionString.resize(end+1);
}
mExtensionString = makeStaticString(extensionString);
}
const char *Context::getExtensionString() const
{
return mExtensionString.c_str();
return mExtensionString;
}
void Context::initRendererString()
{
mRendererString = "ANGLE (";
mRendererString += mRenderer->getAdapterDescription();
mRendererString += ")";
std::ostringstream rendererString;
rendererString << "ANGLE (";
rendererString << mRenderer->getRendererDescription();
rendererString << ")";
mRendererString = makeStaticString(rendererString.str());
}
const char *Context::getRendererString() const
{
return mRendererString.c_str();
return mRendererString;
}
void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
......
......@@ -467,8 +467,8 @@ class Context
QueryMap mQueryMap;
HandleAllocator mQueryHandleAllocator;
std::string mExtensionString;
std::string mRendererString;
const char *mExtensionString;
const char *mRendererString;
BindingPointer<Texture> mIncompleteTextures[TEXTURE_TYPE_COUNT];
......
......@@ -131,7 +131,7 @@ class Renderer
// Renderer capabilities
virtual DWORD getAdapterVendor() const = 0;
virtual const char *getAdapterDescription() const = 0;
virtual std::string getRendererDescription() const = 0;
virtual GUID getAdapterIdentifier() const = 0;
virtual bool getDXT1TextureSupport() = 0;
......
......@@ -29,6 +29,8 @@
#include "libEGL/Config.h"
#include "libEGL/Display.h"
#include <sstream>
namespace rx
{
static const DXGI_FORMAT RenderTargetFormats[] =
......@@ -1391,9 +1393,17 @@ DWORD Renderer11::getAdapterVendor() const
return mAdapterDescription.VendorId;
}
const char *Renderer11::getAdapterDescription() const
std::string Renderer11::getRendererDescription() const
{
return mDescription;
std::ostringstream rendererString;
rendererString << mDescription;
rendererString << " Direct3D11";
rendererString << " vs_" << getMajorShaderModel() << "_" << getMinorShaderModel();
rendererString << " ps_" << getMajorShaderModel() << "_" << getMinorShaderModel();
return rendererString.str();
}
GUID Renderer11::getAdapterIdentifier() const
......@@ -1536,12 +1546,23 @@ int Renderer11::getMajorShaderModel() const
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_1: return D3D10_1_SHADER_MAJOR_VERSION; // 4
case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MAJOR_VERSION; // 4
default: UNREACHABLE(); return 0;
}
}
int Renderer11::getMinorShaderModel() const
{
switch (mFeatureLevel)
{
case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MINOR_VERSION; // 0
case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MINOR_VERSION; // 1
case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MINOR_VERSION; // 0
default: UNREACHABLE(); return 0;
}
}
float Renderer11::getMaxPointSize() const
{
// TODO
......
......@@ -86,7 +86,7 @@ class Renderer11 : public Renderer
// Renderer capabilities
virtual DWORD getAdapterVendor() const;
virtual const char *getAdapterDescription() const;
virtual std::string getRendererDescription() const;
virtual GUID getAdapterIdentifier() const;
virtual bool getDXT1TextureSupport();
......@@ -173,6 +173,7 @@ class Renderer11 : public Renderer
void initializeDevice();
void releaseDeviceResources();
int getMinorShaderModel() const;
RenderStateCache mStateCache;
......
......@@ -30,6 +30,8 @@
#include "libEGL/Config.h"
#include "libEGL/Display.h"
#include <sstream>
// Can also be enabled by defining FORCE_REF_RAST in the project's predefined macros
#define REF_RAST 0
......@@ -2100,9 +2102,24 @@ DWORD Renderer9::getAdapterVendor() const
return mAdapterIdentifier.VendorId;
}
const char *Renderer9::getAdapterDescription() const
std::string Renderer9::getRendererDescription() const
{
return mAdapterIdentifier.Description;
std::ostringstream rendererString;
rendererString << mAdapterIdentifier.Description;
if (getShareHandleSupport())
{
rendererString << " Direct3D9Ex";
}
else
{
rendererString << " Direct3D9";
}
rendererString << " vs_" << D3DSHADER_VERSION_MAJOR(mDeviceCaps.VertexShaderVersion) << "_" << D3DSHADER_VERSION_MINOR(mDeviceCaps.VertexShaderVersion);
rendererString << " ps_" << D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion) << "_" << D3DSHADER_VERSION_MINOR(mDeviceCaps.PixelShaderVersion);
return rendererString.str();
}
GUID Renderer9::getAdapterIdentifier() const
......
......@@ -111,7 +111,7 @@ class Renderer9 : public Renderer
// Renderer capabilities
IDirect3DDevice9 *getDevice() { return mDevice; }
virtual DWORD getAdapterVendor() const;
virtual const char *getAdapterDescription() const;
virtual std::string getRendererDescription() const;
virtual GUID getAdapterIdentifier() const;
virtual bool getDXT1TextureSupport();
......
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