3#include "Foundation/Logging/Logger.h"
6#include "MemoryContext.h"
9#include "RenderPipelineManager.h"
10#include "RenderStateUpdater.h"
11#include "RenderTarget.h"
13#include "CustomRenderer/BoundsRenderer.h"
14#include "CustomRenderer/DebugGeometryRenderers.h"
16#include "Rendering/Factory.h"
17#include "Rendering/ICapabilities.h"
18#include "Rendering/IContext.h"
19#include "Rendering/IGraphicsDevice.h"
20#include "Rendering/ITextures.h"
21#include "Rendering/IRenderTargets.h"
23#include "Resources/ResourceStore.h"
24#include "Resources/Texture.h"
25#include "Services/Variables.h"
26#include "Systems/Core/CameraSystem.h"
27#include "Systems/Core/EnvironmentSystem.h"
28#include "Systems/Core/LightSystem.h"
29#include "Utilities/Parsing.h"
31#include "InspectorGui/InspectorGuiRenderer.h"
33#include <glm/gtc/color_space.hpp>
39 void addLights(std::vector<const LightComponent*>& dst,
size_t& freeSlots, uint32_t& srcCount,
const std::vector<const LightComponent*>& src)
41 srcCount =
static_cast<uint32_t
>(std::min(freeSlots, src.size()));
42 freeSlots -= srcCount;
44 for (
size_t i = 0; i < srcCount; i++) {
45 dst.push_back(src[i]);
49 void buildSortedListOfActiveLights(
Context* context,
ActiveLights& activeLights,
const size_t maxLights)
54 std::vector<const LightComponent*> directionalShadowLights;
55 std::vector<const LightComponent*> pointShadowLights;
56 std::vector<const LightComponent*> directionalLights;
57 std::vector<const LightComponent*> pointLights;
58 const bool shadowsEnabled = context->
variables->get(
"renderer.shadowsEnabled",
false);
64 if (light.
lightType == LightType::Directional) {
65 directionalShadowLights.push_back(&light);
67 else if (light.
lightType == LightType::Point) {
68 pointShadowLights.push_back(&light);
72 if (light.
lightType == LightType::Directional) {
73 directionalLights.push_back(&light);
75 else if (light.
lightType == LightType::Point) {
76 pointLights.push_back(&light);
81 size_t numLightsTotal = directionalShadowLights.size() + directionalLights.size() + pointShadowLights.size() + pointLights.size();
82 if (maxLights < numLightsTotal) {
83 LOG_WARNING_ONCE(logger,
"More active lights (=%zu) than supported (=%zu)", numLightsTotal, maxLights);
86 activeLights.lights.clear();
87 size_t freeLightSlots = maxLights;
88 addLights(activeLights.lights, freeLightSlots, activeLights.numDirectionalShadowLights, directionalShadowLights);
89 addLights(activeLights.lights, freeLightSlots, activeLights.numDirectionalLights, directionalLights);
90 addLights(activeLights.lights, freeLightSlots, activeLights.numPointShadowLights, pointShadowLights);
91 addLights(activeLights.lights, freeLightSlots, activeLights.numPointLights, pointLights);
93 assert(activeLights.lights.size() <= maxLights);
115 renderContext.context = renderer->context;
116 renderContext.renderer = renderer;
117 renderContext.device = renderer->device;
118 renderContext.resources = &renderer->resources;
119 renderContext.states = &renderer->renderStates;
120 renderContext.engineBuffers = &renderer->engineBuffers;
121 renderContext.defaultRenderTarget = renderer->defaultTarget;
123 return renderContext;
130 drawContext.context = renderContext->context;
131 drawContext.renderer = renderContext->renderer;
132 drawContext.device = renderContext->device;
134 drawContext.cameraData = renderContext->cameraData;
135 drawContext.renderTarget = renderContext->defaultRenderTarget;
136 drawContext.engineBuffers = renderContext->engineBuffers;
137 drawContext.taskContext = renderContext;
138 drawContext.permutationIndex = 0;
145Cogs::Core::Renderer::Renderer(
Context * context) :
148 enginePermutations(context),
149 effectBindings(context->memory.get()),
156Cogs::Core::Renderer::~Renderer()
163 LOG_FATAL(logger,
"Cannot initialize renderer with nullptr device.");
167 Instrumentation::initializeGpu(context);
170 this->device = device;
172 auto backColor = context->
variables->get(
"renderer.backgroundColor", glm::vec4(0.5, 0.5, 0.5, 1));
173 setBackgroundColor(backColor);
178 context->
variables->set(
"renderer.DedicatedVideoMemoryMB", (
int)(device_capabilities.DedicatedVideoMemory/(1024*1024)));
179 context->
variables->set(
"renderer.DedicatedSystemMemoryMB", (
int)(device_capabilities.DedicatedSystemMemory/(1024*1024)));
180 context->
variables->set(
"renderer.SharedSystemMemoryMB", (
int)(device_capabilities.SharedSystemMemory/(1024*1024)));
183 enginePermutations.initialize(context);
184 renderStates.initialize(device);
186 resources.initialize(context,
this);
188 defaultTarget = resources.createRenderTarget();
192 renderContext = getRenderTaskContext(
this);
193 pipelineManager->initialize(&renderContext);
195 renderers->boundsRenderer.initialize(
this, device);
196 renderers->debugGeometryRenderer.initialize(
this, device);
197 renderers->imguiRenderer.initialize(context);
198 renderers->engineInspectorGuiRenderer.initialize(context,
this);
201 settings.anisotropicFiltering = context->
variables->get(
"renderer.anisotropicFiltering");
203 for (
auto & extension : extensions) {
204 extension->initialize(context, device);
210 renderers->debugGeometryRenderer.cleanup();
213 resources.releaseResource(defaultTarget);
216 pipelineManager->cleanup(&renderContext);
218 renderers->engineInspectorGuiRenderer.cleanup(context,
this);
219 renderers->imguiRenderer.cleanup();
221 if (context && context->
variables->get(
"renderer.reportLeaks",
false)) {
222 resources.cleanup(context);
225 renderStates.cleanup();
237 bool reverseDepth = context->
variables->get(
"renderer.reverseDepth",
false);
238 if(renderStates.reverseDepth != reverseDepth){
239 renderStates.reverseDepth = reverseDepth;
240 pipelineManager->dirty =
true;
244 renderStates.defaultDepthStencilStateHandle = renderTargets->loadDepthStencilState(defaultState);
245 renderStates.commonDepthStates[(int)
DepthMode::Default] = renderStates.defaultDepthStencilStateHandle;
246 renderStates.setupDepthStates(device);
252 if(reverseDepth) comparisonSamplerState.comparisonFunction = SamplerState::GreaterEqual;
253 else comparisonSamplerState.comparisonFunction = SamplerState::LessEqual;
255 for (
unsigned i = 0; i < 4; i++) {
256 if(reverseDepth) comparisonSamplerState.borderColor[i] = 0.f;
257 else comparisonSamplerState.borderColor[i] = 1.f;
260 renderStates.shadowSampler = textures->loadSamplerState(comparisonSamplerState);
266 renderContext.cameraData = &context->cameraSystem->getMainCameraData();
268 defaultTarget->setName(
"Cogs.BackBuffer");
269 defaultTarget->setOverride();
272 defaultTarget->width =
static_cast<int>(renderContext.cameraData->viewportSize.x);
273 defaultTarget->height =
static_cast<int>(renderContext.cameraData->viewportSize.y);
274 defaultTarget->samples = device->getSettings().
numSamples;
275 defaultTarget->clearColors = { backgroundColor };
277 const bool reloadEffects = context->
variables->get(
"renderer.reloadEffects",
false);
280 effectCache.reload(&renderContext);
281 context->
variables->set(
"renderer.reloadEffects",
false);
284 pipelineManager->setupPipeline(&renderContext);
286 buildSortedListOfActiveLights(context, activeLights, maxLights);
289 const auto eventContext = getDrawContext(&renderContext);
295 int samples = context->
variables->get(
"renderer.samples", 1);
296 context->
variables->set(
"impl.multiSample", samples > 1);
299 pipelineManager->initializeFrame(&renderContext);
300 pipelineManager->applyPipeline(&renderContext);
305 renderers->boundsRenderer.renderBounds(
this, context, *pipelineManager->getRenderList());
309 const auto eventContext = getDrawContext(&renderContext);
314 renderers->engineInspectorGuiRenderer.beginRender(context,
this);
315 renderers->engineInspectorGuiRenderer.render(context,
this);
317 if (context->callbacks.postRenderCallback) {
318 context->callbacks.postRenderCallback(context);
321 renderers->engineInspectorGuiRenderer.endRender(context,
this);
324 const DrawContext eventContext = getDrawContext(&renderContext);
326 context->cameraSystem->postRender(context);
329 pipelineManager->cleanupFrame(&renderContext);
335 this->backgroundColor = glm::vec4(glm::convertSRGBToLinear(glm::vec3(backgroundColor)),
339void Cogs::Core::Renderer::updateEffectFlags()
342 if (context->
variables->get(
"effects.logShaderInfo",
false)) {
345 if (context->
variables->get(
"effects.logShaderSource",
false)) {
351void Cogs::Core::Renderer::updateSettings()
354 if(context->
variables->exist(
"renderer.enableDeferred")){
355 static uint32_t t = 0;
358 LOG_WARNING(logger,
"Variable \"renderer.enableDeferred\" deprecated. Use \"renderer.pipeline\": \"Pipelines/Deferred.pipeline\".");
360 if(context->
variables->get(
"renderer.enableDeferred",
false))
361 context->
variables->set(
"renderer.pipeline",
"Pipelines/Deferred.pipeline");
367 default: settings.transparencyAlgorithm = RenderSettings::TransparencyAlgorithm::Regular;
break;
376 default: settings.blendKernel = RenderSettings::BlendKernel::Alpha;
break;
379 settings.defaultRenderTargetClear = context->
variables->get(
"renderer.backBuffer.clear.enable",
true);
381 if (
Variable* var = context->
variables->get(
"renderer.backBuffer.sRGB"); var->isEmpty()) {
382 switch (context->device->getType()) {
384 settings.defaultRenderTargetExpectsSRGB =
true;
387 settings.defaultRenderTargetExpectsSRGB =
false;
390 var->setBool(settings.defaultRenderTargetExpectsSRGB);
393 settings.defaultRenderTargetExpectsSRGB = var->getBool();
398 if (var->isEmpty()) {
399 var->setValue(
"Exact");
412 settings.sRGBConversion = RenderSettings::SRGBConversion::Exact;
418 if (var->isEmpty()) {
419 var->setValue(
"Filmic");
435 settings.tonemapper = RenderSettings::Tonemapper::Filmic;
439 settings.beersScaleFactor = context->
variables->get(
"renderer.beers.scaleFactor", 1.f);
441 settings.ambientIntensity = context->
variables->get(
"renderer.ambientLightIntensity", 0.f);
442 std::string acStr = context->
variables->get(
"renderer.ambientLightColor",
"1 1 1");
443 static std::string prev;
446 auto acTokens = tokenize(acStr);
447 parseValues(glm::value_ptr(settings.ambientColor), acTokens, 3);
450 settings.ambientColor = glm::convertSRGBToLinear(settings.ambientColor);
458 return projectionMatrix;
461 if(context->
variables->get(
"renderer.reverseDepth",
false)){
462 static glm::mat4 reverse(
468 projectionMatrix = reverse * projectionMatrix;
477 static glm::mat4 depthScale = glm::scale(glm::mat4(1.0f), glm::vec3(1, 1, 0.5f));
478 static glm::mat4 bias(
485 glm::mat4 projection = depthScale * bias * projectionMatrix;
491 static glm::mat4 depthScale = glm::scale(glm::mat4(1.0f), glm::vec3(1, -1, 0.5f));
492 static glm::mat4 bias(
499 glm::mat4 projection = depthScale * bias * projectionMatrix;
506 return projectionMatrix;
509 static glm::mat4 depthScale = glm::scale(glm::mat4(1.0f), glm::vec3(1, 1, 0.5f));
510 static glm::mat4 bias(
517 glm::mat4 projection = depthScale * bias * projectionMatrix;
522 return projectionMatrix;
525 LOG_WARNING(logger,
"Unknown device type.");
526 return projectionMatrix;
532 return inverseProjectionMatrix;
540 glm::vec4 x = glm::vec4(0.1, 0.2, 0.3, 1.0);
541 glm::mat4 clipFromViewport (
547 return inverseProjectionMatrix * clipFromViewport;
552 return inverseProjectionMatrix;
557 glm::mat4 scale = glm::scale(glm::mat4(1.0), glm::vec3(2.0, 2.0, 2.0));
558 static glm::mat4 bias(
564 return inverseProjectionMatrix * bias * scale;
567 glm::mat4 scale = glm::scale(glm::mat4(1.0), glm::vec3(2.0, 2.0, 1.0));
568 static glm::mat4 bias(
574 return inverseProjectionMatrix * bias * scale;
577 return inverseProjectionMatrix;
580 LOG_WARNING(logger,
"Unknown device type.");
581 return inverseProjectionMatrix;
586 if(context->
variables->get(
"renderer.reverseDepth",
false)) {
593 if(context->
variables->get(
"renderer.reverseDepth",
false)) {
615 device->
endFrame(syncInterval, presentFlags);
625 extensions.push_back(extension);
628 extension->initialize(context, device);
634 auto it = std::find(extensions.begin(), extensions.end(), extension);
635 assert(it != extensions.end() &&
"Unregistering unknown IRendererExtension");
636 if (it != extensions.end()) {
637 extensions.erase(it);
648 auto format = TextureFormat::R8G8B8A8_UNORM_SRGB;
650 const size_t size = (size_t)settings.width * (
size_t)settings.height * Cogs::getBlockSize(format);
657 if(settings.numSamples > 1)
658 desc.target = ResourceDimensions::Texture2DMS;
660 desc.target = ResourceDimensions::Texture2D;
661 desc.width = settings.width;
662 desc.height = settings.height;
663 desc.format = format;
664 desc.samples = settings.numSamples;
666 texture = textures->loadTexture(desc,
nullptr);
669 auto renderTarget = renderTargets->createRenderTarget(&texture, 1);
670 auto depthStencilTarget = renderTargets->createDepthStencilTarget(renderTarget);
672 auto camera = context->cameraSystem->getMainCamera();
673 auto restoreViewport = camera->viewportSize;
674 camera->viewportSize = glm::vec2(settings.width, settings.height);
675 context->cameraSystem->update(context);
677 renderContext.cameraData = &context->cameraSystem->getMainCameraData();
679 pipelineManager->setupPipeline(&renderContext);
681 auto restoreRenderTargetHandle = defaultTarget->renderTargetHandle;
682 auto restoreDepthTargetHandle = defaultTarget->depthTargetHandle;
683 auto restoreWidth = defaultTarget->width;
684 auto restoreHeight = defaultTarget->height;
685 auto restoreSamples = defaultTarget->samples;
686 auto restoreColors = std::move(defaultTarget->clearColors);
688 defaultTarget->renderTargetHandle = renderTarget;
689 defaultTarget->depthTargetHandle = depthStencilTarget;
690 defaultTarget->width = settings.width;
691 defaultTarget->height = settings.height;
692 defaultTarget->samples = settings.numSamples;
693 defaultTarget->clearColors = { backgroundColor };
695 pipelineManager->initializeFrame(&renderContext);
696 pipelineManager->applyPipeline(&renderContext);
697 pipelineManager->cleanupFrame(&renderContext);
699 if (settings.numSamples > 1) {
701 auto resolveRt = renderTargets->createRenderTarget(&resolveTexture, 1);
702 auto resolveDt = renderTargets->createDepthStencilTarget(resolveRt);
704 deviceContext->resolveResource(texture, resolveTexture);
706 deviceContext->setRenderTarget(resolveRt, resolveDt);
708 deviceContext->readColorBuffer(readBuffer, 0, 0, settings.width, settings.height,
Framebuffer::Front);
710 renderTargets->releaseDepthStencilTarget(resolveDt);
711 renderTargets->releaseRenderTarget(resolveRt);
712 textures->releaseTexture(resolveTexture);
714 deviceContext->setRenderTarget(renderTarget, depthStencilTarget);
716 deviceContext->readColorBuffer(readBuffer, 0, 0, settings.width, settings.height,
Framebuffer::Front);
723 const size_t bufferSize = data.getStride() ? data.getStride() * settings.height : size;
724 bytes.assign(data.get(), data.get() + bufferSize);
727 *stride = data.getStride();
732 defaultTarget->renderTargetHandle = restoreRenderTargetHandle;
733 defaultTarget->depthTargetHandle = restoreDepthTargetHandle;
734 defaultTarget->width = restoreWidth;
735 defaultTarget->height = restoreHeight;
736 defaultTarget->samples = restoreSamples;
737 defaultTarget->clearColors = std::move(restoreColors);
739 camera->viewportSize = restoreViewport;
741 buffers->releaseBuffer(readBuffer);
742 renderTargets->releaseDepthStencilTarget(depthStencilTarget);
743 renderTargets->releaseRenderTarget(renderTarget);
744 textures->releaseTexture(texture);
749 for (
auto extension : extensions) {
750 extension->handleEvent(eventId, renderingContext);
756 const bool ditherEnabled = context->
variables->get(
"renderer.ditherEnabled",
false);
757 if(permutation->hasVariant(
"Dither"))
758 permutation->setVariant(
"Dither", ditherEnabled);
760 const bool reverseDepth = context->
variables->get(
"renderer.reverseDepth",
false);
761 if(permutation->hasVariant(
"ReverseDepth"))
762 permutation->setVariant(
"ReverseDepth", reverseDepth);
764 if(permutation->hasVariant(
"DepthNegativeOneToOne"))
767 if (!permutation->hasBuiltins())
return;
768 if (!permutation->isShadingPass() || permutation->isDepthOnly())
return;
770 if (
auto ec = context->environmentSystem->getGlobalEnvironment(); ec !=
nullptr) {
771 permutation->setVariant(
"SubseaSupport", ec->subseaSupport);
772 if(ec->imageBasedLighting) {
774 permutation->setVariant(
"ImageBasedLighting",
"PBR");
776 permutation->setVariant(
"ImageBasedLighting",
"Phong");
779 permutation->setVariant(
"ImageBasedLighting",
"Disabled");
784 const bool shadowsEnabled = (activeLights.numDirectionalShadowLights != 0) || (activeLights.numPointShadowLights != 0);
785 permutation->setVariant(
"NumDirectionalShadowLights",
static_cast<int>(activeLights.numDirectionalShadowLights));
786 permutation->setVariant(
"NumPointShadowLights",
static_cast<int>(activeLights.numPointShadowLights));
787 permutation->setVariant(
"NumDirectionalLights",
static_cast<int>(activeLights.numDirectionalLights));
788 permutation->setVariant(
"NumPointLights",
static_cast<int>(activeLights.numPointLights));
789 permutation->setVariant(
"ShadowsEnabled", shadowsEnabled);
790 if (shadowsEnabled) {
791 const Cogs::Core::SoftShadows softShadows = parseEnum<SoftShadows>(context->
variables->get(
"shadows.softShadows",
"Default"));
792 permutation->setVariant(
"SoftShadows", (
int)softShadows);
795 if(permutation->hasVariant(
"sRGBConversion")) {
796 switch (settings.sRGBConversion) {
797 case RenderSettings::SRGBConversion::Fast:
798 permutation->setVariant(
"sRGBConversion",
"Fast");
800 case RenderSettings::SRGBConversion::Approx:
801 permutation->setVariant(
"sRGBConversion",
"Approx");
803 case RenderSettings::SRGBConversion::Exact:
804 permutation->setVariant(
"sRGBConversion",
"Exact");
807 assert(
false &&
"Invalid enum");
812 if (permutation->hasVariant(
"Tonemapper")) {
813 switch (settings.tonemapper) {
814 case RenderSettings::Tonemapper::Reinhard:
815 permutation->setVariant(
"Tonemapper",
"Reinhard");
817 case RenderSettings::Tonemapper::Filmic:
818 permutation->setVariant(
"Tonemapper",
"Filmic");
820 case RenderSettings::Tonemapper::ACESLuminance:
821 permutation->setVariant(
"Tonemapper",
"ACESLuminance");
823 case RenderSettings::Tonemapper::PBRNeutral:
824 permutation->setVariant(
"Tonemapper",
"PBRNeutral");
827 assert(
false &&
"Invalid enum");
835 return &renderers->imguiRenderer;
840 return &renderers->engineInspectorGuiRenderer;
ComponentPool< ComponentType > pool
Pool of components managed by the system.
A Context instance contains all the services, systems and runtime components needed to use Cogs.
std::unique_ptr< class Variables > variables
Variables service instance.
Interface to the render resources.
Defines an extension to the renderer, capable of doing custom rendering.
Defines a single light source and its behavior.
LightType lightType
The type of light.
bool castShadows
If this light should cast shadows.
bool enabled
If the light is enabled.
Holds all LightComponent instances in the system.
void updatePermutation(EnginePermutation *permutation) override
Updates the EnginePermutation.
float getNearDepth() override
Get adjusted near plane depth.
IRenderResources * getResources() override
Get the render resources interface.
void registerExtension(IRendererExtension *extension) override
Registers the given extension with the renderer. Doesn not take ownership of pointer.
void setBackgroundColor(const glm::vec4 &backgroundColor) override
Set the background color applied to the output surface before rendering.
void renderScreenshot(const ScreenshotSettings &settings, std::vector< uint8_t > &bytes, uint32_t *stride=nullptr) override
Render screenshot.
glm::mat4 getViewFromViewportMatrix(glm::mat4 inverseProjectionMatrix) override
Get an adjusted inverse projection matrix mainly used in post processing.
void emitEvent(uint32_t eventId, const DrawContext *renderingContext)
Emits the given render event to all registered extensions.
void endFrame(uint32_t syncInterval=0, Cogs::PresentFlags presentFlags=PresentFlags::None) override
Signals the end of the current frame.
void unregisterExtension(IRendererExtension *extension) override
Unregister an extension with the renderer.
void cleanup() override
Cleanup the renderer, releasing all resources held.
float getClearDepth() override
Get adjusted clear depth used to render.
glm::mat4 getProjectionMatrix(const glm::mat4 projectionMatrix) override
Get an adjusted projection matrix used to render.
void render() override
Kick off the actual rendering, allowing the renderer to produce its output.
void beginFrame() override
Signals the beginning of a new frame.
Represents a graphics device used to manage graphics resources and issue drawing commands.
virtual ITextures * getTextures()=0
Get a pointer to the texture management interface.
virtual ICapabilities * getCapabilities()=0
Get a pointer to the capability management interface used to query the graphics device capability fla...
virtual IContext * getImmediateContext()=0
Get a pointer to the immediate context used to issue commands to the graphics device.
virtual void beginFrame()=0
Signal the beginning of a new frame to the graphics device.
virtual IBuffers * getBuffers()=0
Get a pointer to the buffer management interface.
virtual std::string getIdentifier() const
Get the graphics device identifier.
virtual GraphicsDeviceType getType() const
Get the type of the graphics device.
virtual void endFrame(uint32_t syncInterval=0, PresentFlags presentFlags=PresentFlags::None)=0
Signal the end of a frame to the graphics device.
virtual IRenderTargets * getRenderTargets()=0
Get a pointer to the render target management interface.
Log implementation class.
Provides a weakly referenced view over the contents of a string.
size_t hashLowercase(size_t hashValue=Cogs::hash()) const noexcept
Get the hash code of the string converted to lowercase.
constexpr size_t hash() const noexcept
Get the hash code of the string.
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
@ Box
Bounding-box rendering over regular rendering.
@ Default
Default, depth test & write enabled.
constexpr Log getLogger(const char(&name)[LEN]) noexcept
Contains all Cogs related functionality.
@ Direct3D12
Graphics device using the Direct3D 12 API.
@ OpenGLES30
Graphics device using the OpenGLES 3.0 API.
@ Vulkan
Graphics device using the Vulkan API.
@ Direct3D11
Graphics device using the Direct3D 11 API.
@ OpenGL20
Graphics device using OpenGL, supporting at least OpenGL 2.0.
@ Null
Null device that implements no rendering functionality.
@ WebGPU
Graphics device using the WebGPU API Backend.
constexpr size_t hash() noexcept
Simple getter function that returns the initial value for fnv1a hashing.
PresentFlags
Flags controlling presentation.
@ Read
The buffer can be mapped and read from by the CPU after creation.
@ None
The buffer will not be bound to the graphics pipeline. Suitable for staging resources.
Render settings variables.
@ RenderGui
Rendering GUI elements.
@ PostRender
Rendering has finished for a given rendering context.
@ PreRender
Pre rendering happening for a given rendering context.
Screenshot render settings.
Runtime control variable.
Encapsulates state for depth buffer usage and stencil buffer usage in a state object.
DepthFunction depthFunction
The depth function to use for depth testing.
static DepthStencilState DefaultState()
Constructs a depth stencil state object initialized with the default values.
EEffectFlags
Effect source flags.
@ LogShaderSource
Log the contents of the shader on error.
@ LogShaderInfo
Log detailed info about shaders.
Contains device capabilities.
bool DepthNegativeOneToOne
If true, min z depth=-1 otherwise it is min z depth = 0 (max z depth = 1).
int numSamples
Number of samples to use for back buffer MSAA.
static const Handle_t NoHandle
Represents a handle to nothing.
virtual const GraphicsDeviceCapabilities & getDeviceCapabilities() const
Gets the device capabilities in a structure.
virtual void setRenderTarget(const RenderTargetHandle handle, const DepthStencilHandle depthStencilHandle)=0
Sets the current render target and an associated depth stencil target.
Provides RAII style mapping of a buffer resource.
Encapsulates state for texture sampling in a state object.
AddressMode addressModeS
Specifies the addressing mode along the S axis in texture coordinate space.
@ Border
Texture color is set to the border color when outside [0, 1] range.
@ ComparisonMinMagMipLinear
Comparison filter for depth sample comparisons using linear interpolation sampling.
@ RenderTarget
The texture can be used as a render target and drawn into.