Commit ef6152eb by Nicolas Capens Committed by Nicolas Capens

Default to [X,0,0,one] for undefined texture components

Vulkan 1.1 section 15.3.5 table 24 specifies "Conversion to RGBA" to use 'one' as the last component when it's not present in the format, where "one = 1.0f for floating-point formats and depth aspects, and one = 1 for integer formats and stencil aspects", and 0 for the other missing components. Bug b/129523279 Change-Id: I9e4b0b9a8d1d696e51fc76b6554045835966c4b0 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/29274 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 2d54840b
......@@ -28,7 +28,6 @@ namespace sw
bool booleanFaceRegister = false;
bool fullPixelPositionRegister = false;
bool colorsDefaultToZero = false;
bool forceWindowed = false;
bool quadLayoutEnabled = false;
......
......@@ -47,7 +47,6 @@ namespace sw
{
extern bool booleanFaceRegister;
extern bool fullPixelPositionRegister;
extern bool colorsDefaultToZero;
extern bool forceWindowed;
extern bool postBlendSRGB;
......@@ -78,7 +77,6 @@ namespace sw
{
sw::booleanFaceRegister = conventions.booleanFaceRegister;
sw::fullPixelPositionRegister = conventions.fullPixelPositionRegister;
sw::colorsDefaultToZero = conventions.colorsDefaultToZero;
sw::exactColorRounding = exactColorRounding;
initialized = true;
}
......
......@@ -59,13 +59,12 @@ namespace sw
extern TranscendentalPrecision rsqPrecision;
extern bool perspectiveCorrection;
struct Conventions
struct Conventions // FIXME(capn): Eliminate. Only support Vulkan 1.1 conventions.
{
bool halfIntegerCoordinates;
bool symmetricNormalizedDepth;
bool booleanFaceRegister;
bool fullPixelPositionRegister;
bool colorsDefaultToZero;
};
static const Conventions OpenGL =
......@@ -74,7 +73,6 @@ namespace sw
true, // symmetricNormalizedDepth
true, // booleanFaceRegister
true, // fullPixelPositionRegister
true, // colorsDefaultToZero
};
static const Conventions Direct3D =
......@@ -83,7 +81,6 @@ namespace sw
false, // symmetricNormalizedDepth
false, // booleanFaceRegister
false, // fullPixelPositionRegister
false, // colorsDefaultToZero
};
struct DrawData
......
......@@ -36,8 +36,6 @@ namespace
namespace sw
{
extern bool colorsDefaultToZero;
SamplerCore::SamplerCore(Pointer<Byte> &constants, const Sampler::State &state) : constants(constants), state(state)
{
}
......@@ -188,7 +186,6 @@ namespace sw
}
int componentCount = textureComponentCount();
float defaultColorValue = colorsDefaultToZero ? 0.0f : 1.0f;
if(state.textureFilter != FILTER_GATHER)
{
......@@ -227,14 +224,14 @@ namespace sw
case VK_FORMAT_R8G8B8A8_UNORM:
case VK_FORMAT_R8G8B8A8_SRGB:
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:
if(componentCount < 2) c.y = Float4(defaultColorValue);
if(componentCount < 3) c.z = Float4(defaultColorValue);
if(componentCount < 2) c.y = Float4(0.0f);
if(componentCount < 3) c.z = Float4(0.0f);
if(componentCount < 4) c.w = Float4(1.0f);
break;
case VK_FORMAT_R32_SFLOAT:
c.y = Float4(defaultColorValue);
c.y = Float4(0.0f);
case VK_FORMAT_R32G32_SFLOAT:
c.z = Float4(defaultColorValue);
c.z = Float4(0.0f);
c.w = Float4(1.0f);
case VK_FORMAT_R32G32B32A32_SFLOAT:
break;
......
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