Commit 8af8b40e by Alexis Hetu Committed by Alexis Hétu

Ripped out SwiftConfig

SwiftConfig is unused in Vulkan, so it was removed. Change-Id: Ic82bd186c271522b8552ca9925692e311b5c4156 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/32031Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Presubmit-Ready: Alexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 8565e772
......@@ -42,8 +42,6 @@ swiftshader_source_set("Device") {
"Renderer.hpp",
"SetupProcessor.cpp",
"SetupProcessor.hpp",
"SwiftConfig.cpp",
"SwiftConfig.hpp",
"Vector.cpp",
"Vector.hpp",
"VertexProcessor.cpp",
......
......@@ -30,39 +30,10 @@ namespace sw
framesSec = 0;
framesTotal = 0;
FPS = 0;
#if PERF_PROFILE
for(int i = 0; i < PERF_TIMERS; i++)
{
cycles[i] = 0;
}
ropOperations = 0;
ropOperationsTotal = 0;
ropOperationsFrame = 0;
texOperations = 0;
texOperationsTotal = 0;
texOperationsFrame = 0;
compressedTex = 0;
compressedTexTotal = 0;
compressedTexFrame = 0;
#endif
}
void Profiler::nextFrame()
{
#if PERF_PROFILE
ropOperationsFrame = sw::atomicExchange(&ropOperations, 0);
texOperationsFrame = sw::atomicExchange(&texOperations, 0);
compressedTexFrame = sw::atomicExchange(&compressedTex, 0);
ropOperationsTotal += ropOperationsFrame;
texOperationsTotal += texOperationsFrame;
compressedTexTotal += compressedTexFrame;
#endif
static double fpsTime = sw::Timer::seconds();
double time = sw::Timer::seconds();
......
......@@ -17,18 +17,6 @@
#include "System/Types.hpp"
#define PERF_HUD 0 // Display time spent on vertex, setup and pixel processing for each thread
#define PERF_PROFILE 0 // Profile various pipeline stages and display the timing in SwiftConfig
#define ASTC_SUPPORT 0
// Worker thread count when not set by SwiftConfig
// 0 = process affinity count (recommended)
// 1 = rendering on main thread (no worker threads), useful for debugging
#ifndef DEFAULT_THREAD_COUNT
#define DEFAULT_THREAD_COUNT 0
#endif
namespace sw
{
enum
......@@ -53,22 +41,6 @@ namespace sw
int framesSec;
int framesTotal;
double FPS;
#if PERF_PROFILE
double cycles[PERF_TIMERS];
int64_t ropOperations;
int64_t ropOperationsTotal;
int64_t ropOperationsFrame;
int64_t texOperations;
int64_t texOperationsTotal;
int64_t texOperationsFrame;
int64_t compressedTex;
int64_t compressedTexTotal;
int64_t compressedTexFrame;
#endif
};
extern Profiler profiler;
......
......@@ -24,16 +24,6 @@
namespace sw
{
bool booleanFaceRegister = false;
bool fullPixelPositionRegister = false;
bool forceWindowed = false;
bool quadLayoutEnabled = false;
bool postBlendSRGB = false;
bool exactColorRounding = false;
TransparencyAntialiasing transparencyAntialiasing = TRANSPARENCY_NONE;
bool forceClearRegisters = false;
Context::Context()
{
init();
......@@ -197,11 +187,6 @@ namespace sw
return depthWriteEnable;
}
bool Context::alphaTestActive() const
{
return transparencyAntialiasing != TRANSPARENCY_NONE;
}
bool Context::depthBufferActive() const
{
return depthBuffer && depthBufferEnable;
......@@ -589,6 +574,6 @@ namespace sw
bool Context::colorUsed() const
{
return colorWriteActive() || alphaTestActive() || (pixelShader && pixelShader->getModes().ContainsKill);
return colorWriteActive() || (pixelShader && pixelShader->getModes().ContainsKill);
}
}
......@@ -97,7 +97,6 @@ namespace sw
bool setWriteSRGB(bool sRGB);
bool depthWriteActive() const;
bool alphaTestActive() const;
bool depthBufferActive() const;
bool stencilActive() const;
......
......@@ -24,10 +24,6 @@
namespace sw
{
extern TransparencyAntialiasing transparencyAntialiasing;
bool precachePixel = false;
unsigned int PixelProcessor::States::computeHash()
{
unsigned int *state = (unsigned int*)this;
......
......@@ -22,10 +22,6 @@
namespace sw
{
extern bool fullPixelPositionRegister;
extern int clusterCount;
QuadRasterizer::QuadRasterizer(const PixelProcessor::State &state, SpirvShader const *spirvShader) : state(state), spirvShader{spirvShader}
{
}
......@@ -36,15 +32,6 @@ namespace sw
void QuadRasterizer::generate()
{
#if PERF_PROFILE
for(int i = 0; i < PERF_TIMERS; i++)
{
cycles[i] = 0;
}
Long pixelTime = Ticks();
#endif
constants = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData,constants));
occlusion = 0;
int clusterCount = Renderer::getClusterCount();
......@@ -76,15 +63,6 @@ namespace sw
*Pointer<UInt>(data + OFFSET(DrawData,occlusion) + 4 * cluster) = clusterOcclusion;
}
#if PERF_PROFILE
cycles[PERF_PIXEL] = Ticks() - pixelTime;
for(int i = 0; i < PERF_TIMERS; i++)
{
*Pointer<Long>(data + OFFSET(DrawData,cycles[i]) + 8 * cluster) += cycles[i];
}
#endif
Return();
}
......
......@@ -40,10 +40,6 @@ namespace sw
UInt occlusion;
#if PERF_PROFILE
Long cycles[PERF_TIMERS];
#endif
virtual void quad(Pointer<Byte> cBuffer[4], Pointer<Byte> &zBuffer, Pointer<Byte> &sBuffer, Int cMask[4], Int &x, Int &y) = 0;
bool interpolateZ() const;
......
......@@ -17,7 +17,6 @@
#include "Clipper.hpp"
#include "Primitive.hpp"
#include "Polygon.hpp"
#include "Device/SwiftConfig.hpp"
#include "Reactor/Reactor.hpp"
#include "Pipeline/Constants.hpp"
#include "System/CPUID.hpp"
......@@ -35,8 +34,6 @@
#undef max
bool disableServer = true;
#ifndef NDEBUG
unsigned int minPrimitives = 1;
unsigned int maxPrimitives = 1 << 21;
......@@ -44,42 +41,11 @@ unsigned int maxPrimitives = 1 << 21;
namespace sw
{
extern bool booleanFaceRegister;
extern bool fullPixelPositionRegister;
extern bool forceWindowed;
extern bool postBlendSRGB;
extern bool exactColorRounding;
extern TransparencyAntialiasing transparencyAntialiasing;
extern bool forceClearRegisters;
extern bool precacheVertex;
extern bool precacheSetup;
extern bool precachePixel;
static const int batchSize = 128;
AtomicInt threadCount(1);
AtomicInt Renderer::unitCount(1);
AtomicInt Renderer::clusterCount(1);
TranscendentalPrecision logPrecision = ACCURATE;
TranscendentalPrecision expPrecision = ACCURATE;
TranscendentalPrecision rcpPrecision = ACCURATE;
TranscendentalPrecision rsqPrecision = ACCURATE;
static void setGlobalRenderingSettings(Conventions conventions, bool exactColorRounding)
{
static bool initialized = false;
if(!initialized)
{
sw::booleanFaceRegister = conventions.booleanFaceRegister;
sw::fullPixelPositionRegister = conventions.fullPixelPositionRegister;
sw::exactColorRounding = exactColorRounding;
initialized = true;
}
}
template<typename T>
inline bool setBatchIndices(unsigned int batch[128][3], VkPrimitiveTopology topology, T indices, unsigned int start, unsigned int triangleCount)
{
......@@ -196,14 +162,8 @@ namespace sw
deallocate(data);
}
Renderer::Renderer(Conventions conventions, bool exactColorRounding)
Renderer::Renderer()
{
setGlobalRenderingSettings(conventions, exactColorRounding);
#if PERF_HUD
resetTimers();
#endif
for(int i = 0; i < 16; i++)
{
vertexTask[i] = nullptr;
......@@ -246,7 +206,6 @@ namespace sw
clipFlags = 0;
swiftConfig = new SwiftConfig(disableServer);
updateConfiguration(true);
}
......@@ -263,9 +222,6 @@ namespace sw
delete drawCall[draw];
drawCall[draw] = nullptr;
}
delete swiftConfig;
swiftConfig = nullptr;
}
// This object has to be mem aligned
......@@ -298,10 +254,14 @@ namespace sw
if(count == 0) { return; }
#ifndef NDEBUG
{
unsigned int minPrimitives = 1;
unsigned int maxPrimitives = 1 << 21;
if(count < minPrimitives || count > maxPrimitives)
{
return;
}
}
#endif
updateConfiguration();
......@@ -455,16 +415,6 @@ namespace sw
}
}
#if PERF_PROFILE
for(int cluster = 0; cluster < clusterCount; cluster++)
{
for(int i = 0; i < PERF_TIMERS; i++)
{
data->cycles[i][cluster] = 0;
}
}
#endif
// Viewport
{
float W = 0.5f * viewport.width;
......@@ -574,11 +524,8 @@ namespace sw
Renderer *renderer = static_cast<Parameters*>(parameters)->renderer;
int threadIndex = static_cast<Parameters*>(parameters)->threadIndex;
if(logPrecision < IEEE)
{
CPUID::setFlushToZero(true);
CPUID::setDenormalsAreZero(true);
}
CPUID::setFlushToZero(true);
CPUID::setDenormalsAreZero(true);
renderer->threadLoop(threadIndex);
}
......@@ -733,10 +680,6 @@ namespace sw
void Renderer::executeTask(int threadIndex)
{
#if PERF_HUD
int64_t startTick = Timer::ticks();
#endif
switch(task[threadIndex].type)
{
case Task::PRIMITIVES:
......@@ -750,12 +693,6 @@ namespace sw
processPrimitiveVertices(unit, input, count, draw->count, threadIndex);
#if PERF_HUD
int64_t time = Timer::ticks();
vertexTime[threadIndex] += time - startTick;
startTick = time;
#endif
int visible = 0;
if(!draw->setupState.rasterizerDiscard)
......@@ -765,10 +702,6 @@ namespace sw
primitiveProgress[unit].visible = visible;
primitiveProgress[unit].references = clusterCount;
#if PERF_HUD
setupTime[threadIndex] += Timer::ticks() - startTick;
#endif
}
break;
case Task::PIXELS:
......@@ -788,10 +721,6 @@ namespace sw
}
finishRendering(task[threadIndex]);
#if PERF_HUD
pixelTime[threadIndex] += Timer::ticks() - startTick;
#endif
}
break;
case Task::RESUME:
......@@ -835,16 +764,6 @@ namespace sw
if(ref == 0)
{
#if PERF_PROFILE
for(int cluster = 0; cluster < clusterCount; cluster++)
{
for(int i = 0; i < PERF_TIMERS; i++)
{
profiler.cycles[i] += data.cycles[i][cluster];
}
}
#endif
if(draw.queries)
{
for(auto &query : *(draw.queries))
......@@ -1393,38 +1312,6 @@ namespace sw
}
}
#if PERF_HUD
int Renderer::getThreadCount()
{
return threadCount;
}
int64_t Renderer::getVertexTime(int thread)
{
return vertexTime[thread];
}
int64_t Renderer::getSetupTime(int thread)
{
return setupTime[thread];
}
int64_t Renderer::getPixelTime(int thread)
{
return pixelTime[thread];
}
void Renderer::resetTimers()
{
for(int thread = 0; thread < threadCount; thread++)
{
vertexTime[thread] = 0;
setupTime[thread] = 0;
pixelTime[thread] = 0;
}
}
#endif
void Renderer::setViewport(const VkViewport &viewport)
{
this->viewport = viewport;
......@@ -1437,97 +1324,21 @@ namespace sw
void Renderer::updateConfiguration(bool initialUpdate)
{
bool newConfiguration = swiftConfig->hasNewConfiguration();
if(newConfiguration || initialUpdate)
if(initialUpdate)
{
terminateThreads();
SwiftConfig::Configuration configuration = {};
swiftConfig->getConfiguration(configuration);
VertexProcessor::setRoutineCacheSize(1024);
PixelProcessor::setRoutineCacheSize(1024);
SetupProcessor::setRoutineCacheSize(1024);
precacheVertex = !newConfiguration && configuration.precache;
precacheSetup = !newConfiguration && configuration.precache;
precachePixel = !newConfiguration && configuration.precache;
threadCount = CPUID::processAffinity();
VertexProcessor::setRoutineCacheSize(configuration.vertexRoutineCacheSize);
PixelProcessor::setRoutineCacheSize(configuration.pixelRoutineCacheSize);
SetupProcessor::setRoutineCacheSize(configuration.setupRoutineCacheSize);
switch(configuration.transcendentalPrecision)
{
case 0:
logPrecision = APPROXIMATE;
expPrecision = APPROXIMATE;
rcpPrecision = APPROXIMATE;
rsqPrecision = APPROXIMATE;
break;
case 1:
logPrecision = PARTIAL;
expPrecision = PARTIAL;
rcpPrecision = PARTIAL;
rsqPrecision = PARTIAL;
break;
case 2:
logPrecision = ACCURATE;
expPrecision = ACCURATE;
rcpPrecision = ACCURATE;
rsqPrecision = ACCURATE;
break;
case 3:
logPrecision = WHQL;
expPrecision = WHQL;
rcpPrecision = WHQL;
rsqPrecision = WHQL;
break;
case 4:
logPrecision = IEEE;
expPrecision = IEEE;
rcpPrecision = IEEE;
rsqPrecision = IEEE;
break;
default:
logPrecision = ACCURATE;
expPrecision = ACCURATE;
rcpPrecision = ACCURATE;
rsqPrecision = ACCURATE;
break;
}
switch(configuration.transparencyAntialiasing)
{
case 0: transparencyAntialiasing = TRANSPARENCY_NONE; break;
case 1: transparencyAntialiasing = TRANSPARENCY_ALPHA_TO_COVERAGE; break;
default: transparencyAntialiasing = TRANSPARENCY_NONE; break;
}
switch(configuration.threadCount)
{
case -1: threadCount = CPUID::coreCount(); break;
case 0: threadCount = CPUID::processAffinity(); break;
default: threadCount = configuration.threadCount; break;
}
CPUID::setEnableSSE4_1(configuration.enableSSE4_1);
CPUID::setEnableSSSE3(configuration.enableSSSE3);
CPUID::setEnableSSE3(configuration.enableSSE3);
CPUID::setEnableSSE2(configuration.enableSSE2);
CPUID::setEnableSSE(configuration.enableSSE);
for(int pass = 0; pass < 10; pass++)
{
optimization[pass] = configuration.optimization[pass];
}
forceWindowed = configuration.forceWindowed;
postBlendSRGB = configuration.postBlendSRGB;
exactColorRounding = configuration.exactColorRounding;
forceClearRegisters = configuration.forceClearRegisters;
#ifndef NDEBUG
minPrimitives = configuration.minPrimitives;
maxPrimitives = configuration.maxPrimitives;
#endif
CPUID::setEnableSSE4_1(true);
CPUID::setEnableSSSE3(true);
CPUID::setEnableSSE3(true);
CPUID::setEnableSSE2(true);
CPUID::setEnableSSE(true);
}
if(!initialUpdate && !worker[0])
......
......@@ -40,50 +40,11 @@ namespace sw
struct DrawCall;
class PixelShader;
class VertexShader;
class SwiftConfig;
struct Task;
class TaskEvents;
class Resource;
struct Constants;
enum TranscendentalPrecision
{
APPROXIMATE,
PARTIAL, // 2^-10
ACCURATE,
WHQL, // 2^-21
IEEE // 2^-23
};
extern TranscendentalPrecision logPrecision;
extern TranscendentalPrecision expPrecision;
extern TranscendentalPrecision rcpPrecision;
extern TranscendentalPrecision rsqPrecision;
struct Conventions // FIXME(capn): Eliminate. Only support Vulkan 1.1 conventions.
{
bool halfIntegerCoordinates;
bool symmetricNormalizedDepth;
bool booleanFaceRegister;
bool fullPixelPositionRegister;
};
static const Conventions OpenGL =
{
true, // halfIntegerCoordinates
true, // symmetricNormalizedDepth
true, // booleanFaceRegister
true, // fullPixelPositionRegister
};
static const Conventions Direct3D =
{
false, // halfIntegerCoordinates
false, // symmetricNormalizedDepth
false, // booleanFaceRegister
false, // fullPixelPositionRegister
};
struct DrawData
{
const Constants *constants;
......@@ -103,10 +64,6 @@ namespace sw
PixelProcessor::Factor factor;
unsigned int occlusion[16]; // Number of pixels passing depth test
#if PERF_PROFILE
int64_t cycles[PERF_TIMERS][16];
#endif
float4 Wx16;
float4 Hx16;
float4 X0x16;
......@@ -193,7 +150,7 @@ namespace sw
};
public:
Renderer(Conventions conventions, bool exactColorRounding);
Renderer();
virtual ~Renderer();
......@@ -215,15 +172,6 @@ namespace sw
void synchronize();
#if PERF_HUD
// Performance timers
int getThreadCount();
int64_t getVertexTime(int thread);
int64_t getSetupTime(int thread);
int64_t getPixelTime(int thread);
void resetTimers();
#endif
static int getClusterCount() { return clusterCount; }
private:
......@@ -289,16 +237,8 @@ namespace sw
std::mutex schedulerMutex;
#if PERF_HUD
int64_t vertexTime[16];
int64_t setupTime[16];
int64_t pixelTime[16];
#endif
VertexTask *vertexTask[16];
SwiftConfig *swiftConfig;
std::list<vk::Query*> queries;
WaitGroup sync;
......
......@@ -157,10 +157,6 @@ namespace sw
VkSamplerYcbcrModelConversion ycbcrModel;
bool studioSwing; // Narrow range
bool swappedChroma; // Cb/Cr components in reverse order
#if PERF_PROFILE
bool compressedFormat;
#endif
};
}
......
......@@ -25,10 +25,6 @@
namespace sw
{
extern bool fullPixelPositionRegister;
bool precacheSetup = false;
unsigned int SetupProcessor::States::computeHash()
{
unsigned int *state = (unsigned int*)this;
......
// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef sw_SwiftConfig_hpp
#define sw_SwiftConfig_hpp
#include "Reactor/Nucleus.hpp"
#include "System/Socket.hpp"
#include <mutex>
#include <string>
#include <thread>
#ifdef Status
#undef Status // b/127920555
#endif
namespace sw
{
class SwiftConfig
{
public:
struct Configuration
{
int pixelShaderVersion;
int vertexShaderVersion;
int textureMemory;
int identifier;
int vertexRoutineCacheSize;
int pixelRoutineCacheSize;
int setupRoutineCacheSize;
int vertexCacheSize;
int textureSampleQuality;
int mipmapQuality;
int transcendentalPrecision;
int threadCount;
bool enableSSE;
bool enableSSE2;
bool enableSSE3;
bool enableSSSE3;
bool enableSSE4_1;
rr::Optimization optimization[10];
bool disableServer;
bool keepSystemCursor;
bool forceWindowed;
bool postBlendSRGB;
bool exactColorRounding;
bool disableAlphaMode;
bool disable10BitMode;
int transparencyAntialiasing;
int frameBufferAPI;
bool precache;
int shadowMapping;
bool forceClearRegisters;
#ifndef NDEBUG
unsigned int minPrimitives;
unsigned int maxPrimitives;
#endif
};
SwiftConfig(bool disableServerOverride);
~SwiftConfig();
bool hasNewConfiguration(bool reset = true);
void getConfiguration(Configuration &configuration);
private:
enum Status
{
OK = 200,
NotFound = 404
};
void createServer();
void destroyServer();
static void serverRoutine(void *parameters);
void serverLoop();
void respond(Socket *clientSocket, const char *request);
std::string page();
std::string profile();
void send(Socket *clientSocket, Status code, std::string body = "");
void parsePost(const char *post);
void readConfiguration(bool disableServerOverride = false);
void writeConfiguration();
Configuration config;
std::thread *serverThread;
volatile bool terminate;
std::mutex criticalSection; // Protects reading and writing the configuration settings
bool newConfig;
Socket *listenSocket;
int bufferLength;
char *receiveBuffer;
};
}
#endif // sw_SwiftConfig_hpp
......@@ -23,8 +23,6 @@
namespace sw
{
bool precacheVertex = false;
void VertexCache::clear()
{
for(int i = 0; i < 16; i++)
......
......@@ -20,8 +20,6 @@
namespace sw
{
extern bool postBlendSRGB;
void PixelProgram::setBuiltins(Int &x, Int &y, Float4(&z)[4], Float4 &w)
{
routine.windowSpacePosition[0] = x + SIMD::Int(0,1,0,1);
......
......@@ -24,10 +24,6 @@
namespace sw
{
extern bool postBlendSRGB;
extern bool exactColorRounding;
extern bool forceClearRegisters;
PixelRoutine::PixelRoutine(
const PixelProcessor::State &state,
vk::PipelineLayout const *pipelineLayout,
......@@ -40,12 +36,12 @@ namespace sw
if (spirvShader)
{
spirvShader->emitProlog(&routine);
if (forceClearRegisters)
// Clearing inputs to 0 is not demanded by the spec,
// but it makes the undefined behavior deterministic.
for(int i = 0; i < MAX_INTERFACE_COMPONENTS; i++)
{
for (int i = 0; i < MAX_INTERFACE_COMPONENTS; i++)
{
routine.inputs[i] = Float4(0.0f);
}
routine.inputs[i] = Float4(0.0f);
}
}
}
......@@ -56,10 +52,6 @@ namespace sw
void PixelRoutine::quad(Pointer<Byte> cBuffer[RENDERTARGETS], Pointer<Byte> &zBuffer, Pointer<Byte> &sBuffer, Int cMask[4], Int &x, Int &y)
{
#if PERF_PROFILE
Long pipeTime = Ticks();
#endif
// TODO: consider shader which modifies sample mask in general
const bool earlyDepthTest = !spirvShader || (!spirvShader->getModes().DepthReplacing && !state.alphaToCoverage);
......@@ -109,10 +101,6 @@ namespace sw
If(depthPass || Bool(!earlyDepthTest))
{
#if PERF_PROFILE
Long interpTime = Ticks();
#endif
Float4 yyyy = Float4(Float(y)) + *Pointer<Float4>(primitive + OFFSET(Primitive,yQuad), 16);
// Centroid locations
......@@ -176,25 +164,13 @@ namespace sw
setBuiltins(x, y, z, w);
}
#if PERF_PROFILE
cycles[PERF_INTERP] += Ticks() - interpTime;
#endif
Bool alphaPass = true;
#if PERF_PROFILE
Long shaderTime = Ticks();
#endif
if (spirvShader)
{
applyShader(cMask);
}
#if PERF_PROFILE
cycles[PERF_SHADER] += Ticks() - shaderTime;
#endif
alphaPass = alphaTest(cMask);
if((spirvShader && spirvShader->getModes().ContainsKill) || state.alphaToCoverage)
......@@ -216,10 +192,6 @@ namespace sw
}
}
#if PERF_PROFILE
Long ropTime = Ticks();
#endif
If(depthPass || Bool(earlyDepthTest))
{
for(unsigned int q = 0; q < state.multiSample; q++)
......@@ -235,16 +207,8 @@ namespace sw
}
}
#if PERF_PROFILE
AddAtomic(Pointer<Long>(&profiler.ropOperations), 4);
#endif
rasterOperation(cBuffer, x, sMask, zMask, cMask);
}
#if PERF_PROFILE
cycles[PERF_ROP] += Ticks() - ropTime;
#endif
}
}
......@@ -255,10 +219,6 @@ namespace sw
writeStencil(sBuffer, q, x, sMask[q], zMask[q], cMask[q]);
}
}
#if PERF_PROFILE
cycles[PERF_PIPE] += Ticks() - pipeTime;
#endif
}
Float4 PixelRoutine::interpolateCentroid(Float4 &x, Float4 &y, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective)
......@@ -1102,7 +1062,7 @@ namespace sw
UNIMPLEMENTED("VkFormat %d", state.targetFormat[index]);
}
if(postBlendSRGB || isSRGB(index))
if(isSRGB(index))
{
sRGBtoLinear16_12_16(pixel);
}
......@@ -1229,36 +1189,33 @@ namespace sw
void PixelRoutine::writeColor(int index, Pointer<Byte> &cBuffer, Int &x, Vector4s &current, Int &sMask, Int &zMask, Int &cMask)
{
if(postBlendSRGB || isSRGB(index))
if(isSRGB(index))
{
linearToSRGB16_12_16(current);
}
if(exactColorRounding)
switch(state.targetFormat[index])
{
switch(state.targetFormat[index])
{
case VK_FORMAT_R5G6B5_UNORM_PACK16:
current.x = AddSat(As<UShort4>(current.x), UShort4(0x0400));
current.y = AddSat(As<UShort4>(current.y), UShort4(0x0200));
current.z = AddSat(As<UShort4>(current.z), UShort4(0x0400));
break;
case VK_FORMAT_B8G8R8A8_UNORM:
case VK_FORMAT_B8G8R8A8_SRGB:
case VK_FORMAT_R8G8B8A8_UNORM:
case VK_FORMAT_R8G8B8A8_SRGB:
case VK_FORMAT_R8G8_UNORM:
case VK_FORMAT_R8_UNORM:
case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 8) + Short4(0x0080);
current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 8) + Short4(0x0080);
current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 8) + Short4(0x0080);
current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 8) + Short4(0x0080);
break;
default:
break;
}
case VK_FORMAT_R5G6B5_UNORM_PACK16:
current.x = AddSat(As<UShort4>(current.x), UShort4(0x0400));
current.y = AddSat(As<UShort4>(current.y), UShort4(0x0200));
current.z = AddSat(As<UShort4>(current.z), UShort4(0x0400));
break;
case VK_FORMAT_B8G8R8A8_UNORM:
case VK_FORMAT_B8G8R8A8_SRGB:
case VK_FORMAT_R8G8B8A8_UNORM:
case VK_FORMAT_R8G8B8A8_SRGB:
case VK_FORMAT_R8G8_UNORM:
case VK_FORMAT_R8_UNORM:
case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 8) + Short4(0x0080);
current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 8) + Short4(0x0080);
current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 8) + Short4(0x0080);
current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 8) + Short4(0x0080);
break;
default:
break;
}
int rgbaWriteMask = state.colorWriteActive(index);
......@@ -1956,7 +1913,7 @@ namespace sw
UNIMPLEMENTED("VkFormat: %d", int(state.targetFormat[index]));
}
if(postBlendSRGB || isSRGB(index))
if(isSRGB(index))
{
sRGBtoLinear(pixel.x);
sRGBtoLinear(pixel.y);
......
......@@ -57,15 +57,6 @@ namespace sw
{
Vector4f c;
#if PERF_PROFILE
AddAtomic(Pointer<Long>(&profiler.texOperations), 4);
if(state.compressedFormat)
{
AddAtomic(Pointer<Long>(&profiler.compressedTex), 4);
}
#endif
Float4 uuuu = u;
Float4 vvvv = v;
Float4 wwww = w;
......
......@@ -23,8 +23,6 @@
namespace sw
{
extern TranscendentalPrecision logPrecision;
SetupRoutine::SetupRoutine(const SetupProcessor::State &state) : state(state)
{
routine = 0;
......
......@@ -21,11 +21,6 @@
namespace sw
{
extern TranscendentalPrecision logPrecision;
extern TranscendentalPrecision expPrecision;
extern TranscendentalPrecision rcpPrecision;
extern TranscendentalPrecision rsqPrecision;
Vector4s::Vector4s()
{
}
......@@ -186,20 +181,11 @@ namespace sw
Float4 reciprocal(RValue<Float4> x, bool pp, bool finite, bool exactAtPow2)
{
Float4 rcp;
Float4 rcp = Rcp_pp(x, exactAtPow2);
if(!pp && rcpPrecision >= WHQL)
{
rcp = Float4(1.0f) / x;
}
else
if(!pp)
{
rcp = Rcp_pp(x, exactAtPow2);
if(!pp)
{
rcp = (rcp + rcp) - (x * rcp * rcp);
}
rcp = (rcp + rcp) - (x * rcp * rcp);
}
if(finite)
......
......@@ -74,7 +74,7 @@ VkSubmitInfo* DeepCopySubmitInfo(uint32_t submitCount, const VkSubmitInfo* pSubm
namespace vk
{
Queue::Queue() : renderer(sw::OpenGL, true)
Queue::Queue() : renderer()
{
queueThread = std::thread(TaskLoop, this);
}
......
......@@ -149,7 +149,6 @@ IF EXIST "$(SolutionDir)..\deqp\build\external\vulkancts\modules\vulkan\" (copy
<ClCompile Include="..\Device\QuadRasterizer.cpp" />
<ClCompile Include="..\Device\Renderer.cpp" />
<ClCompile Include="..\Device\SetupProcessor.cpp" />
<ClCompile Include="..\Device\SwiftConfig.cpp" />
<ClCompile Include="..\Device\Vector.cpp" />
<ClCompile Include="..\Device\VertexProcessor.cpp" />
<ClCompile Include="..\Pipeline\ComputeProgram.cpp" />
......@@ -243,7 +242,6 @@ IF EXIST "$(SolutionDir)..\deqp\build\external\vulkancts\modules\vulkan\" (copy
<ClInclude Include="..\Device\Sampler.hpp" />
<ClInclude Include="..\Device\SetupProcessor.hpp" />
<ClInclude Include="..\Device\Stream.hpp" />
<ClInclude Include="..\Device\SwiftConfig.hpp" />
<ClInclude Include="..\Device\Triangle.hpp" />
<ClInclude Include="..\Device\Vector.hpp" />
<ClInclude Include="..\Device\Vertex.hpp" />
......
......@@ -51,9 +51,6 @@
<ClCompile Include="..\Device\Vector.cpp">
<Filter>Source Files\Device</Filter>
</ClCompile>
<ClCompile Include="..\Device\SwiftConfig.cpp">
<Filter>Source Files\Device</Filter>
</ClCompile>
<ClCompile Include="..\Device\SetupProcessor.cpp">
<Filter>Source Files\Device</Filter>
</ClCompile>
......@@ -362,9 +359,6 @@
<ClInclude Include="..\Device\Triangle.hpp">
<Filter>Header Files\Device</Filter>
</ClInclude>
<ClInclude Include="..\Device\SwiftConfig.hpp">
<Filter>Header Files\Device</Filter>
</ClInclude>
<ClInclude Include="..\Device\Stream.hpp">
<Filter>Header Files\Device</Filter>
</ClInclude>
......
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