[D3D12] DXBC samplers
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
#ifndef XENIA_GPU_D3D12_D3D12_SHADER_H_
|
||||
#define XENIA_GPU_D3D12_D3D12_SHADER_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "xenia/gpu/dxbc_shader_translator.h"
|
||||
#include "xenia/gpu/shader.h"
|
||||
#include "xenia/ui/d3d12/d3d12_api.h"
|
||||
@@ -26,34 +28,48 @@ class D3D12Shader : public Shader {
|
||||
|
||||
void SetTexturesAndSamplers(
|
||||
const DxbcShaderTranslator::TextureSRV* texture_srvs,
|
||||
uint32_t texture_srv_count, const uint32_t* sampler_fetch_constants,
|
||||
uint32_t sampler_count);
|
||||
uint32_t texture_srv_count,
|
||||
const DxbcShaderTranslator::SamplerBinding* sampler_bindings,
|
||||
uint32_t sampler_binding_count);
|
||||
|
||||
bool DisassembleDXBC();
|
||||
|
||||
static constexpr uint32_t kMaxTextureSRVIndexBits =
|
||||
DxbcShaderTranslator::kMaxTextureSRVIndexBits;
|
||||
static constexpr uint32_t kMaxTextureSRVs =
|
||||
DxbcShaderTranslator::kMaxTextureSRVs;
|
||||
struct TextureSRV {
|
||||
uint32_t fetch_constant;
|
||||
TextureDimension dimension;
|
||||
};
|
||||
const TextureSRV* GetTextureSRVs(uint32_t& count_out) const {
|
||||
count_out = texture_srv_count_;
|
||||
return texture_srvs_;
|
||||
}
|
||||
const uint32_t* GetSamplerFetchConstants(uint32_t& count_out) const {
|
||||
count_out = sampler_count_;
|
||||
return sampler_fetch_constants_;
|
||||
count_out = uint32_t(texture_srvs_.size());
|
||||
return texture_srvs_.data();
|
||||
}
|
||||
const uint32_t GetUsedTextureMask() const { return used_texture_mask_; }
|
||||
|
||||
static constexpr uint32_t kMaxSamplerBindingIndexBits =
|
||||
DxbcShaderTranslator::kMaxSamplerBindingIndexBits;
|
||||
static constexpr uint32_t kMaxSamplerBindings =
|
||||
DxbcShaderTranslator::kMaxSamplerBindings;
|
||||
struct SamplerBinding {
|
||||
uint32_t fetch_constant;
|
||||
TextureFilter mag_filter;
|
||||
TextureFilter min_filter;
|
||||
TextureFilter mip_filter;
|
||||
AnisoFilter aniso_filter;
|
||||
};
|
||||
const SamplerBinding* GetSamplerBindings(uint32_t& count_out) const {
|
||||
count_out = uint32_t(sampler_bindings_.size());
|
||||
return sampler_bindings_.data();
|
||||
}
|
||||
|
||||
private:
|
||||
ID3DBlob* blob_ = nullptr;
|
||||
|
||||
// Up to 32 2D array textures, 32 3D textures and 32 cube textures.
|
||||
TextureSRV texture_srvs_[96];
|
||||
uint32_t texture_srv_count_ = 0;
|
||||
uint32_t sampler_fetch_constants_[32];
|
||||
uint32_t sampler_count_ = 0;
|
||||
std::vector<TextureSRV> texture_srvs_;
|
||||
uint32_t used_texture_mask_ = 0;
|
||||
std::vector<SamplerBinding> sampler_bindings_;
|
||||
};
|
||||
|
||||
} // namespace d3d12
|
||||
|
||||
Reference in New Issue
Block a user