Commit 056d6922 by Ben Clayton

Use Nucleus::adjustDefaultConfig for Vulkan's default reactor config.

Remove all the explicit config passing to each of the functions. Bug: b/137167988 Change-Id: Ie8ea956d2365f1901d75b0d10c9e649485d78bf4 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33769Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 55bc37af
......@@ -1535,7 +1535,7 @@ namespace sw
}
}
return function(vk::ReactorConfig, "BlitRoutine");
return function("BlitRoutine");
}
Routine *Blitter::getBlitRoutine(const State &state)
......@@ -1890,7 +1890,7 @@ namespace sw
}
}
return function(vk::ReactorConfig, "BlitRoutine");
return function("BlitRoutine");
}
void Blitter::updateBorders(vk::Image* image, const VkImageSubresourceLayers& subresourceLayers)
......
......@@ -238,7 +238,7 @@ namespace sw
{
QuadRasterizer *generator = new PixelProgram(state, pipelineLayout, pixelShader, descriptorSets);
generator->generate();
routine = (*generator)(vk::ReactorConfig, "PixelRoutine_%0.8X", state.shaderID);
routine = (*generator)("PixelRoutine_%0.8X", state.shaderID);
delete generator;
routineCache->add(state, routine);
......
......@@ -105,7 +105,7 @@ namespace sw
{
VertexRoutine *generator = new VertexProgram(state, pipelineLayout, vertexShader, descriptorSets);
generator->generate();
routine = (*generator)(vk::ReactorConfig, "VertexRoutine_%0.8X", state.shaderID);
routine = (*generator)("VertexRoutine_%0.8X", state.shaderID);
delete generator;
routineCache->add(state, routine);
......
......@@ -453,7 +453,7 @@ namespace sw
Return(1);
}
routine = function(vk::ReactorConfig, "SetupRoutine");
routine = function("SetupRoutine");
}
void SetupRoutine::setupGradient(Pointer<Byte> &primitive, Pointer<Byte> &triangle, Float4 &w012, Float4 (&m)[3], Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2, int attribute, int planeEquation, bool flat, bool perspective, int component)
......
......@@ -231,7 +231,7 @@ SpirvShader::ImageSampler *SpirvShader::emitSamplerFunction(ImageInstruction ins
}
}
return (ImageSampler*)function(vk::ReactorConfig, "sampler")->getEntry();
return (ImageSampler*)function("sampler")->getEntry();
}
sw::TextureType SpirvShader::convertTextureType(VkImageViewType imageViewType)
......
......@@ -17,8 +17,6 @@
#include "Version.h"
#include "Reactor/Nucleus.hpp" // ReactorConfig
#include <Vulkan/VulkanPlatform.h>
namespace vk
......@@ -79,9 +77,6 @@ enum
MAX_POINT_SIZE = 1, // Large points are not supported. If/when we turn this on, must be >= 64.
};
// Configuration to use for JIT functions.
static const auto ReactorConfig = rr::Config::Edit().set(rr::Optimization::Level::Default);
}
#endif // VK_CONFIG_HPP_
......@@ -262,7 +262,7 @@ std::shared_ptr<sw::ComputeProgram> createProgram(const vk::PipelineCache::Compu
// TODO(b/119409619): use allocator.
auto program = std::make_shared<sw::ComputeProgram>(key.getShader(), key.getLayout(), descriptorSets);
program->generate();
program->finalize(vk::ReactorConfig);
program->finalize();
return program;
}
......
......@@ -54,6 +54,8 @@
#include "WSI/VkSwapchainKHR.hpp"
#include "Reactor/Nucleus.hpp"
#include <algorithm>
#include <cstring>
#include <string>
......@@ -75,6 +77,27 @@ bool HasExtensionProperty(const char* extensionName, const VkExtensionProperties
return false;
}
// setReactorDefaultConfig() sets the default configuration for Vulkan's use of
// Reactor.
void setReactorDefaultConfig()
{
auto cfg = rr::Config::Edit()
.set(rr::Optimization::Level::Default);
rr::Nucleus::adjustDefaultConfig(cfg);
}
// initializeLibrary() is called by vkCreateInstance() to perform one-off global
// initialization of the swiftshader driver.
void initializeLibrary()
{
static bool doOnce = [] {
setReactorDefaultConfig();
return true;
}();
(void)doOnce;
}
}
extern "C"
......@@ -139,6 +162,8 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo* pCre
TRACE("(const VkInstanceCreateInfo* pCreateInfo = %p, const VkAllocationCallbacks* pAllocator = %p, VkInstance* pInstance = %p)",
pCreateInfo, pAllocator, pInstance);
initializeLibrary();
if(pCreateInfo->enabledLayerCount)
{
UNIMPLEMENTED("pCreateInfo->enabledLayerCount");
......
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