mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-06 22:54:16 +01:00
[dxvk] DxvkBufferBinding -> DxvkBufferSlice
This commit is contained in:
parent
2ad5f49f3e
commit
40241e0b22
@ -628,12 +628,12 @@ namespace dxvk {
|
|||||||
binding.stride = pStrides[i];
|
binding.stride = pStrides[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
DxvkBufferBinding dxvkBinding;
|
DxvkBufferSlice dxvkBinding;
|
||||||
|
|
||||||
if (binding.buffer != nullptr) {
|
if (binding.buffer != nullptr) {
|
||||||
Rc<DxvkBuffer> dxvkBuffer = binding.buffer->GetDXVKBuffer();
|
Rc<DxvkBuffer> dxvkBuffer = binding.buffer->GetDXVKBuffer();
|
||||||
|
|
||||||
dxvkBinding = DxvkBufferBinding(
|
dxvkBinding = DxvkBufferSlice(
|
||||||
dxvkBuffer, binding.offset,
|
dxvkBuffer, binding.offset,
|
||||||
dxvkBuffer->info().size - binding.offset);
|
dxvkBuffer->info().size - binding.offset);
|
||||||
}
|
}
|
||||||
@ -655,12 +655,12 @@ namespace dxvk {
|
|||||||
binding.format = Format;
|
binding.format = Format;
|
||||||
m_state.ia.indexBuffer = binding;
|
m_state.ia.indexBuffer = binding;
|
||||||
|
|
||||||
DxvkBufferBinding dxvkBinding;
|
DxvkBufferSlice dxvkBinding;
|
||||||
|
|
||||||
if (binding.buffer != nullptr) {
|
if (binding.buffer != nullptr) {
|
||||||
Rc<DxvkBuffer> dxvkBuffer = binding.buffer->GetDXVKBuffer();
|
Rc<DxvkBuffer> dxvkBuffer = binding.buffer->GetDXVKBuffer();
|
||||||
|
|
||||||
dxvkBinding = DxvkBufferBinding(
|
dxvkBinding = DxvkBufferSlice(
|
||||||
dxvkBuffer, binding.offset,
|
dxvkBuffer, binding.offset,
|
||||||
dxvkBuffer->info().size - binding.offset);
|
dxvkBuffer->info().size - binding.offset);
|
||||||
}
|
}
|
||||||
@ -1462,10 +1462,10 @@ namespace dxvk {
|
|||||||
pBindings->at(StartSlot + i) = buffer;
|
pBindings->at(StartSlot + i) = buffer;
|
||||||
|
|
||||||
// Figure out which part of the buffer to bind
|
// Figure out which part of the buffer to bind
|
||||||
DxvkBufferBinding bindingInfo;
|
DxvkBufferSlice bindingInfo;
|
||||||
|
|
||||||
if (buffer != nullptr) {
|
if (buffer != nullptr) {
|
||||||
bindingInfo = DxvkBufferBinding(
|
bindingInfo = DxvkBufferSlice(
|
||||||
buffer->GetDXVKBuffer(),
|
buffer->GetDXVKBuffer(),
|
||||||
0, VK_WHOLE_SIZE);
|
0, VK_WHOLE_SIZE);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ namespace dxvk {
|
|||||||
Rc<DxvkSampler> sampler;
|
Rc<DxvkSampler> sampler;
|
||||||
Rc<DxvkImageView> imageView;
|
Rc<DxvkImageView> imageView;
|
||||||
Rc<DxvkBufferView> bufferView;
|
Rc<DxvkBufferView> bufferView;
|
||||||
DxvkBufferBinding bufferSlice;
|
DxvkBufferSlice bufferSlice;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,18 +157,18 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Buffer binding
|
* \brief Buffer slice
|
||||||
*
|
*
|
||||||
* Stores the buffer and the sub-range of the buffer
|
* Stores the buffer and a sub-range of the buffer.
|
||||||
* to bind. Bindings are considered equal if all three
|
* Slices are considered equal if the buffer and
|
||||||
* parameters are the same.
|
* the buffer range are the same.
|
||||||
*/
|
*/
|
||||||
class DxvkBufferBinding {
|
class DxvkBufferSlice {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DxvkBufferBinding() { }
|
DxvkBufferSlice() { }
|
||||||
DxvkBufferBinding(
|
DxvkBufferSlice(
|
||||||
const Rc<DxvkBuffer>& buffer,
|
const Rc<DxvkBuffer>& buffer,
|
||||||
VkDeviceSize rangeOffset,
|
VkDeviceSize rangeOffset,
|
||||||
VkDeviceSize rangeLength)
|
VkDeviceSize rangeLength)
|
||||||
@ -202,13 +202,13 @@ namespace dxvk {
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator == (const DxvkBufferBinding& other) const {
|
bool operator == (const DxvkBufferSlice& other) const {
|
||||||
return this->m_buffer == other.m_buffer
|
return this->m_buffer == other.m_buffer
|
||||||
&& this->m_offset == other.m_offset
|
&& this->m_offset == other.m_offset
|
||||||
&& this->m_length == other.m_length;
|
&& this->m_length == other.m_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator != (const DxvkBufferBinding& other) const {
|
bool operator != (const DxvkBufferSlice& other) const {
|
||||||
return this->m_buffer != other.m_buffer
|
return this->m_buffer != other.m_buffer
|
||||||
|| this->m_offset != other.m_offset
|
|| this->m_offset != other.m_offset
|
||||||
|| this->m_length != other.m_length;
|
|| this->m_length != other.m_length;
|
||||||
|
@ -57,7 +57,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void DxvkContext::bindIndexBuffer(
|
void DxvkContext::bindIndexBuffer(
|
||||||
const DxvkBufferBinding& buffer,
|
const DxvkBufferSlice& buffer,
|
||||||
VkIndexType indexType) {
|
VkIndexType indexType) {
|
||||||
if (m_state.vi.indexBuffer != buffer
|
if (m_state.vi.indexBuffer != buffer
|
||||||
|| m_state.vi.indexType != indexType) {
|
|| m_state.vi.indexType != indexType) {
|
||||||
@ -72,7 +72,7 @@ namespace dxvk {
|
|||||||
void DxvkContext::bindResourceBuffer(
|
void DxvkContext::bindResourceBuffer(
|
||||||
VkPipelineBindPoint pipe,
|
VkPipelineBindPoint pipe,
|
||||||
uint32_t slot,
|
uint32_t slot,
|
||||||
const DxvkBufferBinding& buffer) {
|
const DxvkBufferSlice& buffer) {
|
||||||
auto rc = this->getShaderResourceSlots(pipe);
|
auto rc = this->getShaderResourceSlots(pipe);
|
||||||
|
|
||||||
if (rc->getShaderResource(slot).bufferSlice != buffer) {
|
if (rc->getShaderResource(slot).bufferSlice != buffer) {
|
||||||
@ -186,7 +186,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
void DxvkContext::bindVertexBuffer(
|
void DxvkContext::bindVertexBuffer(
|
||||||
uint32_t binding,
|
uint32_t binding,
|
||||||
const DxvkBufferBinding& buffer,
|
const DxvkBufferSlice& buffer,
|
||||||
uint32_t stride) {
|
uint32_t stride) {
|
||||||
if (m_state.vi.vertexBuffers.at(binding) != buffer) {
|
if (m_state.vi.vertexBuffers.at(binding) != buffer) {
|
||||||
m_state.vi.vertexBuffers.at(binding) = buffer;
|
m_state.vi.vertexBuffers.at(binding) = buffer;
|
||||||
@ -918,7 +918,7 @@ namespace dxvk {
|
|||||||
m_flags.clr(DxvkContextFlag::GpDirtyVertexBuffers);
|
m_flags.clr(DxvkContextFlag::GpDirtyVertexBuffers);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < m_state.vi.vertexBuffers.size(); i++) {
|
for (uint32_t i = 0; i < m_state.vi.vertexBuffers.size(); i++) {
|
||||||
const DxvkBufferBinding vbo = m_state.vi.vertexBuffers.at(i);
|
const DxvkBufferSlice vbo = m_state.vi.vertexBuffers.at(i);
|
||||||
|
|
||||||
VkBuffer handle = vbo.bufferHandle();
|
VkBuffer handle = vbo.bufferHandle();
|
||||||
VkDeviceSize offset = vbo.bufferOffset();
|
VkDeviceSize offset = vbo.bufferOffset();
|
||||||
|
@ -63,7 +63,7 @@ namespace dxvk {
|
|||||||
* \param [in] indexType Index type
|
* \param [in] indexType Index type
|
||||||
*/
|
*/
|
||||||
void bindIndexBuffer(
|
void bindIndexBuffer(
|
||||||
const DxvkBufferBinding& buffer,
|
const DxvkBufferSlice& buffer,
|
||||||
VkIndexType indexType);
|
VkIndexType indexType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,7 +77,7 @@ namespace dxvk {
|
|||||||
void bindResourceBuffer(
|
void bindResourceBuffer(
|
||||||
VkPipelineBindPoint pipe,
|
VkPipelineBindPoint pipe,
|
||||||
uint32_t slot,
|
uint32_t slot,
|
||||||
const DxvkBufferBinding& buffer);
|
const DxvkBufferSlice& buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Binds texel buffer view
|
* \brief Binds texel buffer view
|
||||||
@ -140,7 +140,7 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
void bindVertexBuffer(
|
void bindVertexBuffer(
|
||||||
uint32_t binding,
|
uint32_t binding,
|
||||||
const DxvkBufferBinding& buffer,
|
const DxvkBufferSlice& buffer,
|
||||||
uint32_t stride);
|
uint32_t stride);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,10 +37,10 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
struct DxvkVertexInputState {
|
struct DxvkVertexInputState {
|
||||||
DxvkBufferBinding indexBuffer;
|
DxvkBufferSlice indexBuffer;
|
||||||
VkIndexType indexType = VK_INDEX_TYPE_UINT32;
|
VkIndexType indexType = VK_INDEX_TYPE_UINT32;
|
||||||
|
|
||||||
std::array<DxvkBufferBinding,
|
std::array<DxvkBufferSlice,
|
||||||
DxvkLimits::MaxNumVertexBindings> vertexBuffers;
|
DxvkLimits::MaxNumVertexBindings> vertexBuffers;
|
||||||
std::array<uint32_t,
|
std::array<uint32_t,
|
||||||
DxvkLimits::MaxNumVertexBindings> vertexStrides;
|
DxvkLimits::MaxNumVertexBindings> vertexStrides;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user