Merge branch 'master' into vulkan

This commit is contained in:
Triang3l
2021-06-08 12:15:34 +03:00
607 changed files with 452347 additions and 127070 deletions

View File

@@ -19,6 +19,8 @@
#include <d3dcompiler.h>
#include <dxgi1_4.h>
#include <dxgidebug.h>
// For Microsoft::WRL::ComPtr.
#include <wrl/client.h>
#include "third_party/DirectXShaderCompiler/include/dxc/dxcapi.h"
#include "third_party/DirectXShaderCompiler/projects/dxilconv/include/DxbcConverter.h"

View File

@@ -0,0 +1,54 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2021 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include "xenia/ui/d3d12/d3d12_cpu_descriptor_pool.h"
#include <cstdint>
#include <memory>
#include "xenia/base/logging.h"
namespace xe {
namespace ui {
namespace d3d12 {
D3D12CpuDescriptorPool::Descriptor
D3D12CpuDescriptorPool::AllocateDescriptor() {
if (!freed_indices_.empty()) {
size_t index = freed_indices_.back();
freed_indices_.pop_back();
return Descriptor(shared_from_this(), index);
}
uint32_t heap_size = uint32_t(1) << heap_size_log2_;
if (!heaps_.empty() && last_heap_allocated_ < heap_size) {
return Descriptor(shared_from_this(),
(heaps_.size() - 1) * heap_size + last_heap_allocated_++);
}
D3D12_DESCRIPTOR_HEAP_DESC descriptor_heap_desc;
descriptor_heap_desc.Type = type_;
descriptor_heap_desc.NumDescriptors = heap_size;
descriptor_heap_desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
descriptor_heap_desc.NodeMask = 0;
ID3D12DescriptorHeap* descriptor_heap;
if (FAILED(provider_.GetDevice()->CreateDescriptorHeap(
&descriptor_heap_desc, IID_PPV_ARGS(&descriptor_heap)))) {
XELOGE(
"Failed to create a non-shader-visible descriptor heap for {} "
"descriptors",
heap_size);
return Descriptor();
}
heaps_.push_back(descriptor_heap);
last_heap_allocated_ = 1;
return Descriptor(shared_from_this(), (heaps_.size() - 1) * heap_size);
}
} // namespace d3d12
} // namespace ui
} // namespace xe

View File

@@ -0,0 +1,119 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2021 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#ifndef XENIA_UI_D3D12_D3D12_CPU_DESCRIPTOR_POOL_H_
#define XENIA_UI_D3D12_D3D12_CPU_DESCRIPTOR_POOL_H_
#include <cstdint>
#include <memory>
#include <utility>
#include <vector>
#include "xenia/base/assert.h"
#include "xenia/ui/d3d12/d3d12_provider.h"
namespace xe {
namespace ui {
namespace d3d12 {
// Single-descriptor pool with reference counting and unique ownership of
// allocations, safe to use in environments where the order of releasing of the
// descriptor heap and of allocated descriptors is undefined.
class D3D12CpuDescriptorPool
: public std::enable_shared_from_this<D3D12CpuDescriptorPool> {
public:
class Descriptor {
public:
Descriptor() = default;
// shared_ptr to ensure correct release order with between render targets
// and descriptor pools.
Descriptor(std::shared_ptr<D3D12CpuDescriptorPool> pool, size_t index)
: pool_(pool), index_(index) {}
// Owns a descriptor in the pool exclusively.
Descriptor(const Descriptor& descriptor) = delete;
Descriptor& operator=(const Descriptor& descriptor) = delete;
Descriptor(Descriptor&& descriptor) {
pool_ = std::move(descriptor.pool_);
index_ = descriptor.index_;
}
Descriptor& operator=(Descriptor&& descriptor) {
if (IsValid() && pool_ == descriptor.pool_ &&
index_ == descriptor.index_) {
// If moving to self, don't free.
return *this;
}
Free();
pool_ = std::move(descriptor.pool_);
index_ = descriptor.index_;
return *this;
}
~Descriptor() { Free(); }
void Free() {
if (!pool_) {
return;
}
pool_->FreeDescriptor(index_);
pool_.reset();
}
bool IsValid() const { return pool_.get() != nullptr; }
operator bool() const { return IsValid(); }
D3D12_CPU_DESCRIPTOR_HANDLE GetHandle() const {
assert_true(IsValid());
return pool_->GetHandle(index_);
}
private:
std::shared_ptr<D3D12CpuDescriptorPool> pool_;
size_t index_ = 0;
};
D3D12CpuDescriptorPool(const ui::d3d12::D3D12Provider& provider,
D3D12_DESCRIPTOR_HEAP_TYPE type,
uint32_t heap_size_log2)
: provider_(provider), type_(type), heap_size_log2_(heap_size_log2) {
assert_true(heap_size_log2 <= 31);
}
D3D12CpuDescriptorPool(const D3D12CpuDescriptorPool& pool) = delete;
D3D12CpuDescriptorPool& operator=(const D3D12CpuDescriptorPool& pool) =
delete;
// No point in moving, created only via make_shared.
D3D12CpuDescriptorPool(D3D12CpuDescriptorPool&& pool) = delete;
D3D12CpuDescriptorPool& operator=(D3D12CpuDescriptorPool&& pool) = delete;
~D3D12CpuDescriptorPool() {
for (ID3D12DescriptorHeap* heap : heaps_) {
heap->Release();
}
}
Descriptor AllocateDescriptor();
private:
void FreeDescriptor(size_t index) { freed_indices_.push_back(index); }
D3D12_CPU_DESCRIPTOR_HANDLE GetHandle(size_t index) const {
D3D12_CPU_DESCRIPTOR_HANDLE heap_start =
heaps_[index >> heap_size_log2_]->GetCPUDescriptorHandleForHeapStart();
uint32_t heap_local_index =
uint32_t(index & ((uint32_t(1) << heap_size_log2_) - 1));
return provider_.OffsetDescriptor(type_, heap_start, heap_local_index);
}
const ui::d3d12::D3D12Provider& provider_;
D3D12_DESCRIPTOR_HEAP_TYPE type_;
uint32_t heap_size_log2_;
std::vector<ID3D12DescriptorHeap*> heaps_;
std::vector<size_t> freed_indices_;
uint32_t last_heap_allocated_ = 0;
};
} // namespace d3d12
} // namespace ui
} // namespace xe
#endif // XENIA_UI_D3D12_D3D12_CPU_DESCRIPTOR_POOL_H_

View File

@@ -24,9 +24,11 @@ namespace xe {
namespace ui {
namespace d3d12 {
// Generated with `xb gendxbc`.
// Generated with `xb buildshaders`.
namespace shaders {
#include "xenia/ui/shaders/bytecode/d3d12_5_1/immediate_ps.h"
#include "xenia/ui/shaders/bytecode/d3d12_5_1/immediate_vs.h"
} // namespace shaders
D3D12ImmediateDrawer::D3D12ImmediateTexture::D3D12ImmediateTexture(
uint32_t width, uint32_t height, ID3D12Resource* resource,
@@ -121,10 +123,10 @@ bool D3D12ImmediateDrawer::Initialize() {
// Create the pipelines.
D3D12_GRAPHICS_PIPELINE_STATE_DESC pipeline_desc = {};
pipeline_desc.pRootSignature = root_signature_;
pipeline_desc.VS.pShaderBytecode = immediate_vs;
pipeline_desc.VS.BytecodeLength = sizeof(immediate_vs);
pipeline_desc.PS.pShaderBytecode = immediate_ps;
pipeline_desc.PS.BytecodeLength = sizeof(immediate_ps);
pipeline_desc.VS.pShaderBytecode = shaders::immediate_vs;
pipeline_desc.VS.BytecodeLength = sizeof(shaders::immediate_vs);
pipeline_desc.PS.pShaderBytecode = shaders::immediate_ps;
pipeline_desc.PS.BytecodeLength = sizeof(shaders::immediate_ps);
D3D12_RENDER_TARGET_BLEND_DESC& pipeline_blend_desc =
pipeline_desc.BlendState.RenderTarget[0];
pipeline_blend_desc.BlendEnable = TRUE;

View File

@@ -21,6 +21,8 @@ DEFINE_bool(d3d12_debug, false, "Enable Direct3D 12 and DXGI debug layer.",
"D3D12");
DEFINE_bool(d3d12_break_on_error, false,
"Break on Direct3D 12 validation errors.", "D3D12");
DEFINE_bool(d3d12_break_on_warning, false,
"Break on Direct3D 12 validation warnings.", "D3D12");
DEFINE_int32(d3d12_adapter, -1,
"Index of the DXGI adapter to use. "
"-1 for any physical adapter, -2 for WARP software rendering.",
@@ -52,7 +54,7 @@ std::unique_ptr<D3D12Provider> D3D12Provider::Create(Window* main_window) {
"Unable to initialize Direct3D 12 graphics subsystem.\n"
"\n"
"Ensure that you have the latest drivers for your GPU and it supports "
"Direct3D 12 feature level 11_0.\n"
"Direct3D 12 with the feature level of at least 11_0.\n"
"\n"
"See https://xenia.jp/faq/ for more information and a list of "
"supported GPUs.");
@@ -152,12 +154,12 @@ bool D3D12Provider::Initialize() {
pfn_d3d_disassemble_ =
pD3DDisassemble(GetProcAddress(library_d3dcompiler_, "D3DDisassemble"));
if (pfn_d3d_disassemble_ == nullptr) {
XELOGW(
XELOGD(
"Failed to get D3DDisassemble from D3DCompiler_47.dll, DXBC "
"disassembly for debugging will be unavailable");
}
} else {
XELOGW(
XELOGD(
"Failed to load D3DCompiler_47.dll, DXBC disassembly for debugging "
"will be unavailable");
}
@@ -169,12 +171,12 @@ bool D3D12Provider::Initialize() {
pfn_dxilconv_dxc_create_instance_ = DxcCreateInstanceProc(
GetProcAddress(library_dxilconv_, "DxcCreateInstance"));
if (pfn_dxilconv_dxc_create_instance_ == nullptr) {
XELOGW(
XELOGD(
"Failed to get DxcCreateInstance from dxilconv.dll, converted DXIL "
"disassembly for debugging will be unavailable");
}
} else {
XELOGW(
XELOGD(
"Failed to load dxilconv.dll, converted DXIL disassembly for debugging "
"will be unavailable - DXIL may be unsupported by your OS version");
}
@@ -186,12 +188,12 @@ bool D3D12Provider::Initialize() {
pfn_dxcompiler_dxc_create_instance_ = DxcCreateInstanceProc(
GetProcAddress(library_dxcompiler_, "DxcCreateInstance"));
if (pfn_dxcompiler_dxc_create_instance_ == nullptr) {
XELOGW(
XELOGD(
"Failed to get DxcCreateInstance from dxcompiler.dll, converted DXIL "
"disassembly for debugging will be unavailable");
}
} else {
XELOGW(
XELOGD(
"Failed to load dxcompiler.dll, converted DXIL disassembly for "
"debugging will be unavailable - if needed, download the DirectX "
"Shader Compiler from "
@@ -200,14 +202,20 @@ bool D3D12Provider::Initialize() {
}
// Configure the DXGI debug info queue.
if (cvars::d3d12_break_on_error) {
if (cvars::d3d12_break_on_error || cvars::d3d12_break_on_warning) {
IDXGIInfoQueue* dxgi_info_queue;
if (SUCCEEDED(pfn_dxgi_get_debug_interface1_(
0, IID_PPV_ARGS(&dxgi_info_queue)))) {
dxgi_info_queue->SetBreakOnSeverity(
DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, TRUE);
dxgi_info_queue->SetBreakOnSeverity(
DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, TRUE);
if (cvars::d3d12_break_on_error) {
dxgi_info_queue->SetBreakOnSeverity(
DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, TRUE);
dxgi_info_queue->SetBreakOnSeverity(
DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, TRUE);
}
if (cvars::d3d12_break_on_warning) {
dxgi_info_queue->SetBreakOnSeverity(
DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_WARNING, TRUE);
}
dxgi_info_queue->Release();
}
}
@@ -262,7 +270,9 @@ bool D3D12Provider::Initialize() {
++adapter_index;
}
if (adapter == nullptr) {
XELOGE("Failed to get an adapter supporting Direct3D feature level 11_0");
XELOGE(
"Failed to get an adapter supporting Direct3D 12 with the feature "
"level of at least 11_0");
dxgi_factory->Release();
return false;
}
@@ -273,7 +283,7 @@ bool D3D12Provider::Initialize() {
dxgi_factory->Release();
return false;
}
adapter_vendor_id_ = adapter_desc.VendorId;
adapter_vendor_id_ = GpuVendorID(adapter_desc.VendorId);
int adapter_name_mb_size = WideCharToMultiByte(
CP_UTF8, 0, adapter_desc.Description, -1, nullptr, 0, nullptr, nullptr);
if (adapter_name_mb_size != 0) {
@@ -282,7 +292,7 @@ bool D3D12Provider::Initialize() {
if (WideCharToMultiByte(CP_UTF8, 0, adapter_desc.Description, -1,
adapter_name_mb, adapter_name_mb_size, nullptr,
nullptr) != 0) {
XELOGD3D("DXGI adapter: {} (vendor {:04X}, device {:04X})",
XELOGD3D("DXGI adapter: {} (vendor 0x{:04X}, device 0x{:04X})",
adapter_name_mb, adapter_desc.VendorId, adapter_desc.DeviceId);
}
}
@@ -307,9 +317,20 @@ bool D3D12Provider::Initialize() {
D3D12_MESSAGE_ID d3d12_info_queue_denied_messages[] = {
// Xbox 360 vertex fetch is explicit in shaders.
D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT,
// Bug in the debug layer (fixed in some version of Windows) - gaps in
// render target bindings must be represented with a fully typed RTV
// descriptor and DXGI_FORMAT_UNKNOWN in the pipeline state, but older
// debug layer versions give a format mismatch error in this case.
D3D12_MESSAGE_ID_RENDER_TARGET_FORMAT_MISMATCH_PIPELINE_STATE,
// Render targets and shader exports don't have to match on the Xbox
// 360.
D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RENDERTARGETVIEW_NOT_SET,
// Arbitrary scissor can be specified by the guest, also it can be
// explicitly used to disable drawing.
D3D12_MESSAGE_ID_DRAW_EMPTY_SCISSOR_RECTANGLE,
// Arbitrary clear values can be specified by the guest.
D3D12_MESSAGE_ID_CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE,
D3D12_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_MISMATCHINGCLEARVALUE,
};
D3D12_INFO_QUEUE_FILTER d3d12_info_queue_filter = {};
d3d12_info_queue_filter.DenyList.NumSeverities =
@@ -325,6 +346,10 @@ bool D3D12Provider::Initialize() {
TRUE);
d3d12_info_queue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_ERROR, TRUE);
}
if (cvars::d3d12_break_on_warning) {
d3d12_info_queue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_WARNING,
TRUE);
}
d3d12_info_queue->Release();
}
@@ -334,7 +359,7 @@ bool D3D12Provider::Initialize() {
if (cvars::d3d12_queue_priority >= 2) {
queue_desc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME;
if (!EnableIncreaseBasePriorityPrivilege()) {
XELOGD3D(
XELOGW(
"Failed to enable SeIncreaseBasePriorityPrivilege for global "
"realtime Direct3D 12 command queue priority, falling back to high "
"priority, try launching Xenia as administrator");
@@ -352,7 +377,7 @@ bool D3D12Provider::Initialize() {
IID_PPV_ARGS(&direct_queue)))) {
bool queue_created = false;
if (queue_desc.Priority == D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME) {
XELOGD3D(
XELOGW(
"Failed to create a Direct3D 12 direct command queue with global "
"realtime priority, falling back to high priority, try launching "
"Xenia as administrator");
@@ -373,14 +398,10 @@ bool D3D12Provider::Initialize() {
direct_queue_ = direct_queue;
// Get descriptor sizes for each type.
descriptor_size_view_ = device->GetDescriptorHandleIncrementSize(
D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
descriptor_size_sampler_ = device->GetDescriptorHandleIncrementSize(
D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
descriptor_size_rtv_ =
device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
descriptor_size_dsv_ =
device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV);
for (uint32_t i = 0; i < D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES; ++i) {
descriptor_sizes_[i] =
device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE(i));
}
// Check if optional features are supported.
// D3D12_HEAP_FLAG_CREATE_NOT_ZEROED requires Windows 10 2004 (indicated by
@@ -391,13 +412,16 @@ bool D3D12Provider::Initialize() {
&options7, sizeof(options7)))) {
heap_flag_create_not_zeroed_ = D3D12_HEAP_FLAG_CREATE_NOT_ZEROED;
}
ps_specified_stencil_reference_supported_ = false;
rasterizer_ordered_views_supported_ = false;
resource_binding_tier_ = D3D12_RESOURCE_BINDING_TIER_1;
tiled_resources_tier_ = D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED;
D3D12_FEATURE_DATA_D3D12_OPTIONS options;
if (SUCCEEDED(device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS,
&options, sizeof(options)))) {
rasterizer_ordered_views_supported_ = options.ROVsSupported ? true : false;
ps_specified_stencil_reference_supported_ =
bool(options.PSSpecifiedStencilRefSupported);
rasterizer_ordered_views_supported_ = bool(options.ROVsSupported);
resource_binding_tier_ = options.ResourceBindingTier;
tiled_resources_tier_ = options.TiledResourcesTier;
}
@@ -421,6 +445,7 @@ bool D3D12Provider::Initialize() {
"Direct3D 12 device and OS features:\n"
"* Max GPU virtual address bits per resource: {}\n"
"* Non-zeroed heap creation: {}\n"
"* Pixel-shader-specified stencil reference: {}\n"
"* Programmable sample positions: tier {}\n"
"* Rasterizer-ordered views: {}\n"
"* Resource binding: tier {}\n"
@@ -428,6 +453,7 @@ bool D3D12Provider::Initialize() {
virtual_address_bits_per_resource_,
(heap_flag_create_not_zeroed_ & D3D12_HEAP_FLAG_CREATE_NOT_ZEROED) ? "yes"
: "no",
ps_specified_stencil_reference_supported_ ? "yes" : "no",
uint32_t(programmable_sample_positions_tier_),
rasterizer_ordered_views_supported_ ? "yes" : "no",
uint32_t(resource_binding_tier_), uint32_t(tiled_resources_tier_));

View File

@@ -41,33 +41,50 @@ class D3D12Provider : public GraphicsProvider {
ID3D12Device* GetDevice() const { return device_; }
ID3D12CommandQueue* GetDirectQueue() const { return direct_queue_; }
uint32_t GetViewDescriptorSize() const { return descriptor_size_view_; }
uint32_t GetSamplerDescriptorSize() const { return descriptor_size_sampler_; }
uint32_t GetRTVDescriptorSize() const { return descriptor_size_rtv_; }
uint32_t GetDSVDescriptorSize() const { return descriptor_size_dsv_; }
uint32_t GetDescriptorSize(D3D12_DESCRIPTOR_HEAP_TYPE type) const {
return descriptor_sizes_[type];
}
uint32_t GetViewDescriptorSize() const {
return GetDescriptorSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
}
uint32_t GetSamplerDescriptorSize() const {
return GetDescriptorSize(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
}
uint32_t GetRTVDescriptorSize() const {
return GetDescriptorSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
}
uint32_t GetDSVDescriptorSize() const {
return GetDescriptorSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV);
}
template <typename T>
T OffsetDescriptor(D3D12_DESCRIPTOR_HEAP_TYPE type, T start,
uint32_t index) const {
start.ptr += index * GetDescriptorSize(type);
return start;
}
template <typename T>
T OffsetViewDescriptor(T start, uint32_t index) const {
start.ptr += index * descriptor_size_view_;
start.ptr += index * GetViewDescriptorSize();
return start;
}
template <typename T>
T OffsetSamplerDescriptor(T start, uint32_t index) const {
start.ptr += index * descriptor_size_sampler_;
start.ptr += index * GetSamplerDescriptorSize();
return start;
}
template <typename T>
T OffsetRTVDescriptor(T start, uint32_t index) const {
start.ptr += index * descriptor_size_rtv_;
start.ptr += index * GetRTVDescriptorSize();
return start;
}
template <typename T>
T OffsetDSVDescriptor(T start, uint32_t index) const {
start.ptr += index * descriptor_size_dsv_;
start.ptr += index * GetDSVDescriptorSize();
return start;
}
// Adapter info.
uint32_t GetAdapterVendorID() const { return adapter_vendor_id_; }
GpuVendorID GetAdapterVendorID() const { return adapter_vendor_id_; }
// Device features.
D3D12_HEAP_FLAGS GetHeapFlagCreateNotZeroed() const {
@@ -77,6 +94,9 @@ class D3D12Provider : public GraphicsProvider {
GetProgrammableSamplePositionsTier() const {
return programmable_sample_positions_tier_;
}
bool IsPSSpecifiedStencilReferenceSupported() const {
return ps_specified_stencil_reference_supported_;
}
bool AreRasterizerOrderedViewsSupported() const {
return rasterizer_ordered_views_supported_;
}
@@ -155,15 +175,13 @@ class D3D12Provider : public GraphicsProvider {
ID3D12Device* device_ = nullptr;
ID3D12CommandQueue* direct_queue_ = nullptr;
uint32_t descriptor_size_view_;
uint32_t descriptor_size_sampler_;
uint32_t descriptor_size_rtv_;
uint32_t descriptor_size_dsv_;
uint32_t descriptor_sizes_[D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES];
uint32_t adapter_vendor_id_;
GpuVendorID adapter_vendor_id_;
D3D12_HEAP_FLAGS heap_flag_create_not_zeroed_;
D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER programmable_sample_positions_tier_;
bool ps_specified_stencil_reference_supported_;
bool rasterizer_ordered_views_supported_;
D3D12_RESOURCE_BINDING_TIER resource_binding_tier_;
D3D12_TILED_RESOURCES_TIER tiled_resources_tier_;

View File

@@ -127,6 +127,189 @@ void CreateBufferTypedUAV(ID3D12Device* device,
device->CreateUnorderedAccessView(buffer, nullptr, &desc, handle);
}
void GetFormatCopyInfo(DXGI_FORMAT format, uint32_t plane,
DXGI_FORMAT& copy_format_out, uint32_t& block_width_out,
uint32_t& block_height_out,
uint32_t& bytes_per_block_out) {
DXGI_FORMAT copy_format = format;
uint32_t block_width = 1;
uint32_t block_height = 1;
bool divide_by_block_size = false;
uint32_t bytes_per_block = 1;
switch (format) {
case DXGI_FORMAT_R32G32B32A32_TYPELESS:
case DXGI_FORMAT_R32G32B32A32_FLOAT:
case DXGI_FORMAT_R32G32B32A32_UINT:
case DXGI_FORMAT_R32G32B32A32_SINT:
bytes_per_block = 16;
break;
case DXGI_FORMAT_R32G32B32_TYPELESS:
case DXGI_FORMAT_R32G32B32_FLOAT:
case DXGI_FORMAT_R32G32B32_UINT:
case DXGI_FORMAT_R32G32B32_SINT:
bytes_per_block = 12;
break;
case DXGI_FORMAT_R16G16B16A16_TYPELESS:
case DXGI_FORMAT_R16G16B16A16_FLOAT:
case DXGI_FORMAT_R16G16B16A16_UNORM:
case DXGI_FORMAT_R16G16B16A16_UINT:
case DXGI_FORMAT_R16G16B16A16_SNORM:
case DXGI_FORMAT_R16G16B16A16_SINT:
case DXGI_FORMAT_R32G32_TYPELESS:
case DXGI_FORMAT_R32G32_FLOAT:
case DXGI_FORMAT_R32G32_UINT:
case DXGI_FORMAT_R32G32_SINT:
case DXGI_FORMAT_Y416:
bytes_per_block = 8;
break;
case DXGI_FORMAT_R32G8X24_TYPELESS:
case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
case DXGI_FORMAT_R24G8_TYPELESS:
case DXGI_FORMAT_D24_UNORM_S8_UINT:
case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
if (plane) {
copy_format = DXGI_FORMAT_R8_TYPELESS;
bytes_per_block = 1;
} else {
copy_format = DXGI_FORMAT_R32_TYPELESS;
bytes_per_block = 4;
}
break;
case DXGI_FORMAT_R10G10B10A2_TYPELESS:
case DXGI_FORMAT_R10G10B10A2_UNORM:
case DXGI_FORMAT_R10G10B10A2_UINT:
case DXGI_FORMAT_R11G11B10_FLOAT:
case DXGI_FORMAT_R8G8B8A8_TYPELESS:
case DXGI_FORMAT_R8G8B8A8_UNORM:
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
case DXGI_FORMAT_R8G8B8A8_UINT:
case DXGI_FORMAT_R8G8B8A8_SNORM:
case DXGI_FORMAT_R8G8B8A8_SINT:
case DXGI_FORMAT_R16G16_TYPELESS:
case DXGI_FORMAT_R16G16_FLOAT:
case DXGI_FORMAT_R16G16_UNORM:
case DXGI_FORMAT_R16G16_UINT:
case DXGI_FORMAT_R16G16_SNORM:
case DXGI_FORMAT_R16G16_SINT:
case DXGI_FORMAT_R32_TYPELESS:
case DXGI_FORMAT_D32_FLOAT:
case DXGI_FORMAT_R32_FLOAT:
case DXGI_FORMAT_R32_UINT:
case DXGI_FORMAT_R32_SINT:
case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
case DXGI_FORMAT_B8G8R8A8_UNORM:
case DXGI_FORMAT_B8G8R8X8_UNORM:
case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
case DXGI_FORMAT_B8G8R8A8_TYPELESS:
case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
case DXGI_FORMAT_B8G8R8X8_TYPELESS:
case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
case DXGI_FORMAT_AYUV:
case DXGI_FORMAT_Y410:
bytes_per_block = 4;
break;
case DXGI_FORMAT_R8G8_TYPELESS:
case DXGI_FORMAT_R8G8_UNORM:
case DXGI_FORMAT_R8G8_UINT:
case DXGI_FORMAT_R8G8_SNORM:
case DXGI_FORMAT_R8G8_SINT:
case DXGI_FORMAT_R16_TYPELESS:
case DXGI_FORMAT_R16_FLOAT:
case DXGI_FORMAT_D16_UNORM:
case DXGI_FORMAT_R16_UNORM:
case DXGI_FORMAT_R16_UINT:
case DXGI_FORMAT_R16_SNORM:
case DXGI_FORMAT_R16_SINT:
case DXGI_FORMAT_B5G6R5_UNORM:
case DXGI_FORMAT_B5G5R5A1_UNORM:
case DXGI_FORMAT_A8P8:
case DXGI_FORMAT_B4G4R4A4_UNORM:
bytes_per_block = 2;
break;
case DXGI_FORMAT_R8_TYPELESS:
case DXGI_FORMAT_R8_UNORM:
case DXGI_FORMAT_R8_UINT:
case DXGI_FORMAT_R8_SNORM:
case DXGI_FORMAT_R8_SINT:
case DXGI_FORMAT_A8_UNORM:
case DXGI_FORMAT_AI44:
case DXGI_FORMAT_IA44:
case DXGI_FORMAT_P8:
bytes_per_block = 1;
break;
// R1_UNORM is not supported in Direct3D 12.
case DXGI_FORMAT_R8G8_B8G8_UNORM:
case DXGI_FORMAT_G8R8_G8B8_UNORM:
case DXGI_FORMAT_Y210:
case DXGI_FORMAT_Y216:
// Failed to GetCopyableFootprints for Y210 and Y216 on Intel UHD Graphics
// 630.
block_width = 2;
bytes_per_block = 4;
break;
case DXGI_FORMAT_BC1_TYPELESS:
case DXGI_FORMAT_BC1_UNORM:
case DXGI_FORMAT_BC1_UNORM_SRGB:
case DXGI_FORMAT_BC4_TYPELESS:
case DXGI_FORMAT_BC4_UNORM:
case DXGI_FORMAT_BC4_SNORM:
block_width = 4;
block_height = 4;
bytes_per_block = 8;
break;
case DXGI_FORMAT_BC2_TYPELESS:
case DXGI_FORMAT_BC2_UNORM:
case DXGI_FORMAT_BC2_UNORM_SRGB:
case DXGI_FORMAT_BC3_TYPELESS:
case DXGI_FORMAT_BC3_UNORM:
case DXGI_FORMAT_BC3_UNORM_SRGB:
case DXGI_FORMAT_BC5_TYPELESS:
case DXGI_FORMAT_BC5_UNORM:
case DXGI_FORMAT_BC5_SNORM:
case DXGI_FORMAT_BC6H_TYPELESS:
case DXGI_FORMAT_BC6H_UF16:
case DXGI_FORMAT_BC6H_SF16:
case DXGI_FORMAT_BC7_TYPELESS:
case DXGI_FORMAT_BC7_UNORM:
case DXGI_FORMAT_BC7_UNORM_SRGB:
block_width = 4;
block_height = 4;
bytes_per_block = 16;
break;
// NV12, P010, P016, 420_OPAQUE and NV11 are not handled here because of
// differences that need to be handled externally.
// For future reference, if needed:
// - Width and height of planes 1 and 2 are divided by the block size in the
// footprint itself (unlike in block-compressed textures, where the
// dimensions are merely aligned).
// - Rows are aligned to the placement alignment (512) rather than the pitch
// alignment (256) for some reason (to match the Direct3D 11 layout
// without explicit planes, requiring the plane data to be laid out in
// some specific way defined on MSDN within each row, though Direct3D 12
// possibly doesn't have such requirement, but investigation needed.
// - NV12: R8_TYPELESS plane 0, R8G8_TYPELESS plane 1.
// - P010, P016: R16_TYPELESS plane 0, R16G16_TYPELESS plane 1. Failed to
// GetCopyableFootprints for P016 on Nvidia GeForce GTX 1070.
// - 420_OPAQUE: Single R8_TYPELESS plane.
// - NV11: Failed to GetCopyableFootprints on both Nvidia GeForce GTX 1070
// and Intel UHD Graphics 630.
case DXGI_FORMAT_YUY2:
block_width = 2;
bytes_per_block = 2;
break;
// P208, V208 and V408 are not supported in Direct3D 12.
default:
assert_unhandled_case(format);
}
copy_format_out = copy_format;
block_width_out = block_width;
block_height_out = block_height;
bytes_per_block_out = bytes_per_block;
}
} // namespace util
} // namespace d3d12
} // namespace ui

View File

@@ -19,7 +19,7 @@ namespace ui {
namespace d3d12 {
namespace util {
using DescriptorCPUGPUHandlePair =
using DescriptorCpuGpuHandlePair =
std::pair<D3D12_CPU_DESCRIPTOR_HANDLE, D3D12_GPU_DESCRIPTOR_HANDLE>;
extern const D3D12_HEAP_PROPERTIES kHeapPropertiesDefault;
@@ -93,6 +93,14 @@ void CreateBufferTypedUAV(ID3D12Device* device,
ID3D12Resource* buffer, DXGI_FORMAT format,
uint32_t num_elements, uint64_t first_element = 0);
// For cases where GetCopyableFootprints isn't usable (such as when the size
// needs to be overaligned beyond the maximum texture size), providing data
// needed to compute the copyable footprints manually.
void GetFormatCopyInfo(DXGI_FORMAT format, uint32_t plane,
DXGI_FORMAT& copy_format_out, uint32_t& block_width_out,
uint32_t& block_height_out,
uint32_t& bytes_per_block_out);
} // namespace util
} // namespace d3d12
} // namespace ui

View File

@@ -23,6 +23,17 @@ class Window;
// according to the rules of the backing graphics API.
class GraphicsProvider {
public:
enum class GpuVendorID {
kAMD = 0x1002,
kApple = 0x106B,
kArm = 0x13B5,
kImagination = 0x1010,
kIntel = 0x8086,
kMicrosoft = 0x1414,
kNvidia = 0x10DE,
kQualcomm = 0x5143,
};
virtual ~GraphicsProvider() = default;
// The 'main' window of an application, used to query provider information.

View File

@@ -0,0 +1 @@
DisableFormat: true

View File

@@ -1,68 +1,173 @@
// generated from `xb buildhlsl`
// source: immediate.ps.hlsl
const uint8_t immediate_ps[] = {
0x44, 0x58, 0x42, 0x43, 0xDA, 0xC8, 0x6C, 0xC4, 0x3A, 0x1C, 0x46, 0xE2,
0x62, 0x89, 0x59, 0xC7, 0xDA, 0x3A, 0x9B, 0xAC, 0x01, 0x00, 0x00, 0x00,
0x00, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
0x1C, 0x01, 0x00, 0x00, 0x68, 0x01, 0x00, 0x00, 0x9C, 0x01, 0x00, 0x00,
0x64, 0x02, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xE0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0xFF, 0xFF, 0x00, 0x05, 0x00, 0x00,
0xB6, 0x00, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, 0x3C, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x24, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x8C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x65, 0x5F, 0x69,
0x6D, 0x6D, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x5F, 0x73, 0x61, 0x6D,
0x70, 0x6C, 0x65, 0x72, 0x00, 0x78, 0x65, 0x5F, 0x69, 0x6D, 0x6D, 0x65,
0x64, 0x69, 0x61, 0x74, 0x65, 0x5F, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72,
0x65, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20,
0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61,
0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72,
0x20, 0x31, 0x30, 0x2E, 0x31, 0x00, 0xAB, 0xAB, 0x49, 0x53, 0x47, 0x4E,
0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,
0x38, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00,
0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F, 0x52, 0x44, 0x00, 0xAB, 0xAB, 0xAB,
0x4F, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0F, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x54, 0x61, 0x72, 0x67, 0x65,
0x74, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58, 0xC0, 0x00, 0x00, 0x00,
0x51, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x6A, 0x08, 0x00, 0x01,
0x5A, 0x00, 0x00, 0x06, 0x46, 0x6E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x58, 0x18, 0x00, 0x07, 0x46, 0x7E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xF2, 0x10, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xF2, 0x20, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00,
0x48, 0x00, 0x00, 0x0D, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7E, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xF2, 0x20, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x1E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01,
0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
// Resource Bindings:
//
// Name Type Format Dim ID HLSL Bind Count
// ------------------------------ ---------- ------- ----------- ------- -------------- ------
// xe_immediate_sampler sampler NA NA S0 s0 1
// xe_immediate_texture texture float4 2d T0 t0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD 0 xy 0 NONE float xy
// TEXCOORD 1 xyzw 1 NONE float xyzw
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target 0 xyzw 0 TARGET float xyzw
//
ps_5_1
dcl_globalFlags refactoringAllowed
dcl_sampler S0[0:0], mode_default, space=0
dcl_resource_texture2d (float,float,float,float) T0[0:0], space=0
dcl_input_ps linear v0.xy
dcl_input_ps linear v1.xyzw
dcl_output o0.xyzw
dcl_temps 1
sample_l r0.xyzw, v0.xyxx, T0[0].xyzw, S0[0], l(0.000000)
mul o0.xyzw, r0.xyzw, v1.xyzw
ret
// Approximately 3 instruction slots used
#endif
const BYTE immediate_ps[] =
{
68, 88, 66, 67, 204, 46,
131, 39, 62, 129, 239, 95,
188, 170, 211, 224, 226, 155,
212, 68, 1, 0, 0, 0,
0, 3, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0,
28, 1, 0, 0, 104, 1,
0, 0, 156, 1, 0, 0,
100, 2, 0, 0, 82, 68,
69, 70, 224, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 2, 0, 0, 0,
60, 0, 0, 0, 1, 5,
255, 255, 0, 5, 4, 0,
182, 0, 0, 0, 19, 19,
68, 37, 60, 0, 0, 0,
24, 0, 0, 0, 40, 0,
0, 0, 40, 0, 0, 0,
36, 0, 0, 0, 12, 0,
0, 0, 0, 0, 0, 0,
140, 0, 0, 0, 3, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 161, 0,
0, 0, 2, 0, 0, 0,
5, 0, 0, 0, 4, 0,
0, 0, 255, 255, 255, 255,
0, 0, 0, 0, 1, 0,
0, 0, 12, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 120, 101, 95, 105,
109, 109, 101, 100, 105, 97,
116, 101, 95, 115, 97, 109,
112, 108, 101, 114, 0, 120,
101, 95, 105, 109, 109, 101,
100, 105, 97, 116, 101, 95,
116, 101, 120, 116, 117, 114,
101, 0, 77, 105, 99, 114,
111, 115, 111, 102, 116, 32,
40, 82, 41, 32, 72, 76,
83, 76, 32, 83, 104, 97,
100, 101, 114, 32, 67, 111,
109, 112, 105, 108, 101, 114,
32, 49, 48, 46, 49, 0,
171, 171, 73, 83, 71, 78,
68, 0, 0, 0, 2, 0,
0, 0, 8, 0, 0, 0,
56, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 0, 0,
0, 0, 3, 3, 0, 0,
56, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 1, 0,
0, 0, 15, 15, 0, 0,
84, 69, 88, 67, 79, 79,
82, 68, 0, 171, 171, 171,
79, 83, 71, 78, 44, 0,
0, 0, 1, 0, 0, 0,
8, 0, 0, 0, 32, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 0, 0, 0, 0,
15, 0, 0, 0, 83, 86,
95, 84, 97, 114, 103, 101,
116, 0, 171, 171, 83, 72,
69, 88, 192, 0, 0, 0,
81, 0, 0, 0, 48, 0,
0, 0, 106, 8, 0, 1,
90, 0, 0, 6, 70, 110,
48, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
88, 24, 0, 7, 70, 126,
48, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 85, 85, 0, 0,
0, 0, 0, 0, 98, 16,
0, 3, 50, 16, 16, 0,
0, 0, 0, 0, 98, 16,
0, 3, 242, 16, 16, 0,
1, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
0, 0, 0, 0, 104, 0,
0, 2, 1, 0, 0, 0,
72, 0, 0, 13, 242, 0,
16, 0, 0, 0, 0, 0,
70, 16, 16, 0, 0, 0,
0, 0, 70, 126, 32, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 96, 32, 0,
0, 0, 0, 0, 0, 0,
0, 0, 1, 64, 0, 0,
0, 0, 0, 0, 56, 0,
0, 7, 242, 32, 16, 0,
0, 0, 0, 0, 70, 14,
16, 0, 0, 0, 0, 0,
70, 30, 16, 0, 1, 0,
0, 0, 62, 0, 0, 1,
83, 84, 65, 84, 148, 0,
0, 0, 3, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0
};

View File

@@ -1,39 +0,0 @@
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
// Resource Bindings:
//
// Name Type Format Dim ID HLSL Bind Count
// ------------------------------ ---------- ------- ----------- ------- -------------- ------
// xe_immediate_sampler sampler NA NA S0 s0 1
// xe_immediate_texture texture float4 2d T0 t0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD 0 xy 0 NONE float xy
// TEXCOORD 1 xyzw 1 NONE float xyzw
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target 0 xyzw 0 TARGET float xyzw
//
ps_5_1
dcl_globalFlags refactoringAllowed
dcl_sampler S0[0:0], mode_default, space=0
dcl_resource_texture2d (float,float,float,float) T0[0:0], space=0
dcl_input_ps linear v0.xy
dcl_input_ps linear v1.xyzw
dcl_output o0.xyzw
dcl_temps 1
sample_l r0.xyzw, v0.xyxx, T0[0].xyzw, S0[0], l(0.000000)
mul o0.xyzw, r0.xyzw, v1.xyzw
ret
// Approximately 3 instruction slots used

View File

@@ -1,91 +1,236 @@
// generated from `xb buildhlsl`
// source: immediate.vs.hlsl
const uint8_t immediate_vs[] = {
0x44, 0x58, 0x42, 0x43, 0x72, 0x14, 0x64, 0xA2, 0xD5, 0x3D, 0x4B, 0x94,
0xC5, 0xDD, 0x32, 0xBA, 0xB5, 0xC9, 0x90, 0x20, 0x01, 0x00, 0x00, 0x00,
0x10, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
0x64, 0x01, 0x00, 0x00, 0xD4, 0x01, 0x00, 0x00, 0x44, 0x02, 0x00, 0x00,
0x74, 0x03, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x28, 0x01, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0xFE, 0xFF, 0x00, 0x05, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, 0x3C, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x24, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x58, 0x65, 0x49, 0x6D, 0x6D, 0x65, 0x64, 0x69,
0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6F, 0x6E,
0x73, 0x74, 0x61, 0x6E, 0x74, 0x73, 0x00, 0xAB, 0x64, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0x78, 0x65, 0x5F, 0x76, 0x69, 0x65, 0x77, 0x70, 0x6F, 0x72, 0x74, 0x5F,
0x73, 0x69, 0x7A, 0x65, 0x5F, 0x69, 0x6E, 0x76, 0x00, 0x66, 0x6C, 0x6F,
0x61, 0x74, 0x32, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xD5, 0x00, 0x00, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53,
0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C,
0x65, 0x72, 0x20, 0x31, 0x30, 0x2E, 0x31, 0x00, 0x49, 0x53, 0x47, 0x4E,
0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,
0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,
0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00,
0x50, 0x4F, 0x53, 0x49, 0x54, 0x49, 0x4F, 0x4E, 0x00, 0x54, 0x45, 0x58,
0x43, 0x4F, 0x4F, 0x52, 0x44, 0x00, 0x43, 0x4F, 0x4C, 0x4F, 0x52, 0x00,
0x4F, 0x53, 0x47, 0x4E, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x0C, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x0F, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x0F, 0x00, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F, 0x52, 0x44,
0x00, 0x53, 0x56, 0x5F, 0x50, 0x6F, 0x73, 0x69, 0x74, 0x69, 0x6F, 0x6E,
0x00, 0xAB, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58, 0x28, 0x01, 0x00, 0x00,
0x51, 0x00, 0x01, 0x00, 0x4A, 0x00, 0x00, 0x00, 0x6A, 0x08, 0x00, 0x01,
0x59, 0x00, 0x00, 0x07, 0x46, 0x8E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0xF2, 0x10, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x32, 0x20, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xF2, 0x20, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xF2, 0x20, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02,
0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0F, 0x32, 0x20, 0x10, 0x00,
0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xC0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x00, 0x00, 0x80, 0xBF, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xF2, 0x20, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x46, 0x1E, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x36, 0x00, 0x00, 0x08, 0xC2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x36, 0x00, 0x00, 0x05,
0x32, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54,
0x94, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
// Buffer Definitions:
//
// cbuffer XeImmediateVertexConstants
// {
//
// float2 xe_viewport_size_inv; // Offset: 0 Size: 8
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim ID HLSL Bind Count
// ------------------------------ ---------- ------- ----------- ------- -------------- ------
// XeImmediateVertexConstants cbuffer NA NA CB0 cb0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION 0 xy 0 NONE float xy
// TEXCOORD 0 xy 1 NONE float xy
// COLOR 0 xyzw 2 NONE float xyzw
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD 0 xy 0 NONE float xy
// TEXCOORD 1 xyzw 1 NONE float xyzw
// SV_Position 0 xyzw 2 POS float xyzw
//
vs_5_1
dcl_globalFlags refactoringAllowed
dcl_constantbuffer CB0[0:0][1], immediateIndexed, space=0
dcl_input v0.xy
dcl_input v1.xy
dcl_input v2.xyzw
dcl_output o0.xy
dcl_output o1.xyzw
dcl_output_siv o2.xyzw, position
dcl_temps 1
mul r0.xy, v0.xyxx, CB0[0][0].xyxx
mad o2.xy, r0.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000)
mov o1.xyzw, v2.xyzw
mov o2.zw, l(0,0,0,1.000000)
mov o0.xy, v1.xyxx
ret
// Approximately 6 instruction slots used
#endif
const BYTE immediate_vs[] =
{
68, 88, 66, 67, 88, 56,
35, 17, 155, 211, 230, 48,
9, 16, 27, 220, 163, 42,
194, 218, 1, 0, 0, 0,
16, 4, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0,
100, 1, 0, 0, 212, 1,
0, 0, 68, 2, 0, 0,
116, 3, 0, 0, 82, 68,
69, 70, 40, 1, 0, 0,
1, 0, 0, 0, 128, 0,
0, 0, 1, 0, 0, 0,
60, 0, 0, 0, 1, 5,
254, 255, 0, 5, 4, 0,
0, 1, 0, 0, 19, 19,
68, 37, 60, 0, 0, 0,
24, 0, 0, 0, 40, 0,
0, 0, 40, 0, 0, 0,
36, 0, 0, 0, 12, 0,
0, 0, 0, 0, 0, 0,
100, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 88, 101,
73, 109, 109, 101, 100, 105,
97, 116, 101, 86, 101, 114,
116, 101, 120, 67, 111, 110,
115, 116, 97, 110, 116, 115,
0, 171, 100, 0, 0, 0,
1, 0, 0, 0, 152, 0,
0, 0, 16, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 192, 0, 0, 0,
0, 0, 0, 0, 8, 0,
0, 0, 2, 0, 0, 0,
220, 0, 0, 0, 0, 0,
0, 0, 255, 255, 255, 255,
0, 0, 0, 0, 255, 255,
255, 255, 0, 0, 0, 0,
120, 101, 95, 118, 105, 101,
119, 112, 111, 114, 116, 95,
115, 105, 122, 101, 95, 105,
110, 118, 0, 102, 108, 111,
97, 116, 50, 0, 1, 0,
3, 0, 1, 0, 2, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
213, 0, 0, 0, 77, 105,
99, 114, 111, 115, 111, 102,
116, 32, 40, 82, 41, 32,
72, 76, 83, 76, 32, 83,
104, 97, 100, 101, 114, 32,
67, 111, 109, 112, 105, 108,
101, 114, 32, 49, 48, 46,
49, 0, 73, 83, 71, 78,
104, 0, 0, 0, 3, 0,
0, 0, 8, 0, 0, 0,
80, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 0, 0,
0, 0, 3, 3, 0, 0,
89, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 1, 0,
0, 0, 3, 3, 0, 0,
98, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 2, 0,
0, 0, 15, 15, 0, 0,
80, 79, 83, 73, 84, 73,
79, 78, 0, 84, 69, 88,
67, 79, 79, 82, 68, 0,
67, 79, 76, 79, 82, 0,
79, 83, 71, 78, 104, 0,
0, 0, 3, 0, 0, 0,
8, 0, 0, 0, 80, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 0, 0, 0, 0,
3, 12, 0, 0, 80, 0,
0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 1, 0, 0, 0,
15, 0, 0, 0, 89, 0,
0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 3, 0,
0, 0, 2, 0, 0, 0,
15, 0, 0, 0, 84, 69,
88, 67, 79, 79, 82, 68,
0, 83, 86, 95, 80, 111,
115, 105, 116, 105, 111, 110,
0, 171, 171, 171, 83, 72,
69, 88, 40, 1, 0, 0,
81, 0, 1, 0, 74, 0,
0, 0, 106, 8, 0, 1,
89, 0, 0, 7, 70, 142,
48, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 95, 0,
0, 3, 50, 16, 16, 0,
0, 0, 0, 0, 95, 0,
0, 3, 50, 16, 16, 0,
1, 0, 0, 0, 95, 0,
0, 3, 242, 16, 16, 0,
2, 0, 0, 0, 101, 0,
0, 3, 50, 32, 16, 0,
0, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
1, 0, 0, 0, 103, 0,
0, 4, 242, 32, 16, 0,
2, 0, 0, 0, 1, 0,
0, 0, 104, 0, 0, 2,
1, 0, 0, 0, 56, 0,
0, 9, 50, 0, 16, 0,
0, 0, 0, 0, 70, 16,
16, 0, 0, 0, 0, 0,
70, 128, 48, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 50, 0,
0, 15, 50, 32, 16, 0,
2, 0, 0, 0, 70, 0,
16, 0, 0, 0, 0, 0,
2, 64, 0, 0, 0, 0,
0, 64, 0, 0, 0, 192,
0, 0, 0, 0, 0, 0,
0, 0, 2, 64, 0, 0,
0, 0, 128, 191, 0, 0,
128, 63, 0, 0, 0, 0,
0, 0, 0, 0, 54, 0,
0, 5, 242, 32, 16, 0,
1, 0, 0, 0, 70, 30,
16, 0, 2, 0, 0, 0,
54, 0, 0, 8, 194, 32,
16, 0, 2, 0, 0, 0,
2, 64, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
128, 63, 54, 0, 0, 5,
50, 32, 16, 0, 0, 0,
0, 0, 70, 16, 16, 0,
1, 0, 0, 0, 62, 0,
0, 1, 83, 84, 65, 84,
148, 0, 0, 0, 6, 0,
0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 6, 0,
0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0
};

View File

@@ -1,56 +0,0 @@
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
// Buffer Definitions:
//
// cbuffer XeImmediateVertexConstants
// {
//
// float2 xe_viewport_size_inv; // Offset: 0 Size: 8
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim ID HLSL Bind Count
// ------------------------------ ---------- ------- ----------- ------- -------------- ------
// XeImmediateVertexConstants cbuffer NA NA CB0 cb0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION 0 xy 0 NONE float xy
// TEXCOORD 0 xy 1 NONE float xy
// COLOR 0 xyzw 2 NONE float xyzw
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD 0 xy 0 NONE float xy
// TEXCOORD 1 xyzw 1 NONE float xyzw
// SV_Position 0 xyzw 2 POS float xyzw
//
vs_5_1
dcl_globalFlags refactoringAllowed
dcl_constantbuffer CB0[0:0][1], immediateIndexed, space=0
dcl_input v0.xy
dcl_input v1.xy
dcl_input v2.xyzw
dcl_output o0.xy
dcl_output o1.xyzw
dcl_output_siv o2.xyzw, position
dcl_temps 1
mul r0.xy, v0.xyxx, CB0[0][0].xyxx
mad o2.xy, r0.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000)
mov o1.xyzw, v2.xyzw
mov o2.zw, l(0,0,0,1.000000)
mov o0.xy, v1.xyxx
ret
// Approximately 6 instruction slots used

View File

@@ -48,7 +48,7 @@ class Window {
virtual void DisableMainMenu() = 0;
const std::string& title() const { return title_; }
virtual bool set_title(const std::string& title) {
virtual bool set_title(const std::string_view title) {
if (title == title_) {
return false;
}

View File

@@ -99,11 +99,12 @@ void GTKWindow::OnClose() {
super::OnClose();
}
bool GTKWindow::set_title(const std::string& title) {
bool GTKWindow::set_title(const std::string_view title) {
if (!super::set_title(title)) {
return false;
}
gtk_window_set_title(GTK_WINDOW(window_), (gchar*)title.c_str());
std::string titlez(title);
gtk_window_set_title(GTK_WINDOW(window_), (gchar*)titlez.c_str());
return true;
}

View File

@@ -38,7 +38,7 @@ class GTKWindow : public Window {
void EnableMainMenu() override {}
void DisableMainMenu() override {}
bool set_title(const std::string& title) override;
bool set_title(const std::string_view title) override;
bool SetIcon(const void* buffer, size_t size) override;

View File

@@ -66,7 +66,8 @@ bool Win32Window::OnCreate() {
auto spda = (decltype(&SetProcessDpiAwareness))SetProcessDpiAwareness_;
auto res = spda(PROCESS_PER_MONITOR_DPI_AWARE);
if (res != S_OK) {
XELOGW("Failed to set process DPI awareness. (code = 0x{:08X})", res);
XELOGW("Failed to set process DPI awareness. (code = 0x{:08X})",
static_cast<uint32_t>(res));
}
}
@@ -198,11 +199,12 @@ void Win32Window::DisableMainMenu() {
}
}
bool Win32Window::set_title(const std::string& title) {
bool Win32Window::set_title(const std::string_view title) {
if (!super::set_title(title)) {
return false;
}
SetWindowTextW(hwnd_, reinterpret_cast<LPCWSTR>(xe::to_utf16(title).c_str()));
auto wide_title = xe::to_utf16(title);
SetWindowTextW(hwnd_, reinterpret_cast<LPCWSTR>(wide_title.c_str()));
return true;
}

View File

@@ -34,7 +34,7 @@ class Win32Window : public Window {
void EnableMainMenu() override;
void DisableMainMenu() override;
bool set_title(const std::string& title) override;
bool set_title(const std::string_view title) override;
bool SetIcon(const void* buffer, size_t size) override;