Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[d3d11] Store map mode as raw integer #4468

Merged
merged 2 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/d3d11/d3d11_context_imm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ namespace dxvk {

// If the texture has an image as well as a staging buffer,
// upload the written buffer data to the image
bool needsUpload = mapType != D3D11_MAP_READ
bool needsUpload = mapType != uint32_t(D3D11_MAP_READ)
&& (mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER || mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DYNAMIC);

if (needsUpload) {
Expand Down
14 changes: 7 additions & 7 deletions src/d3d11/d3d11_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1452,10 +1452,10 @@ namespace dxvk {
|| texture->CountSubresources() <= SrcSubresource)
return;

D3D11_MAP map = texture->GetMapType(SrcSubresource);
uint32_t map = texture->GetMapType(SrcSubresource);

if (map != D3D11_MAP_READ
&& map != D3D11_MAP_READ_WRITE)
if (map != uint32_t(D3D11_MAP_READ)
&& map != uint32_t(D3D11_MAP_READ_WRITE))
return;

CopySubresourceData(
Expand All @@ -1481,11 +1481,11 @@ namespace dxvk {
|| texture->CountSubresources() <= DstSubresource)
return;

D3D11_MAP map = texture->GetMapType(DstSubresource);
uint32_t map = texture->GetMapType(DstSubresource);

if (map != D3D11_MAP_WRITE
&& map != D3D11_MAP_WRITE_NO_OVERWRITE
&& map != D3D11_MAP_READ_WRITE)
if (map != uint32_t(D3D11_MAP_WRITE)
&& map != uint32_t(D3D11_MAP_WRITE_NO_OVERWRITE)
&& map != uint32_t(D3D11_MAP_READ_WRITE))
return;

CopySubresourceData(
Expand Down
12 changes: 6 additions & 6 deletions src/d3d11/d3d11_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace dxvk {

public:

static constexpr D3D11_MAP UnmappedSubresource = D3D11_MAP(-1u);
static constexpr uint32_t UnmappedSubresource = ~0u;

D3D11CommonTexture(
ID3D11Resource* pInterface,
Expand Down Expand Up @@ -200,10 +200,10 @@ namespace dxvk {
* \param [in] Subresource Subresource index
* \returns Current map mode of that subresource
*/
D3D11_MAP GetMapType(UINT Subresource) const {
uint32_t GetMapType(UINT Subresource) const {
return Subresource < m_mapInfo.size()
? D3D11_MAP(m_mapInfo[Subresource].mapType)
: D3D11_MAP(~0u);
? m_mapInfo[Subresource].mapType
: UnmappedSubresource;
}

/**
Expand All @@ -216,7 +216,7 @@ namespace dxvk {
*/
void NotifyMap(UINT Subresource, D3D11_MAP MapType) {
if (likely(Subresource < m_mapInfo.size())) {
m_mapInfo[Subresource].mapType = MapType;
m_mapInfo[Subresource].mapType = uint32_t(MapType);

if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DYNAMIC)
CreateMappedBuffer(Subresource);
Expand Down Expand Up @@ -561,7 +561,7 @@ namespace dxvk {

struct MappedInfo {
D3D11_COMMON_TEXTURE_SUBRESOURCE_LAYOUT layout = { };
D3D11_MAP mapType = UnmappedSubresource;
uint32_t mapType = UnmappedSubresource;
uint64_t seq = 0u;
};

Expand Down
2 changes: 1 addition & 1 deletion src/dxvk/dxvk_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
namespace dxvk {

class DxvkMemoryAllocator;
class DxvkMemoryChunk;
class DxvkSparsePageTable;
class DxvkSharedAllocationCache;
class DxvkResourceAllocation;
class DxvkPagedResource;
struct DxvkMemoryChunk;

/**
* \brief Memory stats
Expand Down