Add query for max texture size

This commit is contained in:
Henrik Rydgård committed 2025-11-15 15:26:02 +01:00
1 parent 553ee27629
commit 1efcaafd5a
6 files changed
+38 -2

No files matched your search

+20
View File
@@ -298,6 +298,26 @@ D3D11DrawContext::D3D11DrawContext(ComPtr<ID3D11Device> device, ComPtr<ID3D11Dev
caps_.coordConvention = CoordConvention::Direct3D11;
switch (featureLevel_) {
case D3D_FEATURE_LEVEL_11_1:
case D3D_FEATURE_LEVEL_11_0:
caps_.maxTextureSize = 16384;
break;
case D3D_FEATURE_LEVEL_10_1:
case D3D_FEATURE_LEVEL_10_0:
caps_.maxTextureSize = 8192;
break;
case D3D_FEATURE_LEVEL_9_3:
caps_.maxTextureSize = 4096;
break;
case D3D_FEATURE_LEVEL_9_2:
case D3D_FEATURE_LEVEL_9_1:
default:
caps_.maxTextureSize = 2048;
break;
}
caps_.maxClipPlanes = 8;
// Seems like a fair approximation...
caps_.dualSourceBlend = featureLevel_ >= D3D_FEATURE_LEVEL_10_0;
caps_.depthClampSupported = featureLevel_ >= D3D_FEATURE_LEVEL_10_0;
+7 -2
View File
@@ -204,14 +204,19 @@ bool CheckGLExtensions() {
strncpy(gl_extensions.model, renderer, sizeof(gl_extensions.model));
gl_extensions.model[sizeof(gl_extensions.model) - 1] = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_extensions.maxTextureSize);
#ifndef USING_GLES2
glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_extensions.maxClipPlanes);
#endif
// Start by assuming we're at 2.0.
int parsed[2] = {2, 0};
{ // Grab the version and attempt to parse.
char buffer[128] = { 0 };
strncpy(buffer, versionStr, sizeof(buffer) - 1);
int len = (int)strlen(buffer);
const int len = (int)strlen(buffer);
bool beforeDot = true;
int lastDigit = 0;
for (int i = 0; i < len; i++) {
+3
View File
@@ -44,6 +44,9 @@ struct GLExtensions {
bool IsCoreContext;
bool GLES3; // true if the full OpenGL ES 3.0 is supported
int maxTextureSize;
int maxClipPlanes;
// OES
bool OES_depth24;
bool OES_packed_depth_stencil;
+2
View File
@@ -578,6 +578,8 @@ OpenGLContext::OpenGLContext(bool canChangeSwapInterval) : renderManager_(frameT
caps_.textureDepthSupported = true;
}
caps_.maxTextureSize = gl_extensions.maxTextureSize;
caps_.maxClipPlanes = gl_extensions.IsGLES ? 0 : gl_extensions.maxClipPlanes;
caps_.coordConvention = CoordConvention::OpenGL;
caps_.setMaxFrameLatencySupported = true;
caps_.dualSourceBlend = gl_extensions.ARB_blend_func_extended || gl_extensions.EXT_blend_func_extended;
+3
View File
@@ -919,6 +919,9 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread)
caps_.dualSourceBlend = vulkan->GetDeviceFeatures().enabled.standard.dualSrcBlend != 0;
caps_.depthClampSupported = vulkan->GetDeviceFeatures().enabled.standard.depthClamp != 0;
caps_.maxTextureSize = vulkan->GetPhysicalDeviceProperties().properties.limits.maxImageDimension2D;
caps_.maxClipPlanes = vulkan->GetPhysicalDeviceProperties().properties.limits.maxClipDistances;
// Comment out these two to test geometry shader culling on any geometry shader-supporting hardware.
caps_.clipDistanceSupported = vulkan->GetDeviceFeatures().enabled.standard.shaderClipDistance != 0;
caps_.cullDistanceSupported = vulkan->GetDeviceFeatures().enabled.standard.shaderCullDistance != 0;
+3
View File
@@ -593,6 +593,9 @@ struct DeviceCaps {
GPUVendor vendor;
uint32_t deviceID; // use caution!
uint32_t maxTextureSize; // largest side.
uint32_t maxClipPlanes;
CoordConvention coordConvention;
DataFormat preferredDepthBufferFormat;
DataFormat preferredShadowMapFormatLow;