diff --git a/examples/dxPtexViewer/dxPtexViewer.cpp b/examples/dxPtexViewer/dxPtexViewer.cpp index 39b32562..da34e1a7 100644 --- a/examples/dxPtexViewer/dxPtexViewer.cpp +++ b/examples/dxPtexViewer/dxPtexViewer.cpp @@ -909,10 +909,13 @@ bindProgram(Effect effect, OpenSubdiv::Osd::DrawContext::PatchArray const & patc if (g_mesh->GetDrawContext()->quadOffsetBufferSRV) { g_pd3dDeviceContext->HSSetShaderResources(2, 1, &g_mesh->GetDrawContext()->quadOffsetBufferSRV); } - if (g_mesh->GetDrawContext()->ptexCoordinateBufferSRV) { - g_pd3dDeviceContext->HSSetShaderResources(3, 1, &g_mesh->GetDrawContext()->ptexCoordinateBufferSRV); - g_pd3dDeviceContext->DSSetShaderResources(3, 1, &g_mesh->GetDrawContext()->ptexCoordinateBufferSRV); - g_pd3dDeviceContext->GSSetShaderResources(3, 1, &g_mesh->GetDrawContext()->ptexCoordinateBufferSRV); + if (g_mesh->GetDrawContext()->patchParamBufferSRV) { + g_pd3dDeviceContext->HSSetShaderResources( + 3, 1, &g_mesh->GetDrawContext()->patchParamBufferSRV); + g_pd3dDeviceContext->DSSetShaderResources( + 3, 1, &g_mesh->GetDrawContext()->patchParamBufferSRV); + g_pd3dDeviceContext->GSSetShaderResources( + 3, 1, &g_mesh->GetDrawContext()->patchParamBufferSRV); } g_pd3dDeviceContext->PSSetShaderResources(4, 1, g_osdPTexImage->GetTexelsSRV()); diff --git a/examples/dxViewer/dxviewer.cpp b/examples/dxViewer/dxviewer.cpp index 4699a0a4..4c8a41d7 100644 --- a/examples/dxViewer/dxviewer.cpp +++ b/examples/dxViewer/dxviewer.cpp @@ -762,9 +762,11 @@ bindProgram(Effect effect, OpenSubdiv::Osd::DrawContext::PatchArray const & patc if (g_mesh->GetDrawContext()->quadOffsetBufferSRV) { g_pd3dDeviceContext->HSSetShaderResources(2, 1, &g_mesh->GetDrawContext()->quadOffsetBufferSRV); } - if (g_mesh->GetDrawContext()->ptexCoordinateBufferSRV) { - g_pd3dDeviceContext->HSSetShaderResources(3, 1, &g_mesh->GetDrawContext()->ptexCoordinateBufferSRV); - g_pd3dDeviceContext->DSSetShaderResources(3, 1, &g_mesh->GetDrawContext()->ptexCoordinateBufferSRV); + if (g_mesh->GetDrawContext()->patchParamBufferSRV) { + g_pd3dDeviceContext->HSSetShaderResources( + 3, 1, &g_mesh->GetDrawContext()->patchParamBufferSRV); + g_pd3dDeviceContext->DSSetShaderResources( + 3, 1, &g_mesh->GetDrawContext()->patchParamBufferSRV); } } diff --git a/examples/glPaintTest/glPaintTest.cpp b/examples/glPaintTest/glPaintTest.cpp index 5828a974..e764d7f6 100644 --- a/examples/glPaintTest/glPaintTest.cpp +++ b/examples/glPaintTest/glPaintTest.cpp @@ -236,7 +236,6 @@ createOsdMesh() { bool doAdaptive = true; OpenSubdiv::Osd::MeshBitset bits; bits.set(OpenSubdiv::Osd::MeshAdaptive, doAdaptive); - bits.set(OpenSubdiv::Osd::MeshPtexData, true); g_mesh = new OpenSubdiv::Osd::MeshRelease(); - if (ptexCoordinateBuffer) ptexCoordinateBuffer->Release(); - if (ptexCoordinateBufferSRV) ptexCoordinateBufferSRV->Release(); + if (patchParamBuffer) patchParamBuffer->Release(); + if (patchParamBufferSRV) patchParamBufferSRV->Release(); if (fvarDataBuffer) fvarDataBuffer->Release(); if (fvarDataBufferSRV) fvarDataBufferSRV->Release(); if (vertexBufferSRV) vertexBufferSRV->Release(); @@ -116,7 +116,7 @@ D3D11DrawContext::create(Far::PatchTables const &patchTables, // allocate and initialize additional buffer data - // create ptex coordinate buffer + // create patch param buffer Far::PatchParamTable const & patchParamTables = patchTables.GetPatchParamTable(); @@ -144,7 +144,7 @@ D3D11DrawContext::create(Far::PatchTables const &patchTables, bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; bd.MiscFlags = 0; bd.StructureByteStride = sizeof(unsigned int); - hr = pd3d11Device->CreateBuffer(&bd, NULL, &ptexCoordinateBuffer); + hr = pd3d11Device->CreateBuffer(&bd, NULL, &patchParamBuffer); if (FAILED(hr)) { return false; } @@ -155,17 +155,18 @@ D3D11DrawContext::create(Far::PatchTables const &patchTables, srvd.ViewDimension = D3D11_SRV_DIMENSION_BUFFER; srvd.Buffer.FirstElement = 0; srvd.Buffer.NumElements = numElements; - hr = pd3d11Device->CreateShaderResourceView(ptexCoordinateBuffer, &srvd, &ptexCoordinateBufferSRV); + hr = pd3d11Device->CreateShaderResourceView( + patchParamBuffer, &srvd, &patchParamBufferSRV); if (FAILED(hr)) { return false; } - hr = pd3d11DeviceContext->Map(ptexCoordinateBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); + hr = pd3d11DeviceContext->Map(patchParamBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); if (FAILED(hr)) { return false; } - unsigned int * ptexBuffer = (unsigned int *) mappedResource.pData; - memcpy(ptexBuffer, values, numElements * elementSize); - pd3d11DeviceContext->Unmap(ptexCoordinateBuffer, 0); + unsigned int *dst = (unsigned int *) mappedResource.pData; + memcpy(dst, values, numElements * elementSize); + pd3d11DeviceContext->Unmap(patchParamBuffer, 0); } // create vertex valence buffer and vertex texture diff --git a/opensubdiv/osd/d3d11DrawContext.h b/opensubdiv/osd/d3d11DrawContext.h index f3879ef0..418f3aef 100644 --- a/opensubdiv/osd/d3d11DrawContext.h +++ b/opensubdiv/osd/d3d11DrawContext.h @@ -108,8 +108,8 @@ public: ID3D11Buffer *patchIndexBuffer; - ID3D11Buffer *ptexCoordinateBuffer; - ID3D11ShaderResourceView *ptexCoordinateBufferSRV; + ID3D11Buffer *patchParamBuffer; + ID3D11ShaderResourceView *patchParamBufferSRV; ID3D11Buffer *fvarDataBuffer; ID3D11ShaderResourceView *fvarDataBufferSRV; diff --git a/opensubdiv/osd/d3d11DrawRegistry.h b/opensubdiv/osd/d3d11DrawRegistry.h index 99632ceb..fe08a6b6 100644 --- a/opensubdiv/osd/d3d11DrawRegistry.h +++ b/opensubdiv/osd/d3d11DrawRegistry.h @@ -84,18 +84,10 @@ public: typedef D3D11DrawConfig ConfigType; typedef D3D11DrawSourceConfig SourceConfigType; - D3D11DrawRegistryBase(bool enablePtex=false) : _enablePtex(enablePtex) { } + D3D11DrawRegistryBase() { } virtual ~D3D11DrawRegistryBase(); - bool IsPtexEnabled() const { - return _enablePtex; - } - - void SetPtexEnabled(bool b) { - _enablePtex=b; - } - protected: virtual ConfigType * _NewDrawConfig() { return new ConfigType(); } virtual ConfigType * @@ -109,9 +101,6 @@ protected: virtual SourceConfigType * _NewDrawSourceConfig() { return new SourceConfigType(); } virtual SourceConfigType * _CreateDrawSourceConfig(DescType const & desc, ID3D11Device * pd3dDevice); - -private: - bool _enablePtex; }; //------------------------------------------------------------------------------ diff --git a/opensubdiv/osd/mesh.h b/opensubdiv/osd/mesh.h index d2c77549..bcdfd4f9 100644 --- a/opensubdiv/osd/mesh.h +++ b/opensubdiv/osd/mesh.h @@ -49,13 +49,12 @@ namespace Osd { enum MeshBits { MeshAdaptive = 0, MeshInterleaveVarying = 1, - MeshPtexData = 2, - MeshFVarData = 3, - MeshUseSingleCreasePatch = 4, - MeshEndCapBSplineBasis = 5, // exclusive - MeshEndCapGregoryBasis = 6, // exclusive - MeshEndCapLegacyGregory = 7, // exclusive - NUM_MESH_BITS = 8, + MeshFVarData = 2, + MeshUseSingleCreasePatch = 3, + MeshEndCapBSplineBasis = 4, // exclusive + MeshEndCapGregoryBasis = 5, // exclusive + MeshEndCapLegacyGregory = 6, // exclusive + NUM_MESH_BITS = 7, }; typedef std::bitset MeshBitset;